]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid error "m4_require: circular dependency of AC_LANG_COMPILER(C)".
authorBruno Haible <bruno@clisp.org>
Sat, 18 Jan 2020 18:02:19 +0000 (19:02 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Jan 2020 18:02:19 +0000 (19:02 +0100)
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.

ChangeLog
m4/00gnulib.m4

index 020dfb9df887d805839db51ebf24c9b35b911449..fcf7105b7f93a27c204dd84d06f27843c52d73ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-18  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2020-01-18  Bruno Haible  <bruno@clisp.org>
 
        Ensure Automake does not drop ~~gnulib.m4.
index 36304b933d9a3b3495b7255bc127448ed8160c2a..90e7e04169ae33d63d7baa634e456e2ff4aa62b7 100644 (file)
@@ -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],