2 # Copyright (C) 2002-2017 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 <https://www.gnu.org/licenses/>.
17 # Subpackages that want to use m4 macros from their superpackages,
18 # with AC_CONFIG_MACRO_DIRS.
22 cat > configure.ac
<<'END'
23 AC_INIT([super], [1.0])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_CONFIG_SUBDIRS([pkg])
33 cat > m
4/foo.
m4 <<'EOF'
35 AC_CONFIG_FILES([Makefile])
40 cat > m
4/bar.
m4 <<'EOF'
41 AC_DEFUN([AX_BAR], [AC_SUBST([WHOAMI], [SuperPkg])])
44 cat > Makefile.am
<< 'END'
46 test '$(WHOAMI)' = SuperPkg
47 check-local
: test-whoami
52 cat > pkg
/configure.ac
<<'END'
53 AC_INIT([super], [1.0])
55 AC_CONFIG_MACRO_DIRS([macros ../m4])
61 cat > pkg
/macros
/zardoz.
m4 << 'END'
62 AC_DEFUN
([AX_BAR
], [AC_SUBST
([WHOAMI
], [sub-pkg
])])
65 cat > pkg
/Makefile.am
<< 'END'
67 test '$(WHOAMI)' = sub-pkg
68 check-local
: test-whomai
71 AUTOMAKE
=$AUTOMAKE ACLOCAL
=$ACLOCAL AUTOCONF
=$AUTOCONF $AUTORECONF -vi
73 $FGREP 'm4_include([m4/foo.m4])' aclocal.
m4
74 $FGREP 'm4_include([m4/bar.m4])' aclocal.
m4
75 $FGREP 'm4_include([../m4/foo.m4])' pkg
/aclocal.
m4
76 $FGREP 'm4_include([macros/zardoz.m4])' pkg
/aclocal.
m4
81 (cd pkg
&& $MAKE test-whoami
) ||
exit 1