*** empty log message ***
[deliverable/binutils-gdb.git] / bfd / warning.m4
CommitLineData
9e9b66a9
AM
1dnl Common configure.in fragment
2
3AC_DEFUN([AM_BINUTILS_WARNINGS],[
d1a98e0c
AM
4GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
5AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
9e9b66a9
AM
6
7AC_ARG_ENABLE(werror,
241a6c40 8 [ --enable-werror treat compile warnings as errors],
9e9b66a9
AM
9 [case "${enableval}" in
10 yes | y) ERROR_ON_WARNING="yes" ;;
11 no | n) ERROR_ON_WARNING="no" ;;
12 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
13 esac])
14
d1a98e0c 15# Disable -Wformat by default when using gcc on mingw
bb8541b9
L
16case "${host}" in
17 *-*-mingw32*)
18 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
19 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
20 fi
21 ;;
22 *) ;;
23esac
24
9e9b66a9
AM
25# Enable -Werror by default when using gcc
26if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
27 ERROR_ON_WARNING=yes
28fi
29
30NO_WERROR=
31if test "${ERROR_ON_WARNING}" = yes ; then
49c96104 32 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
9e9b66a9
AM
33 NO_WERROR="-Wno-error"
34fi
35
49c96104
SE
36if test "${GCC}" = yes ; then
37 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
38fi
39
9e9b66a9 40AC_ARG_ENABLE(build-warnings,
241a6c40 41[ --enable-build-warnings enable build-time compiler warnings],
9e9b66a9 42[case "${enableval}" in
49c96104
SE
43 yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
44 no) if test "${GCC}" = yes ; then
45 WARN_CFLAGS="-w"
46 fi;;
9e9b66a9 47 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
49c96104 48 WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
9e9b66a9 49 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
49c96104 50 WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
9e9b66a9
AM
51 *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
52esac])
53
54if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
55 echo "Setting warning flags = $WARN_CFLAGS" 6>&1
56fi
57
58AC_SUBST(WARN_CFLAGS)
59AC_SUBST(NO_WERROR)
60])
This page took 0.345296 seconds and 4 git commands to generate.