From 4960863be275c4c21ef281c96836dfbf12bbd0f4 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Sun, 22 Feb 2009 05:38:46 +0000 Subject: [PATCH] Add --enable-gcov, --enable-efence and --enable-ccmalloc for gcov, Electric Fence and ccmalloc support. gcov support won't work without manual intervention (for now) but some hooks will be added later to automate it. Originally committed to SVN as r2745. --- aegisub/Makefile.am | 6 ++-- configure.in | 78 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 5 deletions(-) diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index e3afa1cc5..f46b10652 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -14,9 +14,9 @@ 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@ -aegisub_2_1_LDFLAGS = @DEBUG_FLAGS@ @PROFILE_FLAGS@ @GL_LIBS@ @PTHREAD_LIBS@ @WX_LIBS@ @ICONV_LDFLAGS@ $(libosxutil_ldflags) -LIBS += @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ +aegisub_2_1_CPPFLAGS = @FREETYPE_CFLAGS@ @GCOV_FLAGS@ +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@ if BUILD_DARWIN aegisub_2_1_LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries diff --git a/configure.in b/configure.in index 9b0fe0d48..9328506ba 100644 --- a/configure.in +++ b/configure.in @@ -1051,7 +1051,7 @@ if test -z "$DEBUG_FLAGS"; then fi AC_MSG_CHECKING([whether to turn on debugging]) -AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging (default=no)]) +AC_ARG_ENABLE(debug, [ --enable-debug enable debugging (default=no)]) if test "$enable_debug" = "yes"; then AC_MSG_RESULT([yes ($DEBUG_FLAGS)]) CPPFLAGS="$DEBUG_FLAGS $CPPFLAGS" @@ -1084,7 +1084,7 @@ if test -z "$PROFILE_FLAGS"; then fi AC_MSG_CHECKING([whether to turn on profiling]) -AC_ARG_ENABLE(profile, [ --enable-profile turn on profiling (default=no)]) +AC_ARG_ENABLE(profile, [ --enable-profile enable profiling (default=no)]) if test "$enable_profile" = "yes"; then AC_MSG_RESULT([yes ($PROFILE_FLAGS)]) CPPFLAGS="$PROFILE_FLAGS $CPPFLAGS" @@ -1095,6 +1095,80 @@ else fi +###### +# gcov +###### + +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)]) +if test "$enable_gcov" = "yes"; then + AC_MSG_RESULT([yes ($GCOV_FLAGS)]) + CPPFLAGS="$GCOV_FLAGS $CPPFLAGS" + AC_SUBST(GCOV_FLAGS) +else + enable_gcov="no" + AC_MSG_RESULT([no]) +fi + + + +################ +# Electric Fence +################ + +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)]) +if test "$enable_efence" = "yes"; then + AC_MSG_RESULT([yes ($EFENCE_LDFLAGS)]) + CPPFLAGS="$EFENCE_LDFLAGS $CPPFLAGS" + AC_SUBST(EFENCE_LDFLAGS) +else + enable_efence="no" + AC_MSG_RESULT([no]) +fi + +########## +# ccmalloc +########## + +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)]) +if test "$enable_ccmalloc" = "yes"; then + 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 + +if test "$enable_efence" = "yes" && test "$enable_ccmalloc" = "yes"; then + AC_MSG_FAILURE([Please enable Electric Fence _or_ ccmalloc otherwise strange things will happen.]) +fi + + ############################## # Internationalisation support ##############################