It's a pitfall for maintenance if stdint.m4 modifies a variable
set in limits-h.m4 and use in the 'limits-h' module. It's
better if this use is done through a macro invocation (like
already done in the 'iconv-h' module).


2018-08-19  Bruno Haible  <br...@clisp.org>

        glob-h: Formalize side effects from other modules.
        * m4/glob_h.m4 (gl_REPLACE_GLOB_H): New macro.
        * m4/glob.m4 (gl_GLOB): Invoke it.

        fnmatch-h: Formalize side effects from other modules.
        * m4/fnmatch_h.m4 (gl_REPLACE_FNMATCH_H): New macro.
        * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Invoke it.

        limits-h: Formalize side effects from other modules.
        * m4/limits-h.m4 (gl_REPLACE_LIMITS_H): New macro.
        * m4/stdint.m4 (gl_STDINT_H): Invoke it.

>From 54b258e089547fb76e1a788c2e3c37df0a560b01 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 19 Aug 2018 20:57:24 +0200
Subject: [PATCH 1/3] limits-h: Formalize side effects from other modules.

* m4/limits-h.m4 (gl_REPLACE_LIMITS_H): New macro.
* m4/stdint.m4 (gl_STDINT_H): Invoke it.
---
 ChangeLog      | 6 ++++++
 m4/limits-h.m4 | 8 ++++++++
 m4/stdint.m4   | 5 ++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7d20b21..b38be6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2018-08-19  Bruno Haible  <br...@clisp.org>
 
+	limits-h: Formalize side effects from other modules.
+	* m4/limits-h.m4 (gl_REPLACE_LIMITS_H): New macro.
+	* m4/stdint.m4 (gl_STDINT_H): Invoke it.
+
+2018-08-19  Bruno Haible  <br...@clisp.org>
+
 	getpass: Move declaration to <unistd.h>.
 	* lib/unistd.in.h (getpass): New declaration.
 	* lib/getpass.h: Replace with a stub that just includes <unistd.h>.
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index 511dcef..8388663 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -29,3 +29,11 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
   AC_SUBST([LIMITS_H])
   AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
 ])
+
+dnl Unconditionally enables the replacement of <limits.h>.
+AC_DEFUN([gl_REPLACE_LIMITS_H],
+[
+  AC_REQUIRE([gl_LIMITS_H])
+  LIMITS_H='limits.h'
+  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
+])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index b86184c..38dbbed 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 51
+# stdint.m4 serial 52
 dnl Copyright (C) 2001-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -364,8 +364,7 @@ int32_t i32 = INT32_C (0x7fffffff);
   esac
 
   dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
-  LIMITS_H=limits.h
-  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
+  gl_REPLACE_LIMITS_H
 
   AC_SUBST([HAVE_C99_STDINT_H])
   AC_SUBST([HAVE_SYS_BITYPES_H])
-- 
2.7.4

>From ffb9d1f11ed7240034865c9447b4ece8806c226b Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 19 Aug 2018 20:58:58 +0200
Subject: [PATCH 2/3] fnmatch-h: Formalize side effects from other modules.

* m4/fnmatch_h.m4 (gl_REPLACE_FNMATCH_H): New macro.
* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Invoke it.
---
 ChangeLog       |  4 ++++
 m4/fnmatch.m4   |  5 ++---
 m4/fnmatch_h.m4 | 10 +++++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b38be6b..38d1ae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-08-19  Bruno Haible  <br...@clisp.org>
 
+	fnmatch-h: Formalize side effects from other modules.
+	* m4/fnmatch_h.m4 (gl_REPLACE_FNMATCH_H): New macro.
+	* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Invoke it.
+
 	limits-h: Formalize side effects from other modules.
 	* m4/limits-h.m4 (gl_REPLACE_LIMITS_H): New macro.
 	* m4/stdint.m4 (gl_STDINT_H): Invoke it.
diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4
index f05f845..a61545a 100644
--- a/m4/fnmatch.m4
+++ b/m4/fnmatch.m4
@@ -1,4 +1,4 @@
-# Check for fnmatch - serial 12.  -*- coding: utf-8 -*-
+# Check for fnmatch - serial 13.  -*- coding: utf-8 -*-
 
 # Copyright (C) 2000-2007, 2009-2018 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -125,8 +125,7 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
     fi
   fi
   if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then
-    FNMATCH_H=fnmatch.h
-    AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
+    gl_REPLACE_FNMATCH_H
   fi
 ])
 
diff --git a/m4/fnmatch_h.m4 b/m4/fnmatch_h.m4
index afa59fe..077dfef 100644
--- a/m4/fnmatch_h.m4
+++ b/m4/fnmatch_h.m4
@@ -1,4 +1,4 @@
-# fnmatch_h.m4 serial 3
+# fnmatch_h.m4 serial 4
 dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,6 +49,14 @@ AC_DEFUN_ONCE([gl_FNMATCH_H],
     [fnmatch])
 ])
 
+dnl Unconditionally enables the replacement of <fnmatch.h>.
+AC_DEFUN([gl_REPLACE_FNMATCH_H],
+[
+  AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
+  FNMATCH_H='fnmatch.h'
+  AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
+])
+
 AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-- 
2.7.4

>From 4172747f577878df970b8494cc7d0d7042d9894e Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 19 Aug 2018 21:00:35 +0200
Subject: [PATCH 3/3] glob-h: Formalize side effects from other modules.

* m4/glob_h.m4 (gl_REPLACE_GLOB_H): New macro.
* m4/glob.m4 (gl_GLOB): Invoke it.
---
 ChangeLog    |  4 ++++
 m4/glob.m4   |  5 ++---
 m4/glob_h.m4 | 10 +++++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 38d1ae3..f43e400 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-08-19  Bruno Haible  <br...@clisp.org>
 
+	glob-h: Formalize side effects from other modules.
+	* m4/glob_h.m4 (gl_REPLACE_GLOB_H): New macro.
+	* m4/glob.m4 (gl_GLOB): Invoke it.
+
 	fnmatch-h: Formalize side effects from other modules.
 	* m4/fnmatch_h.m4 (gl_REPLACE_FNMATCH_H): New macro.
 	* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Invoke it.
diff --git a/m4/glob.m4 b/m4/glob.m4
index 69fd2ab..53a1911 100644
--- a/m4/glob.m4
+++ b/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 20
+# glob.m4 serial 21
 dnl Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -69,8 +69,7 @@ char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1
   fi
 
   if test $HAVE_GLOB = 0 || test $REPLACE_GLOB = 1; then
-    GLOB_H=glob.h
-    AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
+    gl_REPLACE_GLOB_H
   fi
 ])
 
diff --git a/m4/glob_h.m4 b/m4/glob_h.m4
index d504c06..3ac78a8 100644
--- a/m4/glob_h.m4
+++ b/m4/glob_h.m4
@@ -1,4 +1,4 @@
-# glob_h.m4 serial 4
+# glob_h.m4 serial 5
 dnl Copyright (C) 2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -44,6 +44,14 @@ AC_DEFUN_ONCE([gl_GLOB_H],
     [glob globfree glob_pattern_p])
 ])
 
+dnl Unconditionally enables the replacement of <glob.h>.
+AC_DEFUN([gl_REPLACE_GLOB_H],
+[
+  AC_REQUIRE([gl_GLOB_H_DEFAULTS])
+  GLOB_H='glob.h'
+  AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
+])
+
 AC_DEFUN([gl_GLOB_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-- 
2.7.4

Reply via email to