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([debug],
11 [ --enable-debug build a debug version default=yes],
12 [DEBUG=$enableval], [DEBUG="yes"])
14 AC_ARG_ENABLE([strict-ansi],
15 [ --enable-strict-ansi Enable strict ANSI compliance build default=no],
16 [STRICT=$enableval], [STRICT="no"])
17 if test "$GCC" = "yes" && test "$STRICT" = "yes"; then
18 CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
21 # cvs builds are always debug
23 test "${PACKAGE_VERSION%*cvs}" != "$PACKAGE_VERSION" && CVS="yes"
24 test "$CVS" = "yes" && DEBUG="yes"
26 if test "$DEBUG" = "yes"; then
31 if test "$CVS" = "yes"; then
32 MSG="$MSG (CVS build)"
34 if test "$STRICT" = "yes"; then
35 MSG="$MSG with strict ANSI compliance"
39 test "$DEBUG" = "yes" && \
40 AC_DEFINE([DEBUG], [1], [Creating a debug build])
42 AM_CONDITIONAL(CVS, test "$CVS" = "yes")
48 # Check what compiler is being used for compilation.
49 # It sets the CFLAGS variable appropriately for the compiler, including flags
51 AC_DEFUN([OB_COMPILER_FLAGS],
53 AC_REQUIRE([AC_PROG_CPP])
54 AC_REQUIRE([AC_PROG_CC])
58 # Check what compiler we are using
59 AC_MSG_CHECKING([for GNU CC])
60 if test "$GCC" = "yes"; then
62 if test "$DEBUG" = "yes"; then
63 FLAGS="-g -fno-inline"
64 FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
65 FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
67 FLAGS="$FLAGS -Wno-long-long"
69 if test "$STRICT" = "yes"; then
70 FLAGS="$FLAGS -ansi -pedantic -D_XOPEN_SOURCE"
73 AC_MSG_CHECKING([for compiler specific flags])
74 AC_MSG_RESULT([$FLAGS])
75 CFLAGS="$CFLAGS $FLAGS"