From 519e7f0669d61c1d339d156f96469bbd68a328e3 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Mon, 26 Apr 2004 22:39:33 +0000 Subject: [PATCH] check-if-compiler-supports-__FUNCTION__-macro-20040426 Add an autoconf check to see if the compiler supports __FUNCTION__ and __LINE__ --- acinclude.m4 | 1 + src/cf/function-macro.m4 | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/cf/function-macro.m4 diff --git a/acinclude.m4 b/acinclude.m4 index 937657b..a1a204c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -91,6 +91,7 @@ dnl Various compiler setup. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SIGNAL +COMPILER_HAS_FUNCTION_MACRO dnl Checks for programs. AC_PROG_INSTALL diff --git a/src/cf/function-macro.m4 b/src/cf/function-macro.m4 new file mode 100644 index 0000000..ea11ecb --- /dev/null +++ b/src/cf/function-macro.m4 @@ -0,0 +1,15 @@ +AC_DEFUN(COMPILER_HAS_FUNCTION_MACRO, [ +AC_MSG_CHECKING(for __FUNCTION__ and __LINE__ macros) +AC_CACHE_VAL(ac_cv_compiler_has_function_macro, +[ +AC_TRY_COMPILE( +[#include ], +[printf("%s:%d", __FUNCTION__, __LINE__);], +ac_cv_compiler_has_function_macro=yes, +ac_cv_compiler_has_function_macro=no)]) +AC_MSG_RESULT($ac_cv_compiler_has_function_macro) +if test "$ac_cv_compiler_has_function_macro" = "yes"; then + AC_DEFINE(HAVE_FUNCTION_MACRO, 1, [define if compiler has __FUNCTION__]) +fi +]) + -- 1.9.4