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([debug],
15 AC_HELP_STRING([--enable-debug],[build a debug version [[default=no]]]),
16 [DEBUG=$enableval], [DEBUG="no"])
18 AC_ARG_ENABLE([gprof],
19 AC_HELP_STRING([--enable-gprof],[Enable gprof profiling output [[default=no]]]),
20 [PROF=$enableval], [PROF="no"])
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"])
26 if test "$PROFLC" = "yes"; then
27 PROF="yes" # always enable profiling then
31 test "${PACKAGE_VERSION%*alpha*}" != "$PACKAGE_VERSION" && TEST="yes"
32 test "${PACKAGE_VERSION%*beta*}" != "$PACKAGE_VERSION" && TEST="yes"
33 test "$TEST" = "yes" && DEBUG="yes"
35 if test "$DEBUG" = "yes"; then
40 if test "$TEST" = "yes"; then
41 MSG="$MSG (test release)"
43 if test "$STRICT" = "yes"; then
44 MSG="$MSG with strict ANSI compliance"
48 test "$DEBUG" = "yes" && \
49 AC_DEFINE([DEBUG], [1], [Creating a debug build])
55 # Check what compiler is being used for compilation.
56 # It sets the CFLAGS variable appropriately for the compiler, including flags
58 AC_DEFUN([OB_COMPILER_FLAGS],
60 AC_REQUIRE([AC_PROG_CPP])
61 AC_REQUIRE([AC_PROG_CC])
66 if test "$DEBUG" = "yes"; then
69 FLAGS="-DNDEBUG -DG_DISABLE_ASSERT"
72 # Check what compiler we are using
73 AC_MSG_CHECKING([for GNU CC])
74 if test "$GCC" = "yes"; then
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 -Wcast-qual -Wbad-function-cast -Wpointer-arith"
81 #FLAGS="$FLAGS -Wno-long-long"
83 if test "$STRICT" = "yes"; then
84 FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
86 if test "$PROF" = "yes"; then
87 FLAGS="$FLAGS -pg -fno-inline"
89 if test "$PROFLC" = "yes"; then
92 FLAGS="$FLAGS -fno-strict-aliasing"
94 AC_MSG_CHECKING([for compiler specific flags])
95 AC_MSG_RESULT([$FLAGS])
96 CFLAGS="$CFLAGS $FLAGS"
103 AC_HELP_STRING([--enable-nls],[Enable NLS translations [[default=yes]]]),
104 [NLS=$enableval], [NLS="yes"])
106 if test "$NLS" = yes; then
107 DEFS="$DEFS -DENABLE_NLS"