From 4bf9c96497946ce6f7b84f6527ed0291657cf728 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Jan 2022 15:38:51 +0100 Subject: [PATCH] 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. --- ChangeLog | 13 ++++++++++++ gnulib-tool | 11 ---------- m4/gnulib-common.m4 | 20 ++++++++++++++++++- m4/libgmp.m4 | 6 +++--- .../posix_spawn_file_actions_addfchdir-tests | 2 +- modules/uchar-c++-tests | 2 +- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4c294fbef..e330c90f70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2022-01-09 Bruno Haible + + 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 gnulib-tool: Fix "Don't forget" messages (regression 2021-12-12). diff --git a/gnulib-tool b/gnulib-tool index 455d97d9e6..99854415ba 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -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 diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index afe0836083..bd7318aead 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -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]) diff --git a/m4/libgmp.m4 b/m4/libgmp.m4 index a2dee93382..d69dcc7237 100644 --- a/m4/libgmp.m4 +++ b/m4/libgmp.m4 @@ -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]) ]) diff --git a/modules/posix_spawn_file_actions_addfchdir-tests b/modules/posix_spawn_file_actions_addfchdir-tests index 903a30f859..d32dbba2ae 100644 --- a/modules/posix_spawn_file_actions_addfchdir-tests +++ b/modules/posix_spawn_file_actions_addfchdir-tests @@ -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 diff --git a/modules/uchar-c++-tests b/modules/uchar-c++-tests index 7ff4e1bf23..7e63bb9fce 100644 --- a/modules/uchar-c++-tests +++ b/modules/uchar-c++-tests @@ -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 -- 2.39.5