You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/12/20 05:37:57 UTC

svn commit: r1424294 - in /subversion/branches/tweak-build-take-two: Makefile.in configure.ac

Author: brane
Date: Thu Dec 20 04:37:57 2012
New Revision: 1424294

URL: http://svn.apache.org/viewvc?rev=1424294&view=rev
Log:
[On the tweak-build-take-two branch]

Remove standards mode and warning flags from the default CFLAGS so that, e.g.,
the Swig wrappers configury will (eventually) not have to guess which ones
to strip from the command line.


* configure.ac:
  - Call SVN_PROG_CC and SVN_PROG_CXX instead of AC_PROG_CC and
    AC_PROG_CXX, respectively.
  - Use SVN_CFLAGS_ADD_IFELSE and SVN_CXXFLAGS_ADD_IFELSE wherever
    we'd previously had duplicated boilerplate for checking compiler
    option support.
  - In maintainer mode, assign warning options to CMAINTAINERFLAGS and
    CXXMAINTAINERFLAGS; and don't unconditionally use "-ansi".
  - Do not strip the -ansi flags for clang, SVN_PROG_CC takes care to
    not add it if the compiler doesn't support it, and it's no longer
    in CFLAGS anyway.

* Makefile.in (CMODEFLAGS, CMAINTAINERFLAGS, CXXMODEFLAGS, CXXMAINTAINERFLAGS):
   Substitute from configure.
  (COMPILE, COMPILE_APACHE_MOD): Add CMODEFLAGS and CMAINTAINERFLAGS to the
   option set since they're no longer part of CFLAGS.
  (COMPILE_CXX): Do the same with CXXMODEFLAGS and CXXMAINTAINERFLAGS.

Modified:
    subversion/branches/tweak-build-take-two/Makefile.in
    subversion/branches/tweak-build-take-two/configure.ac

Modified: subversion/branches/tweak-build-take-two/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/branches/tweak-build-take-two/Makefile.in?rev=1424294&r1=1424293&r2=1424294&view=diff
==============================================================================
--- subversion/branches/tweak-build-take-two/Makefile.in (original)
+++ subversion/branches/tweak-build-take-two/Makefile.in Thu Dec 20 04:37:57 2012
@@ -169,7 +169,11 @@ DOXYGEN = @DOXYGEN@
 
 # The EXTRA_ parameters can be used to pass extra flags at 'make' time.
 CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS)
+CMODEFLAGS = @CMODEFLAGS@
+CMAINTAINERFLAGS = @CMAINTAINERFLAGS@
 CXXFLAGS = @CXXFLAGS@ $(EXTRA_CXXFLAGS)
+CXXMODEFLAGS = @CXXMODEFLAGS@
+CXXMAINTAINERFLAGS = @CXXMAINTAINERFLAGS@
 ### A few of the CFLAGS (e.g. -Wmissing-prototypes, -Wstrict-prototypes,
 ### -Wmissing-declarations) are not valid for C++, and should be somehow
 ### suppressed (but they may come from httpd or APR).
@@ -177,8 +181,8 @@ CPPFLAGS = @CPPFLAGS@ $(EXTRA_CPPFLAGS)
 LDFLAGS = @LDFLAGS@ $(EXTRA_LDFLAGS)
 SWIG_LDFLAGS = @SWIG_LDFLAGS@ $(EXTRA_SWIG_LDFLAGS)
 
-COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
-COMPILE_CXX = $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES)
+COMPILE = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CMAINTAINERFLAGS) $(CFLAGS) $(INCLUDES)
+COMPILE_CXX = $(CXX) $(CXXMODEFLAGS) $(CPPFLAGS) $(CXXMAINTAINERFLAGS) $(CXXFLAGS) $(INCLUDES)
 LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) $(LT_CFLAGS)
 LT_COMPILE_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS)
 
@@ -186,7 +190,7 @@ LT_COMPILE_CXX = $(LIBTOOL) $(LTCXXFLAGS
 LT_EXECUTE = $(LIBTOOL) $(LTFLAGS) --mode=execute `for f in $(abs_builddir)/subversion/*/*.la; do echo -dlopen $$f; done`
 
 # special compilation for files destined for mod_dav_svn
-COMPILE_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(LT_CFLAGS) $(APACHE_INCLUDES) $(INCLUDES) -o $@ -c
+COMPILE_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CFLAGS) $(CMAINTAINERFLAGS) $(LT_CFLAGS) $(APACHE_INCLUDES) $(INCLUDES) -o $@ -c
 
 # special compilation for files destined for libsvn_swig_* (e.g. swigutil_*.c)
 COMPILE_SWIG_PY = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_PY_COMPILE) $(CPPFLAGS) $(LT_CFLAGS) -DSWIGPYTHON $(SWIG_PY_INCLUDES) $(INCLUDES) -o $@ -c

Modified: subversion/branches/tweak-build-take-two/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/tweak-build-take-two/configure.ac?rev=1424294&r1=1424293&r2=1424294&view=diff
==============================================================================
--- subversion/branches/tweak-build-take-two/configure.ac (original)
+++ subversion/branches/tweak-build-take-two/configure.ac Thu Dec 20 04:37:57 2012
@@ -49,10 +49,10 @@ SVN_CONFIG_NICE(config.nice)
 # ==== Check for programs ====================================================
 
 # Look for a C compiler (before anything can set CFLAGS)
-AC_PROG_CC
+SVN_PROG_CC
 
 # Look for a C++ compiler
-AC_PROG_CXX
+SVN_PROG_CXX
 
 # Look for a C pre-processor
 AC_PROG_CPP
@@ -927,11 +927,8 @@ AS_HELP_STRING([--enable-debug],
 
 
 dnl Add -Werror=implicit-function-declaration to CFLAGS
-CFLAGS_KEEP="$CFLAGS"
-CFLAGS="$CFLAGS_KEEP -Werror=implicit-function-declaration"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-CFLAGS="$CFLAGS_KEEP"
-
+dnl FIXME: Shouldn't this only be set in maintainer mode?
+SVN_CFLAGS_ADD_IFELSE([-Werror=implicit-function-declaration])
 
 dnl Use -Wl,--no-undefined during linking of some libraries
 AC_ARG_ENABLE(disallowing-of-undefined-references,
@@ -985,66 +982,55 @@ AS_HELP_STRING([--enable-maintainer-mode
         AC_MSG_ERROR([Can't have --disable-debug and --enable-maintainer-mode])
       fi
       enable_debugging=yes
+
+      dnl Enable some extra warnings. Put these before the user's flags
+      dnl so the user can specify flags that override these.
       if test "$GCC" = "yes"; then
         AC_MSG_NOTICE([maintainer-mode: adding GCC warning flags])
-        dnl Enable some extra warnings. Put these before the user's flags
-        dnl so the user can specify flags that override these.
-        CFLAGS="-Wpointer-arith -Wwrite-strings -Wshadow -ansi -Wall -Wformat=2 -Wunused -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wno-multichar -Wredundant-decls -Wnested-externs -Wunreachable-code -Winline -Wno-long-long $CFLAGS"
-        CXXFLAGS="-Wpointer-arith -Wwrite-strings -Wshadow -ansi -Wall $CXXFLAGS"
 
         dnl some additional flags that can be handy for an occasional review,
         dnl but throw too many warnings in svn code, of too little importance,
         dnl to keep these enabled. Remove the "dnl" to do a run with these
         dnl switches enabled.
-        dnl CFLAGS="-Wswitch-enum -Wswitch-default $CFLAGS"
+        dnl CMAINTAINERFLAGS="-Wswitch-enum -Wswitch-default $CMAINTAINERFLAGS"
 
         dnl Add each of the following flags only if the C compiler accepts it.
-
         CFLAGS_KEEP="$CFLAGS"
-        AC_LANG_PUSH([C])
-
-        CFLAGS="-Werror=declaration-after-statement $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        CFLAGS="-Wextra-tokens $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        CFLAGS="-Wnewline-eof $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        CFLAGS="-Wshorten-64-to-32 $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        CFLAGS="-Wold-style-definition $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        CFLAGS="-Wno-system-headers $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        dnl Put this flag behind -Wall:
+        CFLAGS=""
 
-        CFLAGS="$CFLAGS_KEEP -Wno-format-nonliteral"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
+        SVN_CFLAGS_ADD_IFELSE([-Werror=declaration-after-statement])
+        SVN_CFLAGS_ADD_IFELSE([-Wextra-tokens])
+        SVN_CFLAGS_ADD_IFELSE([-Wnewline-eof])
+        SVN_CFLAGS_ADD_IFELSE([-Wshorten-64-to-32])
+        SVN_CFLAGS_ADD_IFELSE([-Wold-style-definition])
+        SVN_CFLAGS_ADD_IFELSE([-Wno-system-headers])
+        SVN_CFLAGS_ADD_IFELSE([-Wno-format-nonliteral])
 
-        AC_LANG_POP([C])
+        AC_SUBST(CMAINTAINERFLAGS)
+        CMAINTAINERFLAGS="$CFLAGS"
         CFLAGS="$CFLAGS_KEEP"
 
-        dnl Add each of the following flags only if the C++ compiler accepts it.
+        dnl Add flags that all versions of GCC (should) support
+        CMAINTAINERFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wshadow -Wformat=2 -Wunused -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wno-multichar -Wredundant-decls -Wnested-externs -Winline -Wno-long-long $CMAINTAINERFLAGS"
+      fi
+      if test "$GXX" = "yes"; then
+        AC_MSG_NOTICE([maintainer-mode: adding G++ warning flags])
 
+        dnl Add each of the following flags only if the C++ compiler accepts it.
         CXXFLAGS_KEEP="$CXXFLAGS"
-        AC_LANG_PUSH([C++])
-
-        CXXFLAGS="-Wextra-tokens $CXXFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
-
-        CXXFLAGS="-Wshorten-64-to-32 $CXXFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
+        CXXFLAGS=""
 
-        CXXFLAGS="-Wno-system-headers $CXXFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
+        SVN_CXXFLAGS_ADD_IFELSE([-Wextra-tokens])
+        SVN_CXXFLAGS_ADD_IFELSE([-Wnewline-eof])
+        SVN_CXXFLAGS_ADD_IFELSE([-Wshorten-64-to-32])
+        SVN_CXXFLAGS_ADD_IFELSE([-Wno-system-headers])
 
-        AC_LANG_POP([C++])
+        AC_SUBST(CXXMAINTAINERFLAGS)
+        CXXMAINTAINERFLAGS="$CXXFLAGS"
         CXXFLAGS="$CXXFLAGS_KEEP"
+
+        dnl Add flags that all versions of G++ (should) support
+        CXXMAINTAINERFLAGS="-Wall -Wpointer-arith -Wwrite-strings -Wshadow -Wunused -Wunreachable-code $CXXMAINTAINERFLAGS"
       fi
     fi
 ])
@@ -1387,11 +1373,6 @@ if test "$CC" = "clang"; then
   SVN_STRIP_FLAG(CPPFLAGS, [-no-cpp-precomp ])
 fi
 
-# Clang also doesn't (yet) support the '-ansi' flag
-if test "$CC" = "clang"; then
-  SVN_STRIP_FLAG(CFLAGS, [-ansi ])
-fi
-
 dnl Since this is used only on Unix-y systems, define the path separator as '/'
 AC_DEFINE_UNQUOTED(SVN_PATH_LOCAL_SEPARATOR, '/',
         [Defined to be the path separator used on your local filesystem])