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])
18 [AC_LANG_PROGRAM([], [[return 0;]])],
19 [mc_check_one_cflag=yes],
20 [mc_check_one_cflag=no])
23 AC_MSG_RESULT([$mc_check_one_cflag])
25 if test x$mc_check_one_cflag = xyes; then
26 mc_configured_cflags="$mc_configured_cflags $1"
30 AC_DEFUN([MC_CHECK_CFLAGS],[
33 mc_configured_cflags=""
35 dnl Sorted -f options:
36 dnl AC_MSG_CHECKING([CC is $CC])
39 MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
40 dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
46 dnl Sorted -W options:
47 dnl MC_CHECK_ONE_CFLAG([-Wbad-function-cast])
48 MC_CHECK_ONE_CFLAG([-Wcomment])
49 MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
50 MC_CHECK_ONE_CFLAG([-Wfloat-equal])
51 MC_CHECK_ONE_CFLAG([-Wformat])
52 MC_CHECK_ONE_CFLAG([-Wformat-security])
53 MC_CHECK_ONE_CFLAG([-Wimplicit])
54 MC_CHECK_ONE_CFLAG([-Wignored-qualifiers])
55 MC_CHECK_ONE_CFLAG([-Wmissing-braces])
56 MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
57 MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
58 MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
59 MC_CHECK_ONE_CFLAG([-Wnested-externs])
60 MC_CHECK_ONE_CFLAG([-Wno-long-long])
61 MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
62 MC_CHECK_ONE_CFLAG([-Wparentheses])
63 MC_CHECK_ONE_CFLAG([-Wpointer-sign])
64 MC_CHECK_ONE_CFLAG([-Wreturn-type])
65 MC_CHECK_ONE_CFLAG([-Wsequence-point])
66 MC_CHECK_ONE_CFLAG([-Wshadow])
67 MC_CHECK_ONE_CFLAG([-Wsign-compare])
68 dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
69 MC_CHECK_ONE_CFLAG([-Wswitch])
70 MC_CHECK_ONE_CFLAG([-Wtype-limits])
71 MC_CHECK_ONE_CFLAG([-Wuninitialized])
72 MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
73 MC_CHECK_ONE_CFLAG([-Wunused-function])
74 MC_CHECK_ONE_CFLAG([-Wunused-label])
75 MC_CHECK_ONE_CFLAG([-Wunused-parameter])
76 MC_CHECK_ONE_CFLAG([-Wunused-result])
77 MC_CHECK_ONE_CFLAG([-Wunused-value])
78 MC_CHECK_ONE_CFLAG([-Wunused-variable])
79 MC_CHECK_ONE_CFLAG([-Wwrite-strings])