bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Mats Erik Andersson <mats.andersson@gisladisker.se>
Subject: Re: Messed up gl_COMPILER_PREPARE_CHECK_DECL
Date: Sat, 18 Jan 2020 19:11:34 +0100	[thread overview]
Message-ID: <15957290.6tjZKmyNYO@omega> (raw)
In-Reply-To: <20200118153128.GA62234@aun.utmark.mea>

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  <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.

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	other threads:[~2020-01-18 18:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 15:11 Messed up gl_COMPILER_PREPARE_CHECK_DECL Mats Erik Andersson
2020-01-10 20:14 ` Bruno Haible
2020-01-10 21:36   ` Mats Erik Andersson
2020-01-10 22:06   ` Paul Eggert
2020-01-10 22:47     ` Bruno Haible
2020-01-11  1:32       ` Paul Eggert
2020-01-13 19:02         ` Bruno Haible
2020-01-14  0:38           ` Paul Eggert
2020-01-18 13:14             ` Bruno Haible
2020-01-18 13:34               ` Bruno Haible
2020-01-18 15:31                 ` Mats Erik Andersson
2020-01-18 18:11                   ` Bruno Haible [this message]
2020-01-18 22:02                     ` Mats Erik Andersson
2020-01-18 22:19                       ` Bruno Haible
2020-01-18 21:39               ` Paul Eggert
2020-01-18 22:11                 ` Bruno Haible
2020-01-18 22:23                   ` Paul Eggert
2020-01-18 22:32                     ` Bruno Haible
2020-01-18 17:58             ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15957290.6tjZKmyNYO@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=mats.andersson@gisladisker.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).