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.
8 AC_MSG_CHECKING([build type])
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"])
14 AC_ARG_ENABLE([super-warnings],
15 AC_HELP_STRING([--enable-super-warnings],[Enable extra compiler warnings [[default=no]]]),
16 [SUPERWARN=$enableval], [SUPERWARN="no"])
18 AC_ARG_ENABLE([debug],
19 AC_HELP_STRING([--enable-debug],[build a debug version [[default=no]]]),
20 [DEBUG=$enableval], [DEBUG="no"])
22 AC_ARG_ENABLE([gprof],
23 AC_HELP_STRING([--enable-gprof],[Enable gprof profiling output [[default=no]]]),
24 [PROF=$enableval], [PROF="no"])
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"])
30 if test "$PROFLC" = "yes"; then
31 PROF="yes" # always enable profiling then
35 test "${PACKAGE_VERSION%*alpha*}" != "$PACKAGE_VERSION" && TEST="yes"
36 test "${PACKAGE_VERSION%*beta*}" != "$PACKAGE_VERSION" && TEST="yes"
37 test "$TEST" = "yes" && DEBUG="yes"
39 if test "$DEBUG" = "yes"; then
44 if test "$TEST" = "yes"; then
45 MSG="$MSG (test release)"
47 if test "$STRICT" = "yes"; then
48 MSG="$MSG with strict ANSI compliance"
50 if test "$SUPERWARN" = "yes"; then
51 MSG="$MSG with super warnings"
55 test "$DEBUG" = "yes" && \
56 AC_DEFINE([DEBUG], [1], [Creating a debug build])
62 # Check what compiler is being used for compilation.
63 # It sets the CFLAGS variable appropriately for the compiler, including flags
65 AC_DEFUN([OB_COMPILER_FLAGS],
67 AC_REQUIRE([AC_PROG_CPP])
68 AC_REQUIRE([AC_PROG_CC])
73 if test "$DEBUG" = "yes"; then
76 FLAGS="-DNDEBUG -DG_DISABLE_ASSERT"
79 # Check what compiler we are using
80 AC_MSG_CHECKING([for GNU CC])
81 if test "$GCC" = "yes"; then
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"
89 #FLAGS="$FLAGS -Wno-long-long"
91 if test "$SUPERWARN" = "yes"; then
92 # glib can't handle -Wcast-qual
93 FLAGS="$FLAGS -Wcast-qual -Wextra"
95 if test "$STRICT" = "yes"; then
96 FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
98 if test "$PROF" = "yes"; then
99 FLAGS="$FLAGS -pg -fno-inline"
101 if test "$PROFLC" = "yes"; then
104 FLAGS="$FLAGS -fno-strict-aliasing"
106 AC_MSG_CHECKING([for compiler specific flags])
107 AC_MSG_RESULT([$FLAGS])
108 CFLAGS="$CFLAGS $FLAGS"
115 AC_HELP_STRING([--enable-nls],[Enable NLS translations [[default=yes]]]),
116 [NLS=$enableval], [NLS="yes"])
118 if test "$NLS" = yes; then
119 DEFS="$DEFS -DENABLE_NLS"