medit/m4/moo-debug.m4

99 lines
2.7 KiB
Plaintext
Raw Normal View History

2006-12-12 18:02:04 -08:00
# _MOO_AC_CHECK_COMPILER_OPTIONS(var,options)
AC_DEFUN([_MOO_AC_CHECK_COMPILER_OPTIONS],[
AC_LANG_SAVE
AC_LANG_C
for opt in $2; do
AC_MSG_CHECKING(whether C compiler accepts $opt)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $opt"
AC_TRY_COMPILE([],[],[$1="$[]$1 $opt"; AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
CFLAGS="$save_CFLAGS"
done
AC_LANG_RESTORE
])
2005-10-30 13:16:22 -08:00
##############################################################################
2005-11-05 05:12:50 -08:00
# MOO_AC_DEBUG()
2005-10-30 13:16:22 -08:00
#
AC_DEFUN_ONCE([MOO_AC_DEBUG],[
2005-10-30 13:16:22 -08:00
MOO_DEBUG="no"
MOO_DEBUG_CFLAGS=
AC_ARG_ENABLE(tests,
AC_HELP_STRING([--enable-tests],[build test programs (default = NO)]),[
if test "x$enable_tests" = "xno"; then
MOO_ENABLE_TESTS="no"
else
MOO_ENABLE_TESTS="yes"
fi
],[
MOO_ENABLE_TESTS="no"
])
AM_CONDITIONAL(MOO_ENABLE_TESTS, test x$MOO_ENABLE_TESTS = "xyes")
2006-08-22 21:14:21 -07:00
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug options (default = NO)]),[
if test "x$enable_debug" = "xno"; then
MOO_DEBUG="no"
else
MOO_DEBUG="yes"
fi
],[
MOO_DEBUG="no"
])
2005-10-30 13:16:22 -08:00
2006-12-12 18:02:04 -08:00
_moo_all_warnings="no"
AC_ARG_ENABLE(all-warnings,
AC_HELP_STRING([--enable-all-warnings],[enable lot of compiler warnings (default = NO)]),[
_moo_all_warnings="$withval"
])
2005-10-30 13:16:22 -08:00
2006-12-12 18:02:04 -08:00
MOO_DEBUG_CFLAGS=
if test "x$_moo_all_warnings" = "xyes"; then
if test "x$GCC" = "xyes"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS,
[-W -Wall -Wpointer-arith -Wcast-align -Wsign-compare -Winline -Wreturn-type dnl
2005-10-30 13:16:22 -08:00
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations dnl
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl
2006-12-12 18:02:04 -08:00
-Wdisabled-optimization])
elif test "x$CC" = "icc"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -Wcheck -w2 -wd981 -wd188])
fi
else
if test x$GCC = "xyes"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -W])
fi
fi
2005-10-30 13:16:22 -08:00
if test x$GCC = "xyes"; then
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_W_NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_W_NO_UNUSED, [-Wno-unused])
AC_SUBST(MOO_W_NO_MISSING_FIELD_INITIALIZERS)
AC_SUBST(MOO_W_NO_UNUSED)
fi
2006-12-10 14:45:52 -08:00
if test "x$MOO_DEBUG" = "xyes"; then
_moo_debug_flags="-DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED dnl
-DGDK_DISABLE_DEPRECATED -DENABLE_DEBUG -DENABLE_PROFILE dnl
-DG_ENABLE_DEBUG -DG_ENABLE_PROFILE -DMOO_DEBUG=1"
else
2006-12-10 14:45:52 -08:00
_moo_debug_flags="-DNDEBUG=1 -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT"
fi
2005-10-30 13:16:22 -08:00
2006-12-10 14:45:52 -08:00
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS $_moo_debug_flags"
2005-10-30 13:16:22 -08:00
2006-12-10 14:45:52 -08:00
if test "x$MOO_ENABLE_TESTS" = "xyes"; then
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -DMOO_ENABLE_TESTS"
fi
2006-08-22 21:14:21 -07:00
AC_SUBST(MOO_DEBUG_CFLAGS)
2005-10-30 13:16:22 -08:00
AC_MSG_CHECKING(for C compiler debug options)
if test "x$MOO_DEBUG_CFLAGS" = "x"; then
AC_MSG_RESULT(None)
else
AC_MSG_RESULT($MOO_DEBUG_CFLAGS)
fi
2005-10-30 13:16:22 -08:00
])