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