Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distcheck-configure-flags-subpkg.test
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Check AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS
18 # are not honored in a subpackage Makefile.am, but the flags from
19 # AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS are
20 # passed down to the configure script of the subpackage.  This is
21 # explicitly documented in the manual.
22
23 . ./defs || Exit 1
24
25 set -e
26
27 cat >> configure.in << 'END'
28 AC_CONFIG_SUBDIRS([subpkg])
29 if test $dc != ok || test $am_dc != ok; then
30   AC_MSG_ERROR([dc=$dc am_dc=$dc])
31 fi
32 AC_OUTPUT
33 END
34
35 mkdir subpkg
36
37 sed <configure.in >subpkg/configure.in \
38     -e 's/^AC_INIT.*/AC_INIT([subpkg], [2.0])/' \
39     -e '/^AC_CONFIG_SUBDIRS/d' \
40
41 cat configure.in
42 cat subpkg/configure.in
43
44 dc=KO am_dc=KO; export dc am_dc
45
46 cat > Makefile.am << 'END'
47 AM_DISTCHECK_CONFIGURE_FLAGS = am_dc=ok
48 DISTCHECK_CONFIGURE_FLAGS = dc=ok
49 END
50
51 : > subpkg/Makefile.am
52
53 $ACLOCAL
54 $AUTOMAKE
55 $AUTOCONF
56
57 cd subpkg
58 $ACLOCAL
59 $AUTOMAKE
60 $AUTOCONF
61 cd ..
62
63 # For debugging.
64 $FGREP 'DISTCHECK_CONFIGURE_FLAGS' Makefile.in subpkg/Makefile.in
65
66 grep '^AM_DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
67 grep '^DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
68 $EGREP '^(AM_)?DISTCHECK_CONFIGURE_FLAGS' subpkg/Makefile.in && Exit 1
69
70 ./configure dc=ok am_dc=ok
71
72 # Flags in $(DISTCHECK_CONFIGURE_FLAGS) and $(AM_DISTCHECK_CONFIGURE_FLAGS)
73 # should be passed down to the subpackage configure when "make distcheck"
74 # is run from the top-level package ...
75 $MAKE distcheck
76
77 # ... but not when "make distcheck" is run from the subpackage.
78 cd subpkg
79 $MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
80 cat output
81 grep '^configure:.* dc=KO am_dc=KO' output
82
83 :