[ARC] Fix typo in extension instruction name.
[deliverable/binutils-gdb.git] / bfd / warning.m4
1 dnl Common configure.ac fragment
2 dnl
3 dnl Copyright (C) 2012-2016 Free Software Foundation, Inc.
4 dnl
5 dnl This file is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; see the file COPYING3. If not see
17 dnl <http://www.gnu.org/licenses/>.
18 dnl
19
20 AC_DEFUN([AM_BINUTILS_WARNINGS],[
21 # Set the 'development' global.
22 . $srcdir/../bfd/development.sh
23
24 # Default set of GCC warnings to enable.
25 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
26
27 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
28 AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
29
30 # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
31 AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144")
32
33
34 AC_ARG_ENABLE(werror,
35 [ --enable-werror treat compile warnings as errors],
36 [case "${enableval}" in
37 yes | y) ERROR_ON_WARNING="yes" ;;
38 no | n) ERROR_ON_WARNING="no" ;;
39 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
40 esac])
41
42 # Disable -Wformat by default when using gcc on mingw
43 case "${host}" in
44 *-*-mingw32*)
45 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
46 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
47 fi
48 ;;
49 *) ;;
50 esac
51
52 # Enable -Werror by default when using gcc. Turn it off for releases.
53 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
54 ERROR_ON_WARNING=yes
55 fi
56
57 NO_WERROR=
58 if test "${ERROR_ON_WARNING}" = yes ; then
59 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
60 NO_WERROR="-Wno-error"
61 fi
62
63 if test "${GCC}" = yes ; then
64 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
65 fi
66
67 AC_ARG_ENABLE(build-warnings,
68 [ --enable-build-warnings enable build-time compiler warnings],
69 [case "${enableval}" in
70 yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
71 no) if test "${GCC}" = yes ; then
72 WARN_CFLAGS="-w"
73 fi;;
74 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
75 WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
76 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
77 WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
78 *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
79 esac])
80
81 if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
82 echo "Setting warning flags = $WARN_CFLAGS" 6>&1
83 fi
84
85 AC_SUBST(WARN_CFLAGS)
86 AC_SUBST(NO_WERROR)
87 ])
This page took 0.03287 seconds and 4 git commands to generate.