2016-01-04 21:43:19 +03:00
|
|
|
dnl @synopsis mc_CHECK_CFLAGS
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl
|
2013-01-16 14:03:33 +04:00
|
|
|
dnl Check flags supported by C compiler
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl
|
|
|
|
dnl @author Slava Zanko <slavazanko@gmail.com>
|
2013-01-16 14:03:33 +04:00
|
|
|
dnl @version 2013-01-16
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl @license GPL
|
|
|
|
dnl @copyright Free Software Foundation, Inc.
|
|
|
|
|
2016-01-04 21:43:19 +03:00
|
|
|
AC_DEFUN([mc_CHECK_ONE_CFLAG],[
|
2009-10-30 00:29:32 +03:00
|
|
|
|
2013-01-02 17:19:36 +04:00
|
|
|
AC_MSG_CHECKING([whether ${CC} accepts $1])
|
2009-10-30 00:29:32 +03:00
|
|
|
|
|
|
|
safe_CFLAGS=$CFLAGS
|
2015-04-05 09:43:47 +03:00
|
|
|
|
|
|
|
case "$CC" in
|
|
|
|
clang*)
|
|
|
|
CFLAGS="-Werror $1"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CFLAGS="$1"
|
|
|
|
;;
|
|
|
|
esac
|
2009-10-30 00:29:32 +03:00
|
|
|
|
2013-01-16 14:03:33 +04:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([], [[return 0;]])],
|
|
|
|
[mc_check_one_cflag=yes],
|
|
|
|
[mc_check_one_cflag=no])
|
2009-10-30 00:29:32 +03:00
|
|
|
|
|
|
|
CFLAGS=$safe_CFLAGS
|
|
|
|
AC_MSG_RESULT([$mc_check_one_cflag])
|
|
|
|
|
|
|
|
if test x$mc_check_one_cflag = xyes; then
|
|
|
|
mc_configured_cflags="$mc_configured_cflags $1"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2016-01-04 21:43:19 +03:00
|
|
|
AC_DEFUN([mc_CHECK_CFLAGS],[
|
2013-01-16 14:03:33 +04:00
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
|
2009-10-30 00:29:32 +03:00
|
|
|
mc_configured_cflags=""
|
|
|
|
|
2009-12-06 19:22:33 +03:00
|
|
|
dnl Sorted -f options:
|
2010-01-17 15:51:07 +03:00
|
|
|
dnl AC_MSG_CHECKING([CC is $CC])
|
|
|
|
case "$CC" in
|
|
|
|
gcc*)
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
|
|
|
|
dnl mc_CHECK_ONE_CFLAG([-fno-stack-protector])
|
2010-01-17 15:51:07 +03:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2009-12-06 19:22:33 +03:00
|
|
|
|
|
|
|
dnl Sorted -W options:
|
2016-03-02 09:56:02 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wassign-enum])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wbad-function-cast])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wcomment])
|
2016-02-28 10:18:51 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wconditional-uninitialized])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
|
2016-02-28 10:18:51 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wfloat-conversion])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wfloat-equal])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wformat])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wformat-security])
|
2016-10-03 09:41:01 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wformat-signedness])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wimplicit])
|
2017-12-16 20:52:39 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wimplicit-fallthrough])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wignored-qualifiers])
|
2016-02-28 10:18:51 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wlogical-not-parentheses])
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-braces])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-declarations])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-format-attribute])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-prototypes])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wnested-externs])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wno-long-long])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wno-unreachable-code])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wparentheses])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wpointer-arith])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wpointer-sign])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wredundant-decls])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wreturn-type])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wsequence-point])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wshadow])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wsign-compare])
|
|
|
|
dnl mc_CHECK_ONE_CFLAG([-Wstrict-aliasing])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wstrict-prototypes])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wswitch])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wswitch-default])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wtype-limits])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wundef])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wuninitialized])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunreachable-code])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-function])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-label])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-parameter])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-result])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-value])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wunused-variable])
|
|
|
|
mc_CHECK_ONE_CFLAG([-Wwrite-strings])
|
2013-01-16 14:03:33 +04:00
|
|
|
|
|
|
|
AC_LANG_POP()
|
2009-10-30 00:29:32 +03:00
|
|
|
])
|