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