[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake-1.7b feedback (3)
From: |
Alexandre Duret-Lutz |
Subject: |
Re: automake-1.7b feedback (3) |
Date: |
Mon, 17 Nov 2003 01:33:15 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
>>> "Bruno" == Bruno Haible <address@hidden> writes:
Bruno> Bug (regression) in the treatment of AC_CONFIG_FILES:
Bruno> When the source file in an AC_CONFIG_FILES argument is a
Bruno> relative pathname starting with ../, automake gets
Bruno> confused about this pathname: it behaves as if the
Bruno> pathname were relative to a subdirectory, but the
Bruno> pathname is actually relative to $(top_srcdir) where the
Bruno> configure.ac is located.
Thanks a lot. I'm checking this in
2003-11-17 Alexandre Duret-Lutz <address@hidden>
* 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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1514
diff -u -r1.1514 automake.in
--- automake.in 12 Nov 2003 19:29:53 -0000 1.1514
+++ automake.in 17 Nov 2003 00:27:29 -0000
@@ -317,7 +317,7 @@
# 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 @@
}
}
- 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 @@
. '$@'
. "\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 @@
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 @@
# rebuilt, but shouldn't generate itself.
push (@other_input_files, $_);
}
+ $ac_config_files_location{$local} = $where;
}
}
@@ -4451,8 +4475,7 @@
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')
{
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.527
diff -u -r1.527 Makefile.am
--- tests/Makefile.am 14 Nov 2003 21:12:27 -0000 1.527
+++ tests/Makefile.am 17 Nov 2003 00:27:32 -0000
@@ -334,6 +334,8 @@
output5.test \
output6.test \
output7.test \
+output8.test \
+output9.test \
overrid.test \
parse.test \
percent.test \
Index: tests/output8.test
===================================================================
RCS file: tests/output8.test
diff -N tests/output8.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/output8.test 17 Nov 2003 00:27:33 -0000
@@ -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
Index: tests/output9.test
===================================================================
RCS file: tests/output9.test
diff -N tests/output9.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/output9.test 17 Nov 2003 00:27:33 -0000
@@ -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
--
Alexandre Duret-Lutz