3 [ --enable-debug[[=no/some/yes/checks]] turn on debugging [[default=some]]],
4 [case "${enableval}" in
5 yes) enable_debug=yes ;;
6 some) enable_debug=some ;;
7 checks) enable_debug=checks ;;
9 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
10 esac], [enable_debug=some])
12 dnl -g is added by AC_PROG_CC if the compiler understands it
14 dnl ==========================================================================
16 if test "x$enable_debug" = "xno"; then
17 AC_DEFINE([NDEBUG], [1], [No debugging support at all])
18 FC_C_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CFLAGS])
19 if test "x$cxx_works" = "xyes" ; then
20 FC_CXX_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CXXFLAGS])
24 dnl ==========================================================================
25 dnl debug level >= some
26 if test "x$enable_debug" = "xsome" -o "x$enable_debug" = "xyes" -o \
27 "x$enable_debug" = "xchecks"; then
28 FC_C_FLAGS([-Wall -Wpointer-arith -Wcast-align ],
29 [], [EXTRA_DEBUG_CFLAGS])
30 if test "x$cxx_works" = "xyes" ; then
31 FC_CXX_FLAGS([-Wall -Wpointer-arith -Wcast-align ],
32 [], [EXTRA_DEBUG_CXXFLAGS])
36 dnl ==========================================================================
37 dnl debug level >= yes
38 if test "x$enable_debug" = "xyes" -o "x$enable_debug" = "xchecks"; then
39 AC_DEFINE([DEBUG], [1], [Extra debugging support])
40 AC_DEFINE([LUA_USE_APICHECK], [1], [Lua Api checks])
42 FC_C_FLAGS([-Werror -Wmissing-prototypes -Wmissing-declarations \
43 -Wformat -Wformat-security -Wnested-externs -Wno-deprecated-declarations \
44 -Wno-tautological-compare],
45 [], [EXTRA_DEBUG_CFLAGS])
46 if test "x$cxx_works" = "xyes" ; then
47 FC_CXX_FLAGS([-Werror -Wmissing-prototypes -Wmissing-declarations \
48 -Wformat -Wformat-security -Wno-deprecated-declarations \
49 -Wno-tautological-compare],
50 [], [EXTRA_DEBUG_CXXFLAGS])
53 dnl backtrace log callback needs "-rdynamic" in order to work well.
54 FC_LD_FLAGS([-rdynamic -Wl,--no-add-needed], [], [EXTRA_DEBUG_LDFLAGS])
57 dnl ==========================================================================
58 dnl debug level >= checks
59 if test "x$enable_debug" = "xchecks"; then
60 dnl Add additional flags as stated in ./doc/HACKING. Compiling the
61 dnl server is OK but there are problems in a external library (gtk2)
62 dnl which prevent the compilation of the client using this extended
63 dnl flags (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=148766)
64 dnl temporary fixing the problem by patching this file to compile freeciv
65 dnl with this option set
66 FC_C_FLAGS([-Wstrict-prototypes], [], [EXTRA_DEBUG_CFLAGS])