PageRenderTime 17ms CodeModel.GetById 15ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Tools/config/ac_compile_warnings.m4

#
m4 | 56 lines | 52 code | 4 blank | 0 comment | 0 complexity | aa6afcdc710fe9d1ee2d29f97675dd20 MD5 | raw file
 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 overidden 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])