diff options
author | James Peach <jpeach@samba.org> | 2007-06-14 03:38:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:20 -0500 |
commit | 6e631e5fb561cc60d4672e7ce450f8977541d3db (patch) | |
tree | 31b7647818b372028fb355847786c8ceb97479dc | |
parent | b4a39dc10e751fcb84d1f9709217eaf1b5da325a (diff) | |
download | samba-6e631e5fb561cc60d4672e7ce450f8977541d3db.tar.gz samba-6e631e5fb561cc60d4672e7ce450f8977541d3db.tar.bz2 samba-6e631e5fb561cc60d4672e7ce450f8977541d3db.zip |
r23478: 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.
(This used to be commit 4b392a76eb392375f369c8c64fccd138833dcb52)
-rw-r--r-- | source3/Makefile.in | 6 | ||||
-rw-r--r-- | source3/configure.in | 39 |
2 files changed, 32 insertions, 13 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index d427ed0945..7d1337cff5 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -20,8 +20,14 @@ smbtorture4_path=@smbtorture4_path@ LIBS=@LIBS@ CC=@CC@ SHLD=@SHLD@ + +# Add $(DEVELOPER_CFLAGS) to $(CFLAGS) to enable extra compiler +# (GCC) warnings. This is done automtically for --enable-developer +# and --enable-krb5developer. +DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@ CFLAGS=@CFLAGS@ CPPFLAGS=-DHAVE_CONFIG_H @CPPFLAGS@ + EXEEXT=@EXEEXT@ LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@ AR=@AR@ diff --git a/source3/configure.in b/source3/configure.in index b8e64e1ed7..b6d4c888fe 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -435,7 +435,19 @@ AC_ARG_WITH(smbtorture4_path, AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if eval "test x$enable_developer = xyes"; then developer=yes - DEVELOPER_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], @@ -448,12 +460,12 @@ AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings a samba_cv_HAVE_Wdeclaration_after_statement=yes, 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 + + if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wdeclaration-after-statement" - fi - # here + fi + #-Werror-implicit-function-declaration AC_CACHE_CHECK( [that the C compiler understands -Werror-implicit-function-declaration], @@ -470,13 +482,13 @@ AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings a 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]]) @@ -6474,8 +6486,9 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"], AC_MSG_WARN([cannot run when cross-compiling])) dnl Merge in developer cflags from now on -if test x"$developer" = x"yes"; then - CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}" +AC_SUBST(DEVELOPER_CFLAGS) +if test x"$krb5_developer" = x"yes" -o x"$developer" = x"yes"; then + CFLAGS="${CFLAGS} $(DEVELOPER_CFLAGS)" fi builddir=`pwd` |