]> icculus.org git repositories - dana/openbox.git/blob - m4/openbox.m4
parent relative for grips
[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 # Sets the CVS environment variable when building CVS sources.
6 AC_DEFUN([OB_DEBUG],
7 [
8   AC_MSG_CHECKING([build type])
9
10   AC_ARG_ENABLE([debug],
11   [  --enable-debug          build a debug version default=yes],
12   [DEBUG=$enableval], [DEBUG="yes"])
13
14   AC_ARG_ENABLE([strict-ansi],
15   [  --enable-strict-ansi    Enable strict ANSI compliance build default=no],
16   [STRICT=$enableval], [STRICT="no"])
17   if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
18     CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
19   fi
20
21   # cvs builds are always debug
22   CVS=""
23   test "${VERSION%*cvs}" != "$VERSION" && CVS="yes"
24   test "$CVS" = "yes" && DEBUG="yes"
25
26   if test "$DEBUG" = "yes"; then
27     MSG="DEBUG"
28   else
29     MSG="RELEASE"
30   fi
31   if test "$CVS" = "yes"; then
32     MSG="$MSG (CVS build)"
33   fi
34   if test "$STRICT" = "yes"; then
35     MSG="$MSG with strict ANSI compliance"
36   fi
37   AC_MSG_RESULT([$MSG])
38   
39   test "$DEBUG" = "yes" && \
40       AC_DEFINE([DEBUG], [1], [Creating a debug build])
41
42   AM_CONDITIONAL(CVS, test "$CVS" = "yes")
43 ])
44
45
46 # OB_COMPILER_FLAGS()
47 #
48 # Check what compiler is being used for compilation.
49 # It sets the CFLAGS variable appropriately for the compiler, including flags
50 # for debug builds.
51 AC_DEFUN([OB_COMPILER_FLAGS],
52 [
53   AC_REQUIRE([AC_PROG_CPP])
54   AC_REQUIRE([AC_PROG_CC])
55
56   FLAGS=""
57
58   # Check what compiler we are using
59   AC_MSG_CHECKING([for GNU CC])
60   if test "$GCC" = "yes"; then
61     AC_MSG_RESULT([yes])
62     if test "$DEBUG" = "yes"; then
63       FLAGS="-g -fno-inline"
64       FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
65       FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
66       # for Python.h
67       FLAGS="$FLAGS -Wno-long-long"
68     fi
69     if test "$STRICT" = "yes"; then
70       FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
71     fi
72   fi
73   AC_MSG_CHECKING([for compiler specific flags])
74   AC_MSG_RESULT([$FLAGS])
75   CFLAGS="$CFLAGS $FLAGS"
76 ])