tests: work around strangeness in MSYS
[automake.git] / tests / subpkg.test
blob658a8e53f865f09a73109539350e252b5d42e4bb
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004, 2006, 2011 Free Software Foundation,
3 # Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Check subpackage handling.
20 required=cc
21 . ./defs || Exit 1
23 mkdir m4
25 cat >m4/foo.m4 <<'EOF'
26 AC_DEFUN([FOO],[
27 AC_PROG_CC
28 AC_OUTPUT
30 EOF
32 cat >>configure.in <<'END'
33 AC_CONFIG_SUBDIRS([lib])
34 FOO
35 END
37 cat >Makefile.am <<'EOF'
38 SUBDIRS = lib
39 # Yes, This program is named LDADD. So what?
40 bin_PROGRAMS = LDADD
41 LDADD_LDADD = lib/liblib.a
43 # It's ok to override distdir.
44 distdir = subpack-1
46 # Make sure $(distdir) and $(top_distdir) work as expected.
47 dist-hook:
48 test -f $(distdir)/LDADD.c
49 test -f $(top_distdir)/LDADD.c
51 ACLOCAL_AMFLAGS = -I m4
52 EOF
54 cat >LDADD.c <<'EOF'
55 int lib (void);
56 int main (void)
58 return lib ();
60 EOF
62 mkdir lib
63 mkdir lib/src
65 cat >lib/configure.ac <<'EOF'
66 AC_INIT([lib], [2.3])
67 AM_INIT_AUTOMAKE
68 AM_PROG_AR
69 AC_PROG_RANLIB
70 AC_CONFIG_HEADERS([config.h:config.hin])
71 AC_CONFIG_FILES([Makefile])
72 FOO
73 EOF
75 cat >lib/Makefile.am <<'EOF'
76 noinst_LIBRARIES = liblib.a
77 liblib_a_SOURCES = src/x.c
79 dist-hook:
80 test ! -f $(distdir)/LDADD.c
81 test -f $(top_distdir)/LDADD.c
82 test -f $(distdir)/src/x.c
83 test ! -f $(top_distdir)/src/x.c
85 ACLOCAL_AMFLAGS = -I ../m4
86 EOF
88 cat >lib/src/x.c <<'EOF'
89 #include <config.h>
90 int lib (void)
92 return 0;
94 EOF
96 $ACLOCAL -I m4
97 $AUTOCONF
98 $AUTOMAKE -Wno-override
100 cd lib
101 $ACLOCAL -I ../m4
102 $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
103 $AUTOCONF
104 $AUTOHEADER
105 $AUTOMAKE -Wno-override --add-missing
106 cd ..
108 ./configure
109 $MAKE
110 $MAKE distcheck
111 test ! -d subpack-1 # Make sure distcheck cleans up after itself.
112 test -f subpack-1.tar.gz