* automake.in (handle_configure): Compute $header_dir based on
$one_name, not $one_hdr. Reported by Erez Zadok. Fixes
confh2.test.
(handle_configure): Compute relative path to input header
correctly in all cases.
diff --git a/ChangeLog b/ChangeLog
index 0d67ead..bc43c55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
1999-01-14 Tom Tromey <tromey@cygnus.com>
+ * automake.in (handle_configure): Compute $header_dir based on
+ $one_name, not $one_hdr. Reported by Erez Zadok. Fixes
+ confh2.test.
+ (handle_configure): Compute relative path to input header
+ correctly in all cases.
+
* automake.in (handle_tests): Avoid error messages from dejagnu
test rules. From Karl Heuer.
diff --git a/TODO b/TODO
index bd0430f..e327c05 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,16 @@
+* Run automake before libtool. It will report an error but
+ still won't put the file into the disty. This is wrong.
+ From Mark H Wilkinson <mhw@kremvax.demon.co.uk>
+
+* AM_CONFIG_HEADER might generate the wrong stamp file names
+ when given multiple headers. Write a test.
+
+* Currently don't correctly handle multiple inputs to a config header.
+
+* header stamp files still in wrong dirs.
+ stamp-h.in must be in dir with h.in file
+ stamp-h must be in dir with output file
+
* foo=bar
if cond
foo += joe
diff --git a/automake.in b/automake.in
index e27c399..ccb3ffc 100755
--- a/automake.in
+++ b/automake.in
@@ -3013,7 +3013,7 @@
local ($one_fullname) = shift (@local_fullnames);
local ($one_name) = shift (@local_names);
$hdr_index += 1;
- local ($header_dir) = &dirname ($one_hdr);
+ local ($header_dir) = &dirname ($one_name);
# If the header is in the current directory we want to build
# the header here. Otherwise, if we're at the topmost
@@ -3025,13 +3025,11 @@
local ($ch_sans_dir, $cn_sans_dir, $stamp_dir);
if ($relative_dir eq $header_dir)
{
- $ch_sans_dir = &basename ($one_hdr);
$cn_sans_dir = &basename ($one_name);
$stamp_dir = '';
}
else
{
- $ch_sans_dir = $one_hdr;
$cn_sans_dir = $one_name;
if ($header_dir eq '.')
{
@@ -3043,6 +3041,41 @@
}
}
+ # Compute relative path from directory holding output
+ # header to directory holding input header. FIXME:
+ # doesn't handle case where we have multiple inputs.
+ if (&dirname ($one_hdr) eq $relative_dir)
+ {
+ $ch_sans_dir = &basename ($one_hdr);
+ }
+ else
+ {
+ local (@rel_out_path, $rel_path);
+ # FIXME this chunk of code should be its own sub.
+ # It is used elsewhere.
+ foreach (split (/\//, $relative_dir))
+ {
+ next if $_ eq '' || $_ eq '.';
+ if ($_ eq '..')
+ {
+ # FIXME: actually this is an error.
+ pop @rel_out_path;
+ }
+ else
+ {
+ push (@rel_out_path, '..');
+ }
+ }
+ if (@rel_out_path)
+ {
+ $ch_sans_dir = join ('/', @rel_out_path) . '/' . $one_hdr;
+ }
+ else
+ {
+ $ch_sans_dir = $one_hdr;
+ }
+ }
+
&require_file_with_conf_line ($config_header_line,
$FOREIGN, $ch_sans_dir);
@@ -3077,9 +3110,10 @@
$output_rules .= &file_contents_with_transform ($xform,
'remake-hdr');
- &create ("${relative_dir}/${stamp_dir}${stamp_name}.in");
+ local ($out_dir) = &dirname ($ch_sans_dir);
+ &create ("${relative_dir}/${out_dir}/${stamp_name}.in");
&require_file_with_conf_line ($config_header_line, $FOREIGN,
- "${stamp_dir}${stamp_name}.in");
+ "${out_dir}/${stamp_name}.in");
$distclean_config .= ' ' if $distclean_config;
$distclean_config .= $cn_sans_dir;
diff --git a/tests/confh3.test b/tests/confh3.test
index 0591186..8cfe589 100755
--- a/tests/confh3.test
+++ b/tests/confh3.test
@@ -26,5 +26,5 @@
$AUTOMAKE || exit 1
grep '^config.h:' d1/Makefile.in || exit 1
-fgrep 'echo timestamp > stamp-h' Makefile.in || exit 1
-fgrep '../d2/config.h.in' Makefile.in || exit 1
+fgrep 'echo timestamp > stamp-h' d1/Makefile.in || exit 1
+fgrep '../d2/config.h.in' d1/Makefile.in || exit 1