]> git.sesse.net Git - vlc/commitdiff
Gather and cleanup debug and profiling configuration
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 1 May 2011 16:22:29 +0000 (19:22 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 1 May 2011 17:03:46 +0000 (20:03 +0300)
configure.ac
vlc-config.in.in

index 3af9ed3dfe531065e23128078bafa55d341a00c3..4a8c046ea2b9f90279f8fe02ff229839cf556f68 100644 (file)
@@ -980,11 +980,76 @@ AC_CACHE_CHECK([for ntohl in sys/param.h],
 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
 fi
-CFLAGS="${CFLAGS_save}"
+
+EXTEND_HELP_STRING([Optimization options:])
+VLC_RESTORE_FLAGS
+dnl
+dnl  Compiler warnings
+dnl
 
 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
 RDC_PROG_CC_FLAGS([-pipe])
 
+dnl
+dnl  Debugging mode
+dnl
+AC_ARG_ENABLE(debug,
+  [AS_HELP_STRING([--enable-debug],
+    [build with run-time assertions and debug symbols (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)
+])
+
+dnl
+dnl  Profiling
+dnl
+AC_ARG_ENABLE(gprof,
+  [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
+  [enable_gprof="no"])
+AS_IF([test "${enable_gprof}" != "no"], [
+  CFLAGS="${CFLAGS} -pg"
+  CXXFLAGS="${CXXFLAGS} -pg"
+  OBJCFLAGS="${OBJCFLAGS} -pg"
+  LDFLAGS="${LDFLAGS} -pg"
+])
+
+AC_ARG_ENABLE(cprof,
+  [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
+  [enable_cprof="no"])
+AS_IF([test "${enable_gprof}" != "no"], [
+  CFLAGS="${CFLAGS} -finstrument-functions"
+  CXXFLAGS="${CXXFLAGS} -finstrument-functions"
+  OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
+  LDFLAGS="${LDFLAGS} -finstrument-functions"
+])
+
+dnl
+dnl  Test coverage
+dnl
+AC_ARG_ENABLE(coverage,
+  [AS_HELP_STRING([--enable-coverage],
+    [build for test coverage (default disabled)])],,
+  [enable_coverage="no"])
+AS_IF([test "${enable_coverage}" != "no"], [
+  CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
+  CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
+  LDFLAGS="-lgcov ${LDFLAGS}"
+  CFLAGS_save="${CFLAGS}"
+  CXXFLAGS_save="${CXXFLAGS}"
+  LDFLAGS_save="${LDFLAGS}"
+])
+
+VLC_SAVE_FLAGS
+
 dnl Check for various optimization flags
 AC_CACHE_CHECK([if \$CC accepts -O4],
     [ac_cv_c_o4],
@@ -1109,16 +1174,6 @@ dnl Check for backtrace() support
 AC_CHECK_HEADERS(execinfo.h)
 AC_CHECK_FUNCS(backtrace)
 
-dnl
-dnl  Enable profiling
-dnl
-AC_ARG_ENABLE(gprof,
-  [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])])
-AC_ARG_ENABLE(cprof,
-  [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])])
-test "${enable_gprof}" != "yes" && enable_gprof="no"
-test "${enable_cprof}" != "yes" && enable_cprof="no"
-
 dnl
 dnl  default modules
 dnl
@@ -1140,7 +1195,6 @@ fi
 dnl
 dnl  Accelerated modules
 dnl
-EXTEND_HELP_STRING([Optimization options:])
 
 dnl  Check for fully working MMX intrinsics
 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
@@ -1534,21 +1588,6 @@ if test "${enable_optimizations}" != "no"; then
   enable_optimizations="speed"
 fi
 
-dnl
-dnl  Debugging mode
-dnl
-AC_ARG_ENABLE(debug,
-  [AS_HELP_STRING([--enable-debug],
-    [check assertions at run-time (default disabled)])])
-test "${enable_debug}" != "yes" && enable_debug="no"
-AH_TEMPLATE(NDEBUG,
-            [Define to 1 if debug code should NOT be compiled])
-AS_IF([test "x${enable_debug}" = "xno"], [
-  AC_DEFINE(NDEBUG)
-], [
-  AC_CHECK_HEADERS([valgrind/valgrind.h])
-])
-
 dnl
 dnl Allow running as root (useful for people running on embedded platforms)
 dnl
@@ -1560,23 +1599,6 @@ AS_IF([test "${enable_run_as_root}" = "yes"],[
               [Define to 1 to allow running VLC as root (uid 0).])
 ])
 
-dnl
-dnl  Test coverage
-dnl
-AC_ARG_ENABLE(coverage,
-  [AS_HELP_STRING([--enable-coverage],
-    [build for test coverage (default disabled)])],,
-  [enable_coverage="no"])
-AS_IF([test "${enable_coverage}" != "no"], [
-       CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
-       CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
-       LDFLAGS="-lgcov ${LDFLAGS}"
-       dnl ugly...
-       CFLAGS_save="${CFLAGS}"
-       CXXFLAGS_save="${CXXFLAGS}"
-       LDFLAGS_save="${LDFLAGS}"
-])
-
 dnl
 dnl Stream output
 dnl
@@ -4376,9 +4398,6 @@ version               : ${VERSION}
 system                : ${SYS}
 architecture          : ${ARCH}
 build flavour         : "
-test "${enable_debug}" = "yes" && printf "debug "
-test "${enable_cprof}" = "yes" && printf "cprof "
-test "${enable_gprof}" = "yes" && printf "gprof "
 test "${enable_optimizations}" != "no" && printf ${enable_optimizations}
 echo ""
 if test "${enable_vlc}" != "no"; then
index c0316bd891b92ee2fa51817b03cca384c1275cca..c1fd3d26c183a371e18b3e40ab47ffe286e7a44f 100644 (file)
@@ -84,23 +84,6 @@ cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_REENTRANT -D_THRE
 #
 #  Various additional defines
 #
-if [ "${debug}" = yes ]; then
-  cflags="${cflags} -g"
-  cxxflags="${cxxflags} -g"
-  objcflags="${objcflags} -g"
-  ldflags="${ldflags} -g"
-fi
-if [ "${cprof}" = yes ]; then
-  cflags="${cflags} -finstrument-functions"
-  cxxflags="${cxxflags} -finstrument-functions"
-  objcflags="${objcflags} -finstrument-functions"
-fi
-if [ "${gprof}" = yes ]; then
-  cflags="${cflags} -pg"
-  cxxflags="${cxxflags} -pg"
-  objcflags="${objcflags} -pg"
-  ldflags="${ldflags} -pg"
-fi
 if [ "${optim}" = speed ]; then
   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"