]> Dogcows Code - chaz/openbox/blob - m4/openbox.m4
smarter default debug value :)
[chaz/openbox] / 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 DEFAULTDEBUG="no"
11
12 # cvs builds are always debug
13 CVS=""
14 test "${PACKAGE_VERSION%*cvs}" != "$PACKAGE_VERSION" && CVS="yes"
15 test "$CVS" = "yes" && DEFAULTDEBUG="yes"
16
17 AC_ARG_ENABLE([debug],
18 [ --enable-debug build a debug version default=$DEFAULTDEBUG],
19 [DEBUG=$enableval], [DEBUG=$DEFAULTDEBUG])
20
21 AC_ARG_ENABLE([strict-ansi],
22 [ --enable-strict-ansi Enable strict ANSI compliance build default=no],
23 [STRICT=$enableval], [STRICT="no"])
24 if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
25 CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
26 fi
27
28 if test "$DEBUG" = "yes"; then
29 MSG="DEBUG"
30 else
31 MSG="RELEASE"
32 fi
33 if test "$CVS" = "yes"; then
34 MSG="$MSG (CVS build)"
35 fi
36 if test "$STRICT" = "yes"; then
37 MSG="$MSG with strict ANSI compliance"
38 fi
39 AC_MSG_RESULT([$MSG])
40
41 test "$DEBUG" = "yes" && \
42 AC_DEFINE([DEBUG], [1], [Creating a debug build])
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 ])
77
78 AC_DEFUN([OB_NLS],
79 [
80 AC_ARG_ENABLE([nls],
81 [ --enable-nls Enable NLS translations default=yes],
82 [NLS=$enableval], [NLS="yes"])
83
84 if test "$NLS" = yes; then
85 DEFS="$DEFS -DENABLE_NLS"
86 fi
87 ])
88
This page took 0.043594 seconds and 5 git commands to generate.