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.
9 AC_MSG_CHECKING([build target type])
11 AC_ARG_ENABLE([debug],
12 [ --enable-debug build a debug version default=no],
13 [DEBUG=$enableval],[])
15 # cvs builds are always debug
17 test "${VERSION%*cvs}" != "$VERSION" && CVS="yes"
18 test "$CVS" = "yes" && DEBUG="yes"
20 if test "$DEBUG" = "yes"; then
21 if test "$CVS" = "yes"; then
22 AC_MSG_RESULT([DEBUG (CVS build)])
24 AC_MSG_RESULT([DEBUG])
26 AC_DEFINE([DEBUG], [1], [Creating a debug build])
28 AC_MSG_RESULT([RELEASE])
30 # AC_DEFINE([NDEBUG], [1], [Creating a release build])
33 AM_CONDITIONAL(CVS, test "$CVS" = "yes")
39 # Check what compiler is being used for compilation.
40 # It sets the CFLAGS variable appropriately for the compiler, including flags
42 AC_DEFUN([OB_COMPILER_FLAGS],
44 AC_REQUIRE([AC_PROG_CPP])
45 AC_REQUIRE([AC_PROG_CC])
49 # Check what compiler we are using
50 AC_MSG_CHECKING([for GNU CC])
51 if test "$GCC" = "yes"; then
53 if test "$DEBUG" = "yes"; then
54 FLAGS="-g -fno-inline"
55 FLAGS="$FLAGS -Wall -Wsign-compare -Waggregate-return"
56 FLAGS="$FLAGS -Wcast-qual -Wbad-function-cast -Wpointer-arith"
58 FLAGS="$FLAGS -Wno-long-long"
63 # AC_MSG_RESULT([no, trying other compilers])
64 # AC_MSG_CHECKING(for MIPSpro)
65 # mips_pro_ver=`$CC -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
66 # if test -z "$mips_pro_ver"; then
69 # AC_MSG_RESULT([yes, version $mips_pro_ver.])
70 # AC_MSG_CHECKING(for -LANG:std in CFLAGS)
71 # lang_std_not_set=`echo $CFLAGS | grep "\-LANG:std"`
72 # if test "x$lang_std_not_set" = "x"; then
73 # AC_MSG_RESULT([not set, setting.])
76 # AC_MSG_RESULT([already set.])
80 AC_MSG_CHECKING([for compiler specific flags])
81 AC_MSG_RESULT([$FLAGS])
82 CFLAGS="$CFLAGS $FLAGS"