* Better check for the __func__ keyword that does not rely on assumptions
about the compiler version.
This commit is contained in:
parent
7dfb40b935
commit
d45a5121ef
@ -3,7 +3,7 @@
|
||||
SUBDIRS = src test doc
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
||||
EXTRA_DIST = bootstrap AUTHORS m4/cflags.m4
|
||||
EXTRA_DIST = bootstrap AUTHORS m4/cflags.m4 m4/func.m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AUTOMAKE_OPTIONS = foreign dist-bzip2
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ AC_PROG_CPP
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_C_INLINE
|
||||
AC_C_FUNC
|
||||
|
||||
# Optimizations
|
||||
AC_TRY_CFLAGS(-g -O2, CFLAGS="${CFLAGS} -g -O2")
|
||||
|
||||
13
m4/func.m4
Normal file
13
m4/func.m4
Normal file
@ -0,0 +1,13 @@
|
||||
dnl Check for the __func__ keyword
|
||||
AC_DEFUN([AC_C_FUNC],
|
||||
[AC_MSG_CHECKING(for __func__)
|
||||
ac_v_func='"unknown"'
|
||||
AC_TRY_COMPILE([], [char const *f = __func__;],
|
||||
[ac_v_func="__func__"],
|
||||
[AC_TRY_COMPILE([], [char const *f = __FUNCTION__;],
|
||||
[ac_v_func="__FUNCTION__"])])
|
||||
if test "$ac_v_func" != "__func__"; then
|
||||
AC_DEFINE_UNQUOTED(__func__, $ac_v_func, [Define to a way to access function names])
|
||||
fi
|
||||
AC_MSG_RESULT($ac_v_func)])
|
||||
|
||||
@ -41,6 +41,7 @@ typedef int pid_t;
|
||||
|
||||
#define inline /* undefined */
|
||||
#define __attribute__(x) /* undefined */
|
||||
#define __func__ __FUNCTION__
|
||||
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
@ -16,15 +16,6 @@
|
||||
* lib-load.h: preload library functions
|
||||
*/
|
||||
|
||||
/* The __func__ macro to get the current function name */
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
# if __GNUC__ >= 2
|
||||
# define __func__ __FUNCTION__
|
||||
# else
|
||||
# define __func__ "<?>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Symbol loading stuff */
|
||||
#define STR(x) #x
|
||||
#define ORIG(x) x##_orig
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user