OSDN Git Service

* configure.lang (EXTRA_HEADERS,EXTRA_PASSES,EXTRA_PARTS): Delete.
[pf3gnuchains/gcc-fork.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         # Add a definition of USE_COLLECT2 if system wants one.
141         # Also tell toplev.c what to do.
142         # This substitutes for lots of t-* files.
143         if [ x$use_collect2 != x ]
144         then
145                 rm -f Makefile.xx
146                 (echo "USE_COLLECT2 = ld"; echo "MAYBE_USE_COLLECT2 = -DUSE_COLLECT2")\
147                    | cat - Makefile.tem > Makefile.xx
148                 rm -f Makefile.tem
149                 mv Makefile.xx Makefile.tem
150         fi
151
152         # If using -program-transform-name, override the installation names.
153         if [ "x${program_transform_set}" = "xyes" ] ; then
154                 sed -e "s/^program_transform_name[      ]*=.*$/program_transform_name =
155 $program_transform_name/" \
156                     -e "s/^program_transform_cross_name[
157 ]*=.*$/program_transform_cross_name = $program_transform_name/" \
158                     Makefile.tem > Makefile.xx
159                 rm -f Makefile.tem
160                 mv Makefile.xx Makefile.tem
161         fi
162
163         # Conditionalize the makefile for this target machine.
164         rm -f Makefile.xx Makefile.ll
165         merged_frags=
166         for f in .. ${tmake_file}
167         do
168                 if [ -f ${mainsrcdir}/config/$f ]
169                 then
170                         cat ${mainsrcdir}/config/$f >> Makefile.ll
171                         if [ x"${merged_frags}" != x ]
172                         then
173                                 merged_frags="${merged_frags} and "
174                         fi
175                         merged_frags="${merged_frags}$f"
176                 fi
177         done
178         if [ x"${merged_frags}" != x ]
179         then
180                 sed -e "/####target/  r Makefile.ll" Makefile.tem > Makefile.xx
181                 echo "Merged ${merged_frags}."
182                 rm -f Makefile.tem
183                 mv Makefile.xx Makefile.tem
184                 rm -f Makefile.ll
185         fi
186
187         # If this is the top level Makefile, add the language fragments.
188         # Languages are added via two mechanisms.  Some information must be
189         # recorded in makefile variables, these are defined in config-lang.in.
190         # We accumulate them and plug them into the main Makefile.
191         # The other mechanism is a set of hooks for each of the main targets
192         # like `clean', `install', etc.
193         if [ $subdir = . ]
194         then
195                 rm -f Makefile.xx Makefile.ll
196                 touch Makefile.ll
197                 sed -e "/####language fragments/ r Makefile.ll" Makefile.tem > Makefile.xx
198                 rm -f Makefile.tem
199                 mv Makefile.xx Makefile.tem
200                 subdirs=`echo $subdirs`
201                 sed -e "s|^SUBDIRS[     ]*=.*$|SUBDIRS = $subdirs|" \
202                     -e "s|^LANGUAGES[   ]*=[    ]*\(.*\)$|LANGUAGES = \1 $all_languages|" \
203                     -e "s|^BOOT_LANGUAGES[      ]*=[    ]*\(.*\)$|BOOT_LANGUAGES = \1 $all_boot_languages|" \
204                     -e "s|^COMPILERS[   ]*=[    ]*\(.*\)$|COMPILERS = \1 $all_compilers|" \
205                     -e "s|^LANG_MAKEFILES[      ]*=.*$|LANG_MAKEFILES = $all_lang_makefiles|" \
206                     -e "s|^LANG_STAGESTUFF[     ]*=.*$|LANG_STAGESTUFF = $all_stagestuff|" \
207                     -e "s|^LANG_DIFF_EXCLUDES[  ]*=.*$|LANG_DIFF_EXCLUDES = $all_diff_excludes|" \
208                     -e "s|^LANG_EXTRA_HEADERS[  ]*=.*$|LANG_EXTRA_HEADERS = $all_headers|" \
209                     -e "s|^LANG_LIB2FUNCS[      ]*=.*$|LANG_LIB2FUNCS = $all_lib2funcs|" \
210                     Makefile.tem > Makefile.xx
211                 rm -f Makefile.tem
212                 mv Makefile.xx Makefile.tem
213
214                 # Since we can't use `::' targets, we link each language in
215                 # with a set of hooks, reached indirectly via lang.${target}.
216                 rm -f Makefile.ll
217                 for t in $target_list
218                 do
219                         x=
220                         for l in .. $all_languages
221                         do
222                                 if [ $l != ".." ]; then
223                                         x="$x $l.$t"
224                                 fi
225                         done
226                         echo "lang.$t: $x" >> Makefile.ll
227                 done
228                 sed -e "/####language hooks/ r Makefile.ll" Makefile.tem > Makefile.xx
229                 rm -f Makefile.tem
230                 mv Makefile.xx Makefile.tem
231                 rm -f Makefile.ll
232
233                 # If the host doesn't support symlinks, modify CC in
234                 # FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
235                 # Otherwise, we can use "CC=$(CC)".
236                 rm -f symtest.tem
237                 if $symbolic_link symtest1.tem symtest.tem 2>/dev/null
238                 then
239                         sed -e 's,CC=set-by-configure,CC=$(CC),' \
240                             Makefile.tem > Makefile.xx
241                         sed -e 's,STAGE_PREFIX=set-by-configure,STAGE_PREFIX=$(STAGE_PREFIX),' \
242                             Makefile.xx > Makefile.yy
243                 else
244                         sed -e "s,CC=set-by-configure,CC=\`case '\$(CC)' in *stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`," \
245                             Makefile.tem > Makefile.xx
246                         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\`," \
247                             Makefile.xx > Makefile.yy
248                 fi
249                 rm -f Makefile.tem Makefile.xx
250                 mv Makefile.yy Makefile.tem
251                 rm -f symtest.tem
252
253                 if [ "x$all_languages" != x ]
254                 then
255                         # Missing space after `Merged' is intentional.
256                         echo "Merged$all_languages fragment(s)."
257                 fi
258
259         # Otherwise, this is a language subdirectory.  If the host supports
260         # symlinks, point stage[123] at ../stage[123] so bootstrapping and the
261         # installation procedure can still use CC="stage1/xgcc -Bstage1/".
262         # If the host doesn't support symlinks, FLAGS_TO_PASS has been
263         # modified to solve the problem there.
264         else
265                 for t in stage1 stage2 stage3 stage4 include
266                 do
267                         rm -f $t
268                         $symbolic_link ../$t $t 2>/dev/null
269                 done
270         fi
271
272         # Remove all formfeeds, since some Makes get confused by them.
273         # Also arrange to give the variables `target', `host_xmake_file',
274         # `tmake_file', `prefix', `local_prefix', `exec_prefix', `FIXINCLUDES'
275         # `out_file', `out_object', `md_file', `lang_specs_files',
276         # `lang_options_files', `INSTALL_HEADERS_DIR', and `CROSS_FLOAT_H'
277         # values in the Makefile from the values they have in this script.
278         rm -f Makefile.xx
279         rm -f aux-output.c aux-output.o md
280         # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
281         echo 's|\f||' > Makefile.sed
282         rm Makefile.sed
283         echo 's|\f||' > Makefile.sed
284         echo "s|^target=.*$|target=${target}|" >> Makefile.sed
285         echo "s|^target_alias=.*$|target_alias=${target}|" >> Makefile.sed
286         echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed
287         echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed
288         echo "s|^version=.*$|version=${version}|" >> Makefile.sed
289         echo "s|^out_file=.*$|out_file=${srcdir}/config/${out_file}|" >> Makefile.sed
290         echo "s|^out_object_file=.*$|out_object_file=${out_object_file}|" >> Makefile.sed
291         echo "s|^md_file=.*$|md_file=${md_file}|" >> Makefile.sed
292         echo "s|^tm_file=.*$|tm_file=${tm_file_sub}|" >> Makefile.sed
293         echo "s|^host_xm_file=.*$|host_xm_file=${host_xm_file_sub}|" >> Makefile.sed
294         echo "s|^build_xm_file=.*$|build_xm_file=${build_xm_file_sub}|" >> Makefile.sed
295         echo "s|^lang_specs_files=.*$|lang_specs_files=${lang_specs_files}|" >> Makefile.sed
296         echo "s|^lang_options_files=.*$|lang_options_files=${lang_options_files}|" >> Makefile.sed
297         echo "s|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed
298         echo "s|^prefix[        ]*=.*|prefix = $prefix|" >> Makefile.sed
299         echo "s|^local_prefix[  ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed
300         echo "s|^exec_prefix[   ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed
301         echo "s|^FIXINCLUDES[   ]*=.*|FIXINCLUDES = $fixincludes|" >> Makefile.sed
302         echo "s|^INSTALL_HEADERS_DIR[   ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
303         echo "s|^exeext[        ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed
304         echo "s|^CROSS_FLOAT_H[ ]*=.*|CROSS_FLOAT_H=\$(srcdir)/config/float-${float_format}.h|" >> Makefile.sed
305         sed -f Makefile.sed Makefile.tem > Makefile.xx
306         rm -f Makefile.tem Makefile.sed
307         mv Makefile.xx Makefile.tem
308
309         # Install Makefile for real, after making final changes.
310         # Define macro CROSS_COMPILE in compilation
311         # if this is a cross-compiler.
312         # Also use all.cross instead of all.internal
313         # and add cross-make to Makefile.
314         if [ x$host != x$target ]
315         then
316                 rm -f Makefile.xx
317                 echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
318                 sed -e "/####cross/  r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
319                 rm -f Makefile.tem
320                 mv Makefile.xx Makefile.tem
321         fi
322
323         # When building gcc with a cross-compiler, we need to fix a few things.
324         # This must come after cross-make as we want all.build to override
325         # all.cross.
326         if [ x$build != x$host ]
327         then
328                 rm -f Makefile.xx
329                 echo "build= $build" > Makefile.xx
330                 echo "host= $host" >> Makefile.xx
331                 sed -e "s|objc-runtime$||" \
332                     -e "/####build/  r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx
333                 rm -f Makefile.tem
334                 mv Makefile.xx Makefile.tem
335         fi
336
337         if [ $subdir != . ]
338         then
339                 rm -f Makefile
340                 mv Makefile.tem Makefile
341                 echo "Created \`$subdir/Makefile'."
342         else
343                 rm -f Makefile.tem
344         fi
345
346         cd $STARTDIR
347 done   # end of current-dir SUBDIRS loop
348
349 srcdir=$savesrcdir