summaryrefslogtreecommitdiff
path: root/t/confh-internals.sh
blob: 3fd9b0f287f60aabc8355cf1972bc1e5103b7e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# Copyright (C) 2003-2015 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Check internal make variable populated from AC_CONFIG_HEADERS calls.

. test-init.sh

cat >>configure.ac <<'EOF'
AC_SUBST([BOT], [bot])
AC_CONFIG_HEADERS([defs.h config.h:sub1/config.top:sub2/config.${BOT}],,
                  [BOT=$BOT])
AC_CONFIG_HEADERS([sub0/CFG.h:sub0/CFG-H.in])
AC_CONFIG_FILES([sub0/Makefile])
AC_OUTPUT
EOF

mkdir sub0 sub1 sub2

echo TOP > sub1/config.top
echo BOT > sub2/config.bot

cat > Makefile.am << 'END'
SUBDIRS = sub0
.PHONY: test-vapth test-intree
test-intree:
	is $(am.config-hdr.local) == defs.h config.h
	is $(am.config-hdr.local.in) == ./defs.h.in
test-vpath:
	is $(am.config-hdr.local) == defs.h config.h
	is $(am.config-hdr.local.in) == ../defs.h.in
END

cat > sub0/Makefile.am << 'END'
.PHONY: test-vapth test-intree
test-intree:
	is $(am.config-hdr.local) == CFG.h
	is $(am.config-hdr.local.in) == ../sub0/CFG-H.in
test-vpath:
	is $(am.config-hdr.local) == CFG.h
	is $(am.config-hdr.local.in) == ../../sub0/CFG-H.in
END

: > sub0/CFG-H.in

$ACLOCAL
$AUTOCONF
$AUTOHEADER
test -f defs.h.in
$AUTOMAKE

./configure
$MAKE test-intree
$MAKE distclean
mkdir build
cd build
../configure
$MAKE test-vpath
$MAKE distcleancheck

: