maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / libobj17.test
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 # Make sure AC_LIBOBJ accept non-literal arguments.
18
19 required=cc
20 . ./defs || Exit 1
21
22 cat >> configure.in << 'END'
23 AC_PROG_CC
24 AC_PROG_RANLIB
25 AM_PROG_AR
26 foo=${FOO-oops}
27 AC_LIBSOURCES([quux.c, zardoz.c])
28 AC_LIBOBJ([$foo])
29 AC_OUTPUT
30 END
31
32 cat > Makefile.am << 'END'
33 noinst_LIBRARIES = libtu.a
34 libtu_a_SOURCES =
35 libtu_a_LIBADD = $(LIBOBJS)
36 END
37
38 cat > quux.c <<'END'
39 extern int dummy;
40 END
41
42 cat > zardoz.c <<'END'
43 extern int dummy;
44 END
45
46 # These might print warnings, but should not error out.
47 $ACLOCAL
48 $AUTOMAKE -a
49 $AUTOCONF
50
51 ./configure FOO=quux
52 $MAKE
53 ls -l # For debugging.
54 test -f libtu.a
55 ar t libtu.a | $FGREP quux
56 ar t libtu.a | $FGREP zardoz && Exit 1
57
58 $MAKE distclean
59
60 ./configure FOO=zardoz
61 $MAKE
62 ls -l # For debugging.
63 test -f libtu.a
64 ar t libtu.a | $FGREP zardoz
65 ar t libtu.a | $FGREP quux && Exit 1
66
67 :