1 dnl Common configure.in fragment
3 AC_DEFUN([AM_BINUTILS_WARNINGS],[
4 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
5 AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
8 [ --enable-werror treat compile warnings as errors],
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) ;;
15 # Disable -Wformat by default when using gcc on mingw
18 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
19 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
25 # Enable -Werror by default when using gcc
26 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
31 if test "${ERROR_ON_WARNING}" = yes ; then
32 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
33 NO_WERROR="-Wno-error"
36 if test "${GCC}" = yes ; then
37 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
40 AC_ARG_ENABLE(build-warnings,
41 [ --enable-build-warnings enable build-time compiler warnings],
42 [case "${enableval}" in
43 yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
44 no) if test "${GCC}" = yes ; then
47 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
48 WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
49 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
50 WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
51 *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
54 if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
55 echo "Setting warning flags = $WARN_CFLAGS" 6>&1