From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: Messed up gl_COMPILER_PREPARE_CHECK_DECL
Date: Mon, 13 Jan 2020 16:38:19 -0800 [thread overview]
Message-ID: <7fb89678-cebb-cc01-4cb2-03ac6f17f719@cs.ucla.edu> (raw)
In-Reply-To: <1741057.sbhhibc9n3@omega>
[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]
On 1/13/20 11:02 AM, Bruno Haible wrote:
> I would suggest that
> the particular 'case' and 'if'/'test' statements - or even the entire main body
> of the configure.ac, from line 130 to line 5588 - gets wrapped in an AC_DEFUN
> that gets invoked once.
Thanks for the diagnosis. I came up with a simpler patch to Emacs, and
installed it into Emacs master (attached).
This patch doesn't solve the general problem, just this particular case.
I doubt whether our collection of Emacs hackers can be induced to
remember that the Autoconf macros you mentioned cannot be executed
inside a shell condition, and I wouldn't be surprised if other configure
scripts run into similar problems. I don't have any specific suggestion
to work around this problem in Gnulib, though.
PS. I vaguely recall a long discussion many years ago when we added this
AC_REQUIRE-ish stuff to Autoconf. Although we did fix some major
glitches, we replacing them with other glitches that live on to this
day. For example, there's now this note in the Autoconf manual:
Many Autoconf macros use a compiler, and thus call
`AC_REQUIRE([AC_PROG_CC])' to ensure that the compiler has been
determined before the body of the outermost `AC_DEFUN' macro.
Although `AC_PROG_CC' is safe to directly expand multiple times, it
performs certain checks (such as the proper value of `EXEEXT') only
on the first invocation. Therefore, care must be used when
invoking this macro from within another macro rather than at the
top level (*note Expanded Before Required::).
all of which I had forgotten until I read your email today.
[-- Attachment #2: 0001-Port-configure.ac-to-future-Gnulib.patch --]
[-- Type: text/x-patch, Size: 2656 bytes --]
From 49ad550af6b5c1cfcb2fd31962967d7be71bfcc3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 13 Jan 2020 16:07:27 -0800
Subject: [PATCH] Port configure.ac to future Gnulib
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Rewrite an ancient Alpha ELF check to port to a future Gnulib
version that may require AC_CHECK_DECL to be set up properly as
per the ‘Expanded Before Required’ section of the Autoconf manual
Autoconf doesn’t guarantee that AC_CHECK_DECL will work properly
if called conditionally (e.g., inside a shell ‘case’ statement)
and the condition is false. Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00088.html
* configure.ac (LD_SWITCH_MACHINE): Migrate ELF check later,
when AC_CHECK_DECL is properly set up.
---
configure.ac | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 08a4502122..f040b748d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1508,6 +1508,7 @@ AC_DEFUN
UNEXEC_OBJ=unexelf.o
;;
esac
+AC_SUBST(UNEXEC_OBJ)
LD_SWITCH_SYSTEM=
test "$with_unexec" = no || case "$opsys" in
@@ -1561,8 +1562,6 @@ AC_DEFUN
test $with_unexec = yes &&
case $canonical in
alpha*)
- AC_CHECK_DECL([__ELF__])
- if test "$ac_cv_have_decl___ELF__" = "yes"; then
## With ELF, make sure that all common symbols get allocated to in the
## data section. Otherwise, the dump of temacs may miss variables in
## the shared library that have been initialized. For example, with
@@ -1573,18 +1572,10 @@ AC_DEFUN
else
AC_MSG_ERROR([Non-GCC compilers are not supported.])
fi
- else
- dnl This was the unexalpha.c case. Removed in 24.1, 2010-07-24,
- dnl albeit under the mistaken assumption that said file
- dnl was no longer used.
- AC_MSG_ERROR([Non-ELF systems are not supported since Emacs 24.1.])
- fi
;;
esac
AC_SUBST(C_SWITCH_MACHINE)
-AC_SUBST(UNEXEC_OBJ)
-
C_SWITCH_SYSTEM=
## Some programs in src produce warnings saying certain subprograms
## are too complex and need a MAXMEM value greater than 2000 for
@@ -4216,6 +4207,12 @@ AC_DEFUN
AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
+case $with_unexec,$canonical in
+ yes,alpha*)
+ AC_CHECK_DECL([__ELF__], [],
+ [AC_MSG_ERROR([Non-ELF systems are not supported on this platform.])]);;
+esac
+
# Dump loading
AC_CHECK_FUNCS([posix_madvise])
--
2.24.1
next prev parent reply other threads:[~2020-01-14 0:39 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 [this message]
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
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=7fb89678-cebb-cc01-4cb2-03ac6f17f719@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/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).