diff --git a/Makefile.am b/Makefile.am index e94e790..9915afc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 31c2447..072499e 100644 --- a/configure.ac +++ b/configure.ac @@ -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") diff --git a/m4/func.m4 b/m4/func.m4 new file mode 100644 index 0000000..f59da01 --- /dev/null +++ b/m4/func.m4 @@ -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)]) + diff --git a/msvc/config.h b/msvc/config.h index b88f83c..aebf200 100644 --- a/msvc/config.h +++ b/msvc/config.h @@ -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 diff --git a/src/lib-load.h b/src/lib-load.h index 201bd48..6e29531 100644 --- a/src/lib-load.h +++ b/src/lib-load.h @@ -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