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