1899
|
1 dnl @synopsis AC_COMPILE_WARNINGS
|
|
2 dnl
|
|
3 dnl Set the maximum warning verbosity according to C and C++ compiler used.
|
|
4 dnl Currently supports g++ and gcc.
|
|
5 dnl
|
|
6 dnl The compiler options are always added CFLAGS and CXXFLAGS even if
|
|
7 dnl these are overidden at configure time. Removing the maximum warning
|
|
8 dnl flags can be removed with --without-maximum-compile-warnings. For example:
|
|
9 dnl
|
|
10 dnl ./configure --without-maximum-compile-warnings CFLAGS= CXXFLAGS=
|
|
11 dnl
|
|
12 dnl @category Misc
|
|
13 dnl @author Loic Dachary <loic@senga.org>
|
|
14 dnl @author William Fulton <wsf@fultondesigns.co.uk>
|
|
15 dnl @version 2005-04-29
|
|
16 dnl @license GPLWithACException
|
|
17
|
|
18 AC_DEFUN([AC_COMPILE_WARNINGS], [
|
|
19 AC_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 ])
|