* pa.h (CPP_SPEC): Add whitespace after -D__STDC_EXT__.
[official-gcc.git] / gcc / configure.lang
blobd96b6d8d53147579d1a96ee885cd317a7bbc39cf
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)
13 #any later version.
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.
25 savesrcdir=$srcdir
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 = "".
31         if [ $subdir = . ]
32         then
33                 continue
34         fi
36         oldsrcdir=$savesrcdir
38         # Re-adjust the path
39         case $oldsrcdir in
40         /*)
41                 srcdir=$oldsrcdir/$subdir
42                 ;;
43         *)
44                 oldsrcdir=../${oldsrcdir}
45                 srcdir=$oldsrcdir/$subdir
46                 ;;
47         esac
48         mainsrcdir=$oldsrcdir
49         STARTDIR=`pwd`
50         test -d $subdir || mkdir $subdir
51         cd $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.
58         case $srcdir in
59         . | ./$subdir | .././$subdir)
60                 rm -f Makefile.tem
61                 cp Makefile.in Makefile.tem
62                 chmod +w Makefile.tem
63                 ;;
64         *)
65                 rm -f Makefile.tem
66                 echo "VPATH = ${srcdir}" \
67                   | cat - ${srcdir}/Makefile.in \
68                   | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
69                 rm -f .gdbinit
70                 echo "dir ." > .gdbinit
71                 echo "dir ${srcdir}" >> .gdbinit
72                 echo "dir ${mainsrcdir}" >> .gdbinit
73                 if [ x$gdb_needs_out_file_path = xyes ]
74                 then
75                         echo "dir ${mainsrcdir}/config/"`dirname ${out_file}` >> .gdbinit
76                 fi
77                 echo "source ${mainsrcdir}/.gdbinit" >> .gdbinit
78                 ;;
79         esac
81         # Conditionalize the makefile for this host machine.
82         rm -f Makefile.xx Makefile.ll
83         merged_frags=
84         for f in .. ${host_xmake_file}
85         do
86                 if [ -f ${mainsrcdir}/config/$f ]
87                 then
88                         cat ${mainsrcdir}/config/$f >> Makefile.ll
89                         if [ x"${merged_frags}" != x ]
90                         then
91                                 merged_frags="${merged_frags} and "
92                         fi
93                         merged_frags="${merged_frags}${f}"
94                 fi
95         done
96         if [ x"${merged_frags}" != x ]
97         then
98                 sed -e "/####host/  r Makefile.ll" Makefile.tem > Makefile.xx
99                 echo "Merged ${merged_frags}."
100                 rm -f Makefile.tem
101                 mv Makefile.xx Makefile.tem
102                 rm -f Makefile.ll
103         fi
105         # Add a definition for MAKE if system wants one.
106         case "$SET_MAKE" in
107         ?*)
108                 rm -f Makefile.xx
109                 (echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx
110                 rm -f Makefile.tem
111                 mv Makefile.xx Makefile.tem
112         esac
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 ]
117         then true
118         else
119                 rm -f Makefile.xx
120                 abssrcdir=`cd ${srcdir}; pwd`
121                 sed "s|^INSTALL = .*|${INSTALL}|" Makefile.tem > Makefile.xx
122                 rm -f Makefile.tem
123                 mv Makefile.xx Makefile.tem
124         fi
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
133                 rm -f Makefile.tem
134                 mv Makefile.xx Makefile.tem
135         fi
137         # Conditionalize the makefile for this target machine.
138         rm -f Makefile.xx Makefile.ll
139         merged_frags=
140         for f in .. ${tmake_file}
141         do
142                 if [ -f ${mainsrcdir}/config/$f ]
143                 then
144                         cat ${mainsrcdir}/config/$f >> Makefile.ll
145                         if [ x"${merged_frags}" != x ]
146                         then
147                                 merged_frags="${merged_frags} and "
148                         fi
149                         merged_frags="${merged_frags}$f"
150                 fi
151         done
152         if [ x"${merged_frags}" != x ]
153         then
154                 sed -e "/####target/  r Makefile.ll" Makefile.tem > Makefile.xx
155                 echo "Merged ${merged_frags}."
156                 rm -f Makefile.tem
157                 mv Makefile.xx Makefile.tem
158                 rm -f Makefile.ll
159         fi
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
167         do
168                 rm -f $t
169                 $symbolic_link ../$t $t 2>/dev/null
170         done
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.
177         rm -f Makefile.xx
178         # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
179         echo 's|\f||' > Makefile.sed
180         rm 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 ]
203         then
204                 rm -f Makefile.xx
205                 echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
206                 sed -e "/####cross/  r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
207                 rm -f Makefile.tem
208                 mv Makefile.xx Makefile.tem
209         fi
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
213         # all.cross.
214         if [ x$build != x$host ]
215         then
216                 rm -f Makefile.xx
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
221                 rm -f Makefile.tem
222                 mv Makefile.xx Makefile.tem
223         fi
225         rm -f Makefile
226         mv Makefile.tem Makefile
227         echo "Created \`$subdir/Makefile'."
229         cd $STARTDIR
230 done   # end of current-dir SUBDIRS loop
232 # Restore this, remember we're invoked with `.'.
233 srcdir=$savesrcdir