source: trunk/m4/ax_gcc_warnings.m4 @ 12

Revision 12, 1.2 KB checked in by mmamonski, 10 years ago (diff)

version 1.0.7 release candidate

  • Property svn:keywords set to Id
Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_GCC_FLAGS()
6#
7# DESCRIPTION
8#
9#   Check for supported gcc options.
10#
11#   This macro calls::
12#
13#                       AC_SUBST(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
14#                       AC_SUBST(GCC_W_NO_FORMAT_ZERO_LENGTH)
15#
16# LAST MODIFICATION
17#
18#   2008-10-13
19#
20# LICENSE
21#
22#   Written by Łukasz Cieśnik <lukasz.ciesnik@gmail.com>
23#   and placed under Public Domain.
24#
25AC_DEFUN([AX_GCC_WARNINGS], [
26if test x$GCC == xyes; then
27        AC_SUBST([GCC_W_NO_MISSING_FIELD_INITIALIZERS])
28        AC_SUBST([GCC_W_NO_FORMAT_ZERO_LENGTH])
29        CFLAGS_save="$CFLAGS"
30
31        AC_MSG_CHECKING([whether gcc accepts -Wno-missing-field-initializers])
32        CFLAGS="$CFLAGS_save -Wall -Wextra -Wno-missing-field-initializers"
33        ax_gcc_warnings_src="int main(){ return 0; }"
34        AC_COMPILE_IFELSE([$ax_gcc_warnings_src],
35                [GCC_W_NO_MISSING_FIELD_INITIALIZERS="-Wno-missing-field-initializers"
36                AC_MSG_RESULT([yes])],
37                [GCC_W_NO_MISSING_FIELD_INITIALIZERS="-Wno-extra"
38                AC_MSG_RESULT([no])])
39
40        AC_MSG_CHECKING([whether gcc accepts -Wno-format-zero-length])
41        CFLAGS="$CFLAGS_save -Wno-format-zero-length"
42        AC_COMPILE_IFELSE([$ax_gcc_warnings_src],
43                [GCC_W_NO_FORMAT_ZERO_LENGTH="-Wno-format-zero-length"
44                AC_MSG_RESULT([yes])],
45                [GCC_W_NO_FORMAT_ZERO_LENGTH="-Wno-format"
46                AC_MSG_RESULT([no])])
47
48        CFLAGS="$CFLAGS_save"
49fi
50])
Note: See TracBrowser for help on using the repository browser.