2 # Copyright (C) 2011-2012 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)
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 <http://www.gnu.org/licenses/>.
17 # Check precedence rules for ACLOCAL_PATH.
19 am_create_testdir=empty
22 cat > configure.ac << 'END'
31 mkdir mdir1 mdir2 mdir3 sysdir extradir
33 cat > mdir1/foo1.m4 << 'END'
34 AC_DEFUN([FOO_MACRO], [::pass-foo::])
37 cat > mdir2/foo2.m4 << 'END'
38 AC_DEFUN([FOO_MACRO], [::fail-foo::])
41 cat > mdir1/baz.m4 << 'END'
42 AC_DEFUN([BAR_MACRO], [::fail-bar::])
45 cat > mdir3/bar.m4 << 'END'
46 AC_DEFUN([BAR_MACRO], [::pass-bar::])
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::])
55 cat > sysdir/libtool.m4 << 'END'
56 AC_DEFUN([AC_PROG_LIBTOOL], [::fail-libtool::])
59 cat > extradir/gettext.m4 << 'END'
60 AC_DEFUN([AM_GNU_GETTEXT], [::fail-gettext::])
63 echo ./extradir > sysdir/dirlist
65 ACLOCAL_PATH=mdir1:mdir2 $ACLOCAL -I mdir3 --system-acdir sysdir
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
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