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