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