Ticket #3828: syntax: Apache Hive query language
[midnight-commander.git] / m4.include / mc-cflags.m4
blobaf692c79b0fee24006e5b3060b1a15e03a508753
1 dnl @synopsis mc_CHECK_CFLAGS
2 dnl
3 dnl Check flags supported by C compiler
4 dnl
5 dnl @author Slava Zanko <slavazanko@gmail.com>
6 dnl @version 2013-01-16
7 dnl @license GPL
8 dnl @copyright Free Software Foundation, Inc.
10 AC_DEFUN([mc_CHECK_ONE_CFLAG],[
12   AC_MSG_CHECKING([whether ${CC} accepts $1])
14   safe_CFLAGS=$CFLAGS
16   case "$CC" in
17     clang*)
18       CFLAGS="-Werror $1"
19       ;;
20     *)
21       CFLAGS="$1"
22       ;;
23   esac
25   AC_COMPILE_IFELSE(
26     [AC_LANG_PROGRAM([], [[return 0;]])],
27     [mc_check_one_cflag=yes],
28     [mc_check_one_cflag=no])
30   CFLAGS=$safe_CFLAGS
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"
35   fi
38 AC_DEFUN([mc_CHECK_CFLAGS],[
39     AC_LANG_PUSH(C)
41     mc_configured_cflags=""
43 dnl Sorted -f options:
44 dnl AC_MSG_CHECKING([CC is $CC])
45 case "$CC" in
46   gcc*)
47     mc_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
48 dnl    mc_CHECK_ONE_CFLAG([-fno-stack-protector])
49     ;;
50   *)
51     ;;
52 esac
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([-Wignored-qualifiers])
67     mc_CHECK_ONE_CFLAG([-Wlogical-not-parentheses])
68     mc_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
69     mc_CHECK_ONE_CFLAG([-Wmissing-braces])
70     mc_CHECK_ONE_CFLAG([-Wmissing-declarations])
71     mc_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
72     mc_CHECK_ONE_CFLAG([-Wmissing-format-attribute])
73     mc_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
74     mc_CHECK_ONE_CFLAG([-Wmissing-prototypes])
75     mc_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
76     mc_CHECK_ONE_CFLAG([-Wnested-externs])
77     mc_CHECK_ONE_CFLAG([-Wno-long-long])
78     mc_CHECK_ONE_CFLAG([-Wno-unreachable-code])
79     mc_CHECK_ONE_CFLAG([-Wparentheses])
80     mc_CHECK_ONE_CFLAG([-Wpointer-arith])
81     mc_CHECK_ONE_CFLAG([-Wpointer-sign])
82     mc_CHECK_ONE_CFLAG([-Wredundant-decls])
83     mc_CHECK_ONE_CFLAG([-Wreturn-type])
84     mc_CHECK_ONE_CFLAG([-Wsequence-point])
85     mc_CHECK_ONE_CFLAG([-Wshadow])
86     mc_CHECK_ONE_CFLAG([-Wsign-compare])
87 dnl  mc_CHECK_ONE_CFLAG([-Wstrict-aliasing])
88     mc_CHECK_ONE_CFLAG([-Wstrict-prototypes])
89     mc_CHECK_ONE_CFLAG([-Wswitch])
90     mc_CHECK_ONE_CFLAG([-Wswitch-default])
91     mc_CHECK_ONE_CFLAG([-Wtype-limits])
92     mc_CHECK_ONE_CFLAG([-Wundef])
93     mc_CHECK_ONE_CFLAG([-Wuninitialized])
94     mc_CHECK_ONE_CFLAG([-Wunreachable-code])
95     mc_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
96     mc_CHECK_ONE_CFLAG([-Wunused-function])
97     mc_CHECK_ONE_CFLAG([-Wunused-label])
98     mc_CHECK_ONE_CFLAG([-Wunused-parameter])
99     mc_CHECK_ONE_CFLAG([-Wunused-result])
100     mc_CHECK_ONE_CFLAG([-Wunused-value])
101     mc_CHECK_ONE_CFLAG([-Wunused-variable])
102     mc_CHECK_ONE_CFLAG([-Wwrite-strings])
104     AC_LANG_POP()