From: Arran Cudbard-Bell Date: Fri, 2 Nov 2012 09:53:35 +0000 (+0000) Subject: Remove -O2 and replace -g with -g3 if building from git or configured with --enable... X-Git-Tag: release_3_0_0_beta1~1614 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f657a3c4f0c82294c011b31fc280cefc367bf132;p=thirdparty%2Ffreeradius-server.git Remove -O2 and replace -g with -g3 if building from git or configured with --enable-developer Fix warning in libreadline autoconf macro --- diff --git a/acinclude.m4 b/acinclude.m4 index 2730606faa7..82be3484101 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -394,10 +394,10 @@ AC_DEFUN([FR_TLS], ]) -AC_DEFUN([AC_LIB_READLINE], [ +AC_DEFUN([VL_LIB_READLINE], [ AC_CACHE_CHECK([for a readline compatible library], - ac_cv_lib_readline, [ - ORIG_LIBS=$LIBS + vl_cv_lib_readline, [ + ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then @@ -406,38 +406,36 @@ AC_DEFUN([AC_LIB_READLINE], [ TRY_LIB="-l$readline_lib -l$termcap_lib" fi LIBS="$ORIG_LIBS $TRY_LIB" - AC_TRY_LINK_FUNC(readline, ac_cv_lib_readline="$TRY_LIB") - if test -n "$ac_cv_lib_readline"; then - LIBREADLINE="$TRY_LIB" - AC_SUBST(LIBREADLINE) + AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB") + if test -n "$vl_cv_lib_readline"; then break fi done - if test -n "$ac_cv_lib_readline"; then + if test -n "$vl_cv_lib_readline"; then break fi done - if test -z "$ac_cv_lib_readline"; then - ac_cv_lib_readline="no" + if test -z "$vl_cv_lib_readline"; then + vl_cv_lib_readline="no" + LIBS="$ORIG_LIBS" fi - LIBS=$ORIG_LIBS ]) - if test "$ac_cv_lib_readline" != "no"; then + if test "$vl_cv_lib_readline" != "no"; then AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a readline compatible library]) AC_CHECK_HEADERS(readline.h readline/readline.h) AC_CACHE_CHECK([whether readline supports history], - ac_cv_lib_readline_history, [ - ac_cv_lib_readline_history="no" - AC_TRY_LINK_FUNC(add_history, ac_cv_lib_readline_history="yes") + vl_cv_lib_readline_history, [ + vl_cv_lib_readline_history="no" + AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes") ]) - if test "$ac_cv_lib_readline_history" = "yes"; then + if test "$vl_cv_lib_readline_history" = "yes"; then AC_DEFINE(HAVE_READLINE_HISTORY, 1, [Define if your readline library has \`add_history']) AC_CHECK_HEADERS(history.h readline/history.h) fi fi -]) +])dnl AC_INCLUDE(aclocal.m4) diff --git a/configure b/configure index 7a6d34f88dd..a1368244d13 100755 --- a/configure +++ b/configure @@ -658,7 +658,6 @@ OPENSSL_INCLUDE REGEX_EXTENDED REGEX_PCRE REGEX -LIBREADLINE DIRNAME LOCATE AUTOHEADER @@ -758,6 +757,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_developer enable_largefile with_system_libltdl with_system_libtool @@ -779,7 +779,6 @@ with_vmps with_dhcp with_static_modules with_modules -enable_developer with_experimental_modules with_openssl with_openssl_includes @@ -1414,6 +1413,7 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-developer Enables features of interest to developers. --disable-largefile omit support for large files --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] @@ -1421,7 +1421,6 @@ Optional Features: optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-strict-dependencies Fail configure on lack of module dependancy. - --enable-developer Enables features of interest to developers. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2487,6 +2486,30 @@ RADIUSD_VERSION_STRING=`cat VERSION` PACKAGE=freeradius +# Check whether --enable-developer was given. +if test "${enable_developer+set}" = set; then : + enableval=$enable_developer; case "$enableval" in + no) + developer=no + ;; + *) + developer=yes + esac + +fi + + +if test -d $srcdir/.git; then + if test "x$developer" != "xno"; then + developer="yes" + fi +fi + +if test "x$developer" = "xyes"; then + : ${CFLAGS=-g3} +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -15429,29 +15452,6 @@ if test "${with_modules+set}" = set; then : fi -# Check whether --enable-developer was given. -if test "${enable_developer+set}" = set; then : - enableval=$enable_developer; case "$enableval" in - no) - developer=no - ;; - *) - developer=yes - esac - -fi - - -if test -d $srcdir/.git; then - if test "x$developer" != "xno"; then - developer="yes" - fi - - if test $GIT = yes; then - RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` - fi -fi - EXPERIMENTAL= # Check whether --with-experimental-modules was given. @@ -16445,11 +16445,11 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a readline compatible library" >&5 $as_echo_n "checking for a readline compatible library... " >&6; } -if ${ac_cv_lib_readline+:} false; then : +if ${vl_cv_lib_readline+:} false; then : $as_echo_n "(cached) " >&6 else - ORIG_LIBS=$LIBS + ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then @@ -16477,30 +16477,28 @@ return readline (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_readline="$TRY_LIB" + vl_cv_lib_readline="$TRY_LIB" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test -n "$ac_cv_lib_readline"; then - LIBREADLINE="$TRY_LIB" - + if test -n "$vl_cv_lib_readline"; then break fi done - if test -n "$ac_cv_lib_readline"; then + if test -n "$vl_cv_lib_readline"; then break fi done - if test -z "$ac_cv_lib_readline"; then - ac_cv_lib_readline="no" + if test -z "$vl_cv_lib_readline"; then + vl_cv_lib_readline="no" + LIBS="$ORIG_LIBS" fi - LIBS=$ORIG_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline" >&5 -$as_echo "$ac_cv_lib_readline" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vl_cv_lib_readline" >&5 +$as_echo "$vl_cv_lib_readline" >&6; } - if test "$ac_cv_lib_readline" != "no"; then + if test "$vl_cv_lib_readline" != "no"; then $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h @@ -16519,11 +16517,11 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readline supports history" >&5 $as_echo_n "checking whether readline supports history... " >&6; } -if ${ac_cv_lib_readline_history+:} false; then : +if ${vl_cv_lib_readline_history+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_lib_readline_history="no" + vl_cv_lib_readline_history="no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16543,15 +16541,15 @@ return add_history (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_readline_history="yes" + vl_cv_lib_readline_history="yes" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_history" >&5 -$as_echo "$ac_cv_lib_readline_history" >&6; } - if test "$ac_cv_lib_readline_history" = "yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vl_cv_lib_readline_history" >&5 +$as_echo "$vl_cv_lib_readline_history" >&6; } + if test "$vl_cv_lib_readline_history" = "yes"; then $as_echo "#define HAVE_READLINE_HISTORY 1" >>confdefs.h @@ -17963,12 +17961,20 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for developer gcc flags" >&5 $as_echo_n "checking for developer gcc flags... " >&6; } -if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then - devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -Wformat-y2k -Wno-format-extra-args -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wformat=2" - CFLAGS="$CFLAGS $devflags" - INSTALLSTRIP="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes. Using $devflags" >&5 + + +if test "x$developer" = "xyes"; then + if test "x$GCC" = "xyes"; then + devflags="-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -Wformat-y2k -Wno-format-extra-args -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wformat=2" + CFLAGS="$CFLAGS $devflags" + INSTALLSTRIP="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes. Using $devflags" >&5 $as_echo "yes. Using $devflags" >&6; } + fi + + if test $GIT = yes; then + RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` + fi else devflags="" CFLAGS="$CFLAGS -DNDEBUG" diff --git a/configure.in b/configure.in index 9b68a3c2096..89fbc6ebcda 100644 --- a/configure.in +++ b/configure.in @@ -29,7 +29,11 @@ AC_INIT(PACKAGE_MAIN,[$]Id[$],http://bugs.freeradius.org,,http://www.freeradius. AC_CONFIG_SRCDIR(src/main/radiusd.c) AC_CONFIG_HEADER(src/include/autoconf.h) -dnl # The version of the software +dnl ############################################################# +dnl # +dnl # Custom hackery to discover version at configure time +dnl # +dnl ############################################################# RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'` RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'` @@ -44,6 +48,46 @@ dnl # Still useful for custom builds RADIUSD_VERSION_STRING=`cat VERSION` PACKAGE=PACKAGE_MAIN +dnl ############################################################# +dnl # +dnl # Override some of the default autoconf variables such as +dnl # CFLAGS if were building in developer mode +dnl # +dnl ############################################################# + +dnl # +dnl # Enable developer features like debugging symbols. +dnl # These checks must be done before expanding the AC_PROG_CC +dnl # and AC_PROG_CXX macros. +dnl # +AC_ARG_ENABLE(developer, +[ --enable-developer Enables features of interest to developers.], +[ case "$enableval" in + no) + developer=no + ;; + *) + developer=yes + esac ] +) + +if test -d $srcdir/.git; then + if test "x$developer" != "xno"; then + dnl turn on the developer flag when taken from a git checkout (not a release) + developer="yes" + fi +fi + +dnl # +dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging +dnl # so we remove the defaults if were building in developer mode, and set +dnl # -g3 so nice things like macro values are included. Other arguments are +dnl # added later when we know what compiler were using. +dnl # +if test "x$developer" = "xyes"; then + : ${CFLAGS=-g3} +fi + dnl ############################################################# dnl # dnl # 0. Checks for compiler, libtool, and command line options. @@ -299,32 +343,6 @@ AC_ARG_WITH(modules, done ]) -dnl # -dnl # Enable developer C compiler warnings -dnl # -AC_ARG_ENABLE(developer, -[ --enable-developer Enables features of interest to developers.], -[ case "$enableval" in - no) - developer=no - ;; - *) - developer=yes - esac ] -) - -if test -d $srcdir/.git; then - if test "x$developer" != "xno"; then - dnl turn on the developer flag when taken from a git checkout (not a release) - developer="yes" - fi - - dnl append the current git hash onto the version string - if test $GIT = yes; then - RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` - fi -fi - dnl extra argument: --with-experimental-modules EXPERIMENTAL= AC_ARG_WITH(experimental-modules, @@ -578,7 +596,7 @@ AC_CHECK_LIB(pcap, pcap_open_live, ], [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ]) -AC_LIB_READLINE +VL_LIB_READLINE dnl ############################################################# dnl # @@ -958,11 +976,20 @@ fi AC_SUBST(LIBPREFIX) AC_MSG_CHECKING(for developer gcc flags) -if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then - devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -Wformat-y2k -Wno-format-extra-args -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wformat=2" - CFLAGS="$CFLAGS $devflags" - INSTALLSTRIP="" - AC_MSG_RESULT(yes. Using $devflags) + + +if test "x$developer" = "xyes"; then + if test "x$GCC" = "xyes"; then + devflags="-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -Wformat-y2k -Wno-format-extra-args -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wformat=2" + CFLAGS="$CFLAGS $devflags" + INSTALLSTRIP="" + AC_MSG_RESULT(yes. Using $devflags) + fi + + dnl append the current git hash onto the version string + if test $GIT = yes; then + RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` + fi else devflags="" CFLAGS="$CFLAGS -DNDEBUG"