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 mechanism
4 # for such subdirectories.
6 # Copyright (C) 1997, 1998 Free Software Foundation, Inc.
8 #This file is part of GNU CC.
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)
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.
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.
27 for subdir in . $oldstyle_subdirs
29 # We only want to do this in language subdirs, but we have to handle
30 # the case of $oldstyle_subdirs = "".
41 srcdir=$oldsrcdir/$subdir
44 oldsrcdir=../${oldsrcdir}
45 srcdir=$oldsrcdir/$subdir
50 test -d $subdir || mkdir $subdir
53 # Create Makefile.tem from Makefile.in.
54 # Make it set VPATH if necessary so that the sources are found.
55 # Also change its value of srcdir.
56 # Also create a .gdbinit file which runs the one in srcdir
57 # and tells GDB to look there for source files.
59 . | ./$subdir | .././$subdir)
61 cp Makefile.in Makefile.tem
66 echo "VPATH = ${srcdir}" \
67 | cat - ${srcdir}/Makefile.in \
68 | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
70 echo "dir ." > .gdbinit
71 echo "dir ${srcdir}" >> .gdbinit
72 echo "dir ${mainsrcdir}" >> .gdbinit
73 if [ x$gdb_needs_out_file_path = xyes ]
75 echo "dir ${mainsrcdir}/config/"`dirname ${out_file}` >> .gdbinit
77 echo "source ${mainsrcdir}/.gdbinit" >> .gdbinit
81 # Conditionalize the makefile for this host machine.
82 rm -f Makefile.xx Makefile.ll
84 for f in .. ${host_xmake_file}
86 if [ -f ${mainsrcdir}/config/$f ]
88 cat ${mainsrcdir}/config/$f >> Makefile.ll
89 if [ x"${merged_frags}" != x ]
91 merged_frags="${merged_frags} and "
93 merged_frags="${merged_frags}${f}"
96 if [ x"${merged_frags}" != x ]
98 sed -e "/####host/ r Makefile.ll" Makefile.tem > Makefile.xx
99 echo "Merged ${merged_frags}."
101 mv Makefile.xx Makefile.tem
105 # Add a definition for MAKE if system wants one.
109 (echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx
111 mv Makefile.xx Makefile.tem
114 # Add a definition for INSTALL if system wants one.
115 # This substitutes for lots of x-* files.
116 if [ x$build_broken_install = x ]
120 abssrcdir=`cd ${srcdir}; pwd`
121 sed "s|^INSTALL = .*|${INSTALL}|" Makefile.tem > Makefile.xx
123 mv Makefile.xx Makefile.tem
126 # If using -program-transform-name, override the installation names.
127 if [ "x${program_transform_set}" = "xyes" ] ; then
128 sed -e "s/^program_transform_name[ ]*=.*$/program_transform_name =
129 $program_transform_name/" \
130 -e "s/^program_transform_cross_name[
131 ]*=.*$/program_transform_cross_name = $program_transform_name/" \
132 Makefile.tem > Makefile.xx
134 mv Makefile.xx Makefile.tem
137 # Conditionalize the makefile for this target machine.
138 rm -f Makefile.xx Makefile.ll
140 for f in .. ${tmake_file}
142 if [ -f ${mainsrcdir}/config/$f ]
144 cat ${mainsrcdir}/config/$f >> Makefile.ll
145 if [ x"${merged_frags}" != x ]
147 merged_frags="${merged_frags} and "
149 merged_frags="${merged_frags}$f"
152 if [ x"${merged_frags}" != x ]
154 sed -e "/####target/ r Makefile.ll" Makefile.tem > Makefile.xx
155 echo "Merged ${merged_frags}."
157 mv Makefile.xx Makefile.tem
161 # If the host supports
162 # symlinks, point stage[123] at ../stage[123] so bootstrapping and the
163 # installation procedure can still use CC="stage1/xgcc -Bstage1/".
164 # If the host doesn't support symlinks, FLAGS_TO_PASS has been
165 # modified to solve the problem there.
166 for t in stage1 stage2 stage3 stage4 include
169 $symbolic_link ../$t $t 2>/dev/null
172 # Remove all formfeeds, since some Makes get confused by them.
173 # Also arrange to give the variables `target', `target_alias',
174 # `host_xmake_file', `tmake_file', `prefix', `local_prefix',
175 # `exec_prefix', `INSTALL_HEADERS_DIR', `exeext'
176 # values in the Makefile from the values they have in this script.
178 # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
179 echo 's|
\f||' > Makefile.sed
181 echo 's|
\f||' > Makefile.sed
182 echo "s|^target=.*$|target=${target}|" >> Makefile.sed
183 echo "s|^target_alias=.*$|target_alias=${target_alias}|" >> Makefile.sed
184 echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed
185 echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed
186 echo "s|^version=.*$|version=${version}|" >> Makefile.sed
187 echo "s|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed
188 echo "s|^prefix[ ]*=.*|prefix = $prefix|" >> Makefile.sed
189 echo "s|^local_prefix[ ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed
190 echo "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed
191 echo "s|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
192 echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed
193 sed -f Makefile.sed Makefile.tem > Makefile.xx
194 rm -f Makefile.tem Makefile.sed
195 mv Makefile.xx Makefile.tem
197 # Install Makefile for real, after making final changes.
198 # Define macro CROSS_COMPILE in compilation
199 # if this is a cross-compiler.
200 # Also use all.cross instead of all.internal
201 # and add cross-make to Makefile.
202 if [ x$host != x$target ]
205 echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
206 sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
208 mv Makefile.xx Makefile.tem
211 # When building gcc with a cross-compiler, we need to fix a few things.
212 # This must come after cross-make as we want all.build to override
214 if [ x$build != x$host ]
217 echo "build= $build" > Makefile.xx
218 echo "host= $host" >> Makefile.xx
219 sed -e "s|objc-runtime$||" \
220 -e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx
222 mv Makefile.xx Makefile.tem
226 mv Makefile.tem Makefile
227 echo "Created \`$subdir/Makefile'."
230 done # end of current-dir SUBDIRS loop
232 # Restore this, remember we're invoked with `.'.