3 AS_HELP_STRING([--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 FC_C_FLAGS([-Wno-tautological-compare -Wno-nonnull-compare],
17 [], [EXTRA_DEBUG_CFLAGS])
18 if test "x$cxx_works" = "xyes" ; then
19 FC_CXX_FLAGS([-Wno-tautological-compare -Wno-nonnull-compare],
20 [], [EXTRA_DEBUG_CXXFLAGS])
23 dnl ==========================================================================
25 if test "x$enable_debug" = "xno"; then
26 AC_DEFINE([NDEBUG], [1], [No debugging support at all])
27 AC_DEFINE([FREECIV_NDEBUG], [1], [No freeciv specific debugging support at all])
28 FC_C_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CFLAGS])
29 if test "x$cxx_works" = "xyes" ; then
30 AC_DEFINE([QT_NO_DEBUG], [1], [Qt debugging support disabled])
31 FC_CXX_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CXXFLAGS])
35 dnl ==========================================================================
36 dnl debug level >= some
37 if test "x$enable_debug" = "xsome" -o "x$enable_debug" = "xyes" -o \
38 "x$enable_debug" = "xchecks"; then
39 FC_C_FLAGS([-Wall -Wpointer-arith -Wcast-align ],
40 [], [EXTRA_DEBUG_CFLAGS])
41 if test "x$cxx_works" = "xyes" ; then
42 AC_DEFINE([QT_NO_DEBUG], [1], [Qt debugging support disabled])
43 FC_CXX_FLAGS([-Wall -Wpointer-arith -Wcast-align],
44 [], [EXTRA_DEBUG_CXXFLAGS])
48 dnl ==========================================================================
49 dnl debug level >= yes
50 if test "x$enable_debug" = "xyes" -o "x$enable_debug" = "xchecks"; then
51 AC_DEFINE([FREECIV_DEBUG], [1], [Extra debugging support])
52 AC_DEFINE([LUA_USE_APICHECK], [1], [Lua Api checks])
54 FC_C_FLAGS([-Werror -Wmissing-prototypes -Wmissing-declarations \
55 -Wformat -Wformat-security -Wnested-externs \
57 [], [EXTRA_DEBUG_CFLAGS])
58 if test "x$cxx_works" = "xyes" ; then
59 FC_CXX_FLAGS([-Werror -Wmissing-prototypes -Wmissing-declarations \
60 -Wformat -Wformat-security],
61 [], [EXTRA_DEBUG_CXXFLAGS])
64 dnl backtrace log callback needs "-rdynamic" in order to work well.
65 FC_LD_FLAGS([-rdynamic -Wl,--no-add-needed], [], [EXTRA_DEBUG_LDFLAGS])
68 dnl ==========================================================================
69 dnl debug level >= checks
70 if test "x$enable_debug" = "xchecks"; then
71 dnl Add additional flags as stated in ./doc/HACKING.
72 FC_C_FLAGS([-Wstrict-prototypes], [], [EXTRA_DEBUG_CFLAGS])