Fix for PR automake/322:
[platform/upstream/automake.git] / tests / pr87.test
1 #! /bin/sh
2
3 # Test for PR automake/87.
4
5 . $srcdir/defs || exit 1
6
7 $needs_gnu_make                 # for `make distcheck'
8
9 subdirs="foo bar"
10
11 for i in $subdirs; do
12     mkdir $i
13     cat >$i/$i.c <<EOF
14 int main() { return 0; }
15 EOF
16     cat >$i/Makefile.am <<EOF
17 bin_PROGRAMS = $i
18 ${i}_SOURCES = $i.c
19 EOF
20 done
21
22 echo "SUBDIRS = $subdirs" > Makefile.am
23 cat >configure.in <<EOF
24 AC_INIT(`echo $subdirs | sed 's|\([a-z][a-z]*\).*|\1/\1.c|'`)
25 AC_CONFIG_AUX_DIR(.)
26 AM_INIT_AUTOMAKE(test_am, 1.0)
27 AC_PROG_CC
28 AC_OUTPUT(Makefile `echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`)
29 EOF
30
31 # Likewise for gcc.
32 (gcc -v) > /dev/null 2>&1 || exit 77
33
34 # Ignore user CFLAGS.
35 CFLAGS=
36 export CFLAGS
37
38 touch README NEWS AUTHORS ChangeLog
39
40 mkdir build
41
42 # We use gcc and not gcc -traditional as the latter fails on some
43 # Linux boxes (Red Hat 5.1 in particular).
44 $ACLOCAL \
45    && $AUTOCONF \
46    && $AUTOMAKE -a || exit 1
47
48 # Regression test for bug where `.c.o:' is followed by blank line.
49 (while read line; do
50     if test "$line" = ".c.o:"; then
51        read next
52        if test -z "$next"; then
53           exit 1
54        fi
55        break
56     fi
57  done) < foo/Makefile.in || exit 1
58
59 cd build \
60    && CC='gcc' ../configure \
61    && $MAKE distcheck || exit 1