1dnl @synopsis AC_COMPILE_WARNINGS 2dnl 3dnl Set the maximum warning verbosity according to C and C++ compiler used. 4dnl Currently supports g++ and gcc. 5dnl 6dnl The compiler options are always added CFLAGS and CXXFLAGS even if 7dnl these are overridden at configure time. Removing the maximum warning 8dnl flags can be removed with --without-maximum-compile-warnings. For example: 9dnl 10dnl ./configure --without-maximum-compile-warnings CFLAGS= CXXFLAGS= 11dnl 12dnl @category Misc 13dnl @author Loic Dachary <loic@senga.org> 14dnl @author William Fulton <wsf@fultondesigns.co.uk> 15dnl @version 2005-04-29 16dnl @license GPLWithACException 17 18AC_DEFUN([AC_COMPILE_WARNINGS], [ 19AC_MSG_CHECKING([maximum warning verbosity option]) 20 AC_REQUIRE([AC_PROG_CC]) 21 AC_REQUIRE([AC_PROG_CXX]) 22 23 AC_ARG_WITH([maximum-compile-warnings], 24 AS_HELP_STRING([--without-maximum-compile-warnings], 25 [Disable maximum warning verbosity]), 26 [ac_compile_warnings_on="$withval"], 27 [ac_compile_warnings_on=""]) 28 29 if test x"$ac_compile_warnings_on" = xno 30 then 31 ac_compile_warnings_msg=no 32 else 33 if test -n "$CXX" 34 then 35 if test "$GXX" = "yes" 36 then 37 ac_compile_warnings_opt='-Wall -W -ansi -pedantic' 38 fi 39 CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt" 40 ac_compile_warnings_msg="$ac_compile_warnings_opt for C++" 41 fi 42 43 if test -n "$CC" 44 then 45 if test "$GCC" = "yes" 46 then 47 ac_compile_warnings_opt='-Wall -W -ansi -pedantic' 48 fi 49 CFLAGS="$CFLAGS $ac_compile_warnings_opt" 50 ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C" 51 fi 52 fi 53 AC_MSG_RESULT([$ac_compile_warnings_msg]) 54 unset ac_compile_warnings_msg 55 unset ac_compile_warnings_opt 56]) 57