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