include ansidecl.h
[deliverable/binutils-gdb.git] / configure
CommitLineData
eb02fd64 1#!/bin/sh
eb02fd64 2
46f3c7cd 3# Configuration script
1922d8eb 4# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
eb02fd64
RP
5
6#This file is part of GNU.
7
063efd10
JG
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
eb02fd64 21
49b10446
RP
22# Please email any bugs, comments, and/or additions to this file to:
23# configure@cygnus.com
24
eb02fd64
RP
25#
26# Shell script to create proper links to machine-dependent files in
0df06ca0 27# preparation for compilation.
eb02fd64
RP
28#
29# If configure succeeds, it leaves its status in config.status.
30# If configure fails after disturbing the status quo,
31# config.status is removed.
32#
33
4d714963
RP
34# NOTE: This script contains support for a Cygnus experimental feature, called
35# +subdirs, which is currently, tentatively, de-supported.
c5ae5678 36
4d714963 37export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
c297d71e 38
eb02fd64
RP
39remove=rm
40hard_link=ln
41symbolic_link='ln -s'
42
43#for Test
44#remove="echo rm"
45#hard_link="echo ln"
46#symbolic_link="echo ln -s"
47
48# clear some things potentially inherited from environment.
6f8ac2d9
RP
49
50Makefile=Makefile
51Makefile_in=Makefile.in
b8f8fddc 52arguments=$*
6f8ac2d9
RP
53commontargets=
54configdirs=
4d714963
RP
55datadir=
56datadiroption=
0df06ca0 57defaulttargets=
0df06ca0 58fatal=
4d714963
RP
59floating_point=default
60gas=default
3a07a6ac 61host_makefile_frag=
4d714963 62hosts=
4d714963 63next_host=
3a07a6ac 64next_prefix=
3509822c 65next_site=
4d714963 66next_srcdir=
3509822c
RP
67next_target=
68next_tmpdir=
46766962 69norecursion=
4d714963 70prefix=/usr/local
49b10446 71progname=
46766962 72recurring=
131a3881 73removing=
3a07a6ac 74site_makefile_frag=
74cc5508 75srcdir=
ec342d7d 76srctrigger=
131a3881 77target=
3a07a6ac 78target_makefile_frag=
0df06ca0 79targets=
4d714963 80undefinedargs=
0df06ca0 81verbose=
0c72405d 82version="$Revision$"
4d714963
RP
83x11=default
84
4d714963
RP
85NO_EDIT="This file was generated automatically by configure. Do not edit."
86
87## this is a little touchy and won't always work, but...
88##
89## if the argv[0] starts with a slash then it is an absolute name that can be
90## used as is.
91##
92## otherwise, if argv[0] has no slash in it, we can assume that it is on the
93## path. Since PATH might include "." we also add `pwd` to the end of PATH.
94##
95## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
96## path.
97##
98
99PWD=`pwd`
100
1922d8eb 101if echo $0 | grep '^/' > /dev/null ; then
4d714963 102 progname=$0
1922d8eb 103elif echo $0 | grep '/' > /dev/null ; then
4d714963
RP
104 progname=${PWD}/$0
105else
106 progname=$0
107 PATH=$PATH:${PWD} ; export PATH
108fi
109
eb02fd64
RP
110for arg in $*;
111do
3509822c 112 # handle things that might have args following as separate words
4d714963
RP
113 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
114 elif [ -n "${next_datadir}" ] ; then datadir=${arg} ; datadiroption="-datadir=${datadir}" ; next_datadir=
3509822c 115 elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
4d714963 116 elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=
3509822c
RP
117 elif [ -n "${next_target}" ] ; then
118 next_target=
a98bbe58
RP
119 case "${targets}" in
120 "")
4d714963
RP
121 newtargets="${targets} ${arg}"
122 targets="${newtargets}"
a98bbe58
RP
123 ;;
124 *)
4d714963
RP
125 echo '***' Can only configure for one target at a time.
126 fatal=yes
a98bbe58
RP
127 ;;
128 esac
3509822c
RP
129 elif [ -n "${next_tmpdir}" ] ; then
130 next_tmpdir=
4d714963 131 tmpdiroption="--tmpdir=${arg}"
3509822c
RP
132 TMPDIR=${arg}
133
134 else
135 case ${arg} in
4d714963 136 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* | --da=* | --d=*)
0e0643c7 137 datadir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963 138 datadiroption=${arg}
3509822c 139 ;;
4d714963
RP
140 -datadir | --datadir | --datadi | --datad | --data | --dat | --da | --d)
141 next_datadir=yes
3509822c 142 ;;
4d714963 143 -gas | --g*)
3509822c
RP
144 gas=yes
145 ;;
4d714963 146 -help | --he*)
3509822c
RP
147 fatal=true
148 ;;
4d714963 149 -host=* | --host=* | --hos=* | --ho=*)
a98bbe58
RP
150 case "${hosts}" in
151 "")
0e0643c7 152 newhosts="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`"
4d714963 153 hosts="${newhosts}"
a98bbe58
RP
154 ;;
155 *)
4d714963
RP
156 echo '***' Can only configure for one host at a time.
157 fatal=yes
a98bbe58
RP
158 ;;
159 esac
3509822c 160 ;;
4d714963
RP
161 -nfp | --nf*)
162 floating_point=no
3509822c 163 ;;
4d714963 164 -norecursion | --no*)
3509822c
RP
165 norecursion=true
166 ;;
4d714963 167 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
0e0643c7 168 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963 169 prefixoption=${arg}
3509822c 170 ;;
4d714963
RP
171 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
172 next_prefix=yes
3509822c 173 ;;
4d714963 174 -recurring | --recurring | --recurrin | --recurri | --recurr | --recur | --recu | --rec | --re)
3509822c
RP
175 recurring=true
176 arguments=`echo ${arguments} | sed "s:${arg}::"`
177 ;;
4d714963 178 -rm | --rm)
3509822c
RP
179 removing=${arg}
180 ;;
4d714963 181 -site=* | --site=* | --sit=* | --si=*)
0e0643c7 182 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 183 ;;
4d714963 184 -site | --site | --sit | --si)
3509822c
RP
185 next_site=yes
186 ;;
4d714963 187 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
0e0643c7 188 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963
RP
189 ;;
190 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
191 next_srcdir=yes
3509822c 192 ;;
4d714963 193 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
a98bbe58
RP
194 case "${targets}" in
195 "")
0e0643c7 196 newtargets="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
4d714963 197 targets="${newtargets}"
a98bbe58
RP
198 ;;
199 *)
4d714963
RP
200 echo '***' Can only configure for one target at a time.
201 fatal=yes
a98bbe58
RP
202 ;;
203 esac
3509822c 204 ;;
4d714963 205 -target | --target | --targe | --targ | --tar | --ta)
3509822c
RP
206 next_target=yes
207 ;;
4d714963 208 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
3509822c 209 tmpdiroption=${arg}
0e0643c7 210 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 211 ;;
4d714963 212 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
3509822c
RP
213 next_tmpdir=yes
214 ;;
4d714963 215 -v | -verbose | --v)
3509822c
RP
216 verbose=${arg}
217 ;;
0c72405d 218 -version | -V | --version | --V)
b940b7c2 219 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
0c72405d
RP
220 exit 0
221 ;;
4d714963
RP
222 -x | --x) ;;
223 -* | --*)
3509822c
RP
224 (echo ;
225 echo "Unrecognized option: \"${arg}\"". ;
226 echo) 1>&2
227 fatal=true
228 ;;
229 *)
a98bbe58
RP
230 case "${undefs}" in
231 "")
4d714963
RP
232 newundefs="${undefs} ${arg}"
233 undefs=${newundefs}
a98bbe58
RP
234 ;;
235 *)
4d714963
RP
236 echo '***' Can only configure for one host and one target at a time.
237 fatal=yes
a98bbe58
RP
238 ;;
239 esac
3509822c
RP
240 ;;
241 esac
242 fi
eb02fd64
RP
243done
244
4d714963 245# process host and target
a98bbe58
RP
246case "${fatal}" in
247"")
4d714963
RP
248# # Complain if an arg is missing
249# if [ -z "${hosts}" ] ; then
250# (echo ;
251# echo "configure: No HOST specified." ;
252# echo) 1>&2
253# fatal=true
254# fi
255
256### This is a bit twisted.
257### * if all three are specified, this is an error.
258### * if we have neither hosts, nor unadorned args, this is an error.
259### * if no hosts are specified, then the unadorned args are hosts, but if
260### there were none, this is an error.
261### * if no targets are specified, then the unadorned args are targets, but if
262### there were no unadorned args, then the hosts are also targets.
263
264 if [ -n "${hosts}" -a -n "${targets}" -a -n "${undefs}" ] ; then
265 echo '***' Can only configure for one host and one target at a time.
266 fatal=yes
267 elif [ -z "${hosts}" -a -z "${undefs}" ] ; then
268 echo '***' You must tell me for which host you want to configure.
269 fatal=yes
49b10446 270 else
a98bbe58
RP
271 case "${hosts}" in
272 "") hosts=${undefs} ;;
273 *) ;;
274 esac
49b10446 275
a98bbe58
RP
276 case "${targets}" in
277 "")
278 case "${undefs}" in
279 "") targets=${hosts} ;;
280 *) targets=${undefs} ;;
281 esac
282 ;;
283 *) ;;
284 esac
eb02fd64 285 fi
a98bbe58
RP
286 ;;
287*) ;;
288esac
eb02fd64 289
0df06ca0
RP
290if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
291 (echo "Usage: configure HOST" ;
292 echo ;
293 echo "Options: [defaults in brackets]" ;
4d714963
RP
294 echo " -datadir=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
295 echo " -gas configure the compilers for use with gas. [native as]" ;
296 echo " -help print this message. [normal config]" ;
297 echo " -lang=LANG configure to build LANG. [gcc]" ;
298 echo " -nfp configure the compilers default to soft floating point. [hard float]" ;
299 echo " -norecursion configure this directory only. [recurse]" ;
4d714963
RP
300 echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
301 echo " -rm remove this configuration. [build a configuration]" ;
302 echo " -site configure with site specific makefile" ;
303 echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
4d714963
RP
304 echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ;
305 echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
0df06ca0
RP
306 echo ;
307 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
4d714963 308 ) 1>&2
0df06ca0
RP
309
310 if [ -r config.status ] ; then
311 cat config.status
312 fi
313
314 exit 1
eb02fd64
RP
315fi
316
0c72405d 317configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
7da1d334 318
1922d8eb 319if ${configsub} `echo ${hosts} | sed -e 's/ .*//'` >/dev/null 2>&1 ; then
7da1d334
RP
320 true
321else
0c72405d 322 echo '***' cannot find config.sub.
7da1d334
RP
323 exit 1
324fi
325
a98bbe58
RP
326case "${srcdir}" in
327"")
4d714963
RP
328 if [ -r configure.in ] ; then
329 srcdir=.
4d714963
RP
330 else
331 echo '***' "Can't find configure.in. Try using -srcdir=some_dir"
eb02fd64
RP
332 exit 1
333 fi
a98bbe58
RP
334 ;;
335*) ;;
336esac
eb02fd64 337
bc58b41d 338
3a07a6ac
RP
339# default datadir
340case "${datadir}" in
341"") datadir="$(prefix)/lib" ;;
342*) ;;
343esac
344
4d714963 345### break up ${srcdir}/configure.in.
a98bbe58
RP
346case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
347"")
4d714963
RP
348 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
349 exit 1
a98bbe58
RP
350 ;;
351*) ;;
352esac
49b10446 353
a98bbe58
RP
354case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
355"")
4d714963
RP
356 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
357 exit 1
a98bbe58
RP
358 ;;
359*) ;;
360esac
c5ae5678 361
a98bbe58
RP
362case "${TMPDIR}" in
363"") TMPDIR=/tmp ; export TMPDIR ;;
364*) ;;
365esac
eb02fd64 366
4d714963
RP
367# keep this filename short for &%*%$*# 14 char file names
368tmpfile=${TMPDIR}/cONf$$
369trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
370
371# split ${srcdir}/configure.in into common, per-host, per-target,
372# and post-target parts. Post-target is optional.
373sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
374sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
375if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
376 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
377 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
c297d71e 378else
4d714963
RP
379 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
380 echo >${tmpfile}.pos
c297d71e 381fi
eb02fd64 382
c297d71e 383### do common part of configure.in
eb02fd64 384
c5ae5678 385. ${tmpfile}.com
eb02fd64 386
ec342d7d 387# some sanity checks on configure.in
a98bbe58
RP
388case "${srctrigger}" in
389"")
4d714963 390 echo '***' srctrigger not set in ${PWD}/configure.in.
ec342d7d 391 exit 1
a98bbe58
RP
392 ;;
393*) ;;
394esac
ec342d7d 395
0df06ca0
RP
396for host in ${hosts} ; do
397 # Default other arg
398 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
399 targets=${host}
400 defaulttargets=true
401 fi
eb02fd64 402
b8f8fddc
RP
403 host_alias=${host}
404
0c72405d 405 result=`${configsub} ${host}`
bc58b41d
RP
406 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
407 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
408 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
409 host=${host_cpu}-${host_vendor}-${host_os}
6c18e393 410
c5ae5678 411 . ${tmpfile}.hst
eb02fd64 412
0df06ca0 413 for target in ${targets} ; do
eb02fd64 414
b8f8fddc 415 target_alias=${target}
0c72405d 416 result=`${configsub} ${target}`
bc58b41d
RP
417 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
418 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
419 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
420 target=${target_cpu}-${target_vendor}-${target_os}
6408afba 421
c5ae5678 422 . ${tmpfile}.tgt
0df06ca0 423
a98bbe58
RP
424 case "${host_alias}" in
425 "${target_alias}") subdirname=H-${host_alias} ;;
426 *) subdirname=X-${host_alias}-${target_alias} ;;
427 esac
49b10446 428
a98bbe58
RP
429 case "${namesubdir}" in
430 "") ;;
431 *) subdirname=${namesubdir} ;;
432 esac
0df06ca0 433
a98bbe58
RP
434 case "${removing}" in
435 "")
0df06ca0 436 # Find the source files, if location was not specified.
a98bbe58
RP
437 case "${srcdir}" in
438 "")
0df06ca0
RP
439 srcdirdefaulted=1
440 srcdir=.
4d714963 441 if [ ! -r ${srctrigger} ] ; then
0df06ca0
RP
442 srcdir=..
443 fi
a98bbe58
RP
444 ;;
445 *) ;;
446 esac
eb02fd64 447
4d714963 448 if [ ! -r ${srcdir}/${srctrigger} ] ; then
a98bbe58
RP
449 case "${srcdirdefaulted}" in
450 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
451 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
452 esac
eb02fd64 453
bc58b41d 454 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
0df06ca0
RP
455 exit 1
456 fi
131a3881 457
0df06ca0
RP
458 # Set up the list of links to be made.
459 # ${links} is the list of link names, and ${files} is the list of names to link to.
eb02fd64 460
0df06ca0
RP
461 # Make the links.
462 while [ -n "${files}" ] ; do
463 # set file to car of files, files to cdr of files
464 set ${files}; file=$1; shift; files=$*
465 set ${links}; link=$1; shift; links=$*
131a3881 466
0df06ca0 467 if [ ! -r ${srcdir}/${file} ] ; then
bc58b41d
RP
468 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
469 echo '***' "since the file \"${file}\" does not exist." 1>&2
0df06ca0
RP
470 exit 1
471 fi
131a3881 472
0df06ca0
RP
473 ${remove} -f ${link}
474 rm -f config.status
475 # Make a symlink if possible, otherwise try a hard link
476 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
131a3881 477
0df06ca0 478 if [ ! -r ${link} ] ; then
bc58b41d 479 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
0df06ca0
RP
480 exit 1
481 fi
bc58b41d 482
a98bbe58
RP
483 case "${verbose}" in
484 "") ;;
485 *) echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
486 esac
0df06ca0 487 done
131a3881 488
0df06ca0
RP
489 # Create a .gdbinit file which runs the one in srcdir
490 # and tells GDB to look there for source files.
491
4d714963
RP
492 if [ -r ${srcdir}/.gdbinit ] ; then
493 case ${srcdir} in
494 .)
495 ;;
3a07a6ac
RP
496 *) cat > .gdbinit <<EOF
497# ${NO_EDIT} > .gdbinit
498dir .
499dir ${srcdir}
500source ${srcdir}/.gdbinit
501EOF
4d714963
RP
502 ;;
503 esac
504 fi
0df06ca0
RP
505
506 # Install a makefile, and make it set VPATH
507 # if necessary so that the sources are found.
508 # Also change its value of srcdir.
3a07a6ac
RP
509 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
510 # been somewhat optimized and is perhaps a bit twisty.
0df06ca0 511
3a07a6ac 512 # code is order so as to try to sed the smallest input files we know.
0df06ca0 513
3a07a6ac
RP
514 # the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
515 # so do these separately because I don't trust the order of sed -e expressions.
131a3881 516
3a07a6ac 517 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
a98bbe58 518 case "${site}" in
3a07a6ac 519 "") cp ${srcdir}/${Makefile_in} Makefile.tem ;;
a98bbe58 520 *)
3a07a6ac 521 site_makefile_frag=${srcdir}/config/ms-${site}
28f3b094 522
3a07a6ac
RP
523 if [ -f ${site_makefile_frag} ] ; then
524 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
525 >> Makefile.tem
28f3b094 526 else
3a07a6ac
RP
527 cp ${srcdir}/${Makefile_in} Makefile.tem
528 site_makefile_frag=
28f3b094 529 fi
a98bbe58
RP
530 ;;
531 esac
3a07a6ac 532 # working copy now in Makefile.tem
28f3b094 533
0df06ca0 534 # Conditionalize the makefile for this host.
3a07a6ac
RP
535 case "${host_makefile_frag}" in
536 "") mv Makefile.tem ${Makefile} ;;
537 *)
bcdbe02f 538 host_makefile_frag=${srcdir}/${host_makefile_frag}
3a07a6ac 539 if [ -f ${host_makefile_frag} ] ; then
bcdbe02f 540 sed -e "/^####/ r ${host_makefile_frag}" Makefile.tem > ${Makefile}
3a07a6ac
RP
541 else
542 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
543 echo '***' is missing in ${PWD}. 1>&2
544 mv Makefile.tem ${Makefile}
545 fi
546 esac
547 # working copy now in ${Makefile}
131a3881 548
0df06ca0 549 # Conditionalize the makefile for this target.
bcdbe02f
RP
550 case "${target_makefile_frag}" in
551 "") mv ${Makefile} Makefile.tem ;;
552 *)
553 target_makefile_frag=${srcdir}/${target_makefile_frag}
554 if [ -f ${target_makefile_frag} ] ; then
555 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} >> Makefile.tem
556 else
557 mv ${Makefile} Makefile.tem
558 target_makefile_frag=
559 fi
560 ;;
561 esac
3a07a6ac
RP
562 # real copy now in Makefile.tem
563
564 # prepend warning about editting, and a bunch of variables.
565 # fixme-someday: remove the subdir/unsubdir lines.
566 cat > ${Makefile} <<EOF
567# ${NO_EDIT}
568host_alias = ${host_alias}
569host_cpu = ${host_cpu}
570host_vendor = ${host_vendor}
571host_os = ${host_os}
572target_alias = ${target_alias}
573target_cpu = ${target_cpu}
574target_vendor = ${target_vendor}
575target_os = ${target_os}
576target_makefile_frag = ${target_makefile_frag}
577host_makefile_frag = ${host_makefile_frag}
578site_makefile_frag = ${site_makefile_frag}
579VPATH = ${srcdir}
580subdir =
581unsubdir = .
582EOF
583
584 # fixme: this shouldn't be in configure.
585 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
586 case "${host}" in
587 "${target}") echo "ALL=all.internal" >> ${Makefile} ;;
a98bbe58 588 *)
3a07a6ac
RP
589 echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
590 echo "ALL=all.cross" >> ${Makefile}
a98bbe58
RP
591 ;;
592 esac
eb02fd64 593
3a07a6ac
RP
594 # reset prefix, datadir, srcdir, SUBDIRS, NONSUBDIRS, remove any form
595 # feeds.
596 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
597 -e "s:^datadir[ ]*=.*$:datadir = ${datadir}:" \
598 -e "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" \
599 -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
600 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
601 -e "s/\f//" Makefile.tem >> ${Makefile}
602 # final copy now in ${Makefile}
eb02fd64 603
3a07a6ac 604 rm Makefile.tem
eb02fd64 605
3a07a6ac
RP
606 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
607 case "${host_makefile_frag}" in
608 "") using= ;;
609 *) using="and \"${host_makefile_frag}\"" ;;
610 esac
7875b07f 611
3a07a6ac
RP
612 case "${target_makefile_frag}" in
613 "") ;;
614 *) using="${using} and \"${target_makefile_frag}\"" ;;
615 esac
4d714963 616
3a07a6ac
RP
617 case "${site_makefile_frag}" in
618 "") ;;
619 *) using="${using} and \"${site_makefile_frag}\"" ;;
620 esac
7875b07f 621
3a07a6ac 622 echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'`
bc58b41d 623 fi
063efd10 624
c5ae5678 625 . ${tmpfile}.pos
eb02fd64 626
b8f8fddc
RP
627 # describe the chosen configuration in config.status.
628 # Make that file a shellscript which will reestablish
629 # the same configuration. Used in Makefiles to rebuild
630 # Makefiles.
631
a98bbe58
RP
632 case "${norecursion}" in
633 "") arguments="${arguments} -norecursion" ;;
634 *) ;;
635 esac
4d714963 636
b8f8fddc 637 echo "#!/bin/sh
4d714963
RP
638# ${NO_EDIT}
639# ${PWD} was configured as follows:
640${progname}" ${arguments} "
c5ae5678 641# ${using}" > config.status
b8f8fddc 642 chmod a+x config.status
a98bbe58
RP
643 ;;
644 *) rm -f ${Makefile} config.status ${links} ;;
645 esac
bc58b41d 646
4d714963 647 # If there are subdirectories, then recur.
46766962 648 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
bc58b41d 649 for configdir in ${configdirs} ; do
a98bbe58
RP
650 case "${verbose}" in
651 "") ;;
652 *) echo Configuring ${configdir}... ;;
653 esac
bc58b41d 654
4d714963 655 if [ -d ${srcdir}/${configdir} ] ; then
a98bbe58 656 case "${srcdir}" in
46772bd1
RP
657 ".") ;;
658 *)
4d714963
RP
659 if [ ! -d ./${configdir} ] ; then
660 mkdir ./${configdir}
49b10446 661 fi
a98bbe58 662 ;;
a98bbe58 663 esac
49b10446 664
4d714963 665 POPDIR=${PWD}
5420feaa
RP
666 cd ${configdir}
667
424f0202 668### figure out what to do with srcdir & guest configure
4d714963 669 case "${srcdir}" in
424f0202
RP
670 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
671 /*) # absolute path
672 newsrcdir=${srcdir}/${configdir}
673 srcdiroption="-srcdir=${newsrcdir}"
674 ;;
675 *) # otherwise relative
676 newsrcdir=../${srcdir}/${configdir}
677 srcdiroption="-srcdir=${newsrcdir}"
678 ;;
4d714963
RP
679 esac
680
681### The recursion line is here.
424f0202
RP
682 if [ -f ${newsrcdir}/configure ] ; then
683 recprog=${newsrcdir}/configure
079399f6
RP
684 else
685 recprog=${progname}
686 fi
687
1922d8eb 688 if ${recprog} -recurring ${host_alias} -target=${target_alias} \
4d714963
RP
689 ${verbose} ${subdirs} ${removing} ${prefixoption} \
690 ${tmpdiroption} ${namesubdiroption} ${datadiroption} \
1922d8eb 691 ${srcdiroption} ; then
c5ae5678
RP
692 true
693 else
694 exit 1
695 fi
5420feaa
RP
696
697 cd ${POPDIR}
a98bbe58
RP
698 else
699 case "${verbose}" in
700 "") ;;
701 *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
702 esac
bc58b41d
RP
703 fi
704 done
705 fi
67ca110d 706 done # for each target
67ca110d 707done # for each host
eb02fd64 708
c297d71e
RP
709### clean up.
710
4d714963
RP
711# trap cmd above handles this now:
712#rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
c297d71e 713
eb02fd64 714exit 0
74cc5508 715
0df06ca0
RP
716#
717# Local Variables:
718# fill-column: 131
719# End:
720#
74cc5508 721
46f3c7cd 722# end of configure
This page took 0.079246 seconds and 4 git commands to generate.