Author: jpeach
Date: 2006-01-31 00:00:10 +0000 (Tue, 31 Jan 2006)
New Revision: 13243

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13243

Log:
Bring __FUNCTION__ checks across from Samba 3.

Modified:
   branches/SAMBA_4_0/source/build/m4/check_cc.m4
   branches/SAMBA_4_0/source/include/debug.h


Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/check_cc.m4      2006-01-30 23:43:17 UTC 
(rev 13242)
+++ branches/SAMBA_4_0/source/build/m4/check_cc.m4      2006-01-31 00:00:10 UTC 
(rev 13243)
@@ -187,3 +187,11 @@
 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
+

Modified: branches/SAMBA_4_0/source/include/debug.h
===================================================================
--- branches/SAMBA_4_0/source/include/debug.h   2006-01-30 23:43:17 UTC (rev 
13242)
+++ branches/SAMBA_4_0/source/include/debug.h   2006-01-31 00:00:10 UTC (rev 
13243)
@@ -18,6 +18,14 @@
    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 @@
 #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; \
        } \

Reply via email to