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