doc: typos in test file.
[automake.git] / t / aclocal-path-precedence.sh
blob57b1adadf41b26fd2db0ccf1177c03908a97198a
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Check precedence rules for ACLOCAL_PATH.
19 am_create_testdir=empty
20 . test-init.sh
22 cat > configure.ac << 'END'
23 AC_INIT([foo], [1.0])
24 AM_INIT_AUTOMAKE
25 FOO_MACRO
26 BAR_MACRO
27 AC_PROG_LIBTOOL
28 AM_GNU_GETTEXT
29 END
31 mkdir mdir1 mdir2 mdir3 sysdir extradir
33 cat > mdir1/foo1.m4 << 'END'
34 AC_DEFUN([FOO_MACRO], [::pass-foo::])
35 END
37 cat > mdir2/foo2.m4 << 'END'
38 AC_DEFUN([FOO_MACRO], [::fail-foo::])
39 END
41 cat > mdir1/baz.m4 << 'END'
42 AC_DEFUN([BAR_MACRO], [::fail-bar::])
43 END
45 cat > mdir3/bar.m4 << 'END'
46 AC_DEFUN([BAR_MACRO], [::pass-bar::])
47 END
49 cat > mdir2/quux.m4 << 'END'
50 AC_DEFUN([AM_INIT_AUTOMAKE], [::fail-init::])
51 AC_DEFUN([AC_PROG_LIBTOOL], [::pass-libtool::])
52 AC_DEFUN([AM_GNU_GETTEXT], [::pass-gettext::])
53 END
55 cat > sysdir/libtool.m4 << 'END'
56 AC_DEFUN([AC_PROG_LIBTOOL], [::fail-libtool::])
57 END
59 cat > extradir/gettext.m4 << 'END'
60 AC_DEFUN([AM_GNU_GETTEXT], [::fail-gettext::])
61 END
63 echo ./extradir > sysdir/dirlist
65 ACLOCAL_PATH=mdir1:mdir2 $ACLOCAL -I mdir3 --system-acdir sysdir
66 $AUTOCONF
68 $FGREP '::' configure # For debugging.
70 # Directories coming first in ACLOCAL_PATH should take precedence
71 # over those coming later.
72 $FGREP '::pass-foo::' configure
74 # Directories from '-I' options should take precedence over directories
75 # in ACLOCAL_PATH.
76 $FGREP '::pass-bar::' configure
78 # Directories in ACLOCAL_PATH should take precedence over system acdir
79 # (typically '${prefix}/share/aclocal'), and any directory added through
80 # the 'dirlist' special file.
81 $FGREP '::pass-gettext::' configure
82 $FGREP '::pass-libtool::' configure
84 # Directories in ACLOCAL_PATH shouldn't take precedence over the internal
85 # automake acdir (typically '${prefix}/share/aclocal-${APIVERSION}').
86 $FGREP 'am__api_version' configure
88 # A final sanity check.
89 $FGREP '::fail' configure && exit 1