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