Commit | Line | Data |
---|---|---|
9e9b66a9 AM |
1 | dnl Common configure.in fragment |
2 | ||
3 | AC_DEFUN([AM_BINUTILS_WARNINGS],[ | |
4 | WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" | |
5 | ||
6 | AC_ARG_ENABLE(werror, | |
7 | [ --enable-werror treat compile warnings as errors], | |
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 | ||
14 | # Enable -Werror by default when using gcc | |
15 | if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then | |
16 | ERROR_ON_WARNING=yes | |
17 | fi | |
18 | ||
19 | NO_WERROR= | |
20 | if test "${ERROR_ON_WARNING}" = yes ; then | |
21 | WARN_CFLAGS="$WARN_CFLAGS -Werror" | |
22 | NO_WERROR="-Wno-error" | |
23 | fi | |
24 | ||
25 | AC_ARG_ENABLE(build-warnings, | |
26 | [ --enable-build-warnings Enable build-time compiler warnings], | |
27 | [case "${enableval}" in | |
28 | yes) ;; | |
29 | no) WARN_CFLAGS="-w";; | |
30 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
31 | WARN_CFLAGS="${WARN_CFLAGS} ${t}";; | |
32 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
33 | WARN_CFLAGS="${t} ${WARN_CFLAGS}";; | |
34 | *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
35 | esac]) | |
36 | ||
37 | if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then | |
38 | echo "Setting warning flags = $WARN_CFLAGS" 6>&1 | |
39 | fi | |
40 | ||
41 | AC_SUBST(WARN_CFLAGS) | |
42 | AC_SUBST(NO_WERROR) | |
43 | ]) |