tests: make 'lzip.test' executable
[automake.git] / tests / specflg-dummy.test
blob614d6c25e10ac0d967808794c59ec8781c905a97
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check that even "dummy" per-target flags triggers the use of renamed
18 # objects. I.e., a definition like `foo_CFLAGS = $(AM_CFLAGS)' should
19 # always cause Automake to trigger the semantics for per-target CFLAGS,
20 # even if AM_CFLAGS is undefined. Similarly for other *FLAGS variables
21 # (CXXFLAGS, YFLAGS, LDFLAGS, ...)
23 . ./defs || Exit 1
25 set -e
27 # Disable shell globbing if possible.
28 (set +f) >/dev/null 2>&1 && set +f
30 oIFS=$IFS
31 nl='
34 matches=
35 add_match ()
37 matches="$matches$nl$1"
40 do_check ()
42 IFS=$nl
43 for string in $matches; do
44 IFS=$oIFS
45 $FGREP "$string" Makefile.in
46 done
47 IFS=$oIFS
50 # Fake libtool presence, so that we won't have to require it.
51 cat > acinclude.m4 <<END
52 AC_DEFUN([AC_PROG_LIBTOOL], [AC_SUBST([LIBTOOL], [dummy])])
53 END
54 : > ltmain.sh
56 cat >> configure.in << 'END'
57 AC_PROG_CC
58 AC_PROG_CXX
59 AC_PROG_YACC
60 AC_PROG_LEX
61 AC_PROG_F77
62 AC_PROG_FC
63 AM_PROG_GCJ
64 AC_PROG_RANLIB
65 AC_PROG_LIBTOOL
66 AM_PROG_UPC
67 AC_PROG_OBJC
68 AM_PROG_CC_C_O
69 END
71 cat > Makefile.am <<'END'
72 bin_PROGRAMS =
73 lib_LIBRARIES =
74 lib_LTLIBRARIES =
75 END
77 $ACLOCAL
79 cat >> Makefile.am <<'END'
80 bin_PROGRAMS += prog1
81 prog1_SOURCES = source1.c
82 prog1_CFLAGS = $(AM_CFLAGS)
83 END
85 add_match 'prog1-source1.$(OBJEXT)'
87 cat >> Makefile.am <<'END'
88 bin_PROGRAMS += prog2
89 prog2_SOURCES = source2.c
90 prog2_CPPFLAGS = $(AM_CPPFLAGS)
91 END
93 add_match 'prog2-source2.$(OBJEXT)'
95 cat >> Makefile.am <<'END'
96 bin_PROGRAMS += prog3
97 prog3_SOURCES = source3.cxx
98 prog3_CXXFLAGS = $(AM_CXXFLAGS)
99 END
101 add_match 'prog3-source3.$(OBJEXT)'
103 cat >> Makefile.am <<'END'
104 bin_PROGRAMS += prog4
105 prog4_SOURCES = source4.c++
106 prog4_CPPFLAGS = $(AM_CPPFLAGS)
109 add_match 'prog4-source4.$(OBJEXT)'
111 cat >> Makefile.am <<'END'
112 bin_PROGRAMS += prog5
113 prog5_SOURCES = source5.f
114 prog5_FFLAGS = $(AM_FFLAGS)
117 add_match 'prog5-source5.$(OBJEXT)'
119 cat >> Makefile.am <<'END'
120 bin_PROGRAMS += prog6
121 prog6_SOURCES = source6.f90
122 prog6_FCFLAGS = $(AM_FCFLAGS)
125 add_match 'prog6-source6.$(OBJEXT)'
127 cat >> Makefile.am <<'END'
128 bin_PROGRAMS += prog7
129 prog7_SOURCES = source7.r
130 prog7_RFLAGS = $(AM_RFLAGS)
133 add_match 'prog7-source7.$(OBJEXT)'
135 cat >> Makefile.am <<'END'
136 bin_PROGRAMS += prog8
137 prog8_SOURCES = source8.java
138 prog8_GCJFLAGS = $(AM_GCJFLAGS)
141 add_match 'prog8-source8.$(OBJEXT)'
143 cat >> Makefile.am <<'END'
144 bin_PROGRAMS += prog9
145 prog9_SOURCES = source9.upc
146 prog9_UPCFLAGS = $(AM_UPCFLAGS)
149 add_match 'prog9-source9.$(OBJEXT)'
151 cat >> Makefile.am <<'END'
152 bin_PROGRAMS += prog10
153 prog10_SOURCES = source10.m
154 prog10_OBJCFLAGS = $(AM_OBJCFLAGS)
157 add_match 'prog10-source10.$(OBJEXT)'
159 cat >> Makefile.am <<'END'
160 bin_PROGRAMS += linkprog
161 linkprog_SOURCES = linkprog.c
162 linkprog_LDFLAGS = $(AM_LDFLAGS)
165 add_match 'linkprog_LINK ='
167 cat >> Makefile.am <<'END'
168 lib_LIBRARIES += libstatic.a
169 libstatic_a_SOURCES = static123.c
170 libstatic_a_CFLAGS = $(AM_CFLAGS)
173 add_match 'libstatic_a-static123.$(OBJEXT)'
175 cat >> Makefile.am <<'END'
176 lib_LTLIBRARIES += libshared1.la
177 libshared1_la_SOURCES = shared1.c
178 libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS)
181 add_match 'libshared1_la-shared1.lo'
183 cat >> Makefile.am <<'END'
184 lib_LTLIBRARIES += libshared2.la
185 libshared2_la_SOURCES = shared2.cc
186 libshared2_la_CXXFLAGS = $(AM_CXXFLAGS)
189 add_match 'libshared2_la-shared2.lo'
191 cat >> Makefile.am <<'END'
192 bin_PROGRAMS += parse1
193 parse1_SOURCES = parse.y
194 parse1_YFLAGS = $(AM_YFLAGS)
197 add_match 'parse1-parse.c'
199 cat >> Makefile.am <<'END'
200 bin_PROGRAMS += parse2
201 parse2_SOURCES = parse.ypp
202 parse2_YFLAGS = $(AM_YFLAGS)
205 add_match 'parse2-parse.cpp'
207 cat >> Makefile.am <<'END'
208 bin_PROGRAMS += lexer1
209 lexer1_SOURCES = lex.l
210 lexer1_LFLAGS = $(AM_YFLAGS)
213 add_match 'lexer1-lex.c'
215 cat >> Makefile.am <<'END'
216 bin_PROGRAMS += lexer2
217 lexer2_SOURCES = lexer.ll
218 lexer2_LFLAGS = $(AM_YFLAGS)
221 add_match 'lexer2-lexer.cc'
223 # For debugging.
224 cat Makefile.am
226 $AUTOMAKE -a
227 do_check
229 sed '
230 s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
231 s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
232 s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
233 s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
234 ' Makefile.am > t
236 cat - t > Makefile.am <<'END'
237 AUTOMAKE_OPTIONS = subdir-objects
240 rm -f t
242 # For debugging.
243 cat Makefile.am
245 $AUTOMAKE
246 do_check