bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Messed up gl_COMPILER_PREPARE_CHECK_DECL


From: Bruno Haible
Subject: Re: Messed up gl_COMPILER_PREPARE_CHECK_DECL
Date: Sat, 18 Jan 2020 19:11:34 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

Hi Mats,

> The following appears with Gnulib pulled just minutes ago,
> when bootstrapping Inetutils on OpenIndiana. It was successful
> with Gnulib ba4b91abd from the 10th of January!

Thanks for the report. The patch below fixes it.

> The first change after my report was successful, but now
> you continue to push non-portable, or rather, seemingly
> version-dependent code.

No, the changes I pushed were neither non-portable nor version-dependent.

The cause of the failure is that inetutils/configure.ac invokes
AC_ISC_POSIX before AC_PROG_CC. But AC_ISC_POSIX is documented to expand
into an invocation of AC_SEARCH_LIBS; therefore it requires to run the C
compiler. It therefore does not really make sense to invoke AC_ISC_POSIX
before AC_PROG_CC. You were just lucky that it worked before.

This is a grey area of Autoconf: where you don't get a warning about wrong
order of invocation of two macros, and the result seemingly works, but
stops working when one of the involved macros changes a bit.


2020-01-18  Bruno Haible  <address@hidden>

        Avoid error "m4_require: circular dependency of AC_LANG_COMPILER(C)".
        Reported by Mats Erik Andersson <address@hidden> 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.

diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index 36304b9..90e7e04 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],




reply via email to

[Prev in Thread] Current Thread [Next in Thread]