annotate m4/warnings.m4 @ 14751:fce34e91a9ce

warnings.m4: don't usurp save_CPPFLAGS variable name * m4/warnings.m4: Prefix local temporary variable name with gl_.
author Jim Meyering <meyering@redhat.com>
date Tue, 17 May 2011 14:10:16 +0200
parents 97fc9a21a8fb
children d569119b11e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14751
fce34e91a9ce warnings.m4: don't usurp save_CPPFLAGS variable name
Jim Meyering <meyering@redhat.com>
parents: 14079
diff changeset
1 # warnings.m4 serial 3
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 12735
diff changeset
2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
10789
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
6
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
7 dnl From Simon Josefsson
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
8
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
9 # gl_AS_VAR_APPEND(VAR, VALUE)
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
10 # ----------------------------
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
11 # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
12 m4_ifdef([AS_VAR_APPEND],
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
13 [m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
14 [m4_define([gl_AS_VAR_APPEND],
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
15 [AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
10789
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
16
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
17 # gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS])
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
18 # ------------------------------------------------
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
19 # Adds parameter to WARN_CFLAGS if the compiler supports it. For example,
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
20 # gl_WARN_ADD([-Wparentheses]).
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
21 AC_DEFUN([gl_WARN_ADD],
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
22 [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
23 AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
14751
fce34e91a9ce warnings.m4: don't usurp save_CPPFLAGS variable name
Jim Meyering <meyering@redhat.com>
parents: 14079
diff changeset
24 gl_save_CPPFLAGS="$CPPFLAGS"
10826
e91b16712d59 warnings: Use CPPFLAGS to really check whether the parameter works.
Simon Josefsson <simon@josefsson.org>
parents: 10825
diff changeset
25 CPPFLAGS="${CPPFLAGS} $1"
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
26 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
27 [AS_VAR_SET([gl_Warn], [yes])],
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10830
diff changeset
28 [AS_VAR_SET([gl_Warn], [no])])
14751
fce34e91a9ce warnings.m4: don't usurp save_CPPFLAGS variable name
Jim Meyering <meyering@redhat.com>
parents: 14079
diff changeset
29 CPPFLAGS="$gl_save_CPPFLAGS"
10789
6a1640251330 Add warnings module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
30 ])
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
31 AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
12735
77cea116e541 build: guarantee AS_VAR_IF
Simon Josefsson <simon@josefsson.org>
parents: 12559
diff changeset
32 AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
33 AS_VAR_POPDEF([gl_Flags])dnl
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
34 AS_VAR_POPDEF([gl_Warn])dnl
10793
59bb86777cb9 warnings: Think right.
Paolo Bonzini <bonzini@gnu.org>
parents: 10792
diff changeset
35 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
10790
8e910025bd67 warnings: Support non-literal arguments, and let the user choose the variable
Paolo Bonzini <bonzini@gnu.org>
parents: 10789
diff changeset
36 ])