doc: update Vala documentation
[automake.git] / t / subpkg-macrodir.sh
blob716983642b241653556903ab92fa3ba6609a9595
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Subpackages that want to use m4 macros from their superpackages,
18 # with AC_CONFIG_MACRO_DIRS.
20 . test-init.sh
22 cat > configure.ac <<'END'
23 AC_INIT([super], [1.0])
24 AM_INIT_AUTOMAKE
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_CONFIG_SUBDIRS([pkg])
27 AX_BAR
28 AX_FOO
29 END
31 mkdir m4
33 cat > m4/foo.m4 <<'EOF'
34 AC_DEFUN([AX_FOO], [
35 AC_CONFIG_FILES([Makefile])
36 AC_OUTPUT
38 EOF
40 cat > m4/bar.m4 <<'EOF'
41 AC_DEFUN([AX_BAR], [AC_SUBST([WHOAMI], [SuperPkg])])
42 EOF
44 cat > Makefile.am << 'END'
45 test-whoami:
46 test '$(WHOAMI)' = SuperPkg
47 check-local: test-whoami
48 END
50 mkdir pkg
52 cat > pkg/configure.ac <<'END'
53 AC_INIT([super], [1.0])
54 AM_INIT_AUTOMAKE
55 AC_CONFIG_MACRO_DIRS([macros ../m4])
56 AX_BAR
57 AX_FOO
58 END
60 mkdir pkg/macros
61 cat > pkg/macros/zardoz.m4 << 'END'
62 AC_DEFUN([AX_BAR], [AC_SUBST([WHOAMI], [sub-pkg])])
63 END
65 cat > pkg/Makefile.am << 'END'
66 test-whoami:
67 test '$(WHOAMI)' = sub-pkg
68 check-local: test-whomai
69 END
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
78 ./configure
80 $MAKE test-whoami
81 (cd pkg && $MAKE test-whoami) || exit 1
83 $MAKE distcheck