|
From: <pst...@us...> - 2008-04-02 00:55:00
|
Revision: 383
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=383&view=rev
Author: pstieber
Date: 2008-04-01 17:54:59 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
Added configure options for debug, optimized and profiled builds.
Modified Paths:
--------------
trunk/jazz/configure.ac
Modified: trunk/jazz/configure.ac
===================================================================
--- trunk/jazz/configure.ac 2008-04-02 00:31:44 UTC (rev 382)
+++ trunk/jazz/configure.ac 2008-04-02 00:54:59 UTC (rev 383)
@@ -10,9 +10,37 @@
AC_CONFIG_HEADERS(src/config.h)
-# Checks for programs.
+dnl Checks for programs.
+
+AC_PROG_CPP
+
+dnl C-compiler checks
+dnl defines CC with the compiler to use
+dnl defines GCC with yes if using gcc
+dnl defines GCC empty if not using gcc
+dnl defines CFLAGS
+dnl
+dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
+dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
+dnl -g and -O flags ourselves below
+CFLAGS=${CFLAGS:=}
AC_PROG_CC
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+dnl C++-compiler checks
+dnl defines CXX with the compiler to use
+dnl defines GXX with yes if using gxx
+dnl defines GXX empty if not using gxx
+dnl defines CXXFLAGS
+dnl
+dnl see CFLAGS line above
+CXXFLAGS=${CXXFLAGS:=}
AC_PROG_CXX
+
+AC_LANG_RESTORE
+
AC_PROG_LIBTOOL
dnl Make autoconf use C++ for its tests.
@@ -30,21 +58,9 @@
dnl Check for st_blksize in struct stat
AC_ST_BLKSIZE
-
-dnl These were taken from acconfig.h when it was removed. They do not yet have
-dnl equivalents in this file.
-
-dnl // in ms-windows, we have nothing
-dnl #ifdef wx_msw
-dnl #undef DEV_SEQUENCER2
-dnl #undef DEV_MPU401
-dnl #endif
-
-
dnl Check to see if we are using _Ios_Openmode. gcc 3.2 doesn't like using
dnl ints and std::_Ios_Openmode interchangeably. There's probably a simpler
dnl autoconf technique for checking this feature.
-
AC_MSG_CHECKING(for _Ios_Openmode)
AC_COMPILE_IFELSE(
[#include <iostream>
@@ -56,11 +72,8 @@
fi
AC_MSG_RESULT($result)
-
-
dnl optional stuff, like alsa oss...
-
dnl ---------------------------------------
dnl check if we are to enable alsa support
dnl ---------------------------------------
@@ -104,8 +117,6 @@
AC_DEFINE(DEV_SEQUENCER2, 1, [support /dev/sequencer2])
fi
-
-
dnl ----------------------------------------
dnl check if we are to enable mpu401 support
dnl ----------------------------------------
@@ -116,9 +127,7 @@
AC_DEFINE(DEV_MPU401,1,[support jazz's own driver over tcp/ip])
fi
-
dnl Check for wxWidgets
-
AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG(2.8.7, wxWin=1)
@@ -139,6 +148,68 @@
JAZZ_PATH=\${top_srcdir}
AC_SUBST(JAZZ_PATH)
+AC_MSG_CHECKING([whether to enable debugging])
+AC_ARG_ENABLE(
+ debug,
+ AC_HELP_STRING(
+ [--enable-debug],
+ [enable debugging code (off by default)]),
+ ac_arg_debug="yes",
+ ac_arg_debug="no")
+AC_MSG_RESULT(${enable_debug-no})
+
+AC_MSG_CHECKING([whether to enable optimization])
+AC_ARG_ENABLE(
+ optimize,
+ AC_HELP_STRING(
+ [--enable-optimize@<:@=ARG@:>@],
+ [enable optimized code with ARG = 0, 1, 2, or 3 (off by default ARG = 0)]),
+ [opt_level="$enableval" ac_arg_optimize="yes"],
+ ac_arg_optimize="no")
+AC_MSG_RESULT(${enable_optimize-no})
+
+AC_MSG_CHECKING([whether to enable profiling])
+AC_ARG_ENABLE(
+ profile,
+ AC_HELP_STRING(
+ [--enable-profile],
+ [enable gprof profiling code (off by default)]),
+ ac_arg_profile="yes",
+ ac_arg_profile="no")
+AC_MSG_RESULT(${enable_profile-no})
+
+if test x$ac_arg_debug = xyes ; then
+ TLDEBUG="-g -fno-inline"
+else
+ TLDEBUG="-DNDEBUG"
+fi
+
+PROFILE=
+if test x$ac_arg_profile = xyes ; then
+ dnl The debug flag must be on for profiling to work.
+ if test x$TLDEBUG = x ; then
+ TLDEBUG="-g -fno-inline"
+ fi
+ PROFILE="-pg"
+fi
+
+OPTIMISE=-O0
+if test x$ac_arg_optimize = xyes ; then
+ if test x$opt_level = x; then
+ OPTIMISE="-O2"
+ elif test x$opt_level = x0 ; then
+ OPTIMISE="-O1"
+ elif test x$opt_level = x1 ; then
+ OPTIMISE="-O1"
+ elif test x$opt_level = x2 ; then
+ OPTIMISE="-O2"
+ elif test x$opt_level = x3 ; then
+ OPTIMISE="-O3"
+ fi
+fi
+
+EXTRA_CFLAGS="$TLDEBUG $PROFILE $OPTIMISE"
+
BITMAPS_PATH="$JAZZ_PATH/Bitmaps"
AC_SUBST(BITMAPS_PATH)
BITMAPS_FLAGS="-I$BITMAPS_PATH"
@@ -146,9 +217,9 @@
# CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
CPPFLAGS=`echo -Wall -Wno-unknown-pragmas $BITMAPS_FLAGS $WX_CPPFLAGS | sed 's/ \+/ /g'`
-CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
+CFLAGS=`echo $EXTRA_CFLAGS $CFLAGS $WX_CFLAGS_ONLY | sed 's/ \\+/ /g'`
-CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
+CXXFLAGS=`echo $EXTRA_CFLAGS $CXXFLAGS $WX_CXXFLAGS_ONLY | sed 's/ \+/ /g'`
LDFLAGS="$LDFLAGS $WX_LIBS"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|