]> gcc.gnu.org Git - gcc.git/blob - gcc/configure.lang
(GCC_THREAD_FILE): Renamed from OBJC_THREAD_FILE.
[gcc.git] / gcc / configure.lang
1 # configure.lang for GNU CC
2 # This script is run by configure for configuration of language
3 # subdirectories which conform to the old GCC configure mechansim
4 # for such subdirectories.
5
6 # Copyright (C) 1997 Free Software Foundation, Inc.
7
8 #This file is part of GNU CC.
9
10 #GNU CC is free software; you can redistribute it and/or modify
11 #it under the terms of the GNU General Public License as published by
12 #the Free Software Foundation; either version 2, or (at your option)
13 #any later version.
14
15 #GNU CC is distributed in the hope that it will be useful,
16 #but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 #GNU General Public License for more details.
19
20 #You should have received a copy of the GNU General Public License
21 #along with GNU CC; see the file COPYING. If not, write to
22 #the Free Software Foundation, 59 Temple Place - Suite 330,
23 #Boston, MA 02111-1307, USA.
24
25 savesrcdir=$srcdir
26 for subdir in . $subdirs
27 do
28 oldsrcdir=$savesrcdir
29
30 # Re-adjust the path
31 case $oldsrcdir in
32 /*)
33 case $subdir in
34 .)
35 srcdir=$oldsrcdir
36 ;;
37 *)
38 srcdir=$oldsrcdir/$subdir
39 ;;
40 esac
41 ;;
42 *)
43 case $subdir in
44 .)
45 ;;
46 *)
47 oldsrcdir=../${oldsrcdir}
48 srcdir=$oldsrcdir/$subdir
49 ;;
50 esac
51 ;;
52 esac
53 mainsrcdir=$oldsrcdir
54 STARTDIR=`pwd`
55 test -d $subdir || mkdir $subdir
56 cd $subdir
57
58 # Create Makefile.tem from Makefile.in.
59 # Make it set VPATH if necessary so that the sources are found.
60 # Also change its value of srcdir.
61 # Also create a .gdbinit file which runs the one in srcdir
62 # and tells GDB to look there for source files.
63 case $srcdir in
64 . | ./$subdir | .././$subdir)
65 rm -f Makefile.tem
66 cp Makefile.in Makefile.tem
67 chmod +w Makefile.tem
68 ;;
69 *)
70 rm -f Makefile.tem
71 echo "VPATH = ${srcdir}" \
72 | cat - ${srcdir}/Makefile.in \
73 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
74 rm -f .gdbinit
75 echo "dir ." > .gdbinit
76 echo "dir ${srcdir}" >> .gdbinit
77 if [ x$gdb_needs_out_file_path = xyes ]
78 then
79 echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
80 fi
81 if [ "x$subdirs" != x ]; then
82 for s in $subdirs
83 do
84 echo "dir ${srcdir}/$s" >> .gdbinit
85 done
86 fi
87 echo "source ${srcdir}/.gdbinit" >> .gdbinit
88 ;;
89 esac
90
91 # Conditionalize the makefile for this host machine.
92 rm -f Makefile.xx Makefile.ll
93 merged_frags=
94 for f in .. ${host_xmake_file}
95 do
96 if [ -f ${mainsrcdir}/config/$f ]
97 then
98 cat ${mainsrcdir}/config/$f >> Makefile.ll
99 if [ x"${merged_frags}" != x ]
100 then
101 merged_frags="${merged_frags} and "
102 fi
103 merged_frags="${merged_frags}${f}"
104 fi
105 done
106 if [ x"${merged_frags}" != x ]
107 then
108 sed -e "/####host/ r Makefile.ll" Makefile.tem > Makefile.xx
109 echo "Merged ${merged_frags}."
110 rm -f Makefile.tem
111 mv Makefile.xx Makefile.tem
112 rm -f Makefile.ll
113 fi
114
115 # Add a definition for MAKE if system wants one.
116 case "$SET_MAKE" in
117 ?*)
118 rm -f Makefile.xx
119 (echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx
120 rm -f Makefile.tem
121 mv Makefile.xx Makefile.tem
122 esac
123
124 # Add a definition for INSTALL if system wants one.
125 # This substitutes for lots of x-* files.
126 if [ x$build_broken_install = x ]
127 then true
128 else
129 rm -f Makefile.xx
130 abssrcdir=`cd ${srcdir}; pwd`
131 sed "s|^INSTALL = .*|INSTALL = ${abssrcdir}/install.sh -c|" Makefile.tem > Makefile.xx
132 rm -f Makefile.tem
133 mv Makefile.xx Makefile.tem
134 fi
135
136 # Some of the following don't make sense in the language makefiles,
137 # but rather than introduce another level of nesting, we leave them
138 # as is.
139
140 # Set EXTRA_HEADERS according to extra_headers.
141 # This substitutes for lots of t-* files.
142 extra_headers_list=
143 if [ "x$extra_headers" = x ]
144 then true
145 else
146 rm -f Makefile.xx
147 sed "s|^EXTRA_HEADERS =|EXTRA_HEADERS = ${extra_headers_list}|" Makefile.tem > Makefile.xx
148 rm -f Makefile.tem
149 mv Makefile.xx Makefile.tem
150 fi
151
152 # Set EXTRA_PASSES according to extra_passes.
153 # This substitutes for lots of t-* files.
154 if [ "x$extra_passes" = x ]
155 then true
156 else
157 rm -f Makefile.xx
158 sed "s/^EXTRA_PASSES =/EXTRA_PASSES = $extra_passes/" Makefile.tem > Makefile.xx
159 rm -f Makefile.tem
160 mv Makefile.xx Makefile.tem
161 fi
162
163 # Set EXTRA_PARTS according to extra_parts.
164 # This substitutes for lots of t-* files.
165 if [ "x$extra_parts" = x ]
166 then true
167 else
168 rm -f Makefile.xx
169 sed "s/^EXTRA_PARTS =/EXTRA_PARTS = $extra_parts/" Makefile.tem > Makefile.xx
170 rm -f Makefile.tem
171 mv Makefile.xx Makefile.tem
172 fi
173
174 # Set EXTRA_PROGRAMS according to extra_programs.
175 if [ "x$extra_programs" = x ]
176 then true
177 else
178 rm -f Makefile.xx
179 sed "s/^EXTRA_PROGRAMS =/EXTRA_PROGRAMS = $extra_programs/" Makefile.tem > Makefile.xx
180 rm -f Makefile.tem
181 mv Makefile.xx Makefile.tem
182 fi
183
184 # Set EXTRA_OBJS according to extra_objs.
185 # This substitutes for lots of t-* files.
186 if [ "x$extra_objs" = x ]
187 then true
188 else
189 rm -f Makefile.xx
190 sed "s|^EXTRA_OBJS =|EXTRA_OBJS = $extra_objs|" Makefile.tem > Makefile.xx
191 rm -f Makefile.tem
192 mv Makefile.xx Makefile.tem
193 fi
194
195 # Set EXTRA_GCC_OBJS according to host_extra_gcc_objs.
196 # This substitutes for lots of x-* files.
197 if [ "x$host_extra_gcc_objs" = x ]
198 then true
199 else
200 rm -f Makefile.xx
201 sed "s|^EXTRA_GCC_OBJS =|EXTRA_GCC_OBJS = $host_extra_gcc_objs|"
202 Makefile.tem > Makefile.xx
203 rm -f Makefile.tem
204 mv Makefile.xx Makefile.tem
205 fi
206
207 # Add a definition of USE_COLLECT2 if system wants one.
208 # Also tell toplev.c what to do.
209 # This substitutes for lots of t-* files.
210 if [ x$use_collect2 != x ]
211 then
212 rm -f Makefile.xx
213 (echo "USE_COLLECT2 = ld"; echo "MAYBE_USE_COLLECT2 = -DUSE_COLLECT2")\
214 | cat - Makefile.tem > Makefile.xx
215 rm -f Makefile.tem
216 mv Makefile.xx Makefile.tem
217 fi
218
219 # Set MD_DEPS if the real md file is in md.pre-cpp.
220 # Set MD_CPP to the cpp to pass the md file through. Md files use ';'
221 # for line oriented comments, so we must always use a GNU cpp. If
222 # building gcc with a cross compiler, use the cross compiler just
223 # built. Otherwise, we can use the cpp just built.
224 if [ "x$md_cppflags" != x ]
225 then
226 rm -f Makefile.xx
227 (if [ x$host = x$build ] ; then
228 echo "MD_DEPS = $(md_file) cpp" ; echo "MD_CPP = ./cpp"
229 else
230 echo "MD_DEPS = md.pre-cpp" ; echo "MD_CPP = \$(HOST_CC) -x c -E"
231 fi
232 echo "MD_CPPFLAGS = $md_cppflags") | \
233 cat - Makefile.tem | sed -e "s|^MD_FILE[ ]*=.*|MD_FILE = md|" > Makefile.xx
234 rm -f Makefile.tem
235 mv Makefile.xx Makefile.tem
236 fi
237
238 # If using -program-transform-name, override the installation names.
239 if [ "x${program_transform_set}" = "xyes" ] ; then
240 sed -e "s/^program_transform_name[ ]*=.*$/program_transform_name =
241 $program_transform_name/" \
242 -e "s/^program_transform_cross_name[
243 ]*=.*$/program_transform_cross_name = $program_transform_name/" \
244 Makefile.tem > Makefile.xx
245 rm -f Makefile.tem
246 mv Makefile.xx Makefile.tem
247 fi
248
249 # Conditionalize the makefile for this target machine.
250 rm -f Makefile.xx Makefile.ll
251 merged_frags=
252 for f in .. ${tmake_file}
253 do
254 if [ -f ${mainsrcdir}/config/$f ]
255 then
256 cat ${mainsrcdir}/config/$f >> Makefile.ll
257 if [ x"${merged_frags}" != x ]
258 then
259 merged_frags="${merged_frags} and "
260 fi
261 merged_frags="${merged_frags}$f"
262 fi
263 done
264 if [ x"${merged_frags}" != x ]
265 then
266 sed -e "/####target/ r Makefile.ll" Makefile.tem > Makefile.xx
267 echo "Merged ${merged_frags}."
268 rm -f Makefile.tem
269 mv Makefile.xx Makefile.tem
270 rm -f Makefile.ll
271 fi
272
273 # If this is the top level Makefile, add the language fragments.
274 # Languages are added via two mechanisms. Some information must be
275 # recorded in makefile variables, these are defined in config-lang.in.
276 # We accumulate them and plug them into the main Makefile.
277 # The other mechanism is a set of hooks for each of the main targets
278 # like `clean', `install', etc.
279 if [ $subdir = . ]
280 then
281 rm -f Makefile.xx Makefile.ll
282 touch Makefile.ll
283 sed -e "/####language fragments/ r Makefile.ll" Makefile.tem > Makefile.xx
284 rm -f Makefile.tem
285 mv Makefile.xx Makefile.tem
286 subdirs=`echo $subdirs`
287 sed -e "s|^SUBDIRS[ ]*=.*$|SUBDIRS = $subdirs|" \
288 -e "s|^LANGUAGES[ ]*=[ ]*\(.*\)$|LANGUAGES = \1 $all_languages|" \
289 -e "s|^BOOT_LANGUAGES[ ]*=[ ]*\(.*\)$|BOOT_LANGUAGES = \1 $all_boot_languages|" \
290 -e "s|^COMPILERS[ ]*=[ ]*\(.*\)$|COMPILERS = \1 $all_compilers|" \
291 -e "s|^LANG_MAKEFILES[ ]*=.*$|LANG_MAKEFILES = $all_lang_makefiles|" \
292 -e "s|^LANG_STAGESTUFF[ ]*=.*$|LANG_STAGESTUFF = $all_stagestuff|" \
293 -e "s|^LANG_DIFF_EXCLUDES[ ]*=.*$|LANG_DIFF_EXCLUDES = $all_diff_excludes|" \
294 -e "s|^LANG_EXTRA_HEADERS[ ]*=.*$|LANG_EXTRA_HEADERS = $all_headers|" \
295 -e "s|^LANG_LIB2FUNCS[ ]*=.*$|LANG_LIB2FUNCS = $all_lib2funcs|" \
296 Makefile.tem > Makefile.xx
297 rm -f Makefile.tem
298 mv Makefile.xx Makefile.tem
299
300 # Since we can't use `::' targets, we link each language in
301 # with a set of hooks, reached indirectly via lang.${target}.
302 rm -f Makefile.ll
303 for t in $target_list
304 do
305 x=
306 for l in .. $all_languages
307 do
308 if [ $l != ".." ]; then
309 x="$x $l.$t"
310 fi
311 done
312 echo "lang.$t: $x" >> Makefile.ll
313 done
314 sed -e "/####language hooks/ r Makefile.ll" Makefile.tem > Makefile.xx
315 rm -f Makefile.tem
316 mv Makefile.xx Makefile.tem
317 rm -f Makefile.ll
318
319 # If the host doesn't support symlinks, modify CC in
320 # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
321 # Otherwise, we can use "CC=$(CC)".
322 rm -f symtest.tem
323 if $symbolic_link symtest1.tem symtest.tem 2>/dev/null
324 then
325 sed -e 's,CC=set-by-configure,CC=$(CC),' \
326 Makefile.tem > Makefile.xx
327 sed -e 's,STAGE_PREFIX=set-by-configure,STAGE_PREFIX=$(STAGE_PREFIX),' \
328 Makefile.xx > Makefile.yy
329 else
330 sed -e "s,CC=set-by-configure,CC=\`case '\$(CC)' in *stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`," \
331 Makefile.tem > Makefile.xx
332 sed -e "s,STAGE_PREFIX=set-by-configure,STAGE_PREFIX=\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`," \
333 Makefile.xx > Makefile.yy
334 fi
335 rm -f Makefile.tem Makefile.xx
336 mv Makefile.yy Makefile.tem
337 rm -f symtest.tem
338
339 if [ "x$all_languages" != x ]
340 then
341 # Missing space after `Merged' is intentional.
342 echo "Merged$all_languages fragment(s)."
343 fi
344
345 # Otherwise, this is a language subdirectory. If the host supports
346 # symlinks, point stage[123] at ../stage[123] so bootstrapping and the
347 # installation procedure can still use CC="stage1/xgcc -Bstage1/".
348 # If the host doesn't support symlinks, FLAGS_TO_PASS has been
349 # modified to solve the problem there.
350 else
351 for t in stage1 stage2 stage3 stage4 include
352 do
353 rm -f $t
354 $symbolic_link ../$t $t 2>/dev/null
355 done
356 fi
357
358 # Remove all formfeeds, since some Makes get confused by them.
359 # Also arrange to give the variables `target', `host_xmake_file',
360 # `tmake_file', `prefix', `local_prefix', `exec_prefix', `FIXINCLUDES'
361 # `out_file', `out_object', `md_file', `lang_specs_files',
362 # `lang_options_files', `INSTALL_HEADERS_DIR', and `CROSS_FLOAT_H'
363 # values in the Makefile from the values they have in this script.
364 rm -f Makefile.xx
365 rm -f aux-output.c aux-output.o md
366 # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
367 echo 's|\f||' > Makefile.sed
368 rm Makefile.sed
369 echo 's|\f||' > Makefile.sed
370 echo "s|^target=.*$|target=${target}|" >> Makefile.sed
371 echo "s|^target_alias=.*$|target_alias=${target}|" >> Makefile.sed
372 echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed
373 echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed
374 echo "s|^version=.*$|version=${version}|" >> Makefile.sed
375 echo "s|^version=.*$|version=${version}|" >> Makefile.sed
376 echo "s|^out_file=.*$|out_file=${srcdir}/config/${out_file}|" >> Makefile.sed
377 echo "s|^out_object_file=.*$|out_object_file=${out_object_file}|" >> Makefile.sed
378 echo "s|^md_file=.*$|md_file=${md_file}|" >> Makefile.sed
379 echo "s|^tm_file=.*$|tm_file=${tm_file_sub}|" >> Makefile.sed
380 echo "s|^host_xm_file=.*$|host_xm_file=${host_xm_file_sub}|" >> Makefile.sed
381 echo "s|^build_xm_file=.*$|build_xm_file=${build_xm_file_sub}|" >> Makefile.sed
382 echo "s|^lang_specs_files=.*$|lang_specs_files=${lang_specs_files}|" >> Makefile.sed
383 echo "s|^lang_options_files=.*$|lang_options_files=${lang_options_files}|" >> Makefile.sed
384 echo "s|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed
385 echo "s|^prefix[ ]*=.*|prefix = $prefix|" >> Makefile.sed
386 echo "s|^local_prefix[ ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed
387 echo "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed
388 echo "s|^FIXINCLUDES[ ]*=.*|FIXINCLUDES = $fixincludes|" >> Makefile.sed
389 echo "s|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
390 echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed
391 echo "s|^CROSS_FLOAT_H[ ]*=.*|CROSS_FLOAT_H=\$(srcdir)/config/float-${float_format}.h|" >> Makefile.sed
392 sed -f Makefile.sed Makefile.tem > Makefile.xx
393 rm -f Makefile.tem Makefile.sed
394 mv Makefile.xx Makefile.tem
395
396 # Install Makefile for real, after making final changes.
397 # Define macro CROSS_COMPILE in compilation
398 # if this is a cross-compiler.
399 # Also use all.cross instead of all.internal
400 # and add cross-make to Makefile.
401 if [ x$host != x$target ]
402 then
403 rm -f Makefile.xx
404 echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
405 sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
406 rm -f Makefile.tem
407 mv Makefile.xx Makefile.tem
408 fi
409
410 # When building gcc with a cross-compiler, we need to fix a few things.
411 # This must come after cross-make as we want all.build to override
412 # all.cross.
413 if [ x$build != x$host ]
414 then
415 rm -f Makefile.xx
416 echo "build= $build" > Makefile.xx
417 echo "host= $host" >> Makefile.xx
418 sed -e "s|objc-runtime$||" \
419 -e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx
420 rm -f Makefile.tem
421 mv Makefile.xx Makefile.tem
422 fi
423
424 if [ $subdir != . ]
425 then
426 rm -f Makefile
427 mv Makefile.tem Makefile
428 echo "Created \`$subdir/Makefile'."
429 else
430 rm -f Makefile.tem
431 fi
432
433 cd $STARTDIR
434 done # end of current-dir SUBDIRS loop
435
436 srcdir=$savesrcdir
This page took 0.057823 seconds and 6 git commands to generate.