30fdd86033a470229fbee795e73e565f5e1da7d7
[platform/upstream/automake.git] / tests / aclocal4.test
1 #! /bin/sh
2 # Copyright (C) 2003  Free Software Foundation, Inc.
3 #
4 # This file is part of GNU Automake.
5 #
6 # GNU Automake is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
10 #
11 # GNU Automake is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Automake; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
20
21 # Make sure dependencies on aclocal.m4 are set correctly.
22 # Report from Jim Meyering.
23
24 # We need GNU make for the `rebuild rules' to be triggered.
25 required=GNUmake
26 . ./defs || exit 1
27
28 set -e
29
30 cat >>configure.in <<EOF
31 AC_PROG_RANLIB
32 AC_PROG_CC
33 MY_MACRO
34 AC_CONFIG_FILES([lib/Makefile])
35 AC_OUTPUT
36 EOF
37
38 mkdir m4
39 cat >m4/mymacro.m4 <<EOF
40 AC_DEFUN([MY_MACRO], [])
41 EOF
42
43 mkdir lib
44 : > lib/foo.c
45 : > lib/bar.c
46 cat >lib/Makefile.am <<'EOF'
47 noinst_LIBRARIES = liberi.a
48 liberi_a_SOURCES = bar.c
49 liberi_a_LIBADD = $(LIBOBJS)
50 EOF
51
52 cat >Makefile.am <<'EOF'
53 SUBDIRS = lib
54 EXTRA_DIST = m4/mymacro.m4
55 ACLOCAL_AMFLAGS = -I m4
56 check-foo: distdir
57         test -f $(distdir)/lib/foo.c
58         test -f $(distdir)/lib/bar.c
59
60 check-not-foo: distdir
61         test ! -f $(distdir)/lib/foo.c
62         test -f $(distdir)/lib/bar.c
63 EOF
64
65 $ACLOCAL -I m4
66 $AUTOCONF
67 $AUTOMAKE
68 ./configure
69 $MAKE check-not-foo
70
71 # Update one of the macros.  This should cause ./configure, Makefile.in,
72 # Makefile, lib/Makefile.in, and lib/Makfile to be updated.  This assumes
73 # GNU make.
74
75 cat >m4/mymacro.m4 <<'EOF'
76 AC_DEFUN([MY_MACRO], [AC_LIBOBJ([foo])])
77 EOF
78
79 $MAKE check-foo