changeset 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 748fa2785611
children 1d4824d7f352
files m4/warnings.m4
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 5
+# warnings.m4 serial 6
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,14 +21,14 @@
 AC_DEFUN([gl_WARN_ADD],
 dnl FIXME: gl_Warn must be used unquoted until we can assume
 dnl autoconf 2.64 or newer.
-[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
-AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [
-  gl_save_CPPFLAGS="$CPPFLAGS"
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+  gl_save_compiler_FLAGS="$_AC_LANG_PREFIX[]FLAGS"
   CPPFLAGS="${CPPFLAGS} $1"
-  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
                     [AS_VAR_SET(gl_Warn, [yes])],
                     [AS_VAR_SET(gl_Warn, [no])])
-  CPPFLAGS="$gl_save_CPPFLAGS"
+  _AC_LANG_PREFIX[]FLAGS="$gl_save_compiler_FLAGS"
 ])
 AS_VAR_IF(gl_Warn, [yes],
   [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])])