cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | dnl Available from the GNU Autoconf Macro Archive at: |
| 2 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_compile_warnings.html |
| 3 | dnl |
| 4 | AC_DEFUN([AC_COMPILE_WARNINGS], [ |
| 5 | AC_MSG_CHECKING([maximum warning verbosity option]) |
| 6 | AC_REQUIRE([AC_PROG_CC]) |
| 7 | AC_REQUIRE([AC_PROG_CXX]) |
| 8 | |
| 9 | AC_ARG_WITH([maximum-compile-warnings], |
| 10 | AS_HELP_STRING([--without-maximum-compile-warnings], |
| 11 | [Disable maximum warning verbosity]), |
| 12 | [ac_compile_warnings_on="$withval"], |
| 13 | [ac_compile_warnings_on=""]) |
| 14 | |
| 15 | if test x"$ac_compile_warnings_on" = xno |
| 16 | then |
| 17 | ac_compile_warnings_msg=no |
| 18 | else |
| 19 | if test -n "$CXX" |
| 20 | then |
| 21 | if test "$GXX" = "yes" |
| 22 | then |
| 23 | ac_compile_warnings_opt='-Wall -W' |
| 24 | fi |
| 25 | CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt" |
| 26 | ac_compile_warnings_msg="$ac_compile_warnings_opt for C++" |
| 27 | fi |
| 28 | |
| 29 | if test -n "$CC" |
| 30 | then |
| 31 | if test "$GCC" = "yes" |
| 32 | then |
| 33 | ac_compile_warnings_opt='-Wall -W' |
| 34 | fi |
| 35 | CFLAGS="$CFLAGS $ac_compile_warnings_opt" |
| 36 | ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C" |
| 37 | fi |
| 38 | fi |
| 39 | AC_MSG_RESULT([$ac_compile_warnings_msg]) |
| 40 | unset ac_compile_warnings_msg |
| 41 | unset ac_compile_warnings_opt |
| 42 | ]) |