1326a9e0d86045331876391f11eaa862ae0abfa2
[platform/upstream/automake.git] / tests / libobj16b.test
1 #! /bin/sh
2 # Copyright (C) 2010, 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 # Make sure AC_LIBOBJ and friends work.
18 # Please keep this in sync with sister test `libobj16a.test'.
19
20 required=cc
21 . ./defs || Exit 1
22
23 mv configure.in configure.proto
24 cat >> configure.proto << 'END'
25 AC_PROG_CC
26 AC_PROG_RANLIB
27 %LIBOBJ-STUFF% # Will be activated later.
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 noinst_LIBRARIES = libtu.a
33 libtu_a_SOURCES =
34 libtu_a_LIBADD = @LIBOBJS@
35
36 include extra-checks.am
37 .PHONY: $(extra_checks) pre-test
38
39 pre-test: distdir
40         ls -l $(srcdir) $(builddir) $(distdir)
41         $(AR) tv libtu.a
42 $(extra_checks): pre-test
43 check-local: $(extra_checks)
44
45 maude-src:
46         grep dummy_maude $(srcdir)/maude.c
47 maude-dist:
48         grep dummy_maude $(distdir)/maude.c
49 liver-src:
50         grep dummy_liver $(srcdir)/liver.c
51 liver-dist:
52         grep dummy_liver $(distdir)/liver.c
53 liver-not-dist: distdir
54         test ! -r $(distdir)/liver.c
55 maude-not-dist: distdir
56         test ! -r $(distdir)/maude.c
57 maude-lib:
58         $(AR) t libtu.a | grep maude
59 maude-not-lib:
60         $(AR) t libtu.a | grep maude && exit 1; exit 0
61 liver-lib:
62         $(AR) t libtu.a | grep liver
63 liver-not-lib:
64         $(AR) t libtu.a | grep liver && exit 1; exit 0
65 END
66
67 cat > maude.c << 'END'
68 extern int dummy_maude;
69 END
70
71 cat > liver.c << 'END'
72 extern int dummy_liver;
73 END
74
75 sed '/%LIBOBJ-STUFF%/{
76 s/.*//
77 i\
78 AC_LIBOBJ(maude) dnl: do not quote this!
79 }' configure.proto > configure.in
80 cat configure.in # For debugging.
81
82 cat > extra-checks.am << 'END'
83 extra_checks = maude-src maude-dist maude-lib liver-not-dist
84 END
85
86 $ACLOCAL
87 $AUTOCONF
88 $AUTOMAKE -Wno-extra-portability
89
90 ./configure
91
92 $MAKE
93 $MAKE check
94 $MAKE distcheck
95 $MAKE distclean
96
97 # Avoid timestamp-related differences.
98 rm -rf autom4te*.cache
99
100 cat > extra-checks.am << 'END'
101 extra_checks = maude-src maude-dist liver-src liver-dist
102 if MAUDE_COND
103 extra_checks += maude-lib liver-not-lib
104 else
105 extra_checks += maude-not-lib liver-lib
106 endif
107 END
108
109 sed '/%LIBOBJ-STUFF%/{
110 s/.*//
111 i\
112 AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
113 if test x"$MAUDE" = x"yes"; then\
114   AC_LIBOBJ(maude) dnl: do not quote this!\
115 else\
116   AC_LIBOBJ(liver) dnl: do not quote this!\
117 fi\
118 AC_LIBSOURCE(maude.c) dnl: do not quote this!\
119 AC_LIBSOURCE(liver.c) dnl: do not quote this!
120 }' configure.proto > configure.in
121 cat configure.in # For debugging.
122
123 $ACLOCAL
124 $AUTOCONF
125 $AUTOMAKE -Wno-extra-portability
126
127 ./configure MAUDE=yes
128 $MAKE
129 $MAKE check
130 $MAKE distcheck
131 $MAKE distclean
132
133 ./configure MAUDE=no
134 $MAKE
135 $MAKE check
136 $MAKE distcheck
137 $MAKE distclean
138
139 :