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([-Wassign-enum])
56 mc_CHECK_ONE_CFLAG([-Wbad-function-cast])
57 mc_CHECK_ONE_CFLAG([-Wcomment])
58 mc_CHECK_ONE_CFLAG([-Wconditional-uninitialized])
59 mc_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
60 mc_CHECK_ONE_CFLAG([-Wfloat-conversion])
61 mc_CHECK_ONE_CFLAG([-Wfloat-equal])
62 mc_CHECK_ONE_CFLAG([-Wformat])
63 mc_CHECK_ONE_CFLAG([-Wformat-security])
64 mc_CHECK_ONE_CFLAG([-Wformat-signedness])
65 mc_CHECK_ONE_CFLAG([-Wimplicit])
66 mc_CHECK_ONE_CFLAG([-Wimplicit-fallthrough])
67 mc_CHECK_ONE_CFLAG([-Wignored-qualifiers])
68 mc_CHECK_ONE_CFLAG([-Wlogical-not-parentheses])
69 mc_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
70 mc_CHECK_ONE_CFLAG([-Wmissing-braces])
71 mc_CHECK_ONE_CFLAG([-Wmissing-declarations])
72 mc_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
73 mc_CHECK_ONE_CFLAG([-Wmissing-format-attribute])
74 mc_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
75 mc_CHECK_ONE_CFLAG([-Wmissing-prototypes])
76 mc_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
77 mc_CHECK_ONE_CFLAG([-Wnested-externs])
78 mc_CHECK_ONE_CFLAG([-Wno-long-long])
79 mc_CHECK_ONE_CFLAG([-Wno-unreachable-code])
80 mc_CHECK_ONE_CFLAG([-Wparentheses])
81 mc_CHECK_ONE_CFLAG([-Wpointer-arith])
82 mc_CHECK_ONE_CFLAG([-Wpointer-sign])
83 mc_CHECK_ONE_CFLAG([-Wredundant-decls])
84 mc_CHECK_ONE_CFLAG([-Wreturn-type])
85 mc_CHECK_ONE_CFLAG([-Wsequence-point])
86 mc_CHECK_ONE_CFLAG([-Wshadow])
87 mc_CHECK_ONE_CFLAG([-Wsign-compare])
88 dnl mc_CHECK_ONE_CFLAG([-Wstrict-aliasing])
89 mc_CHECK_ONE_CFLAG([-Wstrict-prototypes])
90 mc_CHECK_ONE_CFLAG([-Wswitch])
91 mc_CHECK_ONE_CFLAG([-Wswitch-default])
92 mc_CHECK_ONE_CFLAG([-Wtype-limits])
93 mc_CHECK_ONE_CFLAG([-Wundef])
94 mc_CHECK_ONE_CFLAG([-Wuninitialized])
95 mc_CHECK_ONE_CFLAG([-Wunreachable-code])
96 mc_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
97 mc_CHECK_ONE_CFLAG([-Wunused-function])
98 mc_CHECK_ONE_CFLAG([-Wunused-label])
99 mc_CHECK_ONE_CFLAG([-Wunused-parameter])
100 mc_CHECK_ONE_CFLAG([-Wunused-result])
101 mc_CHECK_ONE_CFLAG([-Wunused-value])
102 mc_CHECK_ONE_CFLAG([-Wunused-variable])
103 mc_CHECK_ONE_CFLAG([-Wwrite-strings])