Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/configure.ac  view on Meta::CPAN


        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 ./configure CUSERFLAGS="-Wswitch-enum -Wswitch-default"

        dnl Add each of the following flags only if the C compiler accepts it.
        CFLAGS_KEEP="$CFLAGS"
        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])

        CMAINTAINERFLAGS="$CFLAGS $CMAINTAINERFLAGS"
        CFLAGS="$CFLAGS_KEEP"

        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 ...
      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"
        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])

        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. 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
  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([-O3],[],[
        SVN_CFLAGS_ADD_IFELSE([-O2],[],[
          SVN_CFLAGS_ADD_IFELSE([-O1],[],[
            SVN_CFLAGS_ADD_IFELSE([-O])])])])
      SVN_CFLAGS_ADD_IFELSE([-Wno-clobbered])
      SVN_CFLAGS_ADD_IFELSE([-flto])
    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([-O3],[],[
        SVN_CXXFLAGS_ADD_IFELSE([-O2],[],[
          SVN_CXXFLAGS_ADD_IFELSE([-O1],[],[
            SVN_CXXFLAGS_ADD_IFELSE([-O])])])])
      SVN_CXXFLAGS_ADD_IFELSE([-Wno-clobbered])
      SVN_CXXFLAGS_ADD_IFELSE([-flto])
    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



( run in 0.524 second using v1.01-cache-2.11-cpan-df04353d9ac )