First cut config. builds in place.
[deliverable/binutils-gdb.git] / configure
1 #!/bin/sh
2 # Please do not edit this file. It is generated automatically from
3 # configure.in and a configure template.
4 configdirs=
5
6 #!/bin/sh
7
8 # Configuration script template
9 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
10
11 #This file is part of GNU.
12
13 #GNU CC is free software; you can redistribute it and/or modify
14 #it under the terms of the GNU General Public License as published by
15 #the Free Software Foundation; either version 1, or (at your option)
16 #any later version.
17
18 #GNU CC is distributed in the hope that it will be useful,
19 #but WITHOUT ANY WARRANTY; without even the implied warranty of
20 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 #GNU General Public License for more details.
22
23 #You should have received a copy of the GNU General Public License
24 #along with GNU CC; see the file COPYING. If not, write to
25 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 # $Id$
28
29 #
30 # Shell script to create proper links to machine-dependent files in
31 # preparation for compiling gcc.
32 #
33 # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET
34 #
35 # If configure succeeds, it leaves its status in config.status.
36 # If configure fails after disturbing the status quo,
37 # config.status is removed.
38 #
39
40 progname=$0
41
42 remove=rm
43 hard_link=ln
44 symbolic_link='ln -s'
45
46 #for Test
47 #remove="echo rm"
48 #hard_link="echo ln"
49 #symbolic_link="echo ln -s"
50
51 # clear some things potentially inherited from environment.
52 target=
53 template=
54 removing=
55 norecurse=
56 ansi=
57 srcdir=
58
59 for arg in $*;
60 do
61 case $arg in
62 -ansi | +ansi)
63 ansi=true
64 ;;
65 -template=* | +template=*)
66 template=`echo $arg | sed 's/[+-]template=//'`
67 ;;
68 -norecurse | +norecurse)
69 norecurse=true
70 ;;
71 -rm | +rm)
72 removing=$arg
73 ;;
74 -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
75 srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'`
76 ;;
77 -host=* | +host=* | +hos=* | +ho=* | +h=*)
78 host=`echo $arg | sed 's/[+-]h[a-z]*=//'`
79 ;;
80 -languages=* | +languages=* | +language=* | +languag=* \
81 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
82 | +l=*)
83 languages="$languages `echo $arg | sed 's/[+-]l[a-z]*=//'`"
84 ;;
85 -gas | +gas | +ga | +g)
86 gas=yes
87 ;;
88 -nfp | +nfp | +nf | +n)
89 nfp=yes
90 ;;
91 *)
92 # Allow configure HOST TARGET
93 if [ x$host = x ] ; then host=$target ; fi
94 target=$arg
95 ;;
96 esac
97 done
98
99 # process host and target only if not rebuilding configure itself.
100 if [ -z "$template" -a -z "$removing" ]
101 then
102 # Complain if an arg is missing
103 if [ -z "$target" ]
104 then
105 echo "Usage: $progname [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET"
106 echo -n "Where HOST and TARGET are something like "
107 echo "\`vax', \`sun3', \`encore', etc."
108 if [ -r config.status ]
109 then
110 cat config.status
111 fi
112 exit 1
113 fi
114
115 # Default other arg
116 if [ -z "$host" ]
117 then
118 host=$target
119 fi
120
121 fi
122
123 #### configure.in files come in here.
124 # This file is a shell script fragment that supplies the information
125 # necessary to tailor a template configure script into the configure
126 # script appropriate for this directory. For more information, check
127 # any existing configure script.
128
129 configdirs="bfd binutils gas gcc"
130 srctrigger=gcc
131 srcname="gnu development package"
132 ### end of configure.in
133
134 # are we rebuilding config itself?
135 if [ -n "$template" ]
136 then
137 if [ ! -r $template ]
138 then
139 echo "Can't find template ${template}."
140 exit 1
141 fi
142
143 mv configure configure.old
144 echo "#!/bin/sh" > configure
145 echo "# Please do not edit this file. It is generated automatically from" >> configure
146 echo "# configure.in and a configure template." >> configure
147 echo "configdirs=" >> configure
148 echo >> configure
149
150 if [ -r configure.in ]
151 then
152 sed -e "/^####/ r configure.in" $template >> configure
153 else
154 cat $template >> configure
155 fi
156
157 chmod a+x configure
158 rm configure.old
159 echo Rebuilt configure in `pwd`
160
161 if [ x$norecurse = x ]
162 then
163 while [ -n "$configdirs" ]
164 do
165 # set configdir to car of configdirs, configdirs to cdr of configdirs
166 set $configdirs; configdir=$1; shift; configdirs=$*
167
168 if [ "`echo ${configdir}.*`" != "${configdir}.*" ]
169 then
170 targetspecificdirs=${configdir}.*
171 else
172 targetspecificdirs=
173 fi
174
175 for i in ${configdir} ${targetspecificdirs}
176 do
177 if [ -r $i/configure ]
178 then
179 (cd $i ;
180 configure +template=${template})
181 else
182 echo No configure script in `pwd`/$i
183 fi
184 done
185 done
186 fi
187
188 exit 0
189 fi
190
191 # Temporarily, we support only direct subdir builds.
192 hostsubdir=Host-$host
193 targetsubdir=Target-$target
194
195 if [ -n "$removing" ]
196 then
197 # rm -rf $hostsubdir/$targetsubdir
198 #
199 # if [ -z "`(ls $hostsubdir) 2>&1 | grep Target-`" ]
200 # then
201 # rm -rf $hostsubdir
202 # fi
203
204 rm -f .gdbinit Makefile config.status $links
205
206 else
207 # if [ ! -d $hostsubdir ] ; then mkdir $hostsubdir ; fi
208 # cd $hostsubdir
209 #
210 # if [ ! -d $targetsubdir ] ; then mkdir $targetsubdir ; fi
211 # cd $targetsubdir
212 #
213 # srcdir=../..
214
215 # Find the source files, if location was not specified.
216 if [ x$srcdir = x ]
217 then
218 srcdirdefaulted=1
219 srcdir=.
220 if [ ! -r ${srctrigger} ]
221 then
222 srcdir=..
223 fi
224 fi
225
226 if [ ! -r ${srcdir}/${srctrigger} ]
227 then
228 if [ -z "$srcdirdefaulted" ]
229 then
230 echo "$progname: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
231 else
232 echo "$progname: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
233 fi
234 exit 1
235 fi
236
237 # Set up the list of links to be made.
238 # $links is the list of link names, and $files is the list of names to link to.
239
240 # Make the links.
241 while [ -n "$files" ]
242 do
243 # set file to car of files, files to cdr of files
244 set $files; file=$1; shift; files=$*
245 set $links; link=$1; shift; links=$*
246
247 if [ ! -r ${srcdir}/${file} ]
248 then
249 echo "$progname: cannot create a link \"${link}\"," 1>&2
250 echo "since the file \"$file\" does not exist." 1>&2
251 exit 1
252 fi
253
254 $remove -f $link
255 rm -f config.status
256 # Make a symlink if possible, otherwise try a hard link
257 $symbolic_link ${srcdir}/$file $link 2>/dev/null || $hard_link ${srcdir}/$file $link
258
259 if [ ! -r $link ]
260 then
261 echo "$progname: unable to link \"$link\" to \"${srcdir}/$file\"." 1>&2
262 exit 1
263 fi
264 echo "Linked \"$link\" to \"${srcdir}/${file}\"."
265 done
266
267 # Install a makefile, and make it set VPATH
268 # if necessary so that the sources are found.
269 # Also change its value of srcdir.
270 # Also create a .gdbinit file which runs the one in srcdir
271 # and tells GDB to look there for source files.
272 case $srcdir in
273 .)
274 ;;
275 *)
276 echo "VPATH = ${srcdir}" > x
277 cat x ${srcdir}/Makefile.in | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.in
278 rm x
279 echo "dir ." > .gdbinit
280 echo "dir ${srcdir}" >> .gdbinit
281 echo "source ${srcdir}/.gdbinit" >> .gdbinit
282 ;;
283 esac
284
285 host_var_file=hmake-${host}
286 target_var_file=tmake-${target}
287
288 # Conditionalize the makefile for this machine.
289 if [ -f ${srcdir}/config/${host_var_file} ]
290 then
291 sed -e "/^####/ r ${srcdir}/config/${host_var_file}" Makefile.in > Makefile.tem
292 else
293 cp Makefile.in Makefile.tem
294 fi
295
296 if [ -f ${srcdir}/config/${target_var_file} ]
297 then
298 sed -e "/^####/ r ${srcdir}/config/${target_var_file}" Makefile.tem > Makefile.tem1
299 mv Makefile.tem1 Makefile.tem
300 fi
301
302 # Remove all formfeeds, since some Makes get confused by them.
303 sed "s/\f//" Makefile.tem >> Makefile.tem1
304 mv Makefile.tem1 Makefile.tem
305
306 # reset SUBDIRS
307 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile.tem > Makefile.tem1
308 mv Makefile.tem1 Makefile.tem
309
310 # reset NONSUBDIRS
311 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile.tem > Makefile.tem1
312 mv Makefile.tem1 Makefile.tem
313
314 # Delete the intermediate files
315 if [ x$srcdir != x. ] ; then rm Makefile.in ; fi
316
317 rm -f Makefile
318
319 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
320 if [ x$host != x$target ]
321 then
322 echo "CROSS=-DCROSS_COMPILE" > Makefile
323 echo "ALL=start.encap" >> Makefile
324 else
325 echo "ALL=all.internal" > Makefile
326 fi
327
328 # set target and host
329 echo "host = $host" >> Makefile
330 echo "target = $target" >> Makefile
331
332 cat Makefile.tem >> Makefile
333 rm Makefile.tem
334
335 using=
336 if [ -f ${srcdir}/config/${host_var_file} ]
337 then
338 using=" using \"${host_var_file}\""
339 fi
340
341 if [ -f ${srcdir}/config/${target_var_file} ]
342 then
343 if [ -z "${using}" ]
344 then
345 andusing=" using \"${target_var_file}\""
346 else
347 andusing="${using} and \"${target_var_file}\""
348 fi
349 else
350 andusing=${using}
351 fi
352
353 echo "Created \"Makefile\""${andusing}.
354
355 if [ x$host = x$target ]
356 then
357 echo "Links are now set up for use with a $target." \
358 > config.status
359 # | tee ${srcdir}/config.status
360 else
361 echo "Links are now set up for host $host and target $target." \
362 > config.status
363 # | tee ${srcdir}/config.status
364 fi
365
366 cd ${srcdir}
367 fi
368
369 # If there are subdirectories, then recurse.
370
371 if [ -n "$norecurse" ] ; then exit 0 ; fi
372
373 while [ -n "$configdirs" ]
374 do
375 # set configdir to car of configdirs, configdirs to cdr of configdirs
376 set $configdirs; configdir=$1; shift; configdirs=$*
377
378 # check for target override
379 targetspecificdir=${configdir}.${target}
380 if [ -d ${targetspecificdir} ]
381 then
382 configdir=${targetspecificdir}
383 fi
384
385 echo Configuring ${configdir}...
386 # (cd ${configdir} ;
387 # configure +host=${host} ${target} ${removing}) \
388 # | sed 's/^/ /'
389
390 (cd ${configdir} ;
391 ./configure +host=${host} ${target} ${removing}) \
392 | sed 's/^/ /'
393 done
394
395 exit 0
396
397 #
398 # $Log$
399 # Revision 1.2 1991/04/09 23:52:41 rich
400 # First cut config. builds in place.
401 #
402 #
403 #
404
405
406 # end of configure.template
This page took 0.039612 seconds and 5 git commands to generate.