[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib-tool.py and gnulib-tool.sh disagree on AC_REQUIRE([AM_PROG_CC
From: |
Bruno Haible |
Subject: |
Re: gnulib-tool.py and gnulib-tool.sh disagree on AC_REQUIRE([AM_PROG_CC_C_O]) |
Date: |
Thu, 28 Mar 2024 23:40:03 +0100 |
Hi Collin,
> Could you please help me find the correct solution to this issue?
>
> In a few of the test cases there is the following diff in
> gnulib-comp.m4:
>
> $ diff -u ./test-oath-toolkit-2.result/liboath/gl/m4/gnulib-comp.m4
> tmp700002-result/liboath/gl/m4/gnulib-comp.m4
> --- ./test-oath-toolkit-2.result/liboath/gl/m4/gnulib-comp.m4 2024-03-28
> 12:16:32.375344488 -0700
> +++ tmp700002-result/liboath/gl/m4/gnulib-comp.m4 2024-03-28
> 12:18:09.135468095 -0700
> @@ -42,6 +42,7 @@
> AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
> AC_REQUIRE([gl_PROG_AR_RANLIB])
>
> + AC_REQUIRE([AM_PROG_CC_C_O])
> # Code from module absolute-header:
> # Code from module alignasof:
> # Code from module alloca-opt:
Is this line needed? Well, let's look at test-oath-toolkit-2.out: It has
File list:
...
lib/malloc/scratch_buffer_grow.c
lib/malloc/scratch_buffer_grow_preserve.c
lib/malloc/scratch_buffer_set_array_size.c
...
Likewise for the tmp*-out file.
So, it has .c files in subdirectories. Thus the package needs AM_PROG_CC_C_O.
> I don't think we *need* this macro but there might be a compatibility
> reason we want it that I am not aware of [1].
>
> [1] https://git.savannah.gnu.org/cgit/automake.git/tree/NEWS#n496
It is not needed, apparently, with Automake ≥ 1.14. And gnulib requires
Automake ≥ 1.14, since 2022-02-22.
> This is output in line 6030 of gnulib-tool.sh:
>
> if ! $gnu_make && test -n "$uses_subdirs"; then
> echo " AC_REQUIRE([AM_PROG_CC_C_O])"
> fi
>
> However, since gnulib-comp.m4 is emitted before lib/Makefile.am and
> tests/Makefile.am, I don't think it would be possible for
> $uses_subdirs to be set.
Indeed, that's a bug: func_emit_lib_Makefile_am is only invoked in line
6170/6172,
and func_emit_tests_Makefile_am is only invoked in 6203, which is *after*
line 6030.
This bug was introduced on 2022-03-01, in the commit
"Create lib/Makefile.am after gnulib-comp.m4".
Basically:
- With --gnu-make, func_emit_lib_Makefile_am invokes autoconf, in order to
get the list of AC_SUBSTed variables, and that requires gnulib-comp.m4 to
be present.
- Without --gnu-make, it's the other way around: we need
func_emit_lib_Makefile_am to be executed first, in order to set
uses_subdirs,
which is used for the contents of gnulib-comp.m4.
The simplest way out is what I wrote in [3]:
"We have a lot of bug workaround code for automake < 1.14 behaviour that
could be dropped. But let's wait a while for objections, before
considering to clean up things."
Two years have passed since then. It's time to drop the workaround code for
automake < 1.14.
Bruno
[1] maint-tools/end-of-life.txt
[2] https://repology.org/project/automake/versions
[3] https://lists.gnu.org/archive/html/bug-gnulib/2022-02/msg00017.html
2024-03-28 Bruno Haible <bruno@clisp.org>
gnulib-tool: Drop workarounds for Automake < 1.14.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00384.html>.
* gnulib-tool.sh (func_emit_lib_Makefile_am): Emit pkgdata_DATA
initialization always.
(func_emit_tests_Makefile_am): Likewise.
(func_import): Don't emit 'AC_REQUIRE([AM_PROG_CC_C_O])' into
gnulib-comp.m4.
(func_create_testdir): Don't emit AM_PROG_CC_C_O into configure.ac.
Bump required Automake version to 1.14.
(func_create_megatestdir): Bump required Automake version to 1.14.
* pygnulib/constants.py: Update comments.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Emit pkgdata_DATA
initialization always. Don't return uses_subdirs.
(GLEmiter.tests_Makefile_am): Likewise.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Don't emit
'AC_REQUIRE([AM_PROG_CC_C_O])'.
(GLImport.execute): Update.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't emit AM_PROG_CC_C_O
into configure.ac. Bump required Automake version to 1.14.
(GLMegaTestDir.execute): Bump required Automake version to 1.14.
diff --git a/gnulib-tool.sh b/gnulib-tool.sh
index ba9ee83e74..e0c8cfafbd 100755
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -48,7 +48,7 @@ nl='
'
IFS=" "" $nl"
-# You can set AUTOCONFPATH to empty if autoconf 2.64 is already in your PATH.
+# You can set AUTOCONFPATH to empty if autoconf ≥ 2.64 is already in your PATH.
AUTOCONFPATH=
#case $USER in
# bruno )
@@ -57,10 +57,10 @@ AUTOCONFPATH=
# ;;
#esac
-# You can set AUTOMAKEPATH to empty if automake 1.11 is already in your PATH.
+# You can set AUTOMAKEPATH to empty if automake ≥ 1.14 is already in your PATH.
AUTOMAKEPATH=
-# You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
+# You can set GETTEXTPATH to empty if autopoint ≥ 0.15 is already in your PATH.
GETTEXTPATH=
# You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH.
@@ -3763,8 +3763,6 @@ func_update_file ()
# Input/Output:
# - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
# list of edits to be done to Makefile.am variables
-# Output:
-# - uses_subdirs nonempty if object files in subdirs exist
func_emit_lib_Makefile_am ()
{
# When using GNU make, or when creating an includable Makefile.am snippet,
@@ -3912,15 +3910,7 @@ func_emit_lib_Makefile_am ()
echo "noinst_HEADERS ="
echo "noinst_LIBRARIES ="
echo "noinst_LTLIBRARIES ="
- # Automake versions < 1.11.4 create an empty pkgdatadir at
- # installation time if you specify pkgdata_DATA to empty.
- # See automake bugs #10997 and #11030:
- # * https://debbugs.gnu.org/10997
- # * https://debbugs.gnu.org/11030
- # So we need this workaround.
- if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
- echo "pkgdata_DATA ="
- fi
+ echo "pkgdata_DATA ="
echo "EXTRA_DIST ="
echo "BUILT_SOURCES ="
echo "SUFFIXES ="
@@ -4161,8 +4151,6 @@ func_emit_po_POTFILES_in ()
# Input/Output:
# - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val,dotfirst}
# list of edits to be done to Makefile.am variables
-# Output:
-# - uses_subdirs nonempty if object files in subdirs exist
func_emit_tests_Makefile_am ()
{
witness_macro="$1"
@@ -4332,15 +4320,7 @@ func_emit_tests_Makefile_am ()
echo "check_LIBRARIES = libtests.a"
fi
fi
- # Automake versions < 1.11.4 create an empty pkgdatadir at
- # installation time if you specify pkgdata_DATA to empty.
- # See automake bugs #10997 and #11030:
- # * https://debbugs.gnu.org/10997
- # * https://debbugs.gnu.org/11030
- # So we need this workaround.
- if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets "$tmp"/longrunning_snippets
> /dev/null; then
- echo "pkgdata_DATA ="
- fi
+ echo "pkgdata_DATA ="
echo "EXTRA_DIST ="
echo "BUILT_SOURCES ="
echo "SUFFIXES ="
@@ -6027,9 +6007,6 @@ s,//*$,/,'
func_emit_pre_early_macros : ' ' "$final_modules"
- if ! $gnu_make && test -n "$uses_subdirs"; then
- echo " AC_REQUIRE([AM_PROG_CC_C_O])"
- fi
for module in $final_modules; do
func_verify_module
if test -n "$module"; then
@@ -6682,7 +6659,6 @@ func_create_testdir ()
modules="$main_modules"
fi
func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
- any_uses_subdirs="$uses_subdirs"
# Create $m4base/Makefile.am.
mkdir -p "$testdir/$m4base"
@@ -6724,7 +6700,6 @@ func_create_testdir ()
use_libtests=false
destfile="$testsbase/Makefile.am"
func_emit_tests_Makefile_am "" > "$testdir/$testsbase/Makefile.am"
- any_uses_subdirs="$any_uses_subdirs$uses_subdirs"
# Create $testsbase/configure.ac.
(echo "# Process this file with autoconf to produce a configure script."
echo "AC_INIT([dummy], [0])"
@@ -6739,10 +6714,6 @@ func_create_testdir ()
func_emit_pre_early_macros false '' "$modules"
- if test -n "$uses_subdirs"; then
- echo "AM_PROG_CC_C_O"
- echo
- fi
for module in $modules; do
func_verify_module
if test -n "$module"; then
@@ -6822,7 +6793,7 @@ func_create_testdir ()
# Create Makefile.am.
(echo "## Process this file with automake to produce Makefile.in."
echo
- echo "AUTOMAKE_OPTIONS = 1.11 foreign"
+ echo "AUTOMAKE_OPTIONS = 1.14 foreign"
echo
echo "SUBDIRS = $subdirs"
echo
@@ -6854,10 +6825,6 @@ func_create_testdir ()
func_emit_pre_early_macros false '' "$final_modules"
- if test -n "$any_uses_subdirs"; then
- echo "AM_PROG_CC_C_O"
- echo
- fi
for module in $final_modules; do
if $single_configure; then
func_verify_module
@@ -7152,7 +7119,7 @@ func_create_megatestdir ()
# Create Makefile.am.
(echo "## Process this file with automake to produce Makefile.in."
echo
- echo "AUTOMAKE_OPTIONS = 1.11 foreign"
+ echo "AUTOMAKE_OPTIONS = 1.14 foreign"
echo
echo "SUBDIRS = $megasubdirs"
echo
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index efde78823d..0bfbfe10e3 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -698,9 +698,8 @@ AC_DEFUN([%V1%_LIBSOURCES], [
return emit
def lib_Makefile_am(self, destfile: str, modules: list[GLModule],
moduletable: GLModuleTable,
- makefiletable: GLMakefileTable, actioncmd: str,
for_test: bool) -> tuple[str, bool]:
- '''Emit the contents of the library Makefile. Returns str and a bool
- variable which shows if subdirectories are used.
+ makefiletable: GLMakefileTable, actioncmd: str,
for_test: bool) -> str:
+ '''Emit the contents of the library Makefile. Returns it as a string.
GLConfig: localpath, sourcebase, libname, pobase, auxdir,
makefile_name, libtool,
macro_prefix, podomain, conddeps, witness_c_macro.
@@ -865,15 +864,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
emit += 'noinst_HEADERS =\n'
emit += 'noinst_LIBRARIES =\n'
emit += 'noinst_LTLIBRARIES =\n'
- # Automake versions < 1.11.4 create an empty pkgdatadir at
- # installation time if you specify pkgdata_DATA to empty.
- # See automake bugs #10997 and #11030:
- # * https://debbugs.gnu.org/10997
- # * https://debbugs.gnu.org/11030
- # So we need this workaround.
- pattern = re.compile(r'^pkgdata_DATA *\+=', re.M)
- if pattern.findall(allsnippets):
- emit += 'pkgdata_DATA =\n'
+ emit += 'pkgdata_DATA =\n'
emit += 'EXTRA_DIST =\n'
emit += 'BUILT_SOURCES =\n'
emit += 'SUFFIXES =\n'
@@ -1003,13 +994,11 @@ AC_DEFUN([%V1%_LIBSOURCES], [
emit += '\t-rm -f @%s_LIBOBJDEPS@\n' % (macro_prefix)
# Extend the 'maintainer-clean' rule.
emit += 'maintainer-clean-local: distclean-gnulib-libobjs\n'
- result = tuple([emit, uses_subdirs])
- return result
+ return emit
def tests_Makefile_am(self, destfile: str, modules: list[GLModule],
moduletable: GLModuleTable,
- makefiletable: GLMakefileTable, witness_macro: str,
for_test: bool) -> tuple[str, bool]:
- '''Emit the contents of the tests Makefile. Returns str and a bool
variable
- which shows if subdirectories are used.
+ makefiletable: GLMakefileTable, witness_macro: str,
for_test: bool) -> str:
+ '''Emit the contents of the tests Makefile. Returns it as a string.
GLConfig: localpath, modules, libname, auxdir, makefile_name, libtool,
sourcebase, m4base, testsbase, macro_prefix, witness_c_macro,
single_configure, libtests.
@@ -1196,17 +1185,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [
emit += 'noinst_LIBRARIES += libtests.a\n'
else: # if not for_test
emit += 'check_LIBRARIES = libtests.a\n'
-
- # Automake versions < 1.11.4 create an empty pkgdatadir at
- # installation time if you specify pkgdata_DATA to empty.
- # See automake bugs #10997 and #11030:
- # * https://debbugs.gnu.org/10997
- # * https://debbugs.gnu.org/11030
- # So we need this workaround.
- pattern = re.compile(r'^pkgdata_DATA *\+=', re.M)
- if pattern.findall(main_snippets) or pattern.findall(longrun_snippets):
- emit += 'pkgdata_DATA =\n'
-
+ emit += 'pkgdata_DATA =\n'
emit += 'EXTRA_DIST =\n'
emit += 'BUILT_SOURCES =\n'
emit += 'SUFFIXES =\n'
@@ -1327,5 +1306,4 @@ AC_DEFUN([%V1%_LIBSOURCES], [
emit += '\t fi; \\\n'
emit += '\tdone; \\\n'
emit += '\t:\n'
- result = tuple([emit, uses_subdirs])
- return result
+ return emit
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 07be6742a1..5137f07e37 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -648,16 +648,6 @@ AC_DEFUN([%s_EARLY],
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable\n''' % (configure_ac,
macro_prefix)
emit += self.emitter.preEarlyMacros(True, ' ', moduletable['final'])
- uses_subdirs = False
- for module in moduletable['main']:
- # Test whether there are some source files in subdirectories.
- for file in module.getFiles():
- if (file.startswith('lib/') and file.endswith('.c')
- and file.count('/') > 1):
- uses_subdirs = True
- break
- if not gnu_make and uses_subdirs:
- emit += ' AC_REQUIRE([AM_PROG_CC_C_O])\n'
for module in moduletable['final']:
emit += ' # Code from module %s:\n' % str(module)
snippet = module.getAutoconfEarlySnippet()
@@ -1330,9 +1320,9 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
# can run 'autoconf -t', which reads gnulib-comp.m4.
basename = joinpath(sourcebase, source_makefile_am)
tmpfile = self.assistant.tmpfilename(basename)
- emit, uses_subdirs = self.emitter.lib_Makefile_am(basename,
-
self.moduletable['main'], self.moduletable, self.makefiletable,
- actioncmd, for_test)
+ emit = self.emitter.lib_Makefile_am(basename,
+ self.moduletable['main'],
self.moduletable, self.makefiletable,
+ actioncmd, for_test)
if automake_subdir:
emit = sp.run([joinpath(DIRS['root'],
'build-aux/prefix-gnulib-mk'), '--from-gnulib-tool',
f'--lib-name={libname}', f'--prefix={sourcebase}/'],
@@ -1358,9 +1348,9 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
if gentests:
basename = joinpath(testsbase, tests_makefile_am)
tmpfile = self.assistant.tmpfilename(basename)
- emit, uses_subdirs = self.emitter.tests_Makefile_am(basename,
-
self.moduletable['tests'], self.moduletable, self.makefiletable,
-
'%stests_WITNESS' % macro_prefix, for_test)
+ emit = self.emitter.tests_Makefile_am(basename,
+ self.moduletable['tests'],
self.moduletable, self.makefiletable,
+ '%stests_WITNESS' %
macro_prefix, for_test)
with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
file.write(emit)
filename, backup, flag = self.assistant.super_update(basename,
tmpfile)
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index aa9a6b82ea..57fbef7b06 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -396,14 +396,13 @@ class GLTestDir(object):
os.mkdir(directory)
destfile = joinpath(directory, 'Makefile.am')
if single_configure:
- emit, uses_subdirs = self.emitter.lib_Makefile_am(destfile,
main_modules,
- moduletable,
self.makefiletable, '', for_test)
+ emit = self.emitter.lib_Makefile_am(destfile, main_modules,
+ moduletable,
self.makefiletable, '', for_test)
else: # if not single_configure
- emit, uses_subdirs = self.emitter.lib_Makefile_am(destfile,
modules,
- moduletable,
self.makefiletable, '', for_test)
+ emit = self.emitter.lib_Makefile_am(destfile, modules,
+ moduletable,
self.makefiletable, '', for_test)
with codecs.open(destfile, 'wb', 'UTF-8') as file:
file.write(emit)
- any_uses_subdirs = uses_subdirs
# Create $m4base/Makefile.am.
directory = joinpath(self.testdir, m4base)
@@ -433,8 +432,8 @@ class GLTestDir(object):
# Create $testsbase/Makefile.am.
destfile = joinpath(directory, 'Makefile.am')
witness_macro = '%stests_WITNESS' % macro_prefix
- emit, uses_subdirs = self.emitter.tests_Makefile_am(destfile,
tests_modules, moduletable,
-
self.makefiletable, witness_macro, for_test)
+ emit = self.emitter.tests_Makefile_am(destfile, tests_modules,
moduletable,
+ self.makefiletable,
witness_macro, for_test)
with codecs.open(destfile, 'wb', 'UTF-8') as file:
file.write(emit)
else: # if not single_configure
@@ -442,8 +441,8 @@ class GLTestDir(object):
destfile = joinpath(directory, 'Makefile.am')
libtests = False
self.config.setLibtests(False)
- emit, uses_subdirs = self.emitter.tests_Makefile_am(destfile,
modules, moduletable,
-
self.makefiletable, '', for_test)
+ emit = self.emitter.tests_Makefile_am(destfile, modules,
moduletable,
+ self.makefiletable, '',
for_test)
with codecs.open(destfile, 'wb', 'UTF-8') as file:
file.write(emit)
# Viewed from the $testsbase subdirectory, $auxdir is
different.
@@ -462,8 +461,6 @@ class GLTestDir(object):
emit += 'AC_PROG_INSTALL\n'
emit += 'AC_PROG_MAKE_SET\n'
emit += self.emitter.preEarlyMacros(False, '', modules)
- if uses_subdirs:
- emit += 'AM_PROG_CC_C_O\n\n'
snippets = list()
for module in modules:
if str(module) in ['gnumakefile', 'maintainer-makefile']:
@@ -552,7 +549,7 @@ class GLTestDir(object):
# Create Makefile.am.
emit = '## Process this file with automake to produce Makefile.in.\n\n'
- emit += 'AUTOMAKE_OPTIONS = 1.11 foreign\n\n'
+ emit += 'AUTOMAKE_OPTIONS = 1.14 foreign\n\n'
emit += 'SUBDIRS = %s\n\n' % ' '.join(subdirs)
emit += 'ACLOCAL_AMFLAGS = -I %s\n' % m4base
emit = constants.nlconvert(emit)
@@ -579,9 +576,6 @@ class GLTestDir(object):
emit += 'm4_pattern_allow([^gl_LIBOBJS$])dnl a variable\n'
emit += 'm4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable\n'
emit += self.emitter.preEarlyMacros(False, '', modules)
- if any_uses_subdirs:
- emit += 'AM_PROG_CC_C_O\n'
- emit += '\n'
snippets = list()
for module in final_modules:
if single_configure:
@@ -1012,7 +1006,7 @@ class GLMegaTestDir(object):
# Create Makefile.am.
emit = '## Process this file with automake to produce Makefile.in.\n\n'
- emit += 'AUTOMAKE_OPTIONS = 1.11 foreign\n\n'
+ emit += 'AUTOMAKE_OPTIONS = 1.14 foreign\n\n'
emit += 'SUBDIRS = %s\n\n' % ' '.join(megasubdirs)
emit += 'EXTRA_DIST = do-autobuild\n'
emit = constants.nlconvert(emit)
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index dd20624fe8..16a60d1d3d 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -125,11 +125,11 @@ TESTS = \
# Define AUTOCONF minimum version
DEFAULT_AUTOCONF_MINVERSION = 2.64
-# You can set AUTOCONFPATH to empty if autoconf 2.64 is already in your PATH
+# You can set AUTOCONFPATH to empty if autoconf ≥ 2.64 is already in your PATH
AUTOCONFPATH = ''
-# You can set AUTOMAKEPATH to empty if automake 1.11 is already in your PATH
+# You can set AUTOMAKEPATH to empty if automake ≥ 1.14 is already in your PATH
AUTOMAKEPATH = ''
-# You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH
+# You can set GETTEXTPATH to empty if autopoint ≥ 0.15 is already in your PATH
GETTEXTPATH = ''
# You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH
LIBTOOLPATH = ''