* config-ml.in (ml_realsrcdir): New, to account for ${subdir}.
[deliverable/binutils-gdb.git] / configure
CommitLineData
eb02fd64 1#!/bin/sh
eb02fd64 2
70d3fab7
DZ
3### WARNING: this file contains embedded tabs. Do not run untabify on this file.
4
46f3c7cd 5# Configuration script
9336e47e 6# Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
eb02fd64 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
ca2ce3b3 20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
eb02fd64 21
96457d7f 22# This file was originally written by K. Richard Pixley.
c1e4672c 23
eb02fd64
RP
24#
25# Shell script to create proper links to machine-dependent files in
0df06ca0 26# preparation for compilation.
eb02fd64
RP
27#
28# If configure succeeds, it leaves its status in config.status.
29# If configure fails after disturbing the status quo,
73f1f5ba 30# config.status is removed.
eb02fd64
RP
31#
32
4d714963 33export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
c297d71e 34
eb02fd64
RP
35remove=rm
36hard_link=ln
37symbolic_link='ln -s'
38
39#for Test
40#remove="echo rm"
41#hard_link="echo ln"
42#symbolic_link="echo ln -s"
43
44# clear some things potentially inherited from environment.
6f8ac2d9
RP
45
46Makefile=Makefile
47Makefile_in=Makefile.in
7fc36fda 48arguments=
24845456 49build_alias=
6109825c
KR
50cache_file=
51cache_file_option=
6f8ac2d9 52configdirs=
c1e4672c
RP
53exec_prefix=
54exec_prefixoption=
0df06ca0 55fatal=
4d714963
RP
56floating_point=default
57gas=default
24845456 58host_alias=NOHOST
3a07a6ac 59host_makefile_frag=
a98e98d3 60moveifchange=
46766962 61norecursion=
9336e47e 62other_options=
34bdab16 63package_makefile_frag=
4d714963 64prefix=/usr/local
49b10446 65progname=
c1e4672c 66program_prefix=
c5108322
ILT
67program_prefixoption=
68program_suffix=
69program_suffixoption=
70program_transform_name=
71program_transform_nameoption=
a98e98d3
RP
72redirect=">/dev/null"
73removing=
0e693d0b 74site=
3a07a6ac 75site_makefile_frag=
a98e98d3 76site_option=
74cc5508 77srcdir=
ec342d7d 78srctrigger=
8becd045 79subdirs=
24845456 80target_alias=NOTARGET
3a07a6ac 81target_makefile_frag=
24845456 82undefs=NOUNDEFS
0c72405d 83version="$Revision$"
4d714963
RP
84x11=default
85
eb4b02ae
DZ
86### we might need to use some other shell than /bin/sh for running subshells
87#
dbb0309d 88config_shell=${CONFIG_SHELL-/bin/sh}
eb4b02ae 89
4d714963
RP
90NO_EDIT="This file was generated automatically by configure. Do not edit."
91
92## this is a little touchy and won't always work, but...
93##
c1e4672c
RP
94## if the argv[0] starts with a slash then it is an absolute name that can (and
95## must) be used as is.
4d714963
RP
96##
97## otherwise, if argv[0] has no slash in it, we can assume that it is on the
98## path. Since PATH might include "." we also add `pwd` to the end of PATH.
99##
4d714963 100
c1e4672c 101progname=$0
5cc24596
PB
102# if PWD already has a value, it is probably wrong.
103if [ -n "$PWD" ]; then PWD=`pwd`; fi
4d714963 104
c1e4672c
RP
105case "${progname}" in
106/*) ;;
107*/*) ;;
108*)
73f1f5ba
DZ
109 PATH=$PATH:${PWD=`pwd`} ; export PATH
110 ;;
c1e4672c 111esac
4d714963 112
24845456
SG
113# Loop over all args
114
115while :
eb02fd64 116do
3509822c 117
24845456
SG
118# Break out if there are no more args
119 case $# in
120 0)
00f56390 121 break
24845456
SG
122 ;;
123 esac
124
125# Get the first arg, and shuffle
126 option=$1
127 shift
128
129# Make all options have two hyphens
130 orig_option=$option # Save original for error messages
131 case $option in
132 --*) ;;
133 -*) option=-$option ;;
134 esac
135
136# Split out the argument for options that take them
137 case $option in
138 --*=*)
139 optarg=`echo $option | sed -e 's/^[^=]*=//'`
7fc36fda 140 arguments="$arguments $option"
24845456
SG
141 ;;
142# These options have mandatory values. Since we didn't find an = sign,
143# the value must be in the next argument
5a2400c4 144 --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
24845456
SG
145 optarg=$1
146 shift
7fc36fda
ILT
147 arguments="$arguments $option=$optarg"
148 ;;
81749575
ILT
149 --v)
150 arguments="$arguments -v"
151 ;;
7fc36fda
ILT
152 --*)
153 arguments="$arguments $option"
24845456
SG
154 ;;
155 esac
156
157# Now, process the options
158 case $option in
159
160 --build* | --b*)
161 case "$build_alias" in
162 "") build_alias=$optarg ;;
163 *) echo '***' Can only configure for one build machine at a time. 1>&2
164 fatal=yes
165 ;;
166 esac
167 ;;
5a2400c4 168 --cache*)
6109825c 169 cache_file=$optarg
5a2400c4 170 ;;
bfb08994
DM
171 --disable-*)
172 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
173 eval $enableopt=no
174 disableoptions="$disableoptions $option"
175 ;;
00f56390
DM
176 --enable-*)
177 case "$option" in
178 *=*) ;;
179 *) optarg=yes ;;
180 esac
181
182 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
183 eval $enableopt="$optarg"
184 enableoptions="$enableoptions $option"
185 ;;
186 --exec-prefix* | --ex*)
24845456
SG
187 exec_prefix=$optarg
188 exec_prefixoption="--exec-prefix=$optarg"
189 ;;
190 --gas | --g*)
191 gas=yes
192 ;;
193 --help | --he*)
00f56390 194 fatal=yes
24845456
SG
195 ;;
196 --host* | --ho*)
197 case $host_alias in
198 NOHOST) host_alias=$optarg ;;
199 *) echo '***' Can only configure for one host at a time. 1>&2
200 fatal=yes
201 ;;
202 esac
203 ;;
204 --nfp | --nf*)
205 floating_point=no
206 ;;
207 --norecursion | --no*)
00f56390 208 norecursion=yes
24845456
SG
209 ;;
210 --prefix* | --pre*)
211 prefix=$optarg
212 prefixoption="--prefix=$optarg"
213 ;;
214 --program-prefix* | --program-p*)
215 program_prefix=$optarg
216 program_prefixoption="--program-prefix=$optarg"
217 ;;
218 --program-suffix* | --program-s*)
219 program_suffix=$optarg
220 program_suffixoption="--program-suffix=$optarg"
221 ;;
222 --program-transform-name* | --program-t*)
223 # Double any backslashes or dollar signs in the argument
224 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
4b82ae34 225 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
24845456
SG
226 ;;
227 --rm)
228 removing=--rm
229 ;;
d2d324f8
DM
230 --silent | --sil* | --quiet | --q*)
231 redirect=">/dev/null"
232 verbose=--silent
233 ;;
234 --site* | --sit*)
24845456
SG
235 site=$optarg
236 site_option="--site=$optarg"
237 ;;
238 --srcdir*/ | --sr*/)
239 # Remove trailing slashes. Otherwise, when the file name gets
d2d324f8
DM
240 # bolted into an object file as debug info, it has two slashes
241 # in it. Ordinarily this is ok, but emacs takes double slash
242 # to mean "forget the first part".
24845456
SG
243 srcdir=`echo $optarg | sed -e 's:/$::'`
244 ;;
245 --srcdir* | --sr*)
246 srcdir=$optarg
247 ;;
248 --target* | --ta*)
249 case $target_alias in
250 NOTARGET) target_alias=$optarg ;;
251 *) echo '***' Can only configure for one target at a time. 1>&2
252 fatal=yes
253 ;;
254 esac
255 ;;
256 --tmpdir* | --tm*)
257 TMPDIR=$optarg
258 tmpdiroption="--tmpdir=$optarg"
259 ;;
260 --verbose | --v | --verb*)
261 redirect=
262 verbose=--verbose
263 ;;
264 --version | --V | --vers*)
265 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
266 exit 0
267 ;;
268 --with-*)
269 case "$option" in
270 *=*) ;;
271 *) optarg=yes ;;
272 esac
273
274 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
275 eval $withopt="$optarg"
276 withoptions="$withoptions $option"
277 ;;
278 --without-*)
bfb08994 279 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
24845456
SG
280 eval $withopt=no
281 withoutoptions="$withoutoptions $option"
282 ;;
9336e47e
DM
283 --x) with_x=yes
284 withoptions="$withoptions --with-x"
285 ;;
0ffb871e
DM
286 --x-i* | --x-l*) other_options="$other_options $orig_option"
287 ;;
24845456 288 --*)
d237841c
BC
289 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
290 exit 1
24845456
SG
291 ;;
292 *)
293 case $undefs in
294 NOUNDEFS) undefs=$option ;;
295 *) echo '***' Can only configure for one host and one target at a time. 1>&2
296 fatal=yes
297 ;;
298 esac
299 ;;
300 esac
eb02fd64
RP
301done
302
4d714963 303# process host and target
24845456 304
00f56390
DM
305# Do some error checking and defaulting for the host and target type.
306# The inputs are:
307# configure --host=HOST --target=TARGET UNDEFS
24845456 308#
00f56390
DM
309# The rules are:
310# 1. You aren't allowed to specify --host, --target, and undefs at the
311# same time.
312# 2. Host defaults to undefs.
313# 3. If undefs is not specified, then host defaults to the current host,
314# as determined by config.guess.
315# 4. Target defaults to undefs.
316# 5. If undefs is not specified, then target defaults to host.
24845456 317
a98bbe58
RP
318case "${fatal}" in
319"")
24845456
SG
320 # Make sure that host, target & undefs aren't all specified at the
321 # same time.
322 case $host_alias---$target_alias---$undefs in
323 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
324 ;;
325 *) echo '***' Can only configure for one host and one target at a time. 1>&2
326 fatal=yes
327 break 2
328 ;;
329 esac
330
331 # Now, do defaulting for host.
332 case $host_alias in
333 NOHOST)
334 case $undefs in
335 NOUNDEFS)
336 # Neither --host option nor undefs were present.
337 # Call config.guess.
338 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
339 if host_alias=`${guesssys}`
340 then
94028943
ILT
341 # If the string we are going to use for
342 # the target is a prefix of the string
343 # we just guessed for the host, then
344 # assume we are running native, and force
345 # the same string for both target and host.
346 case $target_alias in
64b7bf9f 347 NOTARGET) ;;
94028943
ILT
348 *)
349 if expr $host_alias : $target_alias >/dev/null
350 then
351 host_alias=$target_alias
352 fi
353 ;;
354 esac
24845456
SG
355 echo "Configuring for a ${host_alias} host." 1>&2
356 arguments="--host=$host_alias $arguments"
357 else
358 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
359 fatal=yes
360 fi
361 ;;
362 *)
363 host_alias=$undefs
7fc36fda
ILT
364 arguments="--host=$host_alias $arguments"
365 undefs=NOUNDEFS
24845456
SG
366 ;;
367 esac
368 esac
369
370 # Do defaulting for target. If --target option isn't present, default
371 # to undefs. If undefs isn't present, default to host.
372 case $target_alias in
373 NOTARGET)
374 case $undefs in
375 NOUNDEFS)
376 target_alias=$host_alias
377 ;;
378 *)
379 target_alias=$undefs
7fc36fda 380 arguments="--target=$target_alias $arguments"
24845456
SG
381 ;;
382 esac
383 esac
384 ;;
a98bbe58
RP
385*) ;;
386esac
eb02fd64 387
c1e4672c 388if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
24845456 389 exec 1>&2
64b7bf9f 390 echo Usage: configure [OPTIONS] [HOST]
24845456
SG
391 echo
392 echo Options: [defaults in brackets]
1be96eeb
ILT
393 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
394 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
395 echo ' --help print this message [normal config]'
396 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
397 echo ' --host=HOST configure for HOST [determined via config.guess]'
398 echo ' --norecursion configure this directory only [recurse]'
399 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
400 echo ' --program-suffix=FOO append FOO to installed program names [""]'
401 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
402 echo ' --site=SITE configure with site-specific makefile for SITE'
403 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
404 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
405 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
5a2400c4 406 echo ' --nfp configure for software floating point [hard float]'
00f56390
DM
407 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
408 echo ' --without-FOO package FOO is NOT available'
409 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
bfb08994 410 echo ' --disable-FOO do not include feature FOO'
24845456 411 echo
5a2400c4 412 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
24845456
SG
413 echo
414 if [ -r config.status ] ; then
415 cat config.status
416 fi
417
418 exit 1
eb02fd64
RP
419fi
420
0c72405d 421configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
196377ee 422moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
7da1d334 423
94c7ae21
RP
424# this is a hack. sun4 must always be a valid host alias or this will fail.
425if ${configsub} sun4 >/dev/null 2>&1 ; then
73f1f5ba 426 true
7da1d334 427else
73f1f5ba
DZ
428 echo '***' cannot find config.sub. 1>&2
429 exit 1
7da1d334
RP
430fi
431
196377ee
RP
432touch config.junk
433if ${moveifchange} config.junk config.trash ; then
73f1f5ba 434 true
196377ee 435else
73f1f5ba
DZ
436 echo '***' cannot find move-if-change. 1>&2
437 exit 1
196377ee
RP
438fi
439rm -f config.junk config.trash
440
a98bbe58
RP
441case "${srcdir}" in
442"")
73f1f5ba
DZ
443 if [ -r configure.in ] ; then
444 srcdir=.
445 else
446 if [ -r ${progname}.in ] ; then
447 srcdir=`echo ${progname} | sed 's:/configure$::'`
448 else
24845456 449 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
73f1f5ba
DZ
450 exit 1
451 fi
452 fi
453 ;;
7fc36fda
ILT
454*)
455 # Set srcdir to "." if that's what it is.
456 # This is important for multilib support.
457 if [ ! -d ${srcdir} ] ; then
458 echo "Invalid source directory ${srcdir}" >&2
459 exit 1
460 fi
461 pwd=`pwd`
462 srcpwd=`cd ${srcdir} ; pwd`
463 if [ "${pwd}" = "${srcpwd}" ] ; then
464 srcdir=.
465 fi
a98bbe58 466esac
eb02fd64 467
8fd24008
RP
468### warn about some conflicting configurations.
469
470case "${srcdir}" in
471".") ;;
472*)
73f1f5ba
DZ
473 if [ -f ${srcdir}/config.status ] ; then
474 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
475 exit 1
476 fi
8fd24008 477esac
bc58b41d 478
c1e4672c 479# default exec_prefix
c7f72253 480case "${exec_prefixoption}" in
8becd045 481"") exec_prefix="\$(prefix)" ;;
3a07a6ac
RP
482*) ;;
483esac
484
4d714963 485### break up ${srcdir}/configure.in.
a98bbe58
RP
486case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
487"")
dbb0309d 488 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
6109825c
KR
489 # Check for a directory that's been converted to use autoconf since
490 # it was last configured.
491 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
492 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
493 if [ -r ${srcdir}/configure ] ; then
494 echo '***' Running the local configure script. 1>&2
495 case "${cache_file}" in
496 "") cache_file_option= ;;
497 *) cache_file_option="--cache-file=${cache_file}" ;;
498 esac
499 srcdiroption="--srcdir=${srcdir}"
500 case "${build_alias}" in
501 "") buildopt= ;;
502 *) buildopt="--build=${build_alias}" ;;
503 esac
504 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
505 ${buildopt} --host=${host_alias} --target=${target_alias} \
506 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
507 ${srcdiroption} \
508 ${program_prefixoption} ${program_suffixoption} \
509 ${program_transform_nameoption} ${site_option} \
510 ${withoptions} ${withoutoptions} \
511 ${enableoptions} ${disableoptions} \
512 ${cache_file_option} ${removing} ${other_options} ${redirect}
513 else
514 echo '***' There is no configure script present though. 1>&2
515 fi
516 fi
73f1f5ba
DZ
517 exit 1
518 ;;
a98bbe58
RP
519*) ;;
520esac
49b10446 521
a98bbe58
RP
522case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
523"")
dbb0309d 524 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
73f1f5ba
DZ
525 exit 1
526 ;;
a98bbe58
RP
527*) ;;
528esac
c5ae5678 529
a98bbe58
RP
530case "${TMPDIR}" in
531"") TMPDIR=/tmp ; export TMPDIR ;;
532*) ;;
533esac
eb02fd64 534
4d714963
RP
535# keep this filename short for &%*%$*# 14 char file names
536tmpfile=${TMPDIR}/cONf$$
121bdf8f
ILT
537# Note that under many versions of sh a trap handler for 0 will *override* any
538# exit status you explicitly specify! At this point, the only non-error exit
539# is at the end of the script; these actions are duplicated there, minus
540# the "exit 1". Don't use "exit 0" anywhere after this without resetting the
541# trap handler, or you'll lose.
ca2ce3b3 542trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
4d714963
RP
543
544# split ${srcdir}/configure.in into common, per-host, per-target,
545# and post-target parts. Post-target is optional.
546sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
547sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
548if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
549 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
550 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
c297d71e 551else
4d714963
RP
552 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
553 echo >${tmpfile}.pos
c297d71e 554fi
eb02fd64 555
c297d71e 556### do common part of configure.in
eb02fd64 557
c5ae5678 558. ${tmpfile}.com
eb02fd64 559
ec342d7d 560# some sanity checks on configure.in
a98bbe58
RP
561case "${srctrigger}" in
562"")
73f1f5ba
DZ
563 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
564 exit 1
565 ;;
a98bbe58
RP
566*) ;;
567esac
ec342d7d 568
24845456 569case "${build_alias}" in
ca2ce3b3
ILT
570"")
571 if result=`${config_shell} ${configsub} ${host_alias}` ; then
572 build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
573 build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
574 build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
bfe725ec 575 build=${build_cpu}-${build_vendor}-${build_os}
ca2ce3b3
ILT
576 build_alias=${host_alias}
577 fi
578 ;;
24845456 579*)
121bdf8f
ILT
580 if result=`${config_shell} ${configsub} ${build_alias}` ; then
581 buildopt="--build=${build_alias}"
582 build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
583 build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
584 build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
585 build=${build_cpu}-${build_vendor}-${build_os}
586 else
587 echo "Unrecognized build system name ${build_alias}." 1>&2
588 exit 1
589 fi
24845456
SG
590 ;;
591esac
592
121bdf8f
ILT
593if result=`${config_shell} ${configsub} ${host_alias}` ; then
594 true
595else
596 echo "Unrecognized host system name ${host_alias}." 1>&2
597 exit 1
598fi
c1e4672c
RP
599host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
600host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
601host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
602host=${host_cpu}-${host_vendor}-${host_os}
6c18e393 603
c1e4672c 604. ${tmpfile}.hst
eb02fd64 605
121bdf8f
ILT
606if result=`${config_shell} ${configsub} ${target_alias}` ; then
607 true
608else
609 echo "Unrecognized target system name ${target_alias}." 1>&2
610 exit 1
611fi
c1e4672c
RP
612target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
613target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
614target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
615target=${target_cpu}-${target_vendor}-${target_os}
eb02fd64 616
c1e4672c 617. ${tmpfile}.tgt
49b10446 618
c1e4672c
RP
619# Find the source files, if location was not specified.
620case "${srcdir}" in
621"")
73f1f5ba
DZ
622 srcdirdefaulted=1
623 srcdir=.
624 if [ ! -r ${srctrigger} ] ; then
625 srcdir=..
626 fi
627 ;;
c1e4672c
RP
628*) ;;
629esac
eb02fd64 630
c1e4672c 631if [ ! -r ${srcdir}/${srctrigger} ] ; then
73f1f5ba
DZ
632 case "${srcdirdefaulted}" in
633 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
634 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
635 esac
eb02fd64 636
73f1f5ba
DZ
637 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
638 exit 1
c1e4672c 639fi
131a3881 640
0ed316a0
DZ
641# Some systems (e.g., one of the i386-aix systems the gas testers are
642# using) don't handle "\$" correctly, so don't use it here.
643tooldir='$(exec_prefix)'/${target_alias}
c5108322
ILT
644
645if [ "${host_alias}" != "${target_alias}" ] ; then
d6d49c64
PB
646 if [ "${program_prefixoption}" = "" ] ; then
647 if [ "${program_suffixoption}" = "" ] ; then
648 if [ "${program_transform_nameoption}" = "" ] ; then
73f1f5ba
DZ
649 program_prefix=${target_alias}- ;
650 fi
651 fi
c5108322
ILT
652 fi
653fi
654
121bdf8f
ILT
655# Merge program_prefix and program_suffix onto program_transform_name.
656# (program_suffix used to use $, but it's hard to preserve $ through both
657# make and sh.)
c5108322 658if [ "${program_suffix}" != "" ] ; then
121bdf8f 659 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
c5108322
ILT
660fi
661
662if [ "${program_prefix}" != "" ] ; then
24845456 663 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
c5108322
ILT
664fi
665
ca2ce3b3
ILT
666# If CC and CXX are not set in the environment, and the Makefile
667# exists, try to extract them from it. This is to handle running
668# ./config.status by hand.
669if [ -z "${CC}" -a -r Makefile ]; then
670 sed -n -e ':loop
671/\\$/ N
672/\\$/ b loop
673s/\\\n//g
bfe725ec 674/^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
ca2ce3b3
ILT
675 CC=`tail -1 Makefile.cc`
676 rm -f Makefile.cc
677fi
678
679if [ -z "${CXX}" -a -r Makefile ]; then
680 sed -n -e ':loop
681/\\$/ N
682/\\$/ b loop
683s/\\\n//g
bfe725ec 684/^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
ca2ce3b3
ILT
685 CXX=`tail -1 Makefile.cc`
686 rm -f Makefile.cc
687fi
688
bfe725ec
ILT
689if [ "${build}" != "${host}" ]; then
690 # If we are doing a Canadian Cross, in which the host and build systems
691 # are not the same, we set reasonable default values for the tools.
692
693 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
694 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET HOST_PREFIX"
7fc36fda
ILT
695 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
696 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
bfe725ec
ILT
697
698 for var in ${tools}; do
699 if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
700 sed -n -e ':loop
701/\\$/ N
702/\\$/ b loop
703s/\\\n//g
704/^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
705 < Makefile > Makefile.v
706 t=`tail -1 Makefile.v`
707 if [ -n "${t}" ]; then
708 eval "${var}='${t}'"
709 fi
710 rm -f Makefile.v
ca2ce3b3
ILT
711 fi
712 done
ca2ce3b3 713
bfe725ec
ILT
714 AR=${AR-${host_alias}-ar}
715 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
716 AS=${AS-${host_alias}-as}
717 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
718 CC=${CC-${host_alias}-gcc}
719 CXX=${CXX-${host_alias}-gcc}
720 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
721 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
722 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc}
723 HOST_PREFIX=${build_alias}-
724 HOST_PREFIX_1=${build_alias}-
7fc36fda
ILT
725 LD=${LD-${host_alias}-ld}
726 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
bfe725ec
ILT
727 MAKEINFO=${MAKEINFO-makeinfo}
728 NM=${NM-${host_alias}-nm}
729 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
730 RANLIB=${RANLIB-${host_alias}-ranlib}
731 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
732
733 if [ -z "${BISON}" ]; then
734 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
735 for dir in $PATH; do
736 test -z "$dir" && dir=.
737 if test -f $dir/byacc; then
738 BISON=byacc
739 break
740 fi
741 if test -f $dir/bison; then
742 BISON=bison
743 break
744 fi
745 if test -f $dir/yacc; then
746 BISON=yacc
747 break
748 fi
749 done
750 IFS="$save_ifs"
751 BISON=${BISON-bison}
752 fi
753
754 if [ -z "${LEX}" ]; then
755 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
756 for dir in $PATH; do
757 test -z "$dir" && dir=.
758 if test -f $dir/flex; then
759 LEX=flex
760 break
761 fi
762 if test -f $dir/lex; then
763 LEX=lex
764 break
765 fi
766 done
767 IFS="$save_ifs"
768 LEX=${LEX-flex}
769 fi
770
771 # Export variables which autoconf might try to set.
772 export AS
773 export AR
774 export CC_FOR_BUILD
7fc36fda 775 export LD
bfe725ec
ILT
776 export NM
777 export RANLIB
778else
779 # If CC is still not set, try to get gcc.
780 if [ -z "${CC}" ]; then
781 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
782 for dir in $PATH; do
783 test -z "$dir" && dir=.
784 if test -f $dir/gcc; then
7fc36fda 785 CC="gcc -O2"
bfe725ec
ILT
786 break
787 fi
788 done
789 IFS="$save_ifs"
790 CC=${CC-cc}
791 fi
792
7fc36fda 793 CXX=${CXX-"gcc"}
bfe725ec 794fi
ca2ce3b3 795
96457d7f
PB
796export CC
797export CXX
798
8becd045 799for subdir in . ${subdirs} ; do
eb02fd64 800
8becd045
PB
801 # ${subdir} is relative path from . to the directory we're currently
802 # configuring.
803 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
804 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
131a3881 805
8becd045
PB
806 ### figure out what to do with srcdir
807 case "${srcdir}" in
73f1f5ba
DZ
808 ".") # no -srcdir option. We're building in place.
809 makesrcdir=. ;;
810 /*) # absolute path
811 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
812 ;;
813 *) # otherwise relative
814 case "${subdir}" in
815 .) makesrcdir=${srcdir} ;;
816 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
817 esac
818 ;;
8becd045 819 esac
131a3881 820
8becd045 821 if [ "${subdir}/" != "./" ] ; then
73f1f5ba 822 Makefile=${subdir}/Makefile
8becd045 823 fi
131a3881 824
9546e9b4 825 if [ ! -d ${subdir} ] ; then
73f1f5ba
DZ
826 if mkdir ${subdir} ; then
827 true
09e0b992 828 else
73f1f5ba
DZ
829 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
830 exit 1
09e0b992 831 fi
9546e9b4
RP
832 fi
833
8becd045
PB
834 case "${removing}" in
835 "")
73f1f5ba
DZ
836 case "${subdir}" in
837 .) ;;
838 *) eval echo Building in ${subdir} ${redirect} ;;
839 esac
840
841 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
842 # Set up the list of links to be made.
843 # ${links} is the list of link names, and ${files} is the list of names to link to.
844
845 # Make the links.
846 configlinks="${links}"
847 if [ -r ${subdir}/config.status ] ; then
848 mv -f ${subdir}/config.status ${subdir}/config.back
849 fi
850 while [ -n "${files}" ] ; do
851 # set file to car of files, files to cdr of files
852 set ${files}; file=$1; shift; files=$*
853 set ${links}; link=$1; shift; links=$*
854
855 if [ ! -r ${srcdir}/${file} ] ; then
856 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
857 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
858 exit 1
859 fi
860
861 ${remove} -f ${link}
d237841c
BC
862 # Make a symlink if possible, otherwise try a hard link
863 if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
864 true
865 else
866 # We need to re-remove the file because Lynx leaves a
867 # very strange directory there when it fails an NFS symlink.
868 ${remove} -r -f ${link}
869 ${hard_link} ${srcdir}/${file} ${link}
870 fi
73f1f5ba
DZ
871 if [ ! -r ${link} ] ; then
872 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
873 exit 1
874 fi
875
876 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
877 done
878
879 # Create a .gdbinit file which runs the one in srcdir
880 # and tells GDB to look there for source files.
881
882 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
883 case ${srcdir} in
884 .) ;;
885 *) cat > ${subdir}/.gdbinit <<EOF
8becd045 886# ${NO_EDIT}
8becd045 887dir ${makesrcdir}
c7f72253 888dir .
8becd045 889source ${makesrcdir}/.gdbinit
3a07a6ac 890EOF
73f1f5ba
DZ
891 ;;
892 esac
893 fi
0df06ca0 894
73f1f5ba
DZ
895 # Install a makefile, and make it set VPATH
896 # if necessary so that the sources are found.
897 # Also change its value of srcdir.
898 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
899 # been somewhat optimized and is perhaps a bit twisty.
0df06ca0 900
73f1f5ba 901 # code is order so as to try to sed the smallest input files we know.
0df06ca0 902
73f1f5ba 903 # the four makefile fragments MUST end up in the resulting Makefile in this order:
34bdab16
DZ
904 # package, target, host, and site. so do these separately because I don't trust the
905 # order of sed -e expressions.
131a3881 906
73f1f5ba
DZ
907 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
908
e5c6be8f
DZ
909 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
910 rm -f ${subdir}/Makefile.tem
911 case "${site}" in
912 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
913 *)
914 site_makefile_frag=${srcdir}/config/ms-${site}
915
916 if [ -f ${site_makefile_frag} ] ; then
917 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
918 > ${subdir}/Makefile.tem
919 else
920 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
921 site_makefile_frag=
922 fi
923 ;;
924 esac
925 # working copy now in ${subdir}/Makefile.tem
926
927 # Conditionalize the makefile for this host.
928 rm -f ${Makefile}
929 case "${host_makefile_frag}" in
930 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
931 *)
932 if [ ! -f ${host_makefile_frag} ] ; then
933 host_makefile_frag=${srcdir}/${host_makefile_frag}
934 fi
935 if [ -f ${host_makefile_frag} ] ; then
936 sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
937 else
938 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
939 echo '***' is missing in ${PWD=`pwd`}. 1>&2
940 mv ${subdir}/Makefile.tem ${Makefile}
941 fi
942 esac
943 # working copy now in ${Makefile}
944
945 # Conditionalize the makefile for this target.
946 rm -f ${subdir}/Makefile.tem
947 case "${target_makefile_frag}" in
948 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
949 *)
950 if [ ! -f ${target_makefile_frag} ] ; then
951 target_makefile_frag=${srcdir}/${target_makefile_frag}
952 fi
953 if [ -f ${target_makefile_frag} ] ; then
954 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
955 else
956 mv ${Makefile} ${subdir}/Makefile.tem
957 target_makefile_frag=
958 fi
959 ;;
960 esac
961 # real copy now in ${subdir}/Makefile.tem
962
963 # Conditionalize the makefile for this package.
964 rm -f ${Makefile}
965 case "${package_makefile_frag}" in
966 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
967 *)
968 if [ ! -f ${package_makefile_frag} ] ; then
969 package_makefile_frag=${srcdir}/${package_makefile_frag}
970 fi
971 if [ -f ${package_makefile_frag} ] ; then
972 sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
e08a7c05 973 rm -f ${subdir}/Makefile.tem
e5c6be8f
DZ
974 else
975 echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
976 echo '***' is missing in ${PWD=`pwd`}. 1>&2
977 mv ${subdir}/Makefile.tem ${Makefile}
978 fi
979 esac
980 # working copy now in ${Makefile}
981
982 mv ${Makefile} ${subdir}/Makefile.tem
983
984 # real copy now in ${subdir}/Makefile.tem
985
986 # prepend warning about editting, and a bunch of variables.
987 rm -f ${Makefile}
988 cat > ${Makefile} <<EOF
3a07a6ac 989# ${NO_EDIT}
8becd045
PB
990VPATH = ${makesrcdir}
991links = ${configlinks}
3a07a6ac
RP
992host_alias = ${host_alias}
993host_cpu = ${host_cpu}
994host_vendor = ${host_vendor}
995host_os = ${host_os}
94028943 996host_canonical = ${host_cpu}-${host_vendor}-${host_os}
3a07a6ac
RP
997target_alias = ${target_alias}
998target_cpu = ${target_cpu}
999target_vendor = ${target_vendor}
1000target_os = ${target_os}
5cc24596 1001target_canonical = ${target_cpu}-${target_vendor}-${target_os}
3a07a6ac 1002EOF
24845456
SG
1003 case "${build}" in
1004 "") ;;
94028943 1005 *) cat >> ${Makefile} << EOF
24845456
SG
1006build_alias = ${build_alias}
1007build_cpu = ${build_cpu}
1008build_vendor = ${build_vendor}
1009build_os = ${build_os}
94028943 1010build_canonical = ${build_cpu}-${build_vendor}-${build_os}
24845456
SG
1011EOF
1012 esac
1013
e5c6be8f
DZ
1014 case "${package_makefile_frag}" in
1015 "") ;;
1016 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1017 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1018 esac
1019
1020 case "${target_makefile_frag}" in
1021 "") ;;
1022 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1023 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1024 esac
1025
1026 case "${host_makefile_frag}" in
1027 "") ;;
1028 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1029 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1030 esac
1031
1032 if [ "${site_makefile_frag}" != "" ] ; then
1033 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1034 fi
1035
e5c6be8f
DZ
1036 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1037 # remove any form feeds.
1038 if [ -z "${subdirs}" ]; then
1039 rm -f ${subdir}/Makefile.tem2
70d3fab7
DZ
1040 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1041 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
e5c6be8f
DZ
1042 ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
1043 rm -f ${subdir}/Makefile.tem
1044 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
1045 fi
70d3fab7
DZ
1046 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
1047 -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
ca2ce3b3 1048 -e "/^CC[ ]*=/{
96457d7f
PB
1049 :loop1
1050 /\\\\$/ N
1051 /\\\\$/ b loop1
1052 s/\\\\\\n//g
ca2ce3b3
ILT
1053 s%^CC[ ]*=.*$%CC = ${CC}%
1054 }" \
1055 -e "/^CXX[ ]*=/{
96457d7f
PB
1056 :loop2
1057 /\\\\$/ N
1058 /\\\\$/ b loop2
1059 s/\\\\\\n//g
ca2ce3b3
ILT
1060 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1061 }" \
dbb0309d 1062 -e "s:^SHELL[ ]*=.*$:SHELL = ${config_shell}:" \
70d3fab7 1063 -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \
e5c6be8f 1064 -e "s/\f//" \
70d3fab7
DZ
1065 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1066 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
26e4818b 1067 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
70d3fab7 1068 -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
e5c6be8f 1069 ${subdir}/Makefile.tem >> ${Makefile}
bfe725ec
ILT
1070
1071 # If this is a Canadian Cross, preset the values of many more
1072 # tools.
1073 if [ "${build}" != "${host}" ]; then
1074 for var in ${tools}; do
1075 val=`eval 'echo $'"${var}"`
1076 sed -e "/^${var}[ ]*=/{
1077 :loop1
1078 /\\\\$/ N
1079 /\\\\$/ b loop1
1080 s/\\\\\\n//g
1081 s%^${var}[ ]*=.*$%${var} = ${val}%
1082 }" ${Makefile} > ${Makefile}.tem
1083 mv -f ${Makefile}.tem ${Makefile}
1084 done
1085 fi
1086
e5c6be8f
DZ
1087 # final copy now in ${Makefile}
1088
1089 else
26e4818b 1090 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
e5c6be8f 1091 fi
73f1f5ba
DZ
1092
1093 rm -f ${subdir}/Makefile.tem
1094
1095 case "${host_makefile_frag}" in
1096 "") using= ;;
1097 *) using="and \"${host_makefile_frag}\"" ;;
1098 esac
1099
1100 case "${target_makefile_frag}" in
1101 "") ;;
1102 *) using="${using} and \"${target_makefile_frag}\"" ;;
1103 esac
1104
1105 case "${site_makefile_frag}" in
1106 "") ;;
1107 *) using="${using} and \"${site_makefile_frag}\"" ;;
1108 esac
1109
1110 newusing=`echo "${using}" | sed 's/and/using/'`
1111 using=${newusing}
1112 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1113
1114 . ${tmpfile}.pos
1115
1116 # describe the chosen configuration in config.status.
1117 # Make that file a shellscript which will reestablish
1118 # the same configuration. Used in Makefiles to rebuild
1119 # Makefiles.
1120
1121 case "${norecursion}" in
24845456 1122 "") arguments="${arguments} --norecursion" ;;
73f1f5ba
DZ
1123 *) ;;
1124 esac
1125
1126 if [ ${subdir} = . ] ; then
1127 echo "#!/bin/sh
4d714963 1128# ${NO_EDIT}
4347369f 1129# This directory was configured as follows:
4d714963 1130${progname}" ${arguments} "
196377ee 1131# ${using}" > ${subdir}/config.new
73f1f5ba
DZ
1132 else
1133 echo "#!/bin/sh
8becd045 1134# ${NO_EDIT}
4347369f 1135# This directory was configured as follows:
8becd045
PB
1136cd ${invsubdir}
1137${progname}" ${arguments} "
196377ee 1138# ${using}" > ${subdir}/config.new
73f1f5ba
DZ
1139 fi
1140 chmod a+x ${subdir}/config.new
1141 if [ -r ${subdir}/config.back ] ; then
1142 mv -f ${subdir}/config.back ${subdir}/config.status
1143 fi
1144 ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1145 ;;
8becd045 1146
73f1f5ba 1147 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
8becd045
PB
1148 esac
1149done
c1e4672c
RP
1150
1151# If there are subdirectories, then recur.
1152if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
73f1f5ba
DZ
1153 for configdir in ${configdirs} ; do
1154
1155 if [ -d ${srcdir}/${configdir} ] ; then
1156 eval echo Configuring ${configdir}... ${redirect}
1157 case "${srcdir}" in
1158 ".") ;;
1159 *)
1160 if [ ! -d ./${configdir} ] ; then
1161 if mkdir ./${configdir} ; then
1162 true
1163 else
1164 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1165 exit 1
1166 fi
1167 fi
1168 ;;
1169 esac
1170
1171 POPDIR=${PWD=`pwd`}
1172 cd ${configdir}
c1e4672c
RP
1173
1174### figure out what to do with srcdir
73f1f5ba
DZ
1175 case "${srcdir}" in
1176 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1177 /*) # absolute path
1178 newsrcdir=${srcdir}/${configdir}
24845456 1179 srcdiroption="--srcdir=${newsrcdir}"
73f1f5ba
DZ
1180 ;;
1181 *) # otherwise relative
1182 newsrcdir=../${srcdir}/${configdir}
24845456 1183 srcdiroption="--srcdir=${newsrcdir}"
73f1f5ba
DZ
1184 ;;
1185 esac
c1e4672c 1186
6109825c
KR
1187 # Handle --cache-file=../XXX
1188 case "${cache_file}" in
1189 "") # empty
1190 ;;
1191 /*) # absolute path
1192 cache_file_option="--cache-file=${cache_file}"
1193 ;;
1194 *) # relative path
1195 cache_file_option="--cache-file=../${cache_file}"
1196 ;;
1197 esac
1198
c1e4672c 1199### check for guested configure, otherwise fix possibly relative progname
73f1f5ba
DZ
1200 if [ -f ${newsrcdir}/configure ] ; then
1201 recprog=${newsrcdir}/configure
eb4b02ae 1202 elif [ -f ${newsrcdir}/configure.in ] ; then
73f1f5ba
DZ
1203 case "${progname}" in
1204 /*) recprog=${progname} ;;
1205 *) recprog=../${progname} ;;
1206 esac
eb4b02ae 1207 else
c0c70966 1208 eval echo No configuration information in ${configdir} ${redirect}
eb4b02ae 1209 recprog=
73f1f5ba 1210 fi
4d714963
RP
1211
1212### The recursion line is here.
eb4b02ae 1213 if [ ! -z "${recprog}" ] ; then
24845456 1214 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
eb4b02ae 1215 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
6109825c 1216 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
eb4b02ae
DZ
1217 true
1218 else
00f56390 1219 echo Configure in `pwd` failed, exiting. 1>&2
eb4b02ae
DZ
1220 exit 1
1221 fi
1222 fi
73f1f5ba
DZ
1223
1224 cd ${POPDIR}
1225 fi
1226 done
c1e4672c 1227fi
eb02fd64 1228
121bdf8f
ILT
1229# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1230# and reset the trap handler.
1231rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1232trap 0
1233
eb02fd64 1234exit 0
74cc5508 1235
0df06ca0
RP
1236#
1237# Local Variables:
1238# fill-column: 131
1239# End:
1240#
74cc5508 1241
46f3c7cd 1242# end of configure
This page took 0.204739 seconds and 4 git commands to generate.