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