1 dnl @synopsis MC_CHECK_CFLAGS
3 dnl Check flags supported by C compiler
5 dnl @author Slava Zanko <slavazanko@gmail.com>
6 dnl @version 2013-01-16
8 dnl @copyright Free Software Foundation, Inc.
10 AC_DEFUN([MC_CHECK_ONE_CFLAG],[
12 AC_MSG_CHECKING([whether ${CC} accepts $1])
26 [AC_LANG_PROGRAM([], [[return 0;]])],
27 [mc_check_one_cflag=yes],
28 [mc_check_one_cflag=no])
31 AC_MSG_RESULT([$mc_check_one_cflag])
33 if test x$mc_check_one_cflag = xyes; then
34 mc_configured_cflags="$mc_configured_cflags $1"
38 AC_DEFUN([MC_CHECK_CFLAGS],[
41 mc_configured_cflags=""
43 dnl Sorted -f options:
44 dnl AC_MSG_CHECKING([CC is $CC])
47 MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
48 dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
54 dnl Sorted -W options:
55 MC_CHECK_ONE_CFLAG([-Wbad-function-cast])
56 MC_CHECK_ONE_CFLAG([-Wcomment])
57 MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
58 MC_CHECK_ONE_CFLAG([-Wfloat-equal])
59 MC_CHECK_ONE_CFLAG([-Wformat])
60 MC_CHECK_ONE_CFLAG([-Wformat-security])
61 MC_CHECK_ONE_CFLAG([-Wimplicit])
62 MC_CHECK_ONE_CFLAG([-Wignored-qualifiers])
63 MC_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
64 MC_CHECK_ONE_CFLAG([-Wmissing-braces])
65 MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
66 MC_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
67 MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
68 MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
69 MC_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
70 MC_CHECK_ONE_CFLAG([-Wnested-externs])
71 MC_CHECK_ONE_CFLAG([-Wno-long-long])
72 MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
73 MC_CHECK_ONE_CFLAG([-Wparentheses])
74 MC_CHECK_ONE_CFLAG([-Wpointer-arith])
75 MC_CHECK_ONE_CFLAG([-Wpointer-sign])
76 MC_CHECK_ONE_CFLAG([-Wredundant-decls])
77 MC_CHECK_ONE_CFLAG([-Wreturn-type])
78 MC_CHECK_ONE_CFLAG([-Wsequence-point])
79 MC_CHECK_ONE_CFLAG([-Wshadow])
80 MC_CHECK_ONE_CFLAG([-Wsign-compare])
81 dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
82 MC_CHECK_ONE_CFLAG([-Wstrict-prototypes])
83 MC_CHECK_ONE_CFLAG([-Wswitch])
84 MC_CHECK_ONE_CFLAG([-Wswitch-default])
85 MC_CHECK_ONE_CFLAG([-Wtype-limits])
86 MC_CHECK_ONE_CFLAG([-Wundef])
87 MC_CHECK_ONE_CFLAG([-Wuninitialized])
88 MC_CHECK_ONE_CFLAG([-Wunreachable-code])
89 MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
90 MC_CHECK_ONE_CFLAG([-Wunused-function])
91 MC_CHECK_ONE_CFLAG([-Wunused-label])
92 MC_CHECK_ONE_CFLAG([-Wunused-parameter])
93 MC_CHECK_ONE_CFLAG([-Wunused-result])
94 MC_CHECK_ONE_CFLAG([-Wunused-value])
95 MC_CHECK_ONE_CFLAG([-Wunused-variable])
96 MC_CHECK_ONE_CFLAG([-Wwrite-strings])