From e7c14d967b5bfa587c4a9fc847126b39198b7463 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 19 Dec 2014 15:10:09 +0100 Subject: Improve detection of GNU make, avoiding "Arg list too long" errors. Such errors could take place when the main makefile included too many sub-makefiles, making $(MAKEFILE_LIST) too long and causing the recipes $(am__is_gnu_make) to exceed the shell's command-line length limits. This is not a theoretical issue: it could happen for projects having lots of C/C++ sources and using automatic dependency tracking, which created an included .Po sub-makefile for each of such sources. Fixes http://debbugs.gnu.org/18744 * lib/am/header-vars.am (am__is_gnu_make): Fix the logic to avoid the use of $(MAKEFILE_LIST). * NEWS: Update. Signed-off-by: Stefano Lattarini --- NEWS | 5 +++++ lib/am/header-vars.am | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 626d295ac..bdc9bb9ab 100644 --- a/NEWS +++ b/NEWS @@ -111,6 +111,11 @@ New in 1.14.2: - The expansion of AM_INIT_AUTOMAKE ends once again with a trailing newline (bug#16841). Regression introduced in Automake 1.14. + - The code used to detect whether the currently used make is GNU make + or not (relying on the private macro 'am__is_gnu_make') no longer + risks causing "Arg list too long" for projects using automatic + dependency tracking and having a ton of source files (bug#18744). + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.14.1: diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am index d25efa612..9283903a1 100644 --- a/lib/am/header-vars.am +++ b/lib/am/header-vars.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994-2013 Free Software Foundation, Inc. +## Copyright (C) 1994-2014 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -27,9 +27,36 @@ VPATH = @srcdir@ ## DESTDIR = ## Shell code that determines whether we are running under GNU make. -## This is somewhat of an hack, and might be improved, but is good -## enough for now. -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +## +## Why the this needs to be so convoluted? +## +## (1) We can't unconditionally use make functions or special variables +## starting with a dot, as those cause non-GNU implmentations to +## crash hard. +## +## (2) We can't use $(MAKE_VERSION) here, as it is also defined in some +## non-GNU make implementations (e.g., FreeBSD make). But at least +## BSD make does *not* define the $(CURDIR) variable -- it uses +## $(.CURDIR) instead. +## +## (3) We can't use $(MAKEFILE_LIST) here, as in some situations it +## might cause the shell to die with "Arg list too long" (see +## automake bug#18744). +## +## (4) We can't use $(MAKE_HOST) unconditionally, as it is only +## defined in GNU make 4.0 or later. +## +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} ## Shell code that determines whether the current make instance is ## running with a given one-letter option (e.g., -k, -n) that takes -- cgit v1.2.1 From 5401c31d27b6bdafe0246cf780830717af44188e Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Fri, 7 Nov 2014 23:41:28 +0900 Subject: PATH: quote $(PATH_SEPARATOR) as well On OS/2, $(PATH_SEPARATOR) is ';'. Without quote, it is recognized as a mark of end of sentence. * Makefile.am: quote $(PATH_SEPARATOR) as well. * t/Makefile.inc: Likewise. Copyright-paperwork-exempt: yes Signed-off-by: Stefano Lattarini --- Makefile.am | 2 +- t/Makefile.inc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 143308a11..8501e2a0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,7 +72,7 @@ generated_file_finalize = $(AM_V_at) \ # For some tests or targets, we need to have the just-build automake and # aclocal scripts avaiable on PATH. extend_PATH = \ - { PATH='$(abs_builddir)/t/wrap'$(PATH_SEPARATOR)$$PATH && export PATH; } + { PATH='$(abs_builddir)/t/wrap$(PATH_SEPARATOR)'$$PATH && export PATH; } # The master location for INSTALL is lib/INSTALL. # This is where "make fetch" will install new versions. diff --git a/t/Makefile.inc b/t/Makefile.inc index b67f3a581..e4fe06c27 100644 --- a/t/Makefile.inc +++ b/t/Makefile.inc @@ -64,9 +64,9 @@ AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_; # in case it is given with a relative name containing no slashes. AM_TESTS_ENVIRONMENT += \ if test $(srcdir) != .; then \ - PATH='$(abs_srcdir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \ + PATH='$(abs_srcdir)/%D%/ax$(PATH_SEPARATOR)'$$PATH; \ fi; \ - PATH='$(abs_builddir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \ + PATH='$(abs_builddir)/%D%/ax$(PATH_SEPARATOR)'$$PATH; \ export PATH; # Hand-written tests. -- cgit v1.2.1 From 3c72ada8d048c6d92a6fd323f6647c8e090dd7a6 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Wed, 30 Jul 2014 17:41:15 +0100 Subject: When computing lispdir, don't load emacs site wide init file. When computing the lispdir emacs was previously invoked with the '-q' option to avoid loading the users initialisation files, however, the site wide initialisation file was still loaded, in some cases this can cause emacs to hang, with the result that a configure can also hang. The lisp code that aclocal causes to be executed reduces the load-path list (in emacs) to empty. The load-path is used by emacs to find packages which it wants to load. Currently, if emacs tries to auto load a package during shut down, and the package is not found, then emacs will hang. This does seem like an emacs bug, but protecting against this in aclocal is simply a case of not loading the site wide initialisation file. In this patch then the '-q' option to emacs is replaced with '-Q', this has the same, the '-Q' option is similar to '-q --no-site-file --no-splash'. * doc/automake.texi (Hard-Coded Install Paths): Update explanation of emacs code used to get lispdir. * m4/lispdir.m4 (AM_PATH_LISPDIR): Update emacs flags. Copyright-paperwork-exempt: yes Signed-off-by: Stefano Lattarini --- doc/automake.texi | 2 +- m4/lispdir.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/automake.texi b/doc/automake.texi index 913dee4f0..e690d52b7 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -12991,7 +12991,7 @@ instance, here is how @code{AM_PATH_LISPDIR} (@pxref{Emacs Lisp}) computes @samp{$(lispdir)}: @example -$EMACS -batch -q -eval '(while load-path +$EMACS -batch -Q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' >conftest.out lispdir=`sed -n diff --git a/m4/lispdir.m4 b/m4/lispdir.m4 index 4e0c9140d..ed2e224c2 100644 --- a/m4/lispdir.m4 +++ b/m4/lispdir.m4 @@ -34,7 +34,7 @@ AC_DEFUN([AM_PATH_LISPDIR], # which is non-obvious for non-emacs users. # Redirecting /dev/null should help a bit; pity we can't detect "broken" # emacsen earlier and avoid running this altogether. - AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out]) + AC_RUN_LOG([$EMACS -batch -Q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out]) am_cv_lispdir=`sed -n \ -e 's,/$,,' \ -e '/.*\/lib\/x*emacs\/site-lisp$/{s,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \ -- cgit v1.2.1 From cfc6916ef499014b71e874924f1077e8c0604f89 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 22 Dec 2014 12:39:05 +0100 Subject: maint: make output of 'gen-testsuite-part' deterministic So that diffs displayed by the 'compare-autodiffs' target are less spurious and more useful. * gen-testsuite-part: Sort keys of %deps_extractor, %wrapper_setups and %depmodes before iterating on them. Signed-off-by: Stefano Lattarini --- gen-testsuite-part | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gen-testsuite-part b/gen-testsuite-part index 3bd5c9f01..32158bac2 100755 --- a/gen-testsuite-part +++ b/gen-testsuite-part @@ -297,8 +297,9 @@ foreach my $test (@all_tests) $wrapper_setups{$test} = \@setups if @setups; } # And now create all the wrapper tests. -while (my ($wrapped_test, $setup_list) = each %wrapper_setups) +for my $wrapped_test (sort keys %wrapper_setups) { + my $setup_list = $wrapper_setups{$wrapped_test}; (my $base = $wrapped_test) =~ s/\.([^.]*)$//; my $suf = $1 or die "$me: test '$wrapped_test' lacks a suffix\n"; my $count = 0; @@ -359,7 +360,7 @@ my %depmodes = foreach my $lt (TRUE, FALSE) { - foreach my $m (keys %depmodes) + foreach my $m (sort keys %depmodes) { my $planned = ($lt && $m eq "auto") ? 84 : 28; my @required = @@ -414,8 +415,9 @@ print <{dist_prereqs} || ""; my $nodist_prereqs = $x->{nodist_prereqs} || ""; my @tests = grep { line_match $x->{line_matcher}, $_ } @all_tests; -- cgit v1.2.1 From 986a82e394ee7d8284e67e4d6bc3585daf485ac3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 22 Dec 2014 16:59:38 +0100 Subject: tests: refactor some tests on DIST_COMMON So that they prefer checking the semantics of the generated Makefiles, rather than grepping their content. This will be useful in an upcoming refactoring. * t/distcom-subdir.sh: Adjust this test. * t/distcom2.sh: And this. * t/distcom3.sh: And this. * t/distcom4.sh: And this. * t/distcom5.sh: And this. Signed-off-by: Stefano Lattarini --- t/distcom-subdir.sh | 53 +++++++++++++++++++++++----------------------- t/distcom2.sh | 14 +++++------- t/distcom3.sh | 24 ++++++++++----------- t/distcom4.sh | 30 ++++++++------------------ t/distcom5.sh | 44 ++++++++++++++------------------------ t/hdr-vars-defined-once.sh | 25 ++++++++++------------ 6 files changed, 79 insertions(+), 111 deletions(-) diff --git a/t/distcom-subdir.sh b/t/distcom-subdir.sh index b3651f1cd..df40f96cd 100644 --- a/t/distcom-subdir.sh +++ b/t/distcom-subdir.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,59 +17,60 @@ # Test to make sure that if an auxfile (here depcomp) is required # by a subdir Makefile.am, it is distributed by that Makefile.am. +required=cc . test-init.sh cat >> configure.ac << 'END' AC_CONFIG_FILES([subdir/Makefile]) AC_PROG_CC +AC_PROG_FGREP AC_OUTPUT END cat > Makefile.am << 'END' SUBDIRS = subdir +test-distdir: distdir + test -f $(distdir)/depcomp +.PHONY: test-distdir +check-local: test-distdir END rm -f depcomp mkdir subdir -: > subdir/Makefile.am +cat > subdir/Makefile.am << 'END' +.PHONY: test-distcom +test-distcom: + echo ' ' $(DIST_COMMON) ' ' | $(FGREP) ' $(top_srcdir)/depcomp ' +END $ACLOCAL $AUTOCONF $AUTOMAKE test ! -e depcomp -cat > subdir/Makefile.am << 'END' +cat >> subdir/Makefile.am << 'END' bin_PROGRAMS = foo +.PHONY: test-distcom +test-distcom: + echo ' ' $(DIST_COMMON) ' ' | $(FGREP) ' $(top_srcdir)/depcomp ' +check-local: test-distcom END -: > subdir/foo.c +cat > subdir/foo.c <<'END' +int main (void) +{ + return 0; +} +END $AUTOMAKE -a subdir/Makefile test -f depcomp -# FIXME: the logic of this check and other similar ones in other -# FIXME: 'distcom*.sh' files should be factored out in a common -# FIXME: subroutine in 'am-test-lib.sh'... -sed -n -e " - /^DIST_COMMON =.*\\\\$/ { - :loop - p - n - t clear - :clear - s/\\\\$/\\\\/ - t loop - s/$/ / - s/[$tab ][$tab ]*/ /g - p - n - }" subdir/Makefile.in > dc.txt -cat dc.txt -$FGREP ' $(top_srcdir)/depcomp ' dc.txt - ./configure -$MAKE distdir -test -f $distdir/depcomp +(cd subdir && $MAKE test-distcom) +$MAKE test-distdir + +$MAKE distcheck : diff --git a/t/distcom2.sh b/t/distcom2.sh index 1f39b6679..0cb9307d4 100644 --- a/t/distcom2.sh +++ b/t/distcom2.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,22 +51,18 @@ for opt in '' --no-force; do test -f depcomp for dir in . subdir; do - # FIXME: the logic of this check and other similar ones in other - # FIXME: 'distcom*.sh' files should be factored out in a common - # FIXME: subroutine in 'am-test-lib.sh'... sed -n -e " - /^DIST_COMMON =.*\\\\$/ { + /^\\(am__\\)\\?DIST_COMMON =.*/ { + b body :loop - p n - t clear - :clear + :body + p s/\\\\$/\\\\/ t loop s/$/ / s/[$tab ][$tab ]*/ /g p - n }" $dir/Makefile.in > $dir/dc.txt done diff --git a/t/distcom3.sh b/t/distcom3.sh index d5dc295c5..6f1ebaf3a 100644 --- a/t/distcom3.sh +++ b/t/distcom3.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,9 +19,13 @@ . test-init.sh +echo AC_OUTPUT >> configure.ac + cat > Makefile.am << 'END' README: echo 'I bet you are reading me.' > README +test-distcommon: + echo ' ' $(DIST_COMMON) ' ' | grep ' README ' END # Files required by '--gnu'. @@ -36,20 +40,14 @@ $AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; exit 1; } cat output grep README output && exit 1 -sed -n -e '/^DIST_COMMON =.*\\$/ { - :loop - p - n - t clear - :clear - s/\\$/\\/ - t loop - p - n - }' -e '/^DIST_COMMON =/ p' Makefile.in | grep README - +$AUTOCONF +./configure +$MAKE test-distcommon +$MAKE distdir +test -f $distdir/README # Should warn about missing README. +rm -f README : > Makefile.am AUTOMAKE_fails --add-missing --gnu grep 'required file.*README.*not found' stderr diff --git a/t/distcom4.sh b/t/distcom4.sh index 3febb61e8..39b5b7179 100644 --- a/t/distcom4.sh +++ b/t/distcom4.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,8 +43,13 @@ mkdir tests : > README : > tests/wrapper.in cat > Makefile.am << 'END' -.PHONY: test -test: distdir +.PHONY: test1 test 2 +test1: + for x in $(DIST_COMMON); do echo $$x; done \ + | grep 'tests/' > lst + cat lst # For debugging. + test `wc -l dc.txt - -cat dc.txt # For debugging. - -test 1 -eq $(grep -c tests dc.txt) -grep configure dc.txt +$MAKE test1 test2 : diff --git a/t/distcom5.sh b/t/distcom5.sh index 72f51869f..939702f14 100644 --- a/t/distcom5.sh +++ b/t/distcom5.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,21 +21,6 @@ . test-init.sh -extract_distcommon () -{ - sed -n -e '/^DIST_COMMON =.*\\$/ { - :loop - p - n - t clear - :clear - s/\\$/\\/ - t loop - p - n - }' -e '/^DIST_COMMON =/ p' ${1+"$@"} -} - cat >> configure.ac << 'END' AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in], [chmod +x tests/autoconf]) @@ -57,28 +42,31 @@ END mkdir tests : > tests/wrapper.in -: > tests/Makefile.am + cat > Makefile.am << 'END' SUBDIRS = tests .PHONY: test test: distdir test -f $(distdir)/tests/wrapper.in +check-local: test + for x in $(DIST_COMMON); do echo $$x; done \ + | grep tests && exit 1; : +END + +cat > tests/Makefile.am <<'END' +check-local: + for x in $(DIST_COMMON); do echo $$x; done \ + | grep wrapper.in > lst + cat lst # For debugging. + test `wc -l top.txt -extract_distcommon tests/Makefile.in > inner.txt - -# Might be useful for debugging. -cat top.txt -cat inner.txt - -test 0 -eq $(grep -c tests top.txt) -test 1 -eq $(grep -c wrapper inner.txt) +$MAKE check +# Sanity check. +test -f tests/lst : diff --git a/t/hdr-vars-defined-once.sh b/t/hdr-vars-defined-once.sh index 91fbcb63b..fdf0bb76d 100644 --- a/t/hdr-vars-defined-once.sh +++ b/t/hdr-vars-defined-once.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,25 +25,22 @@ END cat > Makefile.am << 'END' include Will_Be_Included_In_Makefile +test-distcommon: + echo ' ' $(DIST_COMMON) ' ' \ + | grep '[ /]Will_Be_Included_In_Makefile ' END -: > Will_Be_Included_In_Makefile +id=0c35bbde7c95b569a +echo "# $id" > Will_Be_Included_In_Makefile $ACLOCAL $AUTOMAKE test $(grep -c '^srcdir' Makefile.in) -eq 1 -# Also make sure include file is distributed. -sed -n -e '/^DIST_COMMON =.*\\$/ { - :loop - p - n - t clear - :clear - s/\\$/\\/ - t loop - p - n - }' -e '/^DIST_COMMON =/ p' Makefile.in | grep Will_Be_Included_In_Makefile +$AUTOCONF +./configure +$MAKE test-distcommon +$MAKE distdir +grep "$id" $distdir/Will_Be_Included_In_Makefile : -- cgit v1.2.1 From 2c0ffb86f2c7df3476cb9bc5a6e6ff724d95aa01 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 22 Dec 2014 11:20:14 +0100 Subject: dist: ordering of files in DIST_COMMON is deterministic now It had likely stopped being deterministic due to the new perl behavior of having non-deterministic order of numerating hash keys: See also similar commit v1.14-19-g52e6404, albeit in this case the issue is likely coming from autom4te/autoconf, not from automake itself. Fixes automake bug http://debbugs.gnu.org/17908 * bin/automake.in (handle_dist): Sort @dist_common. (print_autodist_files): Swap invocations of 'sort' and 'uniq', for consistency with the new code in 'handle_dist' and to get rid of a minor hack. * NEWS: Update. Signed-off-by: Stefano Lattarini --- NEWS | 6 +++++- bin/automake.in | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index bdc9bb9ab..f4c835e7a 100644 --- a/NEWS +++ b/NEWS @@ -116,6 +116,10 @@ New in 1.14.2: risks causing "Arg list too long" for projects using automatic dependency tracking and having a ton of source files (bug#18744). + - Automake tries to offer a more deterministic output for generated + Makefiles, in the face of the newly-introduced randomization for + hash keys order in Perl 5.18. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.14.1: @@ -131,7 +135,7 @@ New in 1.14.1: was only relevant when the number of python files was high (which is unusual in practice). - - Automake try to offer a more reproducible output for warning messages, + - Automake try to offer a more deterministic output for warning messages, in the face of the newly-introduced randomization for hash keys order in Perl 5.18. diff --git a/bin/automake.in b/bin/automake.in index 283d1bbfe..785145498 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -3714,10 +3714,13 @@ sub handle_dist () } } - # Files to distributed. Don't use ->value_as_list_recursive - # as it recursively expands '$(dist_pkgdata_DATA)' etc. + # Files to distributed. Don't use ->value_as_list_recursive as it + # recursively expands '$(dist_pkgdata_DATA)' etc. + # Use 'sort' so that the expansion of $(DIST_COMMON) in the generated + # Makefile is deterministic, in face of m4 and/or perl randomizations + # (see automake bug#17908). my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value); - @dist_common = uniq (@dist_common); + @dist_common = uniq (sort @dist_common); variable_delete 'DIST_COMMON'; define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common); @@ -7883,10 +7886,7 @@ sub generate_makefile # Helper function for usage(). sub print_autodist_files { - # NOTE: we need to call our 'uniq' function with the leading '&' - # here, because otherwise perl complains that "Unquoted string - # 'uniq' may clash with future reserved word". - my @lcomm = sort (&uniq (@_)); + my @lcomm = uniq (sort @_); my @four; format USAGE_FORMAT = -- cgit v1.2.1 From 912383451a4a394383a8e95240e3e98ee68faf72 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 22 Dec 2014 13:39:30 +0100 Subject: cleanup: refactor code to initialize DIST_COMMON There is not need to make that an Automake variable early, only to later get and munge its contents, and use the new content to redefine the variable. * bin/automake.in (@dist_common): New global variable. (push_dist_common, handle_dist): Use it. (handle_dist): Define am__DIST_COMMON instead of DIST_COMMON directly. (initialize_per_input): Reset it to empty. ($configure_dist_common): Turn this scalar variable ... (@configure_dist_common): ... into this array variable. (handle_dist): Adjust. (required_file_check_or_copy): Update and wrap some comments. * lib/am/distdir.am (DIST_COMMON): Append $(am__DIST_COMMON). * t/distcom2.sh: Tighten a little. Signed-off-by: Stefano Lattarini --- bin/automake.in | 48 ++++++++++++++++++++++++------------------------ lib/am/distdir.am | 1 + t/distcom2.sh | 2 +- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/bin/automake.in b/bin/automake.in index 785145498..d48b2863d 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -342,7 +342,7 @@ my %extension_map = (); # List of the DIST_COMMON files we discovered while reading # configure.ac. -my $configure_dist_common = ''; +my @configure_dist_common = (); # This maps languages names onto objects. my %languages = (); @@ -489,6 +489,9 @@ my %language_scratch; # handling on a per-language basis. my %lang_specific_files; +# List of distributed files to be put in DIST_COMMON. +my @dist_common; + # This is set when 'handle_dist' has finished. Once this happens, # we should no longer push on dist_common. my $handle_dist_run; @@ -586,8 +589,11 @@ sub initialize_per_input () @dist_targets = (); + @dist_common = (); + $handle_dist_run = 0; + %known_programs = (); - %known_libraries= (); + %known_libraries = (); %extension_seen = (); @@ -595,8 +601,6 @@ sub initialize_per_input () %lang_specific_files = (); - $handle_dist_run = 0; - $need_link = 0; $must_handle_compiled_objects = 0; @@ -3693,8 +3697,8 @@ sub handle_dist () } } - # We might copy elements from $configure_dist_common to - # %dist_common if we think we need to. If the file appears in our + # We might copy elements from @configure_dist_common to + # @dist_common if we think we need to. If the file appears in our # directory, we would have discovered it already, so we don't # check that. But if the file is in a subdir without a Makefile, # we want to distribute it here if we are doing '.'. Ugly! @@ -3706,26 +3710,25 @@ sub handle_dist () # See also automake bug#9651. if ($relative_dir eq '.') { - foreach my $file (split (' ' , $configure_dist_common)) + foreach my $file (@configure_dist_common) { my $dir = dirname ($file); push_dist_common ($file) if ($dir eq '.' || ! is_make_dir ($dir)); } + @configure_dist_common = (); } - # Files to distributed. Don't use ->value_as_list_recursive as it - # recursively expands '$(dist_pkgdata_DATA)' etc. + # $(am__DIST_COMMON): files to be distributed automatically. Will be + # appended to $(DIST_COMMON) in the generated Makefile. # Use 'sort' so that the expansion of $(DIST_COMMON) in the generated # Makefile is deterministic, in face of m4 and/or perl randomizations # (see automake bug#17908). - my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value); - @dist_common = uniq (sort @dist_common); - variable_delete 'DIST_COMMON'; - define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common); + define_pretty_variable ('am__DIST_COMMON', TRUE, INTERNAL, + uniq (sort @dist_common)); - # Now that we've processed DIST_COMMON, disallow further attempts - # to set it. + # Now that we've processed @dist_common, disallow further attempts + # to modify it. $handle_dist_run = 1; $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; @@ -5435,8 +5438,7 @@ sub scan_autoconf_files () if -f $config_aux_dir . '/install.sh'; # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; - + @configure_dist_common = @dist_common; } ################################################################ @@ -7402,11 +7404,10 @@ sub required_file_check_or_copy return if $found_it && (! $add_missing || ! $force_missing); - # If we've already looked for it, we're done. You might - # wonder why we don't do this before searching for the - # file. If we do that, then something like - # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into - # DIST_COMMON. + # If we've already looked for it, we're done. You might wonder why we + # don't do this before searching for the file. If we do that, then + # something like AC_OUTPUT([subdir/foo foo]) will fail to put 'foo.in' + # into $(DIST_COMMON). if (! $found_it) { return if defined $required_file_not_found{$fullfile}; @@ -7693,8 +7694,7 @@ sub push_dist_common { prog_error "push_dist_common run after handle_dist" if $handle_dist_run; - Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", - '', INTERNAL, VAR_PRETTY); + push @dist_common, @_; } diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 0c019605c..5a13055fc 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -14,6 +14,7 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . +DIST_COMMON += $(am__DIST_COMMON) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) if %?TOPDIR_P% diff --git a/t/distcom2.sh b/t/distcom2.sh index 0cb9307d4..3eb03762d 100644 --- a/t/distcom2.sh +++ b/t/distcom2.sh @@ -52,7 +52,7 @@ for opt in '' --no-force; do for dir in . subdir; do sed -n -e " - /^\\(am__\\)\\?DIST_COMMON =.*/ { + /^am__DIST_COMMON =.*/ { b body :loop n -- cgit v1.2.1