Commit c7bd5819 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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.
parent 4189e7a5
...@@ -49,11 +49,6 @@ AC_SUBST(vlcdatadir) ...@@ -49,11 +49,6 @@ AC_SUBST(vlcdatadir)
vlclibdir="\${libdir}/\${PKGDIR}" vlclibdir="\${libdir}/\${PKGDIR}"
AC_SUBST(vlclibdir) AC_SUBST(vlclibdir)
dnl
dnl Save *FLAGS
dnl
VLC_SAVE_FLAGS
dnl dnl
dnl Check for tools dnl Check for tools
dnl dnl
...@@ -87,6 +82,11 @@ AC_C_CONST ...@@ -87,6 +82,11 @@ AC_C_CONST
AC_C_INLINE AC_C_INLINE
AC_C_RESTRICT AC_C_RESTRICT
dnl
dnl Save *FLAGS
dnl
VLC_SAVE_FLAGS
dnl Extend the --help string at the current spot. dnl Extend the --help string at the current spot.
AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])]) AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
...@@ -921,16 +921,12 @@ dnl Debugging mode ...@@ -921,16 +921,12 @@ dnl Debugging mode
dnl dnl
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--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"]) [enable_debug="no"])
AH_TEMPLATE(NDEBUG, AH_TEMPLATE(NDEBUG,
[Define to 1 if debug code should NOT be compiled]) [Define to 1 if debug code should NOT be compiled])
AS_IF([test "${enable_debug}" != "no"], [ AS_IF([test "${enable_debug}" != "no"], [
AC_CHECK_HEADERS([valgrind/valgrind.h]) AC_CHECK_HEADERS([valgrind/valgrind.h])
CFLAGS="${CFLAGS} -g"
CXXFLAGS="${CXXFLAGS} -g"
OBJCFLAGS="${OBJCFLAGS} -g"
LDFLAGS="${LDFLAGS} -g"
], [ ], [
AC_DEFINE(NDEBUG) AC_DEFINE(NDEBUG)
]) ])
...@@ -1035,33 +1031,6 @@ AS_IF([test "${enable_optimizations}" != "no"], [ ...@@ -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 VLC_RESTORE_FLAGS
CFLAGS="${CFLAGS} ${C_O}" CFLAGS="${CFLAGS} ${C_O}"
CXXFLAGS="${CXXFLAGS} ${C_O}" CXXFLAGS="${CXXFLAGS} ${C_O}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment