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