OLD | NEW |
1 # Autoconf include file defining macros related to compile-time warnings. | 1 # Autoconf include file defining macros related to compile-time warnings. |
2 | 2 |
3 # Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc. | 3 # Copyright 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc. |
4 | 4 |
5 #This file is part of GCC. | 5 #This file is part of GCC. |
6 | 6 |
7 #GCC is free software; you can redistribute it and/or modify it under | 7 #GCC is free software; you can redistribute it and/or modify it under |
8 #the terms of the GNU General Public License as published by the Free | 8 #the terms of the GNU General Public License as published by the Free |
9 #Software Foundation; either version 3, or (at your option) any later | 9 #Software Foundation; either version 3, or (at your option) any later |
10 #version. | 10 #version. |
11 | 11 |
12 #GCC is distributed in the hope that it will be useful, but WITHOUT | 12 #GCC is distributed in the hope that it will be useful, but WITHOUT |
13 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 13 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
14 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 14 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
15 #for more details. | 15 #for more details. |
16 | 16 |
17 #You should have received a copy of the GNU General Public License | 17 #You should have received a copy of the GNU General Public License |
18 #along with GCC; see the file COPYING3. If not see | 18 #along with GCC; see the file COPYING3. If not see |
19 #<http://www.gnu.org/licenses/>. | 19 #<http://www.gnu.org/licenses/>. |
20 | 20 |
21 # ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS) | 21 # ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS) |
22 # Sets @VARIABLE@ to the subset of the given options which the | 22 # Sets @VARIABLE@ to the subset of the given options which the |
23 # compiler accepts. | 23 # compiler accepts. |
24 AC_DEFUN([ACX_PROG_CC_WARNING_OPTS], | 24 AC_DEFUN([ACX_PROG_CC_WARNING_OPTS], |
25 [AC_REQUIRE([AC_PROG_CC])dnl | 25 [AC_REQUIRE([AC_PROG_CC])dnl |
26 m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl | 26 m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl |
27 AC_SUBST(acx_Var)dnl | 27 AC_SUBST(acx_Var)dnl |
28 m4_expand_once([acx_Var= | 28 m4_expand_once([acx_Var= |
29 ],m4_quote(acx_Var=))dnl | 29 ],m4_quote(acx_Var=))dnl |
30 save_CFLAGS="$CFLAGS" | 30 save_CFLAGS="$CFLAGS" |
31 for option in $1; do | 31 for real_option in $1; do |
| 32 # Do the check with the no- prefix removed since gcc silently |
| 33 # accepts any -Wno-* option on purpose |
| 34 case $real_option in |
| 35 -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;; |
| 36 *) option=$real_option ;; |
| 37 esac |
32 AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option]) | 38 AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option]) |
33 AC_CACHE_CHECK([whether $CC supports $option], acx_Woption, | 39 AC_CACHE_CHECK([whether $CC supports $option], acx_Woption, |
34 [CFLAGS="$option" | 40 [CFLAGS="$option" |
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], | 41 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], |
36 [AS_VAR_SET(acx_Woption, yes)], | 42 [AS_VAR_SET(acx_Woption, yes)], |
37 [AS_VAR_SET(acx_Woption, no)]) | 43 [AS_VAR_SET(acx_Woption, no)]) |
38 ]) | 44 ]) |
39 AS_IF([test AS_VAR_GET(acx_Woption) = yes], | 45 AS_IF([test AS_VAR_GET(acx_Woption) = yes], |
40 [acx_Var="$acx_Var${acx_Var:+ }$option"]) | 46 [acx_Var="$acx_Var${acx_Var:+ }$real_option"]) |
41 AS_VAR_POPDEF([acx_Woption])dnl | 47 AS_VAR_POPDEF([acx_Woption])dnl |
42 done | 48 done |
43 CFLAGS="$save_CFLAGS" | 49 CFLAGS="$save_CFLAGS" |
44 m4_popdef([acx_Var])dnl | 50 m4_popdef([acx_Var])dnl |
45 ])# ACX_PROG_CC_WARNING_OPTS | 51 ])# ACX_PROG_CC_WARNING_OPTS |
46 | 52 |
47 # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC) | 53 # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC]) |
48 # Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC | 54 # Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC |
49 # and accepts all of those options simultaneously, otherwise to nothing. | 55 # and accepts all of those options simultaneously, otherwise to nothing. |
50 AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC], | 56 AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC], |
51 [AC_REQUIRE([AC_PROG_CC])dnl | 57 [AC_REQUIRE([AC_PROG_CC])dnl |
52 m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl | 58 m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl |
53 AC_SUBST(acx_Var)dnl | 59 AC_SUBST(acx_Var)dnl |
54 m4_expand_once([acx_Var= | 60 m4_expand_once([acx_Var= |
55 ],m4_quote(acx_Var=))dnl | 61 ],m4_quote(acx_Var=))dnl |
56 AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_$1])dnl | 62 # Do the check with the no- prefix removed from the warning options |
| 63 # since gcc silently accepts any -Wno-* option on purpose |
| 64 m4_pushdef([acx_Woptions], [m4_bpatsubst([$1], [-Wno-], [-W])])dnl |
| 65 AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_]acx_Woptions)dnl |
57 AS_IF([test "$GCC" = yes], | 66 AS_IF([test "$GCC" = yes], |
58 [AC_CACHE_CHECK([whether $CC supports -pedantic $1], acx_Pedantic, | 67 [AC_CACHE_CHECK([whether $CC supports -pedantic ]acx_Woptions, acx_Pedantic, |
59 [save_CFLAGS="$CFLAGS" | 68 [save_CFLAGS="$CFLAGS" |
60 CFLAGS="-pedantic $1" | 69 CFLAGS="-pedantic acx_Woptions" |
61 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], | 70 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], |
62 [AS_VAR_SET(acx_Pedantic, yes)], | 71 [AS_VAR_SET(acx_Pedantic, yes)], |
63 [AS_VAR_SET(acx_Pedantic, no)]) | 72 [AS_VAR_SET(acx_Pedantic, no)]) |
64 CFLAGS="$save_CFLAGS"]) | 73 CFLAGS="$save_CFLAGS"]) |
65 AS_IF([test AS_VAR_GET(acx_Pedantic) = yes], | 74 AS_IF([test AS_VAR_GET(acx_Pedantic) = yes], |
66 [acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"]) | 75 [acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"]) |
67 ]) | 76 ]) |
68 AS_VAR_POPDEF([acx_Pedantic])dnl | 77 AS_VAR_POPDEF([acx_Pedantic])dnl |
| 78 m4_popdef([acx_Woptions])dnl |
69 m4_popdef([acx_Var])dnl | 79 m4_popdef([acx_Var])dnl |
70 ])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC | 80 ])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC |
71 | 81 |
72 # ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR]) | 82 # ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR]) |
73 # sets @VARIABLE@ to "-Werror" if the compiler is GCC >=x.y.z, or if | 83 # sets @VARIABLE@ to "-Werror" if the compiler is GCC >=x.y.z, or if |
74 # --enable-werror-always was given on the command line, otherwise | 84 # --enable-werror-always was given on the command line, otherwise |
75 # to nothing. | 85 # to nothing. |
76 # If the argument is the word "manual" instead of a version number, | 86 # If the argument is the word "manual" instead of a version number, |
77 # then @VARIABLE@ will be set to -Werror only if --enable-werror-always | 87 # then @VARIABLE@ will be set to -Werror only if --enable-werror-always |
78 # appeared on the configure command line. | 88 # appeared on the configure command line. |
(...skipping 19 matching lines...) Expand all Loading... |
98 < [$]1 * 10000 + [$]2 * 100 + [$]3 | 108 < [$]1 * 10000 + [$]2 * 100 + [$]3 |
99 #error insufficient | 109 #error insufficient |
100 #endif], | 110 #endif], |
101 [AS_VAR_SET(acx_GCCvers, yes)], | 111 [AS_VAR_SET(acx_GCCvers, yes)], |
102 [AS_VAR_SET(acx_GCCvers, no)])]) | 112 [AS_VAR_SET(acx_GCCvers, no)])]) |
103 AS_IF([test AS_VAR_GET(acx_GCCvers) = yes], | 113 AS_IF([test AS_VAR_GET(acx_GCCvers) = yes], |
104 [acx_Var="$acx_Var${acx_Var:+ }-Werror"]) | 114 [acx_Var="$acx_Var${acx_Var:+ }-Werror"]) |
105 AS_VAR_POPDEF([acx_GCCvers])]) | 115 AS_VAR_POPDEF([acx_GCCvers])]) |
106 m4_popdef([acx_Var])dnl | 116 m4_popdef([acx_Var])dnl |
107 ])# ACX_PROG_CC_WARNINGS_ARE_ERRORS | 117 ])# ACX_PROG_CC_WARNINGS_ARE_ERRORS |
OLD | NEW |