From 720cf06a033f8980f9eca4572aa33cfad73c5413 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 17 Nov 2003 00:33:43 +0000 Subject: [PATCH] * automake.in (ac_config_files_location): Declare as a hash. (handle_configure): Rewrite the computation of AC_CONFIG_FILES dependencies; make sure we don't use $(srcdir) or $(top_srcdir) for inputs which are also outputs, and do not check inputs relatively to the current directory. (scan_autoconf_config_files): Take $where as argument, and fill $ac_config_files_location. * tests/output8.test, tests/output9.test: New files. * tests/Makefile.am (TESTS): Add output8.test and output9.test. Report from Bruno Haible. --- ChangeLog | 13 +++++++++++ automake.in | 49 ++++++++++++++++++++++++++++----------- doc/Makefile.in | 6 ++++- tests/Makefile.am | 2 ++ tests/Makefile.in | 2 ++ tests/output8.test | 58 ++++++++++++++++++++++++++++++++++++++++++++++ tests/output9.test | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 174 insertions(+), 14 deletions(-) create mode 100755 tests/output8.test create mode 100755 tests/output9.test diff --git a/ChangeLog b/ChangeLog index a61a87d6f..610398cfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-11-17 Alexandre Duret-Lutz + + * automake.in (ac_config_files_location): Declare as a hash. + (handle_configure): Rewrite the computation of AC_CONFIG_FILES + dependencies; make sure we don't use $(srcdir) or $(top_srcdir) + for inputs which are also outputs, and do not check inputs + relatively to the current directory. + (scan_autoconf_config_files): Take $where as argument, and + fill $ac_config_files_location. + * tests/output8.test, tests/output9.test: New files. + * tests/Makefile.am (TESTS): Add output8.test and output9.test. + Report from Bruno Haible. + 2003-11-14 Alexandre Duret-Lutz * tests/aclibobj.test, tests/aclocal.test, tests/aclocal3.test, diff --git a/automake.in b/automake.in index 1c83bbf31..034090edc 100755 --- a/automake.in +++ b/automake.in @@ -317,7 +317,7 @@ my @configure_input_files = (); # and their outputs. my @other_input_files = (); # Where the last AC_CONFIG_FILES/AC_OUTPUT appears. -my $ac_config_files_location; +my %ac_config_files_location = (); # List of directories to search for configure-required files. This # can be set by AC_CONFIG_AUX_DIR. @@ -3711,7 +3711,34 @@ sub handle_configure ($$$@) } } - my @rewritten_inputs = rewrite_inputs_into_dependencies (1, @inputs); + # An input file is either output by some other AC_CONFIG_FILES, + # or it must exist and be relative to $(top_srcdir). In the + # latter case, we distribute it; in the former, we should not. + my @rewritten_inputs = (); + for my $i (@inputs) + { + if (exists $ac_config_files_location{$i}) + { + if (dirname ($i) eq $relative_dir) + { + $i = basename $i; + } + else + { + $i = '$(top_builddir)/' . $i; + } + } + else + { + msg ('error', $ac_config_files_location{$file}, + "required file `$i' not found") + unless -f $i; + ($i) = rewrite_inputs_into_dependencies (1, $i); + push_dist_common ($i); + } + push @rewritten_inputs, $i; + } + $output_rules .= ($local . ': ' . '$(top_builddir)/config.status ' . "@rewritten_inputs\n" @@ -3722,10 +3749,6 @@ sub handle_configure ($$$@) . '$@' . "\n"); push (@actual_other_files, $local); - - # Require all input files. - require_file ($ac_config_files_location, FOREIGN, - rewrite_inputs_into_dependencies (0, @inputs)); } foreach my $struct (@config_links) @@ -4339,13 +4362,13 @@ sub locate_am (@) my %make_list; -# &scan_autoconf_config_files ($CONFIG-FILES) -# ------------------------------------------- +# &scan_autoconf_config_files ($WHERE, $CONFIG-FILES) +# --------------------------------------------------- # Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES # (or AC_OUTPUT). -sub scan_autoconf_config_files ($) +sub scan_autoconf_config_files ($$) { - my ($config_files) = @_; + my ($where, $config_files) = @_; # Look at potential Makefile.am's. foreach (split ' ', $config_files) @@ -4368,6 +4391,7 @@ sub scan_autoconf_config_files ($) # rebuilt, but shouldn't generate itself. push (@other_input_files, $_); } + $ac_config_files_location{$local} = $where; } } @@ -4451,8 +4475,7 @@ sub scan_autoconf_traces ($) elsif ($macro eq 'AC_CONFIG_FILES') { # Look at potential Makefile.am's. - $ac_config_files_location = $where; - &scan_autoconf_config_files ($args[1]); + scan_autoconf_config_files ($where, $args[1]); } elsif ($macro eq 'AC_CONFIG_HEADERS') { @@ -6421,7 +6444,7 @@ sub require_file_internal ($$@) foreach my $file (@files) { - my $fullfile; + my $fullfile; my $errdir; my $errfile; my $save_dir; diff --git a/doc/Makefile.in b/doc/Makefile.in index 87797311f..eba41325b 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -422,8 +422,12 @@ install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) $(mkdir_p) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 5f1037d9b..4f39f7bdb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -334,6 +334,8 @@ output4.test \ output5.test \ output6.test \ output7.test \ +output8.test \ +output9.test \ overrid.test \ parse.test \ percent.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 807271ca3..a8d0c289e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -448,6 +448,8 @@ output4.test \ output5.test \ output6.test \ output7.test \ +output8.test \ +output9.test \ overrid.test \ parse.test \ percent.test \ diff --git a/tests/output8.test b/tests/output8.test new file mode 100755 index 000000000..7ef82b063 --- /dev/null +++ b/tests/output8.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check AC_CONFIG_FILES support for files starting with `../'. +# Report from Bruno Haible. + +. ./defs || exit 1 + +set -e + +mkdir testdir +cd testdir + +mv ../configure.in . +cat >> configure.in << END +AC_CONFIG_FILES([a/foo.sh:../testdir/a/foo.sh.in]) +AC_CONFIG_FILES([a/Makefile]) +AC_OUTPUT +END + +mkdir a + +echo SUBDIRS = a >Makefile.am +: >a/Makefile.am + +echo foo >a/foo.sh.in + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure +$MAKE +test "`cat a/foo.sh`" = foo + +$sleep +echo 'bar' >a/foo.sh.in + +cd a +$MAKE foo.sh +test "`cat foo.sh`" = bar diff --git a/tests/output9.test b/tests/output9.test new file mode 100755 index 000000000..d2f4e907b --- /dev/null +++ b/tests/output9.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Make sure an AC_CONFIG_FILES can have an AC_CONFIG_FILES output as input. + +. ./defs || exit 1 + +set -e + +cat >> configure.in << END +AC_CONFIG_FILES([a/mid.in:a/input.in.in]) +AC_CONFIG_FILES([b/out:a/mid.in]) +AC_CONFIG_FILES([a/Makefile b/Makefile]) +AC_OUTPUT +END + +mkdir a +mkdir b + + +cat >Makefile.am <<\EOF +SUBDIRS = a b +dist-hook: + test -f $(distdir)/a/input.in.in + test ! -f $(distdir)/a/mid.in + if test ! -f check; then :; else : > ok; fi +EOF + +: >a/Makefile.am +: >b/Makefile.am + +echo foo >a/input.in.in + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure +: > check +$MAKE distcheck +test -f ok -- 2.47.2