Doc: Index of all bindings under Shape, work in progres...
[shapes.git] / m4 / opt.m4
blobf30ab2206a97d398f7ac312a0ec581b188efbaf8
1 AC_DEFUN([AC_DEBUG],
3   AC_REQUIRE([AC_PROG_CC])
4   AC_REQUIRE([AC_PROG_CXX])
5   AC_MSG_CHECKING(for debug information level)
6   AC_ARG_ENABLE([debug],
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
12     case $CXXFLAGS in
13     *-g*) ;;
14     *)    CXXFLAGS="$CXXFLAGS -g" ;;
15     esac
16     case $CFLAGS in
17     *-g*) ;;
18     *)    CFLAGS="$CFLAGS -g" ;;
19     esac
20   else
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"`
24   fi
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
40     case $CXXFLAGS in
41     *-p*) ;;
42     *)    CXXFLAGS="$CXXFLAGS -pg" ;;
43     esac
44     case $CFLAGS in
45     *-p*) ;;
46     *)    CFLAGS="$CFLAGS -pg" ;;
47     esac
48   else
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"`
52   fi
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"`
74     case $CXXFLAGS in
75     *-O*) ;;
76     *)    CXXFLAGS="$CXXFLAGS -O3" ;;
77     esac
78     case $CFLAGS in
79     *-O*) ;;
80     *)    CFLAGS="$CXXFLAGS -O3" ;;
81     esac
82   else
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"`
86   fi
87   changequote([, ])dnl
88   AC_MSG_RESULT($enable_optimization "CFLAGS=$CFLAGS")