From b5de3be503bc9fac73ffbcaf6ce92970195c122f Mon Sep 17 00:00:00 2001 From: Matt Messier Date: Fri, 4 May 2007 20:51:33 -0400 Subject: Begin cleaning up compiler command-line flags - Removed debug related targets from all Makefiles. Debug builds are now fully controlled by --enable-debug passed to configure - Disable optimizations by default when configuring with --enable-debug - Added --enable-profiling for building profile builds. This has problems with optimizations currently, but that'll get taken care of over time. - Initialize ASFLAGS/CFLAGS/CPPFLAGS/OBJCFLAGS/LDFLAGS early so that autoconf defaults don't come into play. - Added some additional commentary to configure.ac --- Makefile.am | 16 +----------- configure.ac | 71 ++++++++++++++++++++++++++++++++++++---------------- include/Makefile.am | 6 ----- m4/optimizations.m4 | 6 +++-- misc/Makefile.common | 10 -------- po/Makefile.in.in | 3 --- 6 files changed, 55 insertions(+), 57 deletions(-) diff --git a/Makefile.am b/Makefile.am index f41b34b2c..2b82d1bdc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,22 +48,8 @@ pass2: @$(MAKE) MULTIPASS_CFLAGS='$(PASS2_CFLAGS)' -debug: - @list='$(SUBDIRS)'; for subdir in $$list; do \ - (cd $$subdir && $(MAKE) $@) || exit;\ - done; - -debug-install: install-debug - -install-debug: debug - @list='$(SUBDIRS)'; for subdir in $$list; do \ - (cd $$subdir && $(MAKE) $@) || exit; \ - done; - $(MAKE) $(AM_MAKEFLAGS) install-data-hook - - prune-cache: - -rm -f config.cache + -rm -rf config.cache autom4te.cache release-check: diff --git a/configure.ac b/configure.ac index e49ff0258..209fcf784 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,11 @@ AC_PREREQ(2.59) dnl Note that autoconf/autoheader/automake cache using autom4te, so version.sh -dnl will only be run if configure.ac has changed. +dnl will only be run if configure.ac has changed. This must be done before +dnl AC_INIT so that XINE_VERSION_SPEC, which is an m4 macro, is available. m4_esyscmd([./version.sh])dnl +dnl Initialize autoconf, autoheader, and automake AC_INIT([xine-lib], XINE_VERSION_SPEC, [xine-bugs@lists.sourceforge.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/xine-engine/xine.c]) @@ -26,8 +28,14 @@ AH_BOTTOM([#ifdef ASMALIGN_1SLN #endif /* __XINE_LIB_CONFIG_H__ */ ]) + +dnl ------------------------- +dnl Setup version information +dnl ------------------------- + dnl Do not change these manually; they come from running ./version.sh when -dnl autoconf runs. +dnl autoconf runs. This must all be done after AC_INIT is done, but running +dnl the version.sh script must be done before AC_INIT. XINE_MAJOR=XINE_VERSION_MAJOR AC_SUBST(XINE_MAJOR) AC_DEFINE_UNQUOTED([XINE_MAJOR], [$XINE_MAJOR], [xine major version number]) @@ -49,6 +57,46 @@ LIBNAME="libxine${XINE_MAJOR}" AC_SUBST(LIBNAME) AC_DEFINE_UNQUOTED([XINE_TEXTDOMAIN], "$LIBNAME", [catalog message text domain]) +dnl +dnl Always set flags to begin with -g so that debug information will be +dnl included. In release bulids, this can be stripped out later if desired. +dnl More importantly, it prevents autoconf from initializing the defaults to +dnl include -O2, which is not desirable in a debug build, and it messes with +dnl other optimizations that we'll want to be setting ourselves later. +ASFLAGS="$ASFLAGS -g" +CFLAGS="$CFLAGS -g" +CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE" +LDFLAGS="$LDFLAGS -g" +OBJCFLAGS="$OBJCFLAGS -g" + +AC_SUBST(ASFLAGS) + + +dnl ------------------------------ +dnl Build modes: debug and profile +dnl ------------------------------ + +AC_ARG_ENABLE([debug], + AS_HELP_STRING([--enable-debug], [build with debugging code enabled]), + [enable_debug="yes"], [enable_debug="no"]) +if test x"$enable_debug" != x"no"; then + CPPFLAGS="$CPPFLAGS -DDEBUG" +else + CPPFLAGS="$CPPFLAGS -DNDEBUG" +fi +AM_CONDITIONAL([DEBUG_BUILD], [test x"$enable_debug" != x"no"]) + +AC_ARG_ENABLE([profiling], + AS_HELP_STRING([--enable-profiling], [build with profiling code enabled]), + [enable_profiling="yes"], [enable_profiling="no"]) +if test x"$enable_profiling" != x"no"; then + CFLAGS="$CFLAGS -pg" + OBJCFLAGS="$OBJCFLAGS -pg" + LDFLAGS="$LDFLAGS -pg" +fi +AM_CONDITIONAL([PROFILING_BUILD], [test x"$enable_profiling" != x"no"]) + + dnl --------------------------------------------- dnl Made possible to build for another arch. dnl --------------------------------------------- @@ -1576,17 +1624,6 @@ AC_CHECK_FUNC(opendir, -dnl --------------------------------------------- -dnl cflags and debug cflags -dnl --------------------------------------------- - -AC_SUBST(DEBUG_CFLAGS) -DEBUG_CFLAGS="-g -DDEBUG $CFLAGS" - -dnl dummy -ASFLAGS="$ASFLAGS" -AC_SUBST(ASFLAGS) - dnl --------------------------------------------- dnl Check for some __attribute__ support needed dnl --------------------------------------------- @@ -2016,15 +2053,7 @@ esac AC_SUBST([NOUNDEF]) dnl Common cflags for all platforms -CPPFLAGS="-D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE $CPPFLAGS" CFLAGS="\$(MULTIPASS_CFLAGS) $warnflags $CFLAGS" -DEBUG_CFLAGS="$warnflags $DEBUG_CFLAGS" - -if test "x$enable_debug" = "xyes"; then - CPPFLAGS="$CPPFLAGS -DDEBUG" -else - CPPFLAGS="$CPPFLAGS -DNDEBUG" -fi dnl --------------------------------------------- dnl Output configuration files diff --git a/include/Makefile.am b/include/Makefile.am index 97d82e063..621bd423c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -8,12 +8,6 @@ include_HEADERS = xine.h CONFIG_CLEAN_FILES = xine.h $(inttypes_h) -debug: - @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)" - -install-debug: debug - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - mostlyclean-generic: -rm -f *~ \#* .*~ .\#* diff --git a/m4/optimizations.m4 b/m4/optimizations.m4 index cc5e7c524..d47dc94e0 100644 --- a/m4/optimizations.m4 +++ b/m4/optimizations.m4 @@ -8,8 +8,10 @@ dnl Note: always disable while crosscompiling dnl AC_DEFUN([AC_OPTIMIZATIONS], [ - AC_ARG_ENABLE([optimizations], - AS_HELP_STRING([--disable-optimizations], [Don't try to guess what optimization to enable])) + dnl By default, enable optimizations only if --enable-debug is not specified + AC_ARG_ENABLE([optimizations], + AS_HELP_STRING([--disable-optimizations], [Don't try to guess what optimization to enable]), + [], [test x"$enable_debug" != x"no" && enable_optimizations="no"]) if test "x$enable_optimizations" != "xno"; then INLINE_FUNCTIONS=-finline-functions diff --git a/misc/Makefile.common b/misc/Makefile.common index a3fe43de6..6df3b9228 100644 --- a/misc/Makefile.common +++ b/misc/Makefile.common @@ -41,16 +41,6 @@ pass1: pass2: @$(MAKE) MULTIPASS_CFLAGS="$(PASS2_CFLAGS)" -debug: - @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)" - -install-debug: debug - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - @list='$(SUBDIRS)'; for subdir in $$list; do \ - (cd $$subdir && $(MAKE) $@) || exit; \ - done; - $(MAKE) $(AM_MAKEFLAGS) install-data-hook - uninstall-hook: @list='$(xineplug_LTLIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's/\.la$$/\.so/g;s|^.*/||'`"; \ diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 2b9a10dc5..582cfc0a5 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -385,9 +385,6 @@ Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ $(SHELL) ./config.status -debug: -install-debug: - force: # Tell versions [3.59,3.63) of GNU make not to export all variables. -- cgit v1.2.3