From: RĂ©mi Denis-Courmont Date: Mon, 5 Sep 2011 16:16:37 +0000 (+0300) Subject: Let autoconf detect -g and -O2, do not reinvent the wheel X-Git-Tag: 1.2.0-pre1~838 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c7bd58198d7fbc03f4c19dd708a736acda70202e;p=vlc Let autoconf detect -g and -O2, do not reinvent the wheel Save CFLAGS and CXXFLAGS after the compiler is detected, rather than before. This is when autoconf sets -g and -O2 automatically by default. --- diff --git a/configure.ac b/configure.ac index 4f20abedc8..d191934a0c 100644 --- a/configure.ac +++ b/configure.ac @@ -49,11 +49,6 @@ AC_SUBST(vlcdatadir) vlclibdir="\${libdir}/\${PKGDIR}" AC_SUBST(vlclibdir) -dnl -dnl Save *FLAGS -dnl -VLC_SAVE_FLAGS - dnl dnl Check for tools dnl @@ -87,6 +82,11 @@ AC_C_CONST AC_C_INLINE AC_C_RESTRICT +dnl +dnl Save *FLAGS +dnl +VLC_SAVE_FLAGS + dnl Extend the --help string at the current spot. AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])]) @@ -921,16 +921,12 @@ dnl Debugging mode dnl AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], - [build with run-time assertions and debug symbols (default disabled)])],, + [build with run-time assertions (default disabled)])],, [enable_debug="no"]) AH_TEMPLATE(NDEBUG, [Define to 1 if debug code should NOT be compiled]) AS_IF([test "${enable_debug}" != "no"], [ AC_CHECK_HEADERS([valgrind/valgrind.h]) - CFLAGS="${CFLAGS} -g" - CXXFLAGS="${CXXFLAGS} -g" - OBJCFLAGS="${OBJCFLAGS} -g" - LDFLAGS="${LDFLAGS} -g" ], [ AC_DEFINE(NDEBUG) ]) @@ -1035,33 +1031,6 @@ AS_IF([test "${enable_optimizations}" != "no"], [ ]) ]) - dnl -O2 and -O in both production and debug builds - AS_IF([test "x$C_O" = "x"], [ - AC_CACHE_CHECK([if \$CC accepts -O2], [ac_cv_c_o2], [ - CFLAGS="${CFLAGS_save} -O2" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ - ac_cv_c_o2=yes - ], [ - ac_cv_c_o2=no - ]) - ]) - AS_IF([test "${ac_cv_c_o2}" != "no"], [ - C_O="-O2" - ], [ - AC_CACHE_CHECK([if \$CC accepts -O], [ac_cv_c_o], [ - CFLAGS="${CFLAGS_save} -O" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ - ac_cv_c_o=yes - ], [ - ac_cv_c_o=no - ]) - ]) - AS_IF([test "${ac_cv_c_o}" != "no"], [ - C_O="-O" - ]) - ]) - ]) - VLC_RESTORE_FLAGS CFLAGS="${CFLAGS} ${C_O}" CXXFLAGS="${CXXFLAGS} ${C_O}"