]> icculus.org git repositories - dana/openbox.git/blob - m4/openbox.m4
my newer better autoconf functions. woowoo
[dana/openbox.git] / m4 / openbox.m4
1 # OB_DEBUG()
2 #
3 # Check if the user has requested a debug build.
4 # Sets the DEBUG or NDEBUG variables as appropriate
5 AC_DEFUN([OB_DEBUG],
6 [
7   DEBUG="no"
8   AC_MSG_CHECKING([build target type])
9
10   AC_ARG_ENABLE([debug],
11   [  --enable-debug          build a debug version default=no],
12   [DEBUG=$enableval],[])
13   if test "$DEBUG" = "yes"; then
14     AC_MSG_RESULT([debug])
15     AC_DEFINE([DEBUG], [1], [Creating a debug build])
16   else
17     AC_MSG_RESULT([release])
18     AC_DEFINE([NDEBUG], [1], [Creating a release build])
19   fi
20 ])
21
22
23 # OB_COMPILER_FLAGS()
24 #
25 # Check what compiler is being used for compilation.
26 # It sets the CXXFLAGS variable appropriately for the compiler, including flags
27 # for debug builds.
28 AC_DEFUN([OB_COMPILER_FLAGS],
29 [
30   AC_REQUIRE([AC_PROG_CXXCPP])
31   AC_REQUIRE([AC_PROG_CXX])
32
33   FLAGS=""
34
35   # Check what compiler we are using
36   AC_MSG_CHECKING([for GNU C++])
37   if test "$GXX" = "yes"; then
38     AC_MSG_RESULT([yes])
39     FLAGS="-Wall -W"
40     # -pedantic
41     test "$DEBUG" = "yes" && FLAGS="$FLAGS -g -fno-inline"
42   else
43     AC_MSG_RESULT([no, trying other compilers])
44     AC_MSG_CHECKING(for MIPSpro)
45     mips_pro_ver=`$CXX -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
46     if test -z "$mips_pro_ver"; then
47       AC_MSG_RESULT([no])
48     else
49       AC_MSG_RESULT([yes, version $mips_pro_ver.])
50       AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
51       lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
52       if test "x$lang_std_not_set" = "x"; then
53         AC_MSG_RESULT([not set, setting.])
54         FLAGS="-LANG:std"
55       else
56         AC_MSG_RESULT([already set.])
57       fi
58     fi
59   fi
60   AC_MSG_CHECKING([for compiler specific flags])
61   AC_MSG_RESULT([$FLAGS])
62   CXXFLAGS="$CXXFLAGS $FLAGS"
63 ])