Merge branch '1605_incorrect_parsing_ftp_string'
[midnight-commander.git] / m4.include / mc-cflags.m4
blobd7d4c0bbcccf0bbd78b12fc7be8ee0d5d76b137e
1 dnl @synopsis MC_CHECK_CFLAGS
2 dnl
3 dnl Check flags supported by compilator
4 dnl
5 dnl @author Slava Zanko <slavazanko@gmail.com>
6 dnl @version 2009-10-29
7 dnl @license GPL
8 dnl @copyright Free Software Foundation, Inc.
10 AC_DEFUN([MC_CHECK_ONE_CFLAG],[
12     AC_MSG_CHECKING([if gcc accepts $1])
14   safe_CFLAGS=$CFLAGS
15   CFLAGS="$1"
17   AC_TRY_COMPILE(, [
18   return 0;
19   ],
20   [
21     mc_check_one_cflag=yes
22   ],
23   [
24     mc_check_one_cflag=no
25   ])
27   CFLAGS=$safe_CFLAGS
28   AC_MSG_RESULT([$mc_check_one_cflag])
30   if test x$mc_check_one_cflag = xyes; then
31     mc_configured_cflags="$mc_configured_cflags $1"
32   fi
36 AC_DEFUN([MC_CHECK_CFLAGS],[
37     mc_configured_cflags=""
39 dnl Sorted -f options:
40     MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
41 dnl    MC_CHECK_ONE_CFLAG([-fno-stack-protector])
43 dnl Sorted -W options:
44     MC_CHECK_ONE_CFLAG([-Wcomment])
45     MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
46     MC_CHECK_ONE_CFLAG([-Wformat])
47     MC_CHECK_ONE_CFLAG([-Wimplicit-function-declaration])
48     MC_CHECK_ONE_CFLAG([-Wimplicit-int])
49     MC_CHECK_ONE_CFLAG([-Wmissing-braces])
50     MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
51     MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
52     MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
53     MC_CHECK_ONE_CFLAG([-Wnested-externs])
54     MC_CHECK_ONE_CFLAG([-Wno-long-long])
55     MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
56     MC_CHECK_ONE_CFLAG([-Wparentheses])
57     MC_CHECK_ONE_CFLAG([-Wpointer-sign])
58     MC_CHECK_ONE_CFLAG([-Wreturn-type])
59 dnl    MC_CHECK_ONE_CFLAG([-Wsequence-point])
60     MC_CHECK_ONE_CFLAG([-Wshadow])
61     MC_CHECK_ONE_CFLAG([-Wsign-compare])
62 dnl    MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
63     MC_CHECK_ONE_CFLAG([-Wswitch])
64     MC_CHECK_ONE_CFLAG([-Wuninitialized])
65     MC_CHECK_ONE_CFLAG([-Wunused-function])
66     MC_CHECK_ONE_CFLAG([-Wunused-label])
67     MC_CHECK_ONE_CFLAG([-Wunused-parameter])
68     MC_CHECK_ONE_CFLAG([-Wunused-result])
69     MC_CHECK_ONE_CFLAG([-Wunused-value])
70     MC_CHECK_ONE_CFLAG([-Wunused-variable])
71     MC_CHECK_ONE_CFLAG([-Wwrite-strings])