summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-01-18 19:02:19 +0100
committerBruno Haible <bruno@clisp.org>2020-01-18 19:02:19 +0100
commitcee130f4dcfcd73385581e00c746eb1084cf9008 (patch)
tree0dee4aa381eaeb8473ad35e7cf7184381fe5ffb4 /m4
parent402ad3f07567fed0e3a3839d184088628d78df07 (diff)
downloadgnulib-cee130f4dcfcd73385581e00c746eb1084cf9008.tar.gz
Avoid error "m4_require: circular dependency of AC_LANG_COMPILER(C)".
Reported by Mats Erik Andersson <mats.andersson@gisladisker.se> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-01/msg00109.html>. * m4/00gnulib.m4 (gl_COMPILER_CLANG): Use _AC_COMPILE_IFELSE, not AC_EGREP_CPP.
Diffstat (limited to 'm4')
-rw-r--r--m4/00gnulib.m421
1 files changed, 13 insertions, 8 deletions
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index 36304b933d..90e7e04169 100644
--- a/m4/00gnulib.m4
+++ b/m4/00gnulib.m4
@@ -1,4 +1,4 @@
-# 00gnulib.m4 serial 6
+# 00gnulib.m4 serial 7
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -58,13 +58,18 @@ AC_DEFUN([gl_COMPILER_CLANG],
dnl AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether the compiler is clang],
[gl_cv_compiler_clang],
- [AC_EGREP_CPP([barfbarf],[
-#ifdef __clang__
-barfbarf
-#endif
- ],
- [gl_cv_compiler_clang=yes],
- [gl_cv_compiler_clang=no])
+ [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error
+ dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has
+ dnl not yet been invoked.
+ _AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #ifdef __clang__
+ barfbarf
+ #endif
+ ]],[[]])
+ ],
+ [gl_cv_compiler_clang=no],
+ [gl_cv_compiler_clang=yes])
])
])
AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL],