summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--THANKS1
-rw-r--r--m4/init.m411
-rwxr-xr-xtests/stamph2.test43
4 files changed, 49 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index abb688e87..2182af941 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-04 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * m4/init.m4 (_AC_AM_CONFIG_HEADER_HOOK): Recompute
+ indexes of header files so we create stamp files with
+ the right numbers when config.status is run on some headers.
+ * tests/stamph2.test: Check for this.
+ Reported by Sander Niemeijer.
+
2003-02-02 Alexandre Duret-Lutz <adl@gnu.org>
* automake.in (vars_scanned): Move near traverse_variable_recursively.
diff --git a/THANKS b/THANKS
index 5eae3680c..d599bce23 100644
--- a/THANKS
+++ b/THANKS
@@ -184,6 +184,7 @@ Ronald Landheer ronald@landheer.com
Rusty Ballinger rusty@rlyeh.engr.sgi.com
Ryan T. Sammartino ryants@shaw.ca
Sam Hocevar sam@zoy.org
+Sander Niemeijer niemeijer@science-and-technology.nl
Sergey Vlasov vsu@mivlgu.murom.ru
Seth Alves alves@hungry.com
Shuhei Amakawa sa264@cam.ac.uk
diff --git a/m4/init.m4 b/m4/init.m4
index 47c94729e..4c24f7571 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -118,5 +118,14 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX],
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
diff --git a/tests/stamph2.test b/tests/stamph2.test
index 6df3b5ea3..34b80fa0f 100755
--- a/tests/stamph2.test
+++ b/tests/stamph2.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -21,6 +21,8 @@
# Make sure stamp-h* files are created where we expect
. ./defs || exit 1
+set -e
+
cat >> configure.in << END
AM_CONFIG_HEADER(1.h
2.h:config.hin
@@ -42,17 +44,32 @@ mkdir sdir2
: > sdir1/config1.hin
: > sdir2/config2.hin
-$ACLOCAL || exit 1
-$AUTOCONF || exit 1
-$AUTOMAKE || exit 1
-./configure || exit 1
-
-test -f stamp-h1 || exit 1
-test -f stamp-h2 || exit 1
-test -f stamp-h3 || exit 1
-test -f sdir1/stamp-h4 || exit 1
-test -f sdir1/stamp-h5 || exit 1
-test -f sdir1/stamp-h6 || exit 1
-test -f sdir1/stamp-h7 || exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+test -f stamp-h1
+test -f stamp-h2
+test -f stamp-h3
+test -f sdir1/stamp-h4
+test -f sdir1/stamp-h5
+test -f sdir1/stamp-h6
+test -f sdir1/stamp-h7
+
+# Make sure `./config.status foo' creates the right stamp file.
+# Report from Sander Niemeijer.
+
+rm -f stamp-h*
+rm -f sdir1/stamp-h*
+
+./config.status sdir1/7.h 2.h sdir1/4.h
+test ! -f stamp-h1
+test -f stamp-h2
+test ! -f stamp-h3
+test -f sdir1/stamp-h4
+test ! -f sdir1/stamp-h5
+test ! -f sdir1/stamp-h6
+test -f sdir1/stamp-h7
exit 0