Remove influence of Automake conditionals on conditional dependencies.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Jan 2022 14:38:51 +0000 (15:38 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Jan 2022 14:38:51 +0000 (15:38 +0100)
* m4/gnulib-common.m4 (gl_CONDITIONAL): New macro.
(gl_CONDITIONAL_HEADER): Use it instead of AM_CONDITIONAL.
* m4/libgmp.m4 (gl_LIBGMP): Likewise.
* modules/posix_spawn_file_actions_addfchdir-tests (configure.ac):
Likewise.
* modules/uchar-c++-tests (configure.ac): Likewise.
* gnulib-tool (func_modules_transitive_closure): Don't inhibit
conditional dependencies processing on a module that uses an Automake
conditional.

ChangeLog
gnulib-tool
m4/gnulib-common.m4
m4/libgmp.m4
modules/posix_spawn_file_actions_addfchdir-tests
modules/uchar-c++-tests

index b4c294fbeff3ed6e87ddb4682e675f47f8e31222..e330c90f70eccb9d8fd51f37bca052bb4a8b9cbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-09  Bruno Haible  <bruno@clisp.org>
+
+       Remove influence of Automake conditionals on conditional dependencies.
+       * m4/gnulib-common.m4 (gl_CONDITIONAL): New macro.
+       (gl_CONDITIONAL_HEADER): Use it instead of AM_CONDITIONAL.
+       * m4/libgmp.m4 (gl_LIBGMP): Likewise.
+       * modules/posix_spawn_file_actions_addfchdir-tests (configure.ac):
+       Likewise.
+       * modules/uchar-c++-tests (configure.ac): Likewise.
+       * gnulib-tool (func_modules_transitive_closure): Don't inhibit
+       conditional dependencies processing on a module that uses an Automake
+       conditional.
+
 2022-01-08  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Fix "Don't forget" messages (regression 2021-12-12).
index 455d97d9e6d9468407b2fcb18c7acffb5b34f50c..99854415ba672eb1611cc072c92dfa479e0982be 100755 (executable)
@@ -3114,17 +3114,6 @@ func_modules_transitive_closure ()
         if func_acceptable $module; then
           func_append outmodules " $module"
           if test "$cond_dependencies" = true; then
-            if ! $gnu_make \
-               && func_get_automake_snippet_conditional $module \
-                  | grep '^if ' > /dev/null; then
-              # A module whose Makefile.am snippet contains a reference to an
-              # automake conditional. If we were to use it conditionally, we
-              # would get an error
-              #   configure: error: conditional "..." was never defined.
-              # because automake 1.11.1 does not handle nested conditionals
-              # correctly. As a workaround, make the module unconditional.
-              func_uncond_add_module $module
-            fi
             if func_cond_module_p $module; then
               conditional=true
             else
index afe08360837395d8a745ba0d0fd39575b8bbac94..bd7318aeadf2b77ce3ad479fc14a5919140b5032 100644 (file)
@@ -813,6 +813,24 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
   ])
 ])
 
+# gl_CONDITIONAL(conditional, condition)
+# is like AM_CONDITIONAL(conditional, condition), except that it does not
+# produce an error
+#   configure: error: conditional "..." was never defined.
+#   Usually this means the macro was only invoked conditionally.
+# when only invoked conditionally. Instead, in that case, both the _TRUE
+# and the _FALSE case are disabled.
+AC_DEFUN([gl_CONDITIONAL],
+[
+  pushdef([AC_CONFIG_COMMANDS_PRE], [:])dnl
+  AM_CONDITIONAL([$1], [$2])
+  popdef([AC_CONFIG_COMMANDS_PRE])dnl
+  if test -z "${[$1]_TRUE}" && test -z "${[$1]_FALSE}"; then
+    [$1]_TRUE='#'
+    [$1]_FALSE='#'
+  fi
+])
+
 # gl_CC_ALLOW_WARNINGS
 # sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option
 # that reverts a preceding '-Werror' option, if available.
@@ -969,7 +987,7 @@ AC_DEFUN([gl_CONDITIONAL_HEADER],
     *) echo "*** gl_generate_var is not set correctly" 1>&2; exit 1 ;;
   esac
   AC_SUBST(gl_header_name)
-  AM_CONDITIONAL(gl_generate_cond, [$gl_generate_var])
+  gl_CONDITIONAL(gl_generate_cond, [$gl_generate_var])
   m4_popdef([gl_generate_cond])
   m4_popdef([gl_generate_var])
   m4_popdef([gl_header_name])
index a2dee93382957d36f12e99ae3e5a052aa9986405..d69dcc7237a93412561a3329ff8240c2fe979f4b 100644 (file)
@@ -1,4 +1,4 @@
-# libgmp.m4 serial 6
+# libgmp.m4 serial 7
 # Configure the GMP library or a replacement.
 dnl Copyright 2020-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -63,8 +63,8 @@ AC_DEFUN([gl_LIBGMP],
   else
     GL_GENERATE_GMP_H=true
   fi
-  AM_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
+  gl_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
     [test $HAVE_LIBGMP != yes])
-  AM_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
+  gl_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
     [test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" != yes])
 ])
index 903a30f859f3fe3ce47e54a044798a80eea99d9c..d32dbba2ae23e91814d7bda9b207d447a1ee07c1 100644 (file)
@@ -20,7 +20,7 @@ AC_EGREP_CPP([notposix], [[
   ]],
   [posix_spawn_ported=no],
   [posix_spawn_ported=yes])
-AM_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes])
+gl_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes])
 
 Makefile.am:
 TESTS += test-posix_spawn_file_actions_addfchdir
index 7ff4e1bf23ed5de1a90e2bb711418faaeac96b40..7e63bb9fcef009ad2e61c2edc8b02dbac5ac6f05 100644 (file)
@@ -29,7 +29,7 @@ if test "$CXX" != no; then
 else
   gl_cv_cxxheader_cuchar=no
 fi
-AM_CONDITIONAL([CXX_HAVE_CUCHAR], [test $gl_cv_cxxheader_cuchar != no])
+gl_CONDITIONAL([CXX_HAVE_CUCHAR], [test $gl_cv_cxxheader_cuchar != no])
 
 Makefile.am:
 if ANSICXX