r13243: Bring __FUNCTION__ checks across from Samba 3.
authorJames Peach <jpeach@samba.org>
Tue, 31 Jan 2006 00:00:10 +0000 (00:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:36 +0000 (13:51 -0500)
source/build/m4/check_cc.m4
source/include/debug.h

index f65adbbca4e66d7614446a0edd4f217954240ad3..a2d2bae79b89d992bde87f39e8a0001994681d6a 100644 (file)
@@ -187,3 +187,11 @@ fi
 AC_SUBST(HOSTCC)
 
 AC_PATH_PROG(GCOV,gcov)
+
+AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
+AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
+samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
+if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
+    AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
+fi
+
index 40d04766e1b8c9fac35b19065e395fb7a2057c03..8ff937e7b93d05c17cee80a7c501a4bfab245358 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+/* If we have these macros, we can add additional info to the header. */
+
+#ifdef HAVE_FUNCTION_MACRO
+#define FUNCTION_MACRO  (__FUNCTION__)
+#else
+#define FUNCTION_MACRO  ("")
+#endif
+
 /* the debug operations structure - contains function pointers to 
    various debug implementations of each operation */
 struct debug_ops {
@@ -44,7 +52,7 @@ extern int DEBUGLEVEL;
 #define _DEBUG(level, body, header) do { \
        if (DEBUGLVL(level)) { \
                if (header) { \
-                       do_debug_header(level, __location__, __FUNCTION__); \
+                       do_debug_header(level, __location__, FUNCTION_MACRO); \
                } \
                do_debug body; \
        } \