am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / aclocal-acdir.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test aclocal's '--automake-acdir' and '--system-acdir' options.  Also
18 # check that stuff in the automake acdir takes precedence over stuff in
19 # the system acdir.
20
21 . test-init.sh
22
23 mkdir am sys
24 # FIXME: remove in Automake 2.0
25 mkdir am/internal
26 : > am/internal/ac-config-macro-dirs.m4
27
28 cat >> configure.ac <<'END'
29 MY_MACRO
30 END
31
32 cat > am/foo.m4 <<'END'
33 AC_DEFUN([AM_INIT_AUTOMAKE], [fake--init--automake])
34 END
35
36 cat > sys/foo.m4 <<'END'
37 AC_DEFUN([MY_MACRO], [my--macro])
38 END
39
40 $ACLOCAL --automake-acdir am
41 $AUTOCONF --force
42 $FGREP 'fake--init--automake' configure
43 $FGREP 'MY_MACRO' configure
44
45 rm -rf autom4te*.cache
46
47 $ACLOCAL --system-acdir sys
48 $AUTOCONF --force
49 $FGREP 'am__api_version' configure
50 $FGREP 'my--macro' configure
51
52 rm -rf autom4te*.cache
53
54 $ACLOCAL --automake-acdir am --system-acdir sys
55 $AUTOCONF --force
56 $FGREP 'fake--init--automake' configure
57 $FGREP 'my--macro' configure
58
59 rm -rf autom4te*.cache
60
61 $ACLOCAL --system-acdir sys --automake-acdir am
62 $AUTOCONF --force
63 $FGREP 'fake--init--automake' configure
64 $FGREP 'my--macro' configure
65
66 rm -rf autom4te*.cache
67
68 # Stuff in automake acdir takes precedence over stuff in system acdir.
69 cat > am/bar.m4 <<'END'
70 AC_DEFUN([MY_MACRO], [am--macro])
71 END
72 $ACLOCAL --automake-acdir am --system-acdir sys
73 $AUTOCONF --force
74 $FGREP 'fake--init--automake' configure
75 $FGREP 'am--macro' configure
76 $FGREP 'my--macro' configure && exit 1 # Just to be sure.
77
78 :