ar-lib: new 'AM_PROG_AR' macro, triggering the 'ar-lib' script
[automake.git] / tests / specflg-dummy.test
blobd0c8ba66072216405e3ccfacfb219ecd4f0eccd5
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 AM_PROG_AR
65 AC_PROG_RANLIB
66 AC_PROG_LIBTOOL
67 AM_PROG_UPC
68 AC_PROG_OBJC
69 AM_PROG_CC_C_O
70 END
72 cat > Makefile.am <<'END'
73 bin_PROGRAMS =
74 lib_LIBRARIES =
75 lib_LTLIBRARIES =
76 END
78 $ACLOCAL
80 cat >> Makefile.am <<'END'
81 bin_PROGRAMS += prog1
82 prog1_SOURCES = source1.c
83 prog1_CFLAGS = $(AM_CFLAGS)
84 END
86 add_match 'prog1-source1.$(OBJEXT)'
88 cat >> Makefile.am <<'END'
89 bin_PROGRAMS += prog2
90 prog2_SOURCES = source2.c
91 prog2_CPPFLAGS = $(AM_CPPFLAGS)
92 END
94 add_match 'prog2-source2.$(OBJEXT)'
96 cat >> Makefile.am <<'END'
97 bin_PROGRAMS += prog3
98 prog3_SOURCES = source3.cxx
99 prog3_CXXFLAGS = $(AM_CXXFLAGS)
102 add_match 'prog3-source3.$(OBJEXT)'
104 cat >> Makefile.am <<'END'
105 bin_PROGRAMS += prog4
106 prog4_SOURCES = source4.c++
107 prog4_CPPFLAGS = $(AM_CPPFLAGS)
110 add_match 'prog4-source4.$(OBJEXT)'
112 cat >> Makefile.am <<'END'
113 bin_PROGRAMS += prog5
114 prog5_SOURCES = source5.f
115 prog5_FFLAGS = $(AM_FFLAGS)
118 add_match 'prog5-source5.$(OBJEXT)'
120 cat >> Makefile.am <<'END'
121 bin_PROGRAMS += prog6
122 prog6_SOURCES = source6.f90
123 prog6_FCFLAGS = $(AM_FCFLAGS)
126 add_match 'prog6-source6.$(OBJEXT)'
128 cat >> Makefile.am <<'END'
129 bin_PROGRAMS += prog7
130 prog7_SOURCES = source7.r
131 prog7_RFLAGS = $(AM_RFLAGS)
134 add_match 'prog7-source7.$(OBJEXT)'
136 cat >> Makefile.am <<'END'
137 bin_PROGRAMS += prog8
138 prog8_SOURCES = source8.java
139 prog8_GCJFLAGS = $(AM_GCJFLAGS)
142 add_match 'prog8-source8.$(OBJEXT)'
144 cat >> Makefile.am <<'END'
145 bin_PROGRAMS += prog9
146 prog9_SOURCES = source9.upc
147 prog9_UPCFLAGS = $(AM_UPCFLAGS)
150 add_match 'prog9-source9.$(OBJEXT)'
152 cat >> Makefile.am <<'END'
153 bin_PROGRAMS += prog10
154 prog10_SOURCES = source10.m
155 prog10_OBJCFLAGS = $(AM_OBJCFLAGS)
158 add_match 'prog10-source10.$(OBJEXT)'
160 cat >> Makefile.am <<'END'
161 bin_PROGRAMS += linkprog
162 linkprog_SOURCES = linkprog.c
163 linkprog_LDFLAGS = $(AM_LDFLAGS)
166 add_match 'linkprog_LINK ='
168 cat >> Makefile.am <<'END'
169 lib_LIBRARIES += libstatic.a
170 libstatic_a_SOURCES = static123.c
171 libstatic_a_CFLAGS = $(AM_CFLAGS)
174 add_match 'libstatic_a-static123.$(OBJEXT)'
176 cat >> Makefile.am <<'END'
177 lib_LTLIBRARIES += libshared1.la
178 libshared1_la_SOURCES = shared1.c
179 libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS)
182 add_match 'libshared1_la-shared1.lo'
184 cat >> Makefile.am <<'END'
185 lib_LTLIBRARIES += libshared2.la
186 libshared2_la_SOURCES = shared2.cc
187 libshared2_la_CXXFLAGS = $(AM_CXXFLAGS)
190 add_match 'libshared2_la-shared2.lo'
192 cat >> Makefile.am <<'END'
193 bin_PROGRAMS += parse1
194 parse1_SOURCES = parse.y
195 parse1_YFLAGS = $(AM_YFLAGS)
198 add_match 'parse1-parse.c'
200 cat >> Makefile.am <<'END'
201 bin_PROGRAMS += parse2
202 parse2_SOURCES = parse.ypp
203 parse2_YFLAGS = $(AM_YFLAGS)
206 add_match 'parse2-parse.cpp'
208 cat >> Makefile.am <<'END'
209 bin_PROGRAMS += lexer1
210 lexer1_SOURCES = lex.l
211 lexer1_LFLAGS = $(AM_YFLAGS)
214 add_match 'lexer1-lex.c'
216 cat >> Makefile.am <<'END'
217 bin_PROGRAMS += lexer2
218 lexer2_SOURCES = lexer.ll
219 lexer2_LFLAGS = $(AM_YFLAGS)
222 add_match 'lexer2-lexer.cc'
224 # For debugging.
225 cat Makefile.am
227 $AUTOMAKE -a
228 do_check
230 sed '
231 s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
232 s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
233 s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
234 s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
235 ' Makefile.am > t
237 cat - t > Makefile.am <<'END'
238 AUTOMAKE_OPTIONS = subdir-objects
241 rm -f t
243 # For debugging.
244 cat Makefile.am
246 $AUTOMAKE
247 do_check