Mercurial > hg > octave-lojdl > gnulib-hg
comparison m4/warnings.m4 @ 16723:376ee9a0ad8d
warnings.m4: check the compiler, not the preprocessor
* m4/warnings.m4 (gl_WARN_ADD): Use the compiler, not the
preprocessor.
Depend on the current AC_LANG for the cache variables.
author | Akim Demaille <akim@lrde.epita.fr> |
---|---|
date | Thu, 29 Mar 2012 15:29:37 +0200 |
parents | 8250f2777afc |
children | b7fd03492209 |
comparison
equal
deleted
inserted
replaced
16722:748fa2785611 | 16723:376ee9a0ad8d |
---|---|
1 # warnings.m4 serial 5 | 1 # warnings.m4 serial 6 |
2 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
19 # Adds parameter to WARN_CFLAGS if the compiler supports it. For example, | 19 # Adds parameter to WARN_CFLAGS if the compiler supports it. For example, |
20 # gl_WARN_ADD([-Wparentheses]). | 20 # gl_WARN_ADD([-Wparentheses]). |
21 AC_DEFUN([gl_WARN_ADD], | 21 AC_DEFUN([gl_WARN_ADD], |
22 dnl FIXME: gl_Warn must be used unquoted until we can assume | 22 dnl FIXME: gl_Warn must be used unquoted until we can assume |
23 dnl autoconf 2.64 or newer. | 23 dnl autoconf 2.64 or newer. |
24 [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl | 24 [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl |
25 AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [ | 25 AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ |
26 gl_save_CPPFLAGS="$CPPFLAGS" | 26 gl_save_compiler_FLAGS="$_AC_LANG_PREFIX[]FLAGS" |
27 CPPFLAGS="${CPPFLAGS} $1" | 27 CPPFLAGS="${CPPFLAGS} $1" |
28 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], | 28 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], |
29 [AS_VAR_SET(gl_Warn, [yes])], | 29 [AS_VAR_SET(gl_Warn, [yes])], |
30 [AS_VAR_SET(gl_Warn, [no])]) | 30 [AS_VAR_SET(gl_Warn, [no])]) |
31 CPPFLAGS="$gl_save_CPPFLAGS" | 31 _AC_LANG_PREFIX[]FLAGS="$gl_save_compiler_FLAGS" |
32 ]) | 32 ]) |
33 AS_VAR_IF(gl_Warn, [yes], | 33 AS_VAR_IF(gl_Warn, [yes], |
34 [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])]) | 34 [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])]) |
35 AS_VAR_POPDEF([gl_Warn])dnl | 35 AS_VAR_POPDEF([gl_Warn])dnl |
36 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl | 36 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl |