I tried using the latest Gnulib with Emacs and ran into a problem. The resulting 'configure' script executed two copies of the following code:

case "$GL_GENERATE_STDINT_H" in false) STDINT_H='' ;; true) if test -z "$STDINT_H"; then STDINT_H="${gl_source_base_prefix}stdint.h" fi ;; *) echo "*** GL_GENERATE_STDINT_H is not set correctly" 1>&2; exit 1 ;; esac


$GL_GENERATE_STDINT_H && GL_GENERATE_STDINT_H=1 || GL_GENERATE_STDINT_H=


and this resulted in 'configure' failing with the diagnostic "*** GL_GENERATE_LIMITS_H is not set correctly".

I worked around the problem by installing the attached patch. However, I'm wondering:

* Should the shell script use a different variable name for the "1" vs "" value, than for the "true" vs "false" value? This might help avoid similar confusion in the future.

* Alternatively (or perhaps also), perhaps gl_CONDITIONAL_HEADER should skip its work if it's already been done.

* There seem to be similar issues with modules/fnmatch's "gl_CONDITIONAL_HEADER([fnmatch.h])" duplicating fnmatch-h, modules/glob's "gl_CONDITIONAL_HEADER([glob.h])" duplicating glob-h, and modules/iconv_open's "gl_CONDITIONAL_HEADER([iconv.h])". However, I left those alone for now because Emacs doesn't use them.
From 88f5ae75df708299b72129da8255d8d03b6b19a5 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 16 Dec 2021 12:40:14 -0800
Subject: [PATCH] stdint: omit duplicate gl_CONFIGURE_HEADER calls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* modules/stdint (configure.ac): Omit
‘gl_CONDITIONAL_HEADER([limits.h])’, since stdint depends on
limits-h and doing gl_CONDITIONAL_HEADER twice can result in
‘configure’ failing with “*** GL_GENERATE_LIMITS_H is not set
correctly”.
---
 ChangeLog      | 9 +++++++++
 modules/stdint | 2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1a8a8e79a..e1be947a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-12-16  Paul Eggert  <egg...@cs.ucla.edu>
+
+	stdint: omit duplicate gl_CONFIGURE_HEADER calls
+	* modules/stdint (configure.ac): Omit
+	‘gl_CONDITIONAL_HEADER([limits.h])’, since stdint depends on
+	limits-h and doing gl_CONDITIONAL_HEADER twice can result in
+	‘configure’ failing with “*** GL_GENERATE_LIMITS_H is not set
+	correctly”.
+
 2021-12-15  Bruno Haible  <br...@clisp.org>
 
 	automake-subdir support: Support the libunistring modules.
diff --git a/modules/stdint b/modules/stdint
index bdec953df..3053a132e 100644
--- a/modules/stdint
+++ b/modules/stdint
@@ -21,8 +21,6 @@ sys_types
 configure.ac:
 gl_STDINT_H
 gl_CONDITIONAL_HEADER([stdint.h])
-dnl Because of gl_REPLACE_LIMITS_H:
-gl_CONDITIONAL_HEADER([limits.h])
 AC_PROG_MKDIR_P
 
 Makefile.am:
-- 
2.32.0

Reply via email to