Author: jpeach
Date: 2007-06-14 03:59:44 +0000 (Thu, 14 Jun 2007)
New Revision: 23479

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

Log:
Merge branches/[EMAIL PROTECTED]

Change the handling of the developer CFLAGS so that they are always
emited to the Makefile in the DEVELOPER_CFLAGS variable. This makes
it easy to turn developer mode on and off without waiting for
configure to run. The developer flags are only added to CFLAGS for
the --enable-developer and --enable-krb5developer cases.

Modified:
   branches/SAMBA_3_0_26/source/Makefile.in
   branches/SAMBA_3_0_26/source/configure.in


Changeset:
Modified: branches/SAMBA_3_0_26/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0_26/source/Makefile.in    2007-06-14 03:38:43 UTC (rev 
23478)
+++ branches/SAMBA_3_0_26/source/Makefile.in    2007-06-14 03:59:44 UTC (rev 
23479)
@@ -20,8 +20,14 @@
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
+
+# Add $(DEVELOPER_CFLAGS) to $(CFLAGS) to enable extra compiler
+# (GCC) warnings. This is done automtically for --enable-developer
+# and --enable-krb5developer.
[EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 CPPFLAGS=-DHAVE_CONFIG_H @CPPFLAGS@
+
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@ @LDFLAGS@
 [EMAIL PROTECTED]@

Modified: branches/SAMBA_3_0_26/source/configure.in
===================================================================
--- branches/SAMBA_3_0_26/source/configure.in   2007-06-14 03:38:43 UTC (rev 
23478)
+++ branches/SAMBA_3_0_26/source/configure.in   2007-06-14 03:59:44 UTC (rev 
23479)
@@ -405,7 +405,19 @@
 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings 
and debugging (default=no)],
     [if eval "test x$enable_developer = xyes"; then
         developer=yes
-       CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes 
-Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
+    fi])
+
+AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer 
warnings and debugging, except -Wstrict-prototypes (default=no)],
+    [if eval "test x$enable_krb5developer = xyes"; then
+        developer=yes
+       krb5_developer=yes
+    fi])
+
+# Probe the gcc version for extra CFLAGS. We always stash these in
+# DEVELOPER_CFLAGS, so that you can turn them on and off with a simple
+# Makefile edit, avoiding the need to re-run configure.
+if test x"$ac_cv_prog_gcc" = x"yes" ; then
+       DEVELOPER_CFLAGS="-gstabs -Wall -Wshadow -Wpointer-arith -Wcast-align 
-Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
        # Add -Wdeclaration-after-statement if compiler supports it
        AC_CACHE_CHECK(
           [that the C compiler understands -Wdeclaration-after-statement],
@@ -419,16 +431,34 @@
            samba_cv_HAVE_Wdeclaration_after_statement=no,
            samba_cv_HAVE_Wdeclaration_after_statement=cross)
        ])
-       if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then
-           CFLAGS="${CFLAGS} -Wdeclaration-after-statement"
+
+       if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then
+           DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wdeclaration-after-statement"
+       fi
+
+       #-Werror-implicit-function-declaration
+       AC_CACHE_CHECK(
+          [that the C compiler understands 
-Werror-implicit-function-declaration],
+          samba_cv_HAVE_Werror_implicit_function_declaration, [
+         AC_TRY_RUN_STRICT([
+           int main(void)
+           {
+               return 0;
+           }],[-Werror-implicit-function-declaration],[$CPPFLAGS],[$LDFLAGS],
+           samba_cv_HAVE_Werror_implicit_function_declaration=yes,
+           samba_cv_HAVE_Werror_implicit_function_declaration=no,
+           samba_cv_HAVE_Werror_implicit_function_declaration=cross)
+       ])
+       if test x"$samba_cv_HAVE_Werror_implicit_function_declaration" = 
x"yes"; then
+           DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} 
-Werror-implicit-function-declaration"
        fi
-    fi])
 
-AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer 
warnings and debugging, except -Wstrict-prototypes (default=no)],
-    [if eval "test x$enable_krb5developer = xyes"; then
-        developer=yes
-       CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual 
-Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
-    fi])
+       # krb5developer is like developer, except we don't get
+       # -Wstrict-prototypes.
+       if test x"$krb5_developer" ~= x"$yes" ; then
+           DEVELOPER_CFLAGS="$DEVELOPER_CFLAGS -Wstrict-prototypes"
+       fi
+fi
 
 AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc        Enable heap debugging 
[default=no]])
 
@@ -6319,6 +6349,12 @@
           AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
           AC_MSG_WARN([cannot run when cross-compiling]))
 
+dnl Merge in developer cflags from now on
+AC_SUBST(DEVELOPER_CFLAGS)
+if test x"$krb5_developer" = x"yes" -o x"$developer" = x"yes"; then
+    CFLAGS="${CFLAGS} \$(DEVELOPER_CFLAGS)"
+fi
+
 builddir=`pwd`
 AC_SUBST(builddir)
 

Reply via email to