summaryrefslogtreecommitdiff
path: root/tests/subdir5.test
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2010-06-19 14:55:10 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2010-07-26 19:22:10 +0200
commitee9fe91c5b01466e9e60757dd1fa673675ec6809 (patch)
treeba92de4db0cc2fe9350fdd563620032512f319d9 /tests/subdir5.test
parent4deaab9eaef915d4bef78e27e8e2d64d4629d01a (diff)
downloadautomake-ee9fe91c5b01466e9e60757dd1fa673675ec6809.tar.gz
Modernize and improve test scripts `subdir*.test'.
* tests/subdir.test: Enable `errexit' shell flag, and related changes. Use the `configure.in' stub created by `./defs', rather than writing one from scratch. * tests/subdir2.test: Likewise. * tests/subdir4.test: Likewise. * tests/subdir3.test: Enable `errexit' shell flag, and related changes. Do not create useless dummy source files. * tests/subdir5.test: Make grepping of Makefile.in (in topdir and in subdirs) stricter. Some minor changes to keep it more in sync with the related test `subdir8.test'. * tests/subdir8.test: Likewise (but with the related test being `subdir5.test' here). * tests/subdir6.test: Cosmetic change in spacing. * tests/subdir9.test: Define and use new variable `$distdir'. Add trailing `:' command. * tests/subdir10.test: Cosmetic consistency-related change. * tests/subdirbuiltsources.test: Cosmetic changes in spacings. (configure.in): Use stub created by `./defs', rather than writing it from scratch. Do not use obsoleted and/or deprecated forms of autoconf/automake macros.
Diffstat (limited to 'tests/subdir5.test')
-rwxr-xr-xtests/subdir5.test51
1 files changed, 30 insertions, 21 deletions
diff --git a/tests/subdir5.test b/tests/subdir5.test
index 2f0113b6f..6eb3aaa2b 100755
--- a/tests/subdir5.test
+++ b/tests/subdir5.test
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2009, 2010 Free Software
+# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,16 +22,15 @@
# This test assumes that the `make' utility is able to start
# over and reload Makefiles which have been remade (a non-POSIX feature).
+# See also the related test subdir8.test.
required='GNUmake gcc'
. ./defs || Exit 1
set -e
-cat > configure.in << 'END'
-AC_INIT(maude, 1.0)
-AM_INIT_AUTOMAKE
+cat >> configure.in << 'END'
+AC_PROG_CC
AM_PROG_CC_C_O
-AC_CONFIG_FILES(Makefile)
AC_OUTPUT
END
@@ -55,26 +54,30 @@ $AUTOMAKE --include-deps --copy --add-missing
./configure
$MAKE
+# Now add new directories.
+#
# We shouldn't need to $sleep here: configure ensures that files
# generated by it are newer than configure. Thus, even if
# Makefile.in is newer than configure but the updated Makefile.am
# below has the same timestamp as Makefile.in, the latter should
# be rebuilt due to its dependency on configure.in.
-# Now add a new directory.
-cat > configure.in << 'END'
-AC_INIT(maude, 1.0)
-AM_INIT_AUTOMAKE
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES(Makefile maude/Makefile)
-m4_include([confile.m4])
-AC_OUTPUT
-END
+# First we add a new directory by modifying configure.in directly.
+# We update configure.in *before* updating sub/Makefile.am; subdir8.test
+# does it in the other way: it updates confiles.m4 (which is m4_included
+# by configure.in there) after Makefile.am.
+
+sed <configure.in >configure.tmp -e '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([maude/Makefile])\
+m4_include([confile.m4])'
+mv -f configure.tmp configure.in
+
+cat configure.in # might be useful for debugging
: > confile.m4
mkdir maude
+
cat > maude/Makefile.am << 'END'
include_HEADERS = foo.h
END
@@ -87,15 +90,21 @@ echo 'SUBDIRS = maude' >> Makefile.am
$MAKE
test -f maude/Makefile
-# Add yet another directory
+# Then we add a new directory by modifying a file included (through
+# `m4_include') by configure.in.
mkdir maude2
-echo 'AC_CONFIG_FILES([maude2/Makefile])AC_SUBST([GREPME])' > confile.m4
+cat >> confile.m4 << 'END'
+AC_CONFIG_FILES([maude2/Makefile])
+AC_SUBST([GREPME])
+END
: > maude2/Makefile.am
echo 'SUBDIRS += maude2' >> Makefile.am
# We want a simple rebuild to create maude2/Makefile and update
# all other Makefiles automatically.
$MAKE
-grep GREPME Makefile
-grep GREPME maude/Makefile
-grep GREPME maude2/Makefile
+grep '^GREPME =' Makefile
+grep '^GREPME =' maude/Makefile
+grep '^GREPME =' maude2/Makefile
+
+: