+2003-11-17 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * 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 <adl@gnu.org>
* tests/aclibobj.test, tests/aclocal.test, tests/aclocal3.test,
# 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.
}
}
- 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"
. '$@'
. "\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)
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)
# rebuilt, but shouldn't generate itself.
push (@other_input_files, $_);
}
+ $ac_config_files_location{$local} = $where;
}
}
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')
{
foreach my $file (@files)
{
- my $fullfile;
+ my $fullfile;
my $errdir;
my $errfile;
my $save_dir;
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] \
output5.test \
output6.test \
output7.test \
+output8.test \
+output9.test \
overrid.test \
parse.test \
percent.test \
output5.test \
output6.test \
output7.test \
+output8.test \
+output9.test \
overrid.test \
parse.test \
percent.test \
--- /dev/null
+#! /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
--- /dev/null
+#! /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