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