summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2014-12-22 17:56:22 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2014-12-22 17:56:22 +0100
commit88ac92b2d5beaf4aee7d7bb4f3dc9a86da823550 (patch)
tree16c1527969be06b21275e997f559333b738c8be5
parent4179284a3de093f3578a67c9b258a0d91eb4b6be (diff)
parent912383451a4a394383a8e95240e3e98ee68faf72 (diff)
downloadautomake-88ac92b2d5beaf4aee7d7bb4f3dc9a86da823550.tar.gz
Merge branch 'micro' into minor
* micro: cleanup: refactor code to initialize DIST_COMMON dist: ordering of files in DIST_COMMON is deterministic now tests: refactor some tests on DIST_COMMON maint: make output of 'gen-testsuite-part' deterministic When computing lispdir, don't load emacs site wide init file. PATH: quote $(PATH_SEPARATOR) as well Improve detection of GNU make, avoiding "Arg list too long" errors.
-rw-r--r--Makefile.am2
-rw-r--r--NEWS11
-rw-r--r--bin/automake.in56
-rw-r--r--doc/automake.texi2
-rwxr-xr-xgen-testsuite-part8
-rw-r--r--lib/am/distdir.am1
-rw-r--r--lib/am/header-vars.am33
-rw-r--r--m4/lispdir.m42
-rw-r--r--t/Makefile.inc4
-rw-r--r--t/distcom-subdir.sh51
-rw-r--r--t/distcom2.sh12
-rw-r--r--t/distcom3.sh22
-rw-r--r--t/distcom4.sh28
-rw-r--r--t/distcom5.sh42
-rw-r--r--t/hdr-vars-defined-once.sh23
15 files changed, 152 insertions, 145 deletions
diff --git a/Makefile.am b/Makefile.am
index 7e1c74800..ba4179cd4 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/NEWS b/NEWS
index 2e7f31fda..4d451fc2c 100644
--- a/NEWS
+++ b/NEWS
@@ -111,6 +111,15 @@ New in 1.15:
- We no longer risk to use '$ac_aux_dir' before it's defined (see
automake bug#15981). Bug 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).
+
+ - 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:
@@ -126,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 f9cc611a4..eedc8bcf1 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,23 +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.
- my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq (@dist_common);
- variable_delete 'DIST_COMMON';
- define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
+ # $(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).
+ 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';
@@ -5432,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;
}
################################################################
@@ -7399,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};
@@ -7690,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, @_;
}
@@ -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 =
diff --git a/doc/automake.texi b/doc/automake.texi
index 54f3bb3c0..fb6c05f1c 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -12971,7 +12971,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/gen-testsuite-part b/gen-testsuite-part
index 98f8c24da..46ae56d56 100755
--- a/gen-testsuite-part
+++ b/gen-testsuite-part
@@ -283,8 +283,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;
@@ -345,7 +346,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 =
@@ -400,8 +401,9 @@ print <<EOF;
EOF
-while (my ($k, $x) = each %deps_extractor)
+for my $k (sort keys %deps_extractor)
{
+ my $x = $deps_extractor{$k};
my $dist_prereqs = $x->{dist_prereqs} || "";
my $nodist_prereqs = $x->{nodist_prereqs} || "";
my @tests = grep { line_match $x->{line_matcher}, $_ } @all_tests;
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 7834f3db8..3441a7c98 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 <http://www.gnu.org/licenses/>.
+DIST_COMMON += $(am__DIST_COMMON)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
if %?TOPDIR_P%
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 463531a90..9283903a1 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -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
diff --git a/m4/lispdir.m4 b/m4/lispdir.m4
index 95a88da30..f1f2212f1 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)))' </dev/null >conftest.out])
+ AC_RUN_LOG([$EMACS -batch -Q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' </dev/null >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;}' \
diff --git a/t/Makefile.inc b/t/Makefile.inc
index 5f10d90ef..62613ac7d 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.
diff --git a/t/distcom-subdir.sh b/t/distcom-subdir.sh
index 257561ed8..df40f96cd 100644
--- a/t/distcom-subdir.sh
+++ b/t/distcom-subdir.sh
@@ -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 c13a6d711..3eb03762d 100644
--- a/t/distcom2.sh
+++ b/t/distcom2.sh
@@ -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 78379594d..6f1ebaf3a 100644
--- a/t/distcom3.sh
+++ b/t/distcom3.sh
@@ -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 5feae9b96..39b5b7179 100644
--- a/t/distcom4.sh
+++ b/t/distcom4.sh
@@ -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 <lst` -eq 1
+test2: distdir
test -f $(distdir)/tests/wrapper.in
END
@@ -52,23 +57,6 @@ $ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' Makefile.in > 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 2bb1b3435..939702f14 100644
--- a/t/distcom5.sh
+++ b/t/distcom5.sh
@@ -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 <lst` -eq 1
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
-$MAKE test
-
-extract_distcommon Makefile.in > 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 85a254ae6..fdf0bb76d 100644
--- a/t/hdr-vars-defined-once.sh
+++ b/t/hdr-vars-defined-once.sh
@@ -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
: