]> icculus.org git repositories - mikachu/openbox.git/blob - m4/openbox.m4
look for 'alpha' and 'beta' releases also
[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 # 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([strict-ansi],
11     [  --enable-strict-ansi    Enable strict ANSI compliance build default=no],
12     [STRICT=$enableval], [STRICT="no"])
13     if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
14         CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
15     fi
16
17     AC_ARG_ENABLE([debug],
18     [  --enable-debug          build a debug version default=no],
19     [DEBUG=$enableval], [DEBUG="no"])
20
21     # these special builds are always debug
22     CVS=""
23     test "${PACKAGE_VERSION%*cvs*}" != "$PACKAGE_VERSION" && CVS="yes"
24     test "$CVS" = "yes" && DEBUG="yes"
25
26     TEST=""
27     test "${PACKAGE_VERSION%*alpha*}" != "$PACKAGE_VERSION" && TEST="yes"
28     test "$TEST" = "yes" && DEBUG="yes"
29
30     TEST=""
31     test "${PACKAGE_VERSION%*beta*}" != "$PACKAGE_VERSION" && TEST="yes"
32     test "$TEST" = "yes" && DEBUG="yes"
33
34     if test "$DEBUG" = "yes"; then
35         MSG="DEBUG"
36     else
37         MSG="RELEASE"
38     fi
39     if test "$CVS" = "yes"; then
40         MSG="$MSG (CVS build)"
41     fi
42     if test "$TEST" = "yes"; then
43         MSG="$MSG (test release)"
44     fi
45     if test "$STRICT" = "yes"; then
46         MSG="$MSG with strict ANSI compliance"
47     fi
48     AC_MSG_RESULT([$MSG])
49     
50     test "$DEBUG" = "yes" && \
51         AC_DEFINE([DEBUG], [1], [Creating a debug build])
52 ])
53
54
55 # OB_COMPILER_FLAGS()
56 #
57 # Check what compiler is being used for compilation.
58 # It sets the CFLAGS variable appropriately for the compiler, including flags
59 # for debug builds.
60 AC_DEFUN([OB_COMPILER_FLAGS],
61 [
62     AC_REQUIRE([AC_PROG_CPP])
63     AC_REQUIRE([AC_PROG_CC])
64
65     FLAGS=""
66
67     # Check what compiler we are using
68     AC_MSG_CHECKING([for GNU CC])
69     if test "$GCC" = "yes"; then
70         AC_MSG_RESULT([yes])
71         if test "$DEBUG" = "yes"; then
72             FLAGS="-g -fno-inline"
73             FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
74             FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
75             # for Python.h
76             #FLAGS="$FLAGS -Wno-long-long"
77         fi
78         if test "$STRICT" = "yes"; then
79             FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
80         fi
81     fi
82     AC_MSG_CHECKING([for compiler specific flags])
83     AC_MSG_RESULT([$FLAGS])
84     CFLAGS="$CFLAGS $FLAGS"
85 ])
86
87 AC_DEFUN([OB_NLS],
88 [
89     AC_ARG_ENABLE([nls],
90     [  --enable-nls            Enable NLS translations  default=yes],
91     [NLS=$enableval], [NLS="yes"])
92
93     if test "$NLS" = yes; then
94         DEFS="$DEFS -DENABLE_NLS"
95     fi
96 ])
97