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 [ --enable-strict-ansi Enable strict ANSI compliance build default=no],
12 [STRICT=$enableval], [STRICT="no"])
13 if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
14 CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
17 AC_ARG_ENABLE([debug],
18 [ --enable-debug build a debug version default=no],
19 [DEBUG=$enableval], [DEBUG="no"])
21 # these special builds are always debug
23 test "${PACKAGE_VERSION%*cvs*}" != "$PACKAGE_VERSION" && CVS="yes"
24 test "$CVS" = "yes" && DEBUG="yes"
27 test "${PACKAGE_VERSION%*alpha*}" != "$PACKAGE_VERSION" && TEST="yes"
28 test "${PACKAGE_VERSION%*beta*}" != "$PACKAGE_VERSION" && TEST="yes"
29 test "$TEST" = "yes" && DEBUG="yes"
31 if test "$DEBUG" = "yes"; then
36 if test "$CVS" = "yes"; then
37 MSG="$MSG (CVS build)"
39 if test "$TEST" = "yes"; then
40 MSG="$MSG (test release)"
42 if test "$STRICT" = "yes"; then
43 MSG="$MSG with strict ANSI compliance"
47 test "$DEBUG" = "yes" && \
48 AC_DEFINE([DEBUG], [1], [Creating a debug build])
54 # Check what compiler is being used for compilation.
55 # It sets the CFLAGS variable appropriately for the compiler, including flags
57 AC_DEFUN([OB_COMPILER_FLAGS],
59 AC_REQUIRE([AC_PROG_CPP])
60 AC_REQUIRE([AC_PROG_CC])
64 # Check what compiler we are using
65 AC_MSG_CHECKING([for GNU CC])
66 if test "$GCC" = "yes"; then
68 if test "$DEBUG" = "yes"; then
69 FLAGS="-g -fno-inline"
70 FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
71 FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
73 #FLAGS="$FLAGS -Wno-long-long"
75 if test "$STRICT" = "yes"; then
76 FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
79 AC_MSG_CHECKING([for compiler specific flags])
80 AC_MSG_RESULT([$FLAGS])
81 CFLAGS="$CFLAGS $FLAGS"
87 [ --enable-nls Enable NLS translations default=yes],
88 [NLS=$enableval], [NLS="yes"])
90 if test "$NLS" = yes; then
91 DEFS="$DEFS -DENABLE_NLS"