]> icculus.org git repositories - mikachu/openbox.git/blob - m4/openbox.m4
missed some "'s
[mikachu/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
14   # cvs builds are always debug
15   test "${VERSION%*cvs}" != "$VERSION" && DEBUG="yes"
16   
17   if test "$DEBUG" = "yes"; then
18     AC_MSG_RESULT([DEBUG])
19     AC_DEFINE([DEBUG], [1], [Creating a debug build])
20   else
21     AC_MSG_RESULT([RELEASE])
22 # keep the asserts in
23 #    AC_DEFINE([NDEBUG], [1], [Creating a release build])
24   fi
25 ])
26
27
28 # OB_COMPILER_FLAGS()
29 #
30 # Check what compiler is being used for compilation.
31 # It sets the CXXFLAGS variable appropriately for the compiler, including flags
32 # for debug builds.
33 AC_DEFUN([OB_COMPILER_FLAGS],
34 [
35   AC_REQUIRE([AC_PROG_CXXCPP])
36   AC_REQUIRE([AC_PROG_CXX])
37
38   FLAGS=""
39
40   # Check what compiler we are using
41   AC_MSG_CHECKING([for GNU C++])
42   if test "$GXX" = "yes"; then
43     AC_MSG_RESULT([yes])
44     FLAGS="-Wall -W -fno-check-new -fno-exceptions"
45     # -pedantic
46     test "$DEBUG" = "yes" && FLAGS="$FLAGS -g -fno-inline"
47   else
48     AC_MSG_RESULT([no, trying other compilers])
49     AC_MSG_CHECKING(for MIPSpro)
50     mips_pro_ver=`$CXX -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
51     if test -z "$mips_pro_ver"; then
52       AC_MSG_RESULT([no])
53     else
54       AC_MSG_RESULT([yes, version $mips_pro_ver.])
55       AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
56       lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
57       if test "x$lang_std_not_set" = "x"; then
58         AC_MSG_RESULT([not set, setting.])
59         FLAGS="-LANG:std"
60       else
61         AC_MSG_RESULT([already set.])
62       fi
63     fi
64   fi
65   AC_MSG_CHECKING([for compiler specific flags])
66   AC_MSG_RESULT([$FLAGS])
67   CXXFLAGS="$CXXFLAGS $FLAGS"
68 ])