2008-08-18 18:16:52 -05:00
|
|
|
# _MOO_AC_CHECK_COMPILER_OPTIONS(var,options)
|
|
|
|
AC_DEFUN([_MOO_AC_CHECK_COMPILER_OPTIONS],[
|
2008-08-27 13:04:26 -05:00
|
|
|
MOO_AC_CC_OPT([$1],[$2],[$3])
|
2008-08-18 18:16:52 -05:00
|
|
|
])
|
|
|
|
|
|
|
|
# _MOO_AC_CHECK_COMPILER_OPTIONS(var,options)
|
|
|
|
AC_DEFUN([_MOO_AC_CHECK_CPP_COMPILER_OPTIONS],[
|
2008-08-27 13:04:26 -05:00
|
|
|
m4_ifdef([MOO_USE_CPP_DEFINE],[MOO_AC_CXX_OPT([$1],[$2],[$3])])
|
2007-10-08 09:03:16 -05:00
|
|
|
])
|
|
|
|
|
2005-10-30 21:16:22 +00:00
|
|
|
##############################################################################
|
2005-11-05 13:12:50 +00:00
|
|
|
# MOO_AC_DEBUG()
|
2005-10-30 21:16:22 +00:00
|
|
|
#
|
2007-01-02 05:07:30 -06:00
|
|
|
AC_DEFUN_ONCE([MOO_AC_DEBUG],[
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2007-08-20 22:15:58 -05:00
|
|
|
MOO_DEBUG_ENABLED="no"
|
2006-11-26 01:08:56 -06:00
|
|
|
MOO_DEBUG_CFLAGS=
|
2008-08-18 18:16:52 -05:00
|
|
|
MOO_DEBUG_CXXFLAGS=
|
2006-11-26 01:08:56 -06:00
|
|
|
|
|
|
|
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 23:14:21 -05:00
|
|
|
|
2008-01-20 12:03:01 -06:00
|
|
|
AC_ARG_ENABLE(unit-tests,
|
|
|
|
AC_HELP_STRING([--enable-unit-tests],[build unit tests (default = NO)]),[
|
|
|
|
if test "x$enable_unit_tests" = "xno"; then
|
|
|
|
MOO_ENABLE_UNIT_TESTS="no"
|
|
|
|
else
|
|
|
|
MOO_ENABLE_UNIT_TESTS="yes"
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
MOO_ENABLE_UNIT_TESTS="no"
|
|
|
|
])
|
|
|
|
AM_CONDITIONAL(MOO_ENABLE_UNIT_TESTS, test x$MOO_ENABLE_UNIT_TESTS = "xyes")
|
|
|
|
|
2006-11-26 01:08:56 -06:00
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
AC_HELP_STRING([--enable-debug],[enable debug options (default = NO)]),[
|
|
|
|
if test "x$enable_debug" = "xno"; then
|
2007-08-20 22:15:58 -05:00
|
|
|
MOO_DEBUG_ENABLED="no"
|
2006-11-26 01:08:56 -06:00
|
|
|
else
|
2007-08-20 22:15:58 -05:00
|
|
|
MOO_DEBUG_ENABLED="yes"
|
2006-11-26 01:08:56 -06:00
|
|
|
fi
|
|
|
|
],[
|
2007-08-20 22:15:58 -05:00
|
|
|
MOO_DEBUG_ENABLED="no"
|
2006-11-26 01:08:56 -06:00
|
|
|
])
|
2007-08-20 22:15:58 -05:00
|
|
|
AM_CONDITIONAL(MOO_DEBUG_ENABLED, test x$MOO_DEBUG_ENABLED = "xyes")
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2006-12-12 20:02:04 -06:00
|
|
|
_moo_all_warnings="no"
|
|
|
|
AC_ARG_ENABLE(all-warnings,
|
|
|
|
AC_HELP_STRING([--enable-all-warnings],[enable lot of compiler warnings (default = NO)]),[
|
2007-07-07 07:34:21 -05:00
|
|
|
_moo_all_warnings="$enableval"
|
2006-11-26 01:08:56 -06:00
|
|
|
])
|
2007-04-10 00:46:15 -05:00
|
|
|
AM_CONDITIONAL(MOO_ALL_WARNINGS, test x$_moo_all_warnings = "xyes")
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2007-10-08 09:03:16 -05:00
|
|
|
MOO_COMPILER
|
2007-02-27 21:49:56 -06:00
|
|
|
|
2006-12-12 20:02:04 -06:00
|
|
|
MOO_DEBUG_CFLAGS=
|
2008-08-18 18:16:52 -05:00
|
|
|
MOO_DEBUG_CXXFLAGS=
|
2006-12-12 20:02:04 -06:00
|
|
|
if test "x$_moo_all_warnings" = "xyes"; then
|
2007-10-08 09:03:16 -05:00
|
|
|
if $MOO_ICC; then
|
2007-02-27 21:49:56 -06:00
|
|
|
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -Wcheck -w2 -wd981 -wd188 -wd869 -wd556 -wd810])
|
2008-08-18 18:16:52 -05:00
|
|
|
_MOO_AC_CHECK_CPP_COMPILER_OPTIONS(MOO_DEBUG_CXXFLAGS, [-Wall -Wcheck -w2 -wd981 -wd188 -wd869 -wd556 -wd810])
|
2007-10-08 09:03:16 -05:00
|
|
|
elif $MOO_GCC; then
|
2006-12-12 20:02:04 -06:00
|
|
|
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS,
|
2008-08-18 18:16:52 -05:00
|
|
|
[-W -Wall -Wpointer-arith -Wcast-align -Wsign-compare -Wreturn-type dnl
|
2005-10-30 21:16:22 +00:00
|
|
|
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations dnl
|
|
|
|
-Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs dnl
|
2007-12-09 13:10:52 -06:00
|
|
|
-Wdisabled-optimization -Wendif-labels -Wstrict-prototypes dnl
|
2008-08-18 18:16:52 -05:00
|
|
|
-Wno-format-y2k -Wno-inline -Wno-missing-field-initializers])
|
|
|
|
_MOO_AC_CHECK_CPP_COMPILER_OPTIONS(MOO_DEBUG_CXXFLAGS,
|
2008-08-27 13:04:26 -05:00
|
|
|
[-W -Wall -Weffc++ -Wpointer-arith -Wcast-align -Wsign-compare -Wreturn-type dnl
|
2008-08-18 18:16:52 -05:00
|
|
|
-Wwrite-strings -Wmissing-noreturn -Wmissing-format-attribute dnl
|
|
|
|
-Wdisabled-optimization -Wendif-labels dnl
|
|
|
|
-Wno-format-y2k -Wno-inline -Wno-missing-field-initializers])
|
2006-12-12 20:02:04 -06:00
|
|
|
fi
|
|
|
|
else
|
2007-10-08 09:03:16 -05:00
|
|
|
if $MOO_GCC; then
|
2008-01-05 22:03:50 -06:00
|
|
|
_MOO_AC_CHECK_COMPILER_OPTIONS(MOO_DEBUG_CFLAGS, [-Wall -W -Wno-format-y2k -Wno-missing-field-initializers])
|
2008-08-18 18:16:52 -05:00
|
|
|
_MOO_AC_CHECK_CPP_COMPILER_OPTIONS(MOO_DEBUG_CXXFLAGS, [-Wall -W -Wno-format-y2k -Wno-missing-field-initializers])
|
2006-12-12 20:02:04 -06:00
|
|
|
fi
|
2006-11-26 01:08:56 -06:00
|
|
|
fi
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2008-08-22 19:01:00 -05:00
|
|
|
m4_foreach([wname],[unused, sign-compare, write-strings, missing-noreturn],[dnl
|
2007-02-27 21:49:56 -06:00
|
|
|
m4_define([_moo_WNAME],[MOO_W_NO_[]m4_bpatsubst(m4_toupper(wname),-,_)])
|
|
|
|
_moo_WNAME=
|
2007-10-08 09:03:16 -05:00
|
|
|
if $MOO_GCC; then
|
2007-02-27 21:49:56 -06:00
|
|
|
_MOO_AC_CHECK_COMPILER_OPTIONS(_moo_WNAME,[-Wno-wname])
|
2008-08-18 18:16:52 -05:00
|
|
|
_MOO_AC_CHECK_CPP_COMPILER_OPTIONS(_moo_WNAME,[-Wno-wname])
|
2007-01-22 08:10:07 -06:00
|
|
|
fi
|
2007-02-27 21:49:56 -06:00
|
|
|
AC_SUBST(_moo_WNAME)
|
|
|
|
m4_undefine([_moo_WNAME])
|
|
|
|
])
|
2007-01-22 08:10:07 -06:00
|
|
|
|
2007-08-20 22:15:58 -05:00
|
|
|
if test "x$MOO_DEBUG_ENABLED" = "xyes"; then
|
2006-12-10 16:45:52 -06:00
|
|
|
_moo_debug_flags="-DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED dnl
|
2006-11-26 01:08:56 -06:00
|
|
|
-DGDK_DISABLE_DEPRECATED -DENABLE_DEBUG -DENABLE_PROFILE dnl
|
2007-08-20 22:15:58 -05:00
|
|
|
-DG_ENABLE_DEBUG -DG_ENABLE_PROFILE -DMOO_DEBUG_ENABLED=1"
|
2006-11-26 01:08:56 -06:00
|
|
|
else
|
2006-12-10 16:45:52 -06:00
|
|
|
_moo_debug_flags="-DNDEBUG=1 -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT"
|
2006-11-26 01:08:56 -06:00
|
|
|
fi
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2006-12-10 16:45:52 -06:00
|
|
|
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS $_moo_debug_flags"
|
2008-08-18 18:16:52 -05:00
|
|
|
MOO_DEBUG_CXXFLAGS="$MOO_DEBUG_CXXFLAGS $_moo_debug_flags"
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2006-12-10 16:45:52 -06:00
|
|
|
if test "x$MOO_ENABLE_TESTS" = "xyes"; then
|
2006-11-26 01:08:56 -06:00
|
|
|
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -DMOO_ENABLE_TESTS"
|
2008-08-18 18:16:52 -05:00
|
|
|
MOO_DEBUG_CXXFLAGS="$MOO_DEBUG_CXXFLAGS -DMOO_ENABLE_TESTS"
|
2006-11-26 01:08:56 -06:00
|
|
|
fi
|
2008-01-20 12:03:01 -06:00
|
|
|
if test "x$MOO_ENABLE_UNIT_TESTS" = "xyes"; then
|
|
|
|
MOO_DEBUG_CFLAGS="$MOO_DEBUG_CFLAGS -DMOO_ENABLE_UNIT_TESTS"
|
2008-08-18 18:16:52 -05:00
|
|
|
MOO_DEBUG_CXXFLAGS="$MOO_DEBUG_CXXFLAGS -DMOO_ENABLE_UNIT_TESTS"
|
2008-01-20 12:03:01 -06:00
|
|
|
fi
|
2006-08-22 23:14:21 -05:00
|
|
|
|
2006-11-26 01:08:56 -06:00
|
|
|
AC_SUBST(MOO_DEBUG_CFLAGS)
|
2008-08-18 18:16:52 -05:00
|
|
|
AC_SUBST(MOO_DEBUG_CXXFLAGS)
|
2005-10-30 21:16:22 +00:00
|
|
|
|
2006-11-26 01:08:56 -06: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
|
2008-08-18 18:16:52 -05:00
|
|
|
|
|
|
|
m4_ifdef([MOO_USE_CPP_DEFINE],[
|
|
|
|
AC_MSG_CHECKING(for C++ compiler debug options)
|
|
|
|
if test "x$MOO_DEBUG_CXXFLAGS" = "x"; then
|
|
|
|
AC_MSG_RESULT(None)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT($MOO_DEBUG_CXXFLAGS)
|
|
|
|
fi
|
|
|
|
])
|
2005-10-30 21:16:22 +00:00
|
|
|
])
|