3 AC_REQUIRE([AC_PROG_CC])
4 AC_REQUIRE([AC_PROG_CXX])
5 AC_MSG_CHECKING(for debug information level)
7 [AC_HELP_STRING([--enable-debug],[Enable debugging symbols in objects])])
8 if test "x$enable_debug" = "xno" ; then
9 CFLAGS=`echo $CFLAGS | sed -e 's,^-g[[:graph:]]*,,g'-e 's, -g[[:graph:]]*,,g'`
10 CXXFLAGS=`echo $CXXFLAGS | sed -e 's,^-g[[:graph:]]*,,g'-e 's, -g[[:graph:]]*,,g'`
11 elif test "x$enable_debug" = "xyes" ; then
14 *) CXXFLAGS="$CXXFLAGS -g" ;;
18 *) CFLAGS="$CFLAGS -g" ;;
21 test -z $enable_debug && enable_debug=dwarf-2
22 CFLAGS=`echo $CFLAGS | sed -e "s,^-g[[:graph:]]*,-g$enable_debug,g" -e "s, -g[[:graph:]]*, -g$enable_debug,g"`
23 CXXFLAGS=`echo $CXXFLAGS | sed -e "s,^-g[[:graph:]]*,-g$enable_debug,g" -e "s, -g[[:graph:]]*, -g$enable_debug,g"`
25 AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
29 AC_DEFUN([AC_PROFILE],
31 AC_REQUIRE([AC_PROG_CC])
32 AC_REQUIRE([AC_PROG_CXX])
33 AC_MSG_CHECKING(for profiling information)
34 AC_ARG_ENABLE([profile],
35 [AC_HELP_STRING([--enable-profile],[Enable profiling information])])
36 if test "x$enable_profile" = "xno" ; then
37 CFLAGS=`echo $CFLAGS | sed -e 's,^-p[[:graph:]]*,,g' -e 's, -p[[:graph:]]*,,g'`
38 CXXFLAGS=`echo $CXXFLAGS | sed -e 's,^-p[[:graph:]]*,,g' -e 's, -p[[:graph:]]*,,g'`
39 elif test "x$enable_profile" = "xyes" ; then
42 *) CXXFLAGS="$CXXFLAGS -pg" ;;
46 *) CFLAGS="$CFLAGS -pg" ;;
49 test -z $enable_profile && enable_profile=g
50 CFLAGS=`echo $CFLAGS | sed -e "s,^-p[[:graph:]]*,-p$enable_profile,g" -e "s, -p[[:graph:]]*, -p$enable_profile,g"`
51 CXXFLAGS=`echo $CXXFLAGS | sed -e "s,^-p[[:graph:]]*,-p$enable_profile,g" -e "s, -p[[:graph:]]*, -p$enable_profile,g"`
53 AC_MSG_RESULT($enable_profile 'CFLAGS=$CFLAGS')
57 AC_DEFUN([AC_OPTIMIZATION],
59 AC_REQUIRE([AC_PROG_CC])
60 AC_REQUIRE([AC_PROG_CXX])
62 # enable_optimization=yes
63 AC_ARG_ENABLE([optimization],
64 [AC_HELP_STRING([--enable-optimization],[Enable optimization of objects])])
65 AC_MSG_CHECKING(for optimiztion level)
67 changequote(<<, >>)dnl
68 if test "x$enable_optimization" = "xno" ; then
69 CFLAGS=`echo $CFLAGS | sed -e "s,^-O[[:graph:]]*,,g" -e "s, -O[[:graph:]]*,,g"`
70 CXXFLAGS=`echo $CXXFLAGS | sed -e "s,^-O[[:graph:]]*,,g" -e "s, -O[[:graph:]]*,,g"`
71 elif test "x$enable_optimization" = "xyes" ; then
72 CFLAGS=`echo $CFLAGS | sed -e "s,^-O[[:graph:]]*,,g" -e "s, -O[[:graph:]]*,,g"`
73 CXXFLAGS=`echo $CXXFLAGS | sed -e "s,^-O[[:graph:]]*,,g" -e "s, -O[[:graph:]]*,,g"`
76 *) CXXFLAGS="$CXXFLAGS -O3" ;;
80 *) CFLAGS="$CXXFLAGS -O3" ;;
83 test -z $enable_optimization || enable_optimization=3
84 CFLAGS=`echo "$CFLAGS" | sed -e "s,^-O[[:graph:]]*,-O$enable_optimization,g" -e "s, -O[[:graph:]]*, -O$enable_optimization,g"`
85 CXXFLAGS=`echo "$CXXFLAGS" | sed -e "s,^-O[[:graph:]]*,-O$enable_optimization,g" -e "s, -O[[:graph:]]*, -O$enable_optimization,g"`
88 AC_MSG_RESULT($enable_optimization "CFLAGS=$CFLAGS")