Author: brane
Date: Mon Dec 24 09:59:39 2012
New Revision: 1425617

URL: http://svn.apache.org/viewvc?rev=1425617&view=rev
Log:
Reintegrate tweak-build-take-two branch to trunk.

Summary of changes:

 ** Split standards-compliance mode and maintainer mode compiler flags
    out of CFLAGS, so that compilation command lines that do not
    generate (too many) warnings or are not forced to comply with ISO
    C '90 can be constructed without having to resort to stripping
    individual flags out of CFLAGS.

    $ svn diff -r1424288:1424822 \
      ^/subversion/branches/tweak-build-take-two/configure.ac \
      ^/subversion/branches/tweak-build-take-two/aclocal.m4 \
      ^/subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4 \
      ^/subversion/branches/tweak-build-take-two/Makefile.in

 ** Now that warning and standards-compliance mode macros are no
    longer part of CFLAGS, stop stripping them in the Swig wrapper
    configury, except for Ruby, which is more delicate.

    $ svn diff -r1424329:1425040 \
      ^/subversion/branches/tweak-build-take-two/build/ac-macros/swig.m4

 ** Allow optimization and debugging to coexist, including in
    maintainer mode, adding a new configure option
    --enable-optimize. Neither --enable-optimize nor --enable-debug
    will override any optimization or debugging flags set by the user
    in C(XX)FLAGS at configure time. If debugging and optimization are
    enabled at the same time, we will try to use -O1, then -O; if
    debuggin is not enabled, we will try -O2 first.

    $ svn diff -c1424860 \
      ^/subversion/branches/tweak-build-take-two/configure.ac

 ** Remove an obsolete autoconf macro that was not used anywhere and
    is superceded with SVN_CFLAGS_ADD_IFELSE.

    $ svn diff -c1424297 \
      ^/subversion/branches/tweak-build-take-two/build/ac-macros/svn-macros.m4

 ** Move the sqlite-amalgamation directory from the root of the source tree
    under subversion/include/private to make include paths safer from
    possible collision with sqlite include files from other install locations.

    $ svn diff -c1425050 \
      ^/subversion/branches/tweak-build-take-two

 ** Allow a user to set a custom set of compiler flags at configure time that
    are used for Subversion sources, but not, e.g., Swig-generated sources,
    like this:

    $ ./configure CUSERFLAGS=--flags-for-C CXXUSERFLAGS=--flags-for-C++

    $ svn diff -c1425086 \
      ^/subversion/branches/tweak-build-take-two

Added:
    subversion/trunk/build/ac-macros/compiler.m4
      - copied unchanged from r1425613, 
subversion/branches/tweak-build-take-two/build/ac-macros/compiler.m4
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/INSTALL
    subversion/trunk/Makefile.in
    subversion/trunk/aclocal.m4
    subversion/trunk/autogen.sh
    subversion/trunk/build/ac-macros/sqlite.m4
    subversion/trunk/build/ac-macros/svn-macros.m4
    subversion/trunk/build/ac-macros/swig.m4
    subversion/trunk/configure.ac
    subversion/trunk/get-deps.sh
    subversion/trunk/subversion/include/private/   (props changed)
    subversion/trunk/subversion/libsvn_subr/sqlite.c
    subversion/trunk/subversion/libsvn_subr/sqlite3wrapper.c
    subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Dec 24 09:59:39 2012
@@ -47,7 +47,6 @@ mkmf.log
 .settings
 .cproject
 zlib
-sqlite-amalgamation
 serf
 .git
 .gitignore

Propchange: subversion/trunk/
------------------------------------------------------------------------------
  Merged /subversion/branches/tweak-build-take-two:r1424288-1425613

Modified: subversion/trunk/INSTALL
URL: 
http://svn.apache.org/viewvc/subversion/trunk/INSTALL?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/INSTALL (original)
+++ subversion/trunk/INSTALL Mon Dec 24 09:59:39 2012
@@ -172,9 +172,9 @@ I.    INTRODUCTION
       libraries (Apache Portable Runtime, Sqlite, and Zlib).  The script,
       'get-deps.sh', is available in the same directory as this file.
       When run, it will place 'apr', 'apr-util', 'serf', 'zlib', and
-      'sqlite-amalgamation' directories directly into your unpacked Subversion
-      distribution, where they will be automatically configured and built by
-      Subversion's build process.
+      'subversion/include/private/sqlite-amalgamation' directories directly
+      into your unpacked Subversion distribution, where they will be
+      automatically configured and built by Subversion's build process.
 
       Note: there are optional dependencies (such as openssl, swig, and httpd)
       which get-deps.sh does not download and Subversion does not attempt to

Modified: subversion/trunk/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Mon Dec 24 09:59:39 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/trunk/aclocal.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Mon Dec 24 09:59:39 2012
@@ -36,6 +36,7 @@ sinclude(build/ac-macros/apr.m4)
 sinclude(build/ac-macros/aprutil.m4)
 sinclude(build/ac-macros/apr_memcache.m4)
 sinclude(build/ac-macros/berkeley-db.m4)
+sinclude(build/ac-macros/compiler.m4)
 sinclude(build/ac-macros/ctypesgen.m4)
 sinclude(build/ac-macros/gssapi.m4)
 sinclude(build/ac-macros/java.m4)

Modified: subversion/trunk/autogen.sh
URL: 
http://svn.apache.org/viewvc/subversion/trunk/autogen.sh?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/autogen.sh (original)
+++ subversion/trunk/autogen.sh Mon Dec 24 09:59:39 2012
@@ -202,6 +202,7 @@ echo ""
 echo "./configure --enable-maintainer-mode"
 echo "./configure --disable-shared"
 echo "./configure --enable-maintainer-mode --disable-shared"
+echo "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'"
 echo ""
 echo "Note:  If you wish to run a Subversion HTTP server, you will need"
 echo "Apache 2.x.  See the INSTALL file for details."

Modified: subversion/trunk/build/ac-macros/sqlite.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/sqlite.m4?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/sqlite.m4 (original)
+++ subversion/trunk/build/ac-macros/sqlite.m4 Mon Dec 24 09:59:39 2012
@@ -27,14 +27,20 @@ dnl   the recommended version of sqlite.
 dnl
 dnl   If a --with-sqlite=PREFIX option is passed, look for a suitable sqlite
 dnl   either installed under the directory PREFIX or as an amalgamation file
-dnl   at the path PREFIX.  In this case ignore any sqlite-amalgamation/ subdir
-dnl   within the source tree.
+dnl   at the path PREFIX.  In this case ignore any
+dnl
+dnl       subversion/include/private/sqlite-amalgamation/
+dnl
+dnl   subdir within the source tree.
 dnl
 dnl   If no --with-sqlite option is passed, look first for
-dnl   sqlite-amalgamation/sqlite3.c which should be the amalgamated version of
-dnl   the source distribution.  If the amalgamation exists and is the wrong
-dnl   version, exit with a failure.  If no sqlite-amalgamation/ subdir is
-dnl   present, search for a sqlite installed on the system.
+dnl
+dnl       subversion/include/private/sqlite-amalgamation/sqlite3.c
+dnl
+dnl   which should be the amalgamated version of the source distribution.
+dnl   If the amalgamation exists and is the wrong version, exit with a
+dnl   failure.  If no sqlite-amalgamation/ subdir is present, search
+dnl   for a sqlite installed on the system.
 dnl
 dnl   If the search for sqlite fails, set svn_lib_sqlite to no, otherwise set
 dnl   it to yes.
@@ -75,7 +81,7 @@ AC_DEFUN(SVN_LIB_SQLITE,
   ],
   [
     dnl see if the sqlite amalgamation exists in the source tree
-    SVN_SQLITE_FILE_CONFIG($abs_srcdir/sqlite-amalgamation/sqlite3.c)
+    
SVN_SQLITE_FILE_CONFIG([$abs_srcdir/subversion/include/private/sqlite-amalgamation/sqlite3.c])
 
     if test -z "$svn_lib_sqlite"; then
       dnl check the "standard" location of /usr
@@ -189,10 +195,12 @@ AC_DEFUN(SVN_SQLITE_FILE_CONFIG,
 SQLITE_VERSION_OKAY
 #endif],
                  [AC_MSG_RESULT([amalgamation found and is okay])
+                  dnl No additional include dirs since sources use a
+                  dnl relative path to include the amalgamated files.
+                  SVN_SQLITE_INCLUDES=""
                   _SVN_SQLITE_DSO_LIBS
                   AC_DEFINE(SVN_SQLITE_INLINE, 1,
                   [Defined if svn should use the amalgamated version of 
sqlite])
-                  SVN_SQLITE_INCLUDES="-I`dirname $sqlite_amalg`"
                   if test -n "$svn_sqlite_dso_ldflags"; then
                     SVN_SQLITE_LIBS="$svn_sqlite_dso_ldflags -lpthread"
                   else

Modified: subversion/trunk/build/ac-macros/svn-macros.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/svn-macros.m4?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/svn-macros.m4 (original)
+++ subversion/trunk/build/ac-macros/svn-macros.m4 Mon Dec 24 09:59:39 2012
@@ -141,37 +141,6 @@ done
 $1="${svn_cur}"
 ])
 
-dnl SVN_MAYBE_ADD_TO_CFLAGS(option)
-dnl
-dnl Attempt to compile a trivial C program to test if the option passed
-dnl is valid. If it is, then add it to CFLAGS. with the passed in option
-dnl and see if it was successfully compiled.
-dnl
-dnl This macro is usually used for stricter syntax checking flags.
-dnl Therefore we include certain headers which may in turn include system
-dnl headers, as system headers on some platforms may fail strictness checks
-dnl we wish to use on other platforms.
-
-AC_DEFUN(SVN_MAYBE_ADD_TO_CFLAGS,
-[
-  option="$1"
-  svn_maybe_add_to_cflags_saved_flags="$CFLAGS"
-  CFLAGS="$CFLAGS $option"
-  AC_MSG_CHECKING([if $CC accepts $option])
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-    [[#include <apr_portable.h>]],
-    [[]])],
-    [svn_maybe_add_to_cflags_ok="yes"],
-    [svn_maybe_add_to_cflags_ok="no"]
-  )
-  if test "$svn_maybe_add_to_cflags_ok" = "yes"; then
-    AC_MSG_RESULT([yes, will use it])
-  else
-    AC_MSG_RESULT([no])
-    CFLAGS="$svn_maybe_add_to_cflags_saved_flags"
-  fi
-])
-
 dnl SVN_STRIP_FLAG(FLAG_VAR_NAME, FLAG)
 dnl
 dnl Remove FLAG from the variable FLAG_VAR_NAME, if it exists.  This macro

Modified: subversion/trunk/build/ac-macros/swig.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/swig.m4?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/swig.m4 (original)
+++ subversion/trunk/build/ac-macros/swig.m4 Mon Dec 24 09:59:39 2012
@@ -120,14 +120,6 @@ AC_DEFUN(SVN_FIND_SWIG,
     ])
     SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
 
-    dnl Swig-generated code results in a number of shadowed variables and other
-    dnl warnings, so ignore them when compiling swig-py
-    SVN_STRIP_FLAG(SWIG_PY_COMPILE, [-Wall])
-    SVN_STRIP_FLAG(SWIG_PY_COMPILE, [-Wunused])
-    SVN_STRIP_FLAG(SWIG_PY_COMPILE, [-Wshadow])
-    SVN_STRIP_FLAG(SWIG_PY_COMPILE, [-Wmissing-prototypes])
-    SVN_STRIP_FLAG(SWIG_PY_COMPILE, [-Wmissing-declarations])
-
     AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
       ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
     ])
@@ -213,20 +205,13 @@ AC_DEFUN(SVN_FIND_SWIG,
     SWIG_RB_INCLUDES="\$(SWIG_INCLUDES) $svn_cv_ruby_includes"
 
     AC_CACHE_CHECK([how to compile Ruby extensions], [svn_cv_ruby_compile],[
-      # Ruby doesn't like '-ansi', so strip that out of CFLAGS
-      svn_cv_ruby_compile="$rbconfig_CC `echo $CFLAGS | $SED -e "s/ 
-ansi//g;s/ -std=c89//g"`"
+      svn_cv_ruby_compile="$rbconfig_CC $CFLAGS"
     ])
     SWIG_RB_COMPILE="$svn_cv_ruby_compile"
-
-    dnl The swig bindings create a lot of spurious warnings with several of
-    dnl our standard compiler flags, so filter them out here
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wall])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wunused])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wshadow])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wstrict-prototypes])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wmissing-declarations])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wmissing-prototypes])
-    SVN_STRIP_FLAG(SWIG_RB_COMPILE, [-Wredundant-decls])
+    SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-ansi])
+    SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c89])
+    SVN_STRIP_FLAG([SWIG_RB_COMPILE], [-std=c90])
+    dnl FIXME: Check that the compiler for Ruby actually supports this flag
     SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast"
 
     AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[
@@ -245,7 +230,10 @@ AC_DEFUN(SVN_FIND_SWIG,
     AC_MSG_CHECKING([for rb_errinfo])
     old_CFLAGS="$CFLAGS"
     old_LIBS="$LIBS"
-    CFLAGS="`echo $CFLAGS | $SED -e "s/ -ansi//g;s/ -std=c89//g"` 
$svn_cv_ruby_includes"
+    CFLAGS="$CFLAGS $svn_cv_ruby_includes"
+    SVN_STRIP_FLAG([CFLAGS], [-ansi])
+    SVN_STRIP_FLAG([CFLAGS], [-std=c89])
+    SVN_STRIP_FLAG([CFLAGS], [-std=c90])
     LIBS="$SWIG_RB_LIBS"
     AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #include <ruby.h>

Modified: subversion/trunk/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Mon Dec 24 09:59:39 2012
@@ -49,10 +49,16 @@ SVN_CONFIG_NICE(config.nice)
 # ==== Check for programs ====================================================
 
 # Look for a C compiler (before anything can set CFLAGS)
+CMAINTAINERFLAGS="$CUSERFLAGS"
+CUSERFLAGS="$CFLAGS"
 AC_PROG_CC
+SVN_CC_MODE_SETUP
 
-# Look for a C++ compiler
+# Look for a C++ compiler (before anything can set CXXFLAGS)
+CXXMAINTAINERFLAGS="$CXXUSERFLAGS"
+CXXUSERFLAGS="$CXXFLAGS"
 AC_PROG_CXX
+SVN_CXX_MODE_SETUP
 
 # Look for a C pre-processor
 AC_PROG_CPP
@@ -916,22 +922,22 @@ AS_HELP_STRING([--enable-debug],
 [
     # Neither --enable-debug nor --disable-debug was passed.
     enable_debugging="maybe"
-
-        # We leave this as 'maybe' because setting it to 'no' would modify the
-        # CFLAGS/CXXFLAGS later (just after the --enable-maintainer-mode 
block),
-        # and we don't want to force that.
-    #
-    # TODO: set enable_debugging='no' here, and provide another way to disable
-    #       the CFLAGS/CXXFLAGS munging.
 ])
 
-
-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"
-
+AC_ARG_ENABLE(optimize,
+AS_HELP_STRING([--enable-optimize],
+               [Turn on optimizations]),
+[
+    if test "$enableval" = "yes" ; then
+      enable_optimization="yes"
+    else
+      enable_optimization="no"
+    fi
+],
+[
+    # Neither --enable-optimize nor --disable-optimize was passed.
+    enable_optimization="maybe"
+])
 
 dnl Use -Wl,--no-undefined during linking of some libraries
 AC_ARG_ENABLE(disallowing-of-undefined-references,
@@ -985,89 +991,138 @@ 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 ./configure CUSERFLAGS="-Wswitch-enum -Wswitch-default"
 
         dnl Add each of the following flags only if the C compiler accepts it.
-
         CFLAGS_KEEP="$CFLAGS"
-        AC_LANG_PUSH([C])
+        CFLAGS=""
 
-        CFLAGS="-Werror=declaration-after-statement $CFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
+        SVN_CFLAGS_ADD_IFELSE([-Werror=implicit-function-declaration])
+        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])
 
-        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_KEEP -Wno-format-nonliteral"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CFLAGS_KEEP="$CFLAGS"])
-
-        AC_LANG_POP([C])
+        CMAINTAINERFLAGS="$CFLAGS $CMAINTAINERFLAGS"
         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=""
 
-        CXXFLAGS="-Wshorten-64-to-32 $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])
 
-        CXXFLAGS="-Wno-system-headers $CXXFLAGS_KEEP"
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [CXXFLAGS_KEEP="$CXXFLAGS"])
-
-        AC_LANG_POP([C++])
+        CXXMAINTAINERFLAGS="$CXXFLAGS $CXXMAINTAINERFLAGS"
         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
 ])
 
 if test "$enable_debugging" = "yes" ; then
   dnl At the moment, we don't want optimization, because we're
-  dnl debugging.
-  CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
-  CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+  dnl debugging. Unless optiization was explicitly enabled.
+  if test "$enable_optimization" != "yes"; then
+    AC_MSG_NOTICE([Disabling optimizations for debugging])
+    CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+    CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+  fi
+  dnl Add debugging flags, unless they were set by the user
+  if test -z ["`echo $CUSERFLAGS' ' | $EGREP -- '-g[0-9]? '`"]; then
+    AC_MSG_NOTICE([Enabling debugging for C])
+    CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-g[0-9] //g' -e 's/-g //g'`"]
+    SVN_CFLAGS_ADD_IFELSE([-fno-inline])
+    SVN_CFLAGS_ADD_IFELSE([-fno-omit-frame-pointer])
+    SVN_CFLAGS_ADD_IFELSE([-g3],[],[
+      SVN_CFLAGS_ADD_IFELSE([-g2],[],[
+        SVN_CFLAGS_ADD_IFELSE([-g])])])
+  fi
+  if test -z ["`echo $CXXUSERFLAGS' ' | $EGREP -- '-g[0-9]? '`"]; then
+    AC_MSG_NOTICE([Enabling debugging for C++])
+    CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-g[0-9] //g' -e 's/-g //g'`"]
+    SVN_CXXFLAGS_ADD_IFELSE([-fno-inline])
+    SVN_CXXFLAGS_ADD_IFELSE([-fno-omit-frame-pointer])
+    SVN_CXXFLAGS_ADD_IFELSE([-g3],[],[
+      SVN_CXXFLAGS_ADD_IFELSE([-g2],[],[
+        SVN_CXXFLAGS_ADD_IFELSE([-g])])])
+  fi
   dnl SVN_DEBUG enables specific features for developer builds
   dnl AP_DEBUG enables specific (Apache) features for developer builds
   CFLAGS="$CFLAGS -DSVN_DEBUG -DAP_DEBUG"
   CXXFLAGS="$CXXFLAGS -DSVN_DEBUG -DAP_DEBUG"
 elif test "$enable_debugging" = "no" ; then
-    CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-g[0-9] //g' | $SED -e 's/-g//g'`"]
-    CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-g[0-9] //g' | $SED -e 
's/-g//g'`"]
-    dnl Compile with NDEBUG to get rid of assertions
-    CFLAGS="$CFLAGS -DNDEBUG"
-    CXXFLAGS="$CXXFLAGS -DNDEBUG"
+  AC_MSG_NOTICE([Disabling debugging])
+  CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-g[0-9] //g' -e 's/-g //g'`"]
+  CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-g[0-9] //g' -e 's/-g //g'`"]
+  dnl Compile with NDEBUG to get rid of assertions
+  CFLAGS="$CFLAGS -DNDEBUG"
+  CXXFLAGS="$CXXFLAGS -DNDEBUG"
 # elif test "$enable_debugging" = "maybe" ; then
 #   # do nothing
 fi
 
+if test "$enable_optimization" = "yes"; then
+  dnl Add optimization flags, unless they were set by the user
+  if test -z ["`echo $CUSERFLAGS' ' | $EGREP -- '-O[^ ]* '`"]; then
+    CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+    if test "$enable_debugging" = "yes"; then
+      AC_MSG_NOTICE([Enabling optimizations for C (with debugging enabled)])
+      SVN_CFLAGS_ADD_IFELSE([-O1],[],[
+        SVN_CFLAGS_ADD_IFELSE([-O])])
+    else
+      AC_MSG_NOTICE([Enabling optimizations for C])
+      SVN_CFLAGS_ADD_IFELSE([-O2],[],[
+        SVN_CFLAGS_ADD_IFELSE([-O1],[],[
+          SVN_CFLAGS_ADD_IFELSE([-O])])])
+    fi
+  fi
+  if test -z ["`echo $CXXUSERFLAGS' ' | $EGREP -- '-O[^ ]* '`"]; then
+    CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+    if test "$enable_debugging" = "yes"; then
+      AC_MSG_NOTICE([Enabling optimizations for C++ (with debugging enabled)])
+      SVN_CXXFLAGS_ADD_IFELSE([-O1],[],[
+        SVN_CXXFLAGS_ADD_IFELSE([-O])])
+    else
+      AC_MSG_NOTICE([Enabling optimizations for C++])
+      SVN_CXXFLAGS_ADD_IFELSE([-O2],[],[
+        SVN_CXXFLAGS_ADD_IFELSE([-O1],[],[
+          SVN_CXXFLAGS_ADD_IFELSE([-O])])])
+    fi
+  fi
+elif test "$enable_optimization" = "no"; then
+  dnl Remove all optimization flags
+  AC_MSG_NOTICE([Disabling optimizations])
+  CFLAGS=["`echo $CFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+  CXXFLAGS=["`echo $CXXFLAGS' ' | $SED -e 's/-O[^ ]* //g'`"]
+# elif test "$enable_optimization" = "maybe" ; then
+#   # do nothing
+fi
+
+
 AC_ARG_ENABLE(full-version-match,
 AS_HELP_STRING([--disable-full-version-match],
                [Disable the full version match rules when checking
@@ -1387,11 +1442,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])

Modified: subversion/trunk/get-deps.sh
URL: 
http://svn.apache.org/viewvc/subversion/trunk/get-deps.sh?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/get-deps.sh (original)
+++ subversion/trunk/get-deps.sh Mon Dec 24 09:59:39 2012
@@ -91,7 +91,7 @@ get_zlib() {
 }
 
 get_sqlite() {
-    test -d $BASEDIR/sqlite-amalgamation && return
+    test -d $BASEDIR/subversion/include/private/sqlite-amalgamation && return
 
     cd $TEMPDIR
     $HTTP_FETCH http://www.sqlite.org/$SQLITE.zip
@@ -99,7 +99,7 @@ get_sqlite() {
 
     unzip -q $TEMPDIR/$SQLITE.zip
 
-    mv $SQLITE sqlite-amalgamation
+    mv $SQLITE subversion/include/private/sqlite-amalgamation
 
 }
 
@@ -107,7 +107,7 @@ get_sqlite() {
 get_deps() {
     mkdir -p $TEMPDIR
 
-    for i in zlib serf sqlite-amalgamation apr apr-util; do
+    for i in zlib serf subversion/include/private/sqlite-amalgamation apr 
apr-util; do
       if [ -d $i ]; then
         echo "Local directory '$i' already exists; the downloaded copy won't 
be used" >&2
       fi

Propchange: subversion/trunk/subversion/include/private/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec 24 09:59:39 2012
@@ -0,0 +1 @@
+sqlite-amalgamation

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Mon Dec 24 09:59:39 2012
@@ -45,7 +45,7 @@
 #ifdef SVN_SQLITE_INLINE
 /* Import the sqlite3 API vtable from sqlite3wrapper.c */
 #  define SQLITE_OMIT_DEPRECATED
-#  include <sqlite3ext.h>
+#  include <private/sqlite-amalgamation/sqlite3ext.h>
 extern const sqlite3_api_routines *const svn_sqlite3__api_funcs;
 extern int (*const svn_sqlite3__api_initialize)(void);
 extern int (*const svn_sqlite3__api_config)(int, ...);

Modified: subversion/trunk/subversion/libsvn_subr/sqlite3wrapper.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite3wrapper.c?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite3wrapper.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite3wrapper.c Mon Dec 24 
09:59:39 2012
@@ -39,7 +39,7 @@
 #      pragma GCC diagnostic ignored "-Wshorten-64-to-32"
 #    endif
 #  endif
-#  include <sqlite3.c>
+#  include <private/sqlite-amalgamation/sqlite3.c>
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6))
 #    pragma GCC diagnostic pop
 #  endif

Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1425617&r1=1425616&r2=1425617&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Mon Dec 24 
09:59:39 2012
@@ -32,7 +32,7 @@
 #ifdef SVN_SQLITE_INLINE
 /* Include sqlite3 inline, making all symbols private. */
   #define SQLITE_API static
-  #include <sqlite3.c>
+  #include <private/sqlite-amalgamation/sqlite3.c>
 #else
   #include <sqlite3.h>
 #endif


Reply via email to