From 10a531b68405c74383434b69d08df4bfba8c1759 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Sun, 22 Feb 2009 22:01:14 +0000 Subject: [PATCH] * Rework the debugging flags to set the variables conditionally on either being enabled. * Fix some cut-and-paste-o's (dunno how I managed these) * Move AC_SUBST* outside of the conditionally enabled blocks * Fix typo. Originally committed to SVN as r2746. --- aegisub/Makefile.am | 2 +- configure.in | 62 ++++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index f46b10652..5e80dd3a6 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -14,7 +14,7 @@ AM_CXXFLAGS = -DAEGISUB -Iinclude @WX_CPPFLAGS@ @OPENMP_CXXFLAGS@ @LIBAVFORMAT_C bin_PROGRAMS = aegisub-2.1 aegisub_2_1_LDADD = libresrc/libresrc.a $(libosxutil_lib) -aegisub_2_1_CPPFLAGS = @FREETYPE_CFLAGS@ @GCOV_FLAGS@ +aegisub_2_1_CPPFLAGS = @FREETYPE_CFLAGS@ aegisub_2_1_LDFLAGS = @DEBUG_FLAGS@ @PROFILE_FLAGS@ @GL_LIBS@ @PTHREAD_LIBS@ @WX_LIBS@ @ICONV_LDFLAGS@ $(libosxutil_ldflags) @CCMALLOC_LDFLAGS@ @EFENCE_LDFLAGS@ LIBS += @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @CCMALLOC_LIBS@ diff --git a/configure.in b/configure.in index 9328506ba..8cb44ba6b 100644 --- a/configure.in +++ b/configure.in @@ -1046,13 +1046,14 @@ fi ###################################################### AC_ARG_VAR([DEBUG_FLAGS], [Debug flag to use with --enable-debug (default: -g)]) -if test -z "$DEBUG_FLAGS"; then - DEBUG_FLAGS="-g"; -fi AC_MSG_CHECKING([whether to turn on debugging]) AC_ARG_ENABLE(debug, [ --enable-debug enable debugging (default=no)]) if test "$enable_debug" = "yes"; then + if test -z "$DEBUG_FLAGS"; then + DEBUG_FLAGS="-g"; + fi + AC_MSG_RESULT([yes ($DEBUG_FLAGS)]) CPPFLAGS="$DEBUG_FLAGS $CPPFLAGS" msg_debug="($DEBUG_FLAGS)" @@ -1079,16 +1080,15 @@ fi ########### AC_ARG_VAR([PROFILE_FLAGS], [Profile flag(s) to use with --enable-profile (default: -pg)]) -if test -z "$PROFILE_FLAGS"; then - PROFILE_FLAGS="-pg"; -fi AC_MSG_CHECKING([whether to turn on profiling]) AC_ARG_ENABLE(profile, [ --enable-profile enable profiling (default=no)]) if test "$enable_profile" = "yes"; then + if test -z "$PROFILE_FLAGS"; then + PROFILE_FLAGS="-pg"; + fi AC_MSG_RESULT([yes ($PROFILE_FLAGS)]) CPPFLAGS="$PROFILE_FLAGS $CPPFLAGS" - AC_SUBST(PROFILE_FLAGS) else enable_profile="no" AC_MSG_RESULT([no]) @@ -1100,16 +1100,17 @@ fi ###### AC_ARG_VAR([GCOV_FLAGS], [gcov flag(s) to use with --enable-gcov (default: -ftest-coverage -fprofile-arcs)]) -if test -z "$GCOV_FLAGS"; then - GCOV_FLAGS="-fprofile-arcs -ftest-coverage"; -fi AC_MSG_CHECKING([whether to turn on gcov]) -AC_ARG_ENABLE(profile, [ --enable-gcov enable gcov (default=no)]) +AC_ARG_ENABLE(gcov, [ --enable-gcov enable gcov (default=no)]) + if test "$enable_gcov" = "yes"; then + if test -z "$GCOV_FLAGS"; then + GCOV_FLAGS="-fprofile-arcs -ftest-coverage"; + fi AC_MSG_RESULT([yes ($GCOV_FLAGS)]) - CPPFLAGS="$GCOV_FLAGS $CPPFLAGS" - AC_SUBST(GCOV_FLAGS) + CFLAGS="$CFLAGS $GCOV_FLAGS" + CPPFLAGS="$CPPFLAGS $GCOV_FLAGS" else enable_gcov="no" AC_MSG_RESULT([no]) @@ -1122,20 +1123,19 @@ fi ################ AC_ARG_VAR([EFENCE_LDFLAGS], [Electric Fence ldflag(s) to use with --enable-profile (default: -lefence)]) -if test -z "EFENCE_LDFLAGS"; then - EFENCE_LDFLAGS="-pg -fprofile-arcs -ftest-coverage"; -fi -AC_MSG_CHECKING([whether turn on Electric Fence]) -AC_ARG_ENABLE(profile, [ --enable-efence enable Electric Fence (default=no)]) +AC_MSG_CHECKING([whether to turn on Electric Fence]) +AC_ARG_ENABLE(efence, [ --enable-efence enable Electric Fence (default=no)]) if test "$enable_efence" = "yes"; then + if test -z "$EFENCE_LDFLAGS"; then + EFENCE_LDFLAGS="-lefence"; + fi AC_MSG_RESULT([yes ($EFENCE_LDFLAGS)]) - CPPFLAGS="$EFENCE_LDFLAGS $CPPFLAGS" - AC_SUBST(EFENCE_LDFLAGS) else enable_efence="no" AC_MSG_RESULT([no]) fi +AC_SUBST(EFENCE_LDFLAGS) ########## # ccmalloc @@ -1144,25 +1144,23 @@ fi AC_ARG_VAR([CCMALLOC_LIBS], [ccmalloc libs(s) to use with --enable-ccmalloc (default: $prefix/lib/ccmalloc-c++.o)]) AC_ARG_VAR([CCMALLOC_LDFLAGS], [ccmalloc ldflag(s) to use with --enable-ccmalloc (default: -lccmalloc)]) -if test -z "$CCMALLOC_LIBS"; then - CCMALLOC_LIBS="$prefix/lib/ccmalloc-c++.o"; -fi - -if test -z "$CCMALLOC_LIBS"; then - CCMALLOC_LDFLAGS="-lccmalloc"; -fi - AC_MSG_CHECKING([whether to turn on ccmalloc]) -AC_ARG_ENABLE(profile, [ --enable-ccmalloc enable ccmalloc (default=no)]) +AC_ARG_ENABLE(ccmalloc, [ --enable-ccmalloc enable ccmalloc (default=no)]) if test "$enable_ccmalloc" = "yes"; then + if test -z "$CCMALLOC_LIBS"; then + CCMALLOC_LIBS="$prefix/lib/ccmalloc-c++.o"; + fi + + if test -z "$CCMALLOC_LDFLAGS"; then + CCMALLOC_LDFLAGS="-lccmalloc"; + fi AC_MSG_RESULT([yes ($CCMALLOC_LIBS $CCMALLOC_LDFLAGS)]) - CPPFLAGS="$CCMALLOC_LIBS $CCMALLOC_LDFLAGS $CPPFLAGS" - AC_SUBST(CCMALLOC_LDFLAGS) - AC_SUBST(CCMALLOC_LIBS) else enable_ccmalloc="no" AC_MSG_RESULT([no]) fi +AC_SUBST(CCMALLOC_LDFLAGS) +AC_SUBST(CCMALLOC_LIBS) if test "$enable_efence" = "yes" && test "$enable_ccmalloc" = "yes"; then AC_MSG_FAILURE([Please enable Electric Fence _or_ ccmalloc otherwise strange things will happen.])