Another way of getting at button-*.toggled.unpressed (no unpressed needed).
[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([strict-ansi],
11     AC_HELP_STRING([--enable-strict-ansi],[Enable strict ANSI compliance build [[default=no]]]),
12     [STRICT=$enableval], [STRICT="no"])
13
14     AC_ARG_ENABLE([debug],
15     AC_HELP_STRING([--enable-debug],[build a debug version [[default=no]]]),
16     [DEBUG=$enableval], [DEBUG="no"])
17
18     AC_ARG_ENABLE([gprof],
19     AC_HELP_STRING([--enable-gprof],[Enable gprof profiling output [[default=no]]]),
20     [PROF=$enableval], [PROF="no"])
21
22     AC_ARG_ENABLE([gprof-libc],
23     AC_HELP_STRING([--enable-gprof-libc],[Link against libc with profiling support [[default=no]]]),
24     [PROFLC=$enableval], [PROFLC="no"])
25
26     if test "$PROFLC" = "yes"; then
27         PROF="yes" # always enable profiling then
28     fi
29
30     TEST=""
31     test "${PACKAGE_VERSION%*alpha*}" != "$PACKAGE_VERSION" && TEST="yes"
32     test "${PACKAGE_VERSION%*beta*}" != "$PACKAGE_VERSION" && TEST="yes"
33     test "$TEST" = "yes" && DEBUG="yes"
34
35     if test "$DEBUG" = "yes"; then
36         MSG="DEBUG"
37     else
38         MSG="RELEASE"
39     fi
40     if test "$TEST" = "yes"; then
41         MSG="$MSG (test release)"
42     fi
43     if test "$STRICT" = "yes"; then
44         MSG="$MSG with strict ANSI compliance"
45     fi
46     AC_MSG_RESULT([$MSG])
47     
48     test "$DEBUG" = "yes" && \
49         AC_DEFINE([DEBUG], [1], [Creating a debug build])
50 ])
51
52
53 # OB_COMPILER_FLAGS()
54 #
55 # Check what compiler is being used for compilation.
56 # It sets the CFLAGS variable appropriately for the compiler, including flags
57 # for debug builds.
58 AC_DEFUN([OB_COMPILER_FLAGS],
59 [
60     AC_REQUIRE([AC_PROG_CPP])
61     AC_REQUIRE([AC_PROG_CC])
62
63     FLAGS=""
64     L=""
65
66     if test "$DEBUG" = "yes"; then
67         FLAGS="-DDEBUG"
68     else
69         FLAGS="-DNDEBUG -DG_DISABLE_ASSERT"
70     fi
71
72     # Check what compiler we are using
73     AC_MSG_CHECKING([for GNU CC])
74     if test "$GCC" = "yes"; then
75         AC_MSG_RESULT([yes])
76         if test "$DEBUG" = "yes"; then
77             FLAGS="$FLAGS -O0 -ggdb -fno-inline -Wwrite-strings"
78             FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
79             FLAGS="$FLAGS -Wbad-function-cast -Wpointer-arith"
80             # glib can't handle this flag
81             # -Wcast-qual
82             # for Python.h
83             #FLAGS="$FLAGS -Wno-long-long"
84         fi
85         if test "$STRICT" = "yes"; then
86             FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
87         fi
88         if test "$PROF" = "yes"; then
89             FLAGS="$FLAGS -pg -fno-inline"
90         fi
91         if test "$PROFLC" = "yes"; then
92             L="$L -lc_p -lm_p"
93         fi
94         FLAGS="$FLAGS -fno-strict-aliasing"
95     fi
96     AC_MSG_CHECKING([for compiler specific flags])
97     AC_MSG_RESULT([$FLAGS])
98     CFLAGS="$CFLAGS $FLAGS"
99     LIBS="$LIBS $L"
100 ])
101
102 AC_DEFUN([OB_NLS],
103 [
104     AC_ARG_ENABLE([nls],
105     AC_HELP_STRING([--enable-nls],[Enable NLS translations [[default=yes]]]),
106     [NLS=$enableval], [NLS="yes"])
107
108     if test "$NLS" = yes; then
109         DEFS="$DEFS -DENABLE_NLS"
110     fi
111 ])
112