]> git.ipfire.org Git - thirdparty/gcc.git/blame - configure
* varasm.c (struct constant_descriptor): Put CONTENTS inside a
[thirdparty/gcc.git] / configure
CommitLineData
a8298541 1#!/bin/sh
2
3### WARNING: this file contains embedded tabs. Do not run untabify on this file.
4
5# Configuration script
151ad919 6# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
a8298541 7# Free Software Foundation, Inc.
8
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23# This file was originally written by K. Richard Pixley.
24
25#
26# Shell script to create proper links to machine-dependent files in
27# preparation for compilation.
28#
29# If configure succeeds, it leaves its status in config.status.
30# If configure fails after disturbing the status quo,
31# config.status is removed.
32#
33
34export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
35
36remove=rm
37hard_link=ln
38symbolic_link='ln -s'
39
40#for Test
41#remove="echo rm"
42#hard_link="echo ln"
43#symbolic_link="echo ln -s"
44
45# clear some things potentially inherited from environment.
46
47Makefile=Makefile
48Makefile_in=Makefile.in
49arguments=
50build_alias=
51cache_file=config.cache
52cache_file_option=
53configdirs=
ed37269d 54extraconfigdirs=
55diroptions=
e800dd2f 56enable_threads=no
57enable_shared=no
4ec87d68 58enable_libstdcxx_v3=yes
a8298541 59exec_prefix=
60exec_prefixoption=
61fatal=
62floating_point=default
63gas=default
7955e3d2 64gcc_version=
65gcc_version_trigger=
a8298541 66host_alias=NOHOST
67host_makefile_frag=
68moveifchange=
69norecursion=
70other_options=
71package_makefile_frag=
3d2749bb 72package_makefile_rules_frag=
a8298541 73prefix=/usr/local
74progname=
75program_prefix=
76program_prefixoption=
77program_suffix=
78program_suffixoption=
79program_transform_name=
80program_transform_nameoption=
ed37269d 81redirect=
a8298541 82removing=
83site=
84site_makefile_frag=
85site_option=
86srcdir=
87srctrigger=
88subdirs=
89target_alias=NOTARGET
90target_makefile_frag=
91undefs=NOUNDEFS
4ec87d68 92version="$Revision: 1.30 $"
a8298541 93x11=default
ed37269d 94bindir='${exec_prefix}/bin'
95sbindir='${exec_prefix}/sbin'
96libexecdir='${exec_prefix}/libexec'
97datadir='${prefix}/share'
98sysconfdir='${prefix}/etc'
99sharedstatedir='${prefix}/com'
100localstatedir='${prefix}/var'
101libdir='${exec_prefix}/lib'
102includedir='${prefix}/include'
103oldincludedir='/usr/include'
104infodir='${prefix}/info'
105mandir='${prefix}/man'
a8298541 106
107### we might need to use some other shell than /bin/sh for running subshells
108
109### If we are on Windows, search for the shell. This will permit people
110### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
111### without also having to set CONFIG_SHELL. This code will work when
112### using bash, which sets OSTYPE.
113case "${OSTYPE}" in
114*win32*)
115 if [ x${CONFIG_SHELL} = x ]; then
116 if [ ! -f /bin/sh ]; then
117 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
118 CONFIG_SHELL=${SHELL}
119 export CONFIG_SHELL
120 else
121 for prog in sh sh.exe bash bash.exe; do
122 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
123 for dir in $PATH; do
124 test -z "$dir" && dir=.
125 if test -f $dir/$prog; then
126 CONFIG_SHELL=$dir/$prog
127 export CONFIG_SHELL
128 break
129 fi
130 done
131 IFS="$save_ifs"
132 test -n "${CONFIG_SHELL}" && break
133 done
134 fi
135 fi
136 fi
137 ;;
138esac
139
140config_shell=${CONFIG_SHELL-/bin/sh}
141
142NO_EDIT="This file was generated automatically by configure. Do not edit."
143
144## this is a little touchy and won't always work, but...
145##
146## if the argv[0] starts with a slash then it is an absolute name that can (and
147## must) be used as is.
148##
149## otherwise, if argv[0] has no slash in it, we can assume that it is on the
150## path. Since PATH might include "." we also add `pwd` to the end of PATH.
151##
152
153progname=$0
154# if PWD already has a value, it is probably wrong.
155if [ -n "$PWD" ]; then PWD=`pwd`; fi
156
157case "${progname}" in
158/*) ;;
159*/*) ;;
160*)
161 PATH=$PATH:${PWD=`pwd`} ; export PATH
162 ;;
163esac
164
165# Loop over all args
166
167while :
168do
169
170# Break out if there are no more args
171 case $# in
172 0)
173 break
174 ;;
175 esac
176
177# Get the first arg, and shuffle
178 option=$1
179 shift
180
181# Make all options have two hyphens
182 orig_option=$option # Save original for error messages
183 case $option in
184 --*) ;;
185 -*) option=-$option ;;
186 esac
187
188# Split out the argument for options that take them
189 case $option in
190 --*=*)
191 optarg=`echo $option | sed -e 's/^[^=]*=//'`
192 arguments="$arguments $option"
193 ;;
194# These options have mandatory values. Since we didn't find an = sign,
195# the value must be in the next argument
196 --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
197 optarg=$1
198 shift
199 arguments="$arguments $option=$optarg"
200 ;;
201 --v)
202 arguments="$arguments -v"
203 ;;
204 --*)
205 arguments="$arguments $option"
206 ;;
207 esac
208
209# Now, process the options
210 case $option in
211
ed37269d 212 --bi*)
213 bindir=$optarg
214 diroptions="$diroptions --bindir=$optarg"
215 ;;
a8298541 216 --build* | --bu*)
217 case "$build_alias" in
218 "") build_alias=$optarg ;;
219 *) echo '***' Can only configure for one build machine at a time. 1>&2
220 fatal=yes
221 ;;
222 esac
223 ;;
224 --cache*)
225 cache_file=$optarg
226 ;;
ed37269d 227 --da*)
228 datadir=$optarg
229 diroptions="$diroptions --datadir=$optarg"
230 ;;
a8298541 231 --disable-*)
232 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
233 eval $enableopt=no
234 disableoptions="$disableoptions $option"
235 ;;
236 --enable-*)
237 case "$option" in
238 *=*) ;;
239 *) optarg=yes ;;
240 esac
241
242 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
34834d2a 243 eval "$enableopt=\$optarg"
a8298541 244 enableoptions="$enableoptions '$option'"
245 ;;
246 --exec-prefix* | --ex*)
247 exec_prefix=$optarg
248 exec_prefixoption="--exec-prefix=$optarg"
249 ;;
250 --gas | --g*)
251 gas=yes
252 ;;
253 --help | --he*)
254 fatal=yes
255 ;;
256 --host* | --ho*)
257 case $host_alias in
258 NOHOST) host_alias=$optarg ;;
259 *) echo '***' Can only configure for one host at a time. 1>&2
260 fatal=yes
261 ;;
262 esac
263 ;;
ed37269d 264 --inc*)
265 includedir=$optarg
266 diroptions="$diroptions --includedir=$optarg"
267 ;;
268 --inf*)
269 infodir=$optarg
270 diroptions="$diroptions --infodir=$optarg"
271 ;;
272 --libd*)
273 libdir=$optarg
274 diroptions="$diroptions --libdir=$optarg"
275 ;;
276 --libe*)
277 libexecdir=$optarg
278 diroptions="$diroptions --libexecdir=$optarg"
279 ;;
280 --lo*)
281 localstatedir=$optarg
282 diroptions="$diroptions --localstatedir=$optarg"
283 ;;
284 --ma*)
285 mandir=$optarg
286 diroptions="$diroptions --mandir=$optarg"
287 ;;
a8298541 288 --nfp | --nf*)
289 floating_point=no
290 floating_pointoption="--nfp"
291 ;;
292 --norecursion | --no*)
293 norecursion=yes
294 ;;
ed37269d 295 --ol*)
296 oldincludedir=$optarg
297 diroptions="$diroptions --oldincludedir=$optarg"
298 ;;
a8298541 299 --prefix* | --pre*)
300 prefix=$optarg
301 prefixoption="--prefix=$optarg"
302 ;;
303 --program-prefix* | --program-p*)
304 program_prefix=$optarg
305 program_prefixoption="--program-prefix=$optarg"
306 ;;
307 --program-suffix* | --program-s*)
308 program_suffix=$optarg
309 program_suffixoption="--program-suffix=$optarg"
310 ;;
311 --program-transform-name* | --program-t*)
312 # Double any backslashes or dollar signs in the argument
313 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
314 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
315 ;;
316 --rm)
317 removing=--rm
318 ;;
ed37269d 319 --sb*)
320 sbindir=$optarg
321 diroptions="$diroptions --sbindir=$optarg"
322 ;;
323 --sh*)
324 sharedstatedir=$optarg
325 diroptions="$diroptions --sharedstatedir=$optarg"
326 ;;
a8298541 327 --silent | --sil* | --quiet | --q*)
328 redirect=">/dev/null"
329 verbose=--silent
330 ;;
331 --site* | --sit*)
332 site=$optarg
333 site_option="--site=$optarg"
334 ;;
335 --srcdir*/ | --sr*/)
336 # Remove trailing slashes. Otherwise, when the file name gets
337 # bolted into an object file as debug info, it has two slashes
338 # in it. Ordinarily this is ok, but emacs takes double slash
339 # to mean "forget the first part".
340 srcdir=`echo $optarg | sed -e 's:/$::'`
341 ;;
342 --srcdir* | --sr*)
343 srcdir=$optarg
344 ;;
ed37269d 345 --sy*)
346 sysconfdir=$optarg
347 diroptions="$diroptions --sysconfdir=$optarg"
348 ;;
a8298541 349 --target* | --ta*)
350 case $target_alias in
351 NOTARGET) target_alias=$optarg ;;
352 *) echo '***' Can only configure for one target at a time. 1>&2
353 fatal=yes
354 ;;
355 esac
356 ;;
357 --tmpdir* | --tm*)
358 TMPDIR=$optarg
359 tmpdiroption="--tmpdir=$optarg"
360 ;;
361 --verbose | --v | --verb*)
362 redirect=
363 verbose=--verbose
364 ;;
365 --version | --V | --vers*)
366 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
367 exit 0
368 ;;
369 --with-*)
370 case "$option" in
371 *=*) ;;
372 *) optarg=yes ;;
373 esac
374
375 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
34834d2a 376 eval $withopt="\$optarg"
a8298541 377 withoptions="$withoptions $option"
378 ;;
379 --without-*)
380 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
381 eval $withopt=no
382 withoutoptions="$withoutoptions $option"
383 ;;
384 --x) with_x=yes
385 withoptions="$withoptions --with-x"
386 ;;
387 --x-i* | --x-l*) other_options="$other_options $orig_option"
388 ;;
a8298541 389 --*)
390 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
391 exit 1
392 ;;
393 *)
394 case $undefs in
395 NOUNDEFS) undefs=$option ;;
396 *) echo '***' Can only configure for one host and one target at a time. 1>&2
397 fatal=yes
398 ;;
399 esac
400 ;;
401 esac
402done
403
4a0e2d42 404# Remember the pristine configure arguments for later. $arguments gets
405# built up with further defaults in preparation for recursion.
406original_arguments=$arguments
407
a8298541 408# process host and target
409
410# Do some error checking and defaulting for the host and target type.
411# The inputs are:
412# configure --host=HOST --target=TARGET UNDEFS
413#
414# The rules are:
415# 1. You aren't allowed to specify --host, --target, and undefs at the
416# same time.
417# 2. Host defaults to undefs.
418# 3. If undefs is not specified, then host defaults to the current host,
419# as determined by config.guess.
420# 4. Target defaults to undefs.
421# 5. If undefs is not specified, then target defaults to host.
422
423case "${fatal}" in
424"")
425 # Make sure that host, target & undefs aren't all specified at the
426 # same time.
427 case $host_alias---$target_alias---$undefs in
428 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
429 ;;
430 *) echo '***' Can only configure for one host and one target at a time. 1>&2
431 fatal=yes
432 break 2
433 ;;
434 esac
435
436 # Now, do defaulting for host.
437 case $host_alias in
438 NOHOST)
439 case $undefs in
440 NOUNDEFS)
441 # Neither --host option nor undefs were present.
442 # Call config.guess.
443 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
444 if host_alias=`${config_shell} ${guesssys}`
445 then
446 # If the string we are going to use for
447 # the target is a prefix of the string
448 # we just guessed for the host, then
449 # assume we are running native, and force
450 # the same string for both target and host.
451 case $target_alias in
452 NOTARGET) ;;
453 *)
454 if expr $host_alias : $target_alias >/dev/null
455 then
456 host_alias=$target_alias
457 fi
458 ;;
459 esac
460 echo "Configuring for a ${host_alias} host." 1>&2
461 arguments="--host=$host_alias $arguments"
462 else
463 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
464 fatal=yes
465 fi
466 ;;
467 *)
468 host_alias=$undefs
469 arguments="--host=$host_alias $arguments"
470 undefs=NOUNDEFS
471 ;;
472 esac
473 esac
474
475 # Do defaulting for target. If --target option isn't present, default
476 # to undefs. If undefs isn't present, default to host.
477 case $target_alias in
478 NOTARGET)
479 case $undefs in
480 NOUNDEFS)
481 target_alias=$host_alias
482 ;;
483 *)
484 target_alias=$undefs
485 arguments="--target=$target_alias $arguments"
486 ;;
487 esac
488 esac
489 ;;
490*) ;;
491esac
492
493if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
494 exec 1>&2
495 echo Usage: configure [OPTIONS] [HOST]
496 echo
497 echo Options: [defaults in brackets]
498 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
499 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
500 echo ' --help print this message [normal config]'
501 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
502 echo ' --host=HOST configure for HOST [determined via config.guess]'
503 echo ' --norecursion configure this directory only [recurse]'
504 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
505 echo ' --program-suffix=FOO append FOO to installed program names [""]'
506 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
507 echo ' --site=SITE configure with site-specific makefile for SITE'
508 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
509 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
510 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
511 echo ' --nfp configure for software floating point [hard float]'
512 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
513 echo ' --without-FOO package FOO is NOT available'
514 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
515 echo ' --disable-FOO do not include feature FOO'
516 echo
517 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
518 echo
519 if [ -r config.status ] ; then
520 cat config.status
521 fi
522
523 exit 1
524fi
525
526configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
527moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
2dce220b 528## the sed command below emulates the dirname command
529topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
a8298541 530
ed37269d 531
a8298541 532# this is a hack. sun4 must always be a valid host alias or this will fail.
533if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
534 true
535else
536 echo '***' cannot find config.sub. 1>&2
537 exit 1
538fi
539
540touch config.junk
541if ${config_shell} ${moveifchange} config.junk config.trash ; then
542 true
543else
544 echo '***' cannot find move-if-change. 1>&2
545 exit 1
546fi
547rm -f config.junk config.trash
548
549case "${srcdir}" in
550"")
551 if [ -r configure.in ] ; then
552 srcdir=.
553 else
554 if [ -r ${progname}.in ] ; then
555 srcdir=`echo ${progname} | sed 's:/configure$::'`
556 else
557 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
558 exit 1
559 fi
560 fi
561 ;;
562*)
563 # Set srcdir to "." if that's what it is.
564 # This is important for multilib support.
565 if [ ! -d ${srcdir} ] ; then
566 echo "Invalid source directory ${srcdir}" >&2
567 exit 1
568 fi
569 pwd=`pwd`
570 srcpwd=`cd ${srcdir} ; pwd`
571 if [ "${pwd}" = "${srcpwd}" ] ; then
572 srcdir=.
573 fi
574esac
575
576### warn about some conflicting configurations.
577
578case "${srcdir}" in
579".") ;;
580*)
581 if [ -f ${srcdir}/config.status ] ; then
582 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
583 exit 1
584 fi
585esac
586
587# default exec_prefix
588case "${exec_prefixoption}" in
589"") exec_prefix="\$(prefix)" ;;
590*) ;;
591esac
592
7955e3d2 593# Define the trigger file to make sure configure will re-run whenever
594# the gcc version number changes.
595if [ "${with_gcc_version_trigger+set}" = set ]; then
596 gcc_version_trigger="$with_gcc_version_trigger"
4f5e65d7 597 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
7955e3d2 598else
599 # If gcc's sources are available, define the trigger file.
600 if [ -f ${topsrcdir}/gcc/version.c ] ; then
601 gcc_version_trigger=${topsrcdir}/gcc/version.c
4f5e65d7 602 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
7955e3d2 603 case "$arguments" in
604 *--with-gcc-version-trigger=$gcc_version_trigger* )
605 ;;
606 * )
607 # Make sure configure.in knows about this.
608 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
609 ;;
610 esac
611 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
612 fi
613fi
614
a8298541 615### break up ${srcdir}/configure.in.
616case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
617"")
618 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
619 # Check for a directory that's been converted to use autoconf since
620 # it was last configured.
621 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
622 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
623 if [ -r ${srcdir}/configure ] ; then
624 echo '***' Running the local configure script. 1>&2
625 case "${cache_file}" in
626 "") cache_file_option= ;;
627 *) cache_file_option="--cache-file=${cache_file}" ;;
628 esac
629 srcdiroption="--srcdir=${srcdir}"
630 case "${build_alias}" in
631 "") buildopt= ;;
632 *) buildopt="--build=${build_alias}" ;;
633 esac
634 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
635 ${buildopt} --host=${host_alias} --target=${target_alias} \
636 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
ed37269d 637 ${srcdiroption} ${diroptions} \
a8298541 638 ${program_prefixoption} ${program_suffixoption} \
639 ${program_transform_nameoption} ${site_option} \
640 ${withoptions} ${withoutoptions} \
641 ${enableoptions} ${disableoptions} ${floating_pointoption} \
642 ${cache_file_option} ${removing} ${other_options} ${redirect}
643 else
644 echo '***' There is no configure script present though. 1>&2
645 fi
646 fi
647 exit 1
648 ;;
649*) ;;
650esac
651
652case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
653"")
654 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
655 exit 1
656 ;;
657*) ;;
658esac
659
660case "${TMPDIR}" in
661"") TMPDIR=/tmp ; export TMPDIR ;;
662*) ;;
663esac
664
151ad919 665# keep this filename short for &%*%$*# 14 char file names and 8+3 file names
666tmpfile=${TMPDIR}/cNf$$
a8298541 667# Note that under many versions of sh a trap handler for 0 will *override* any
668# exit status you explicitly specify! At this point, the only non-error exit
669# is at the end of the script; these actions are duplicated there, minus
670# the "exit 1". Don't use "exit 0" anywhere after this without resetting the
671# trap handler, or you'll lose.
672trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
673
674# split ${srcdir}/configure.in into common, per-host, per-target,
675# and post-target parts. Post-target is optional.
676sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
677sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
678if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
679 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
680 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
681else
682 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
683 echo >${tmpfile}.pos
684fi
685
686### do common part of configure.in
687
76103b2c 688# If the language specific compiler does not exist, but the "gcc" directory does,
689# we will skip this directory; in this case the sub-directory's common part
690# of configure.in will create a small shell script "skip-this-dir" containing
691# commands to completely clean up any temporary or created files.
692
a8298541 693. ${tmpfile}.com
694
76103b2c 695if test -f skip-this-dir; then
696 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
697 # and reset the trap handler.
698 trap 0
699 rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
700 # Execute the final clean-up actions
701 ${config_shell} skip-this-dir
702 # and stop configuring this directory.
703 exit 0
704fi
705
a8298541 706# some sanity checks on configure.in
707case "${srctrigger}" in
708"")
709 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
710 exit 1
711 ;;
712*) ;;
713esac
714
715case "${build_alias}" in
716"")
717 if result=`${config_shell} ${configsub} ${host_alias}` ; then
718 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
719 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
720 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
721 build=${build_cpu}-${build_vendor}-${build_os}
722 build_alias=${host_alias}
723 fi
724 ;;
725*)
726 if result=`${config_shell} ${configsub} ${build_alias}` ; then
727 buildopt="--build=${build_alias}"
728 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
729 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
730 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
731 build=${build_cpu}-${build_vendor}-${build_os}
732 else
733 echo "Unrecognized build system name ${build_alias}." 1>&2
734 exit 1
735 fi
736 ;;
737esac
738
739if result=`${config_shell} ${configsub} ${host_alias}` ; then
740 true
741else
742 echo "Unrecognized host system name ${host_alias}." 1>&2
743 exit 1
744fi
745host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
746host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
747host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
748host=${host_cpu}-${host_vendor}-${host_os}
749
750. ${tmpfile}.hst
751
752if result=`${config_shell} ${configsub} ${target_alias}` ; then
753 true
754else
755 echo "Unrecognized target system name ${target_alias}." 1>&2
756 exit 1
757fi
758target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
759target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
760target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
761target=${target_cpu}-${target_vendor}-${target_os}
762
763. ${tmpfile}.tgt
764
765# Find the source files, if location was not specified.
766case "${srcdir}" in
767"")
768 srcdirdefaulted=1
769 srcdir=.
770 if [ ! -r ${srctrigger} ] ; then
771 srcdir=..
772 fi
773 ;;
774*) ;;
775esac
776
777if [ ! -r ${srcdir}/${srctrigger} ] ; then
778 case "${srcdirdefaulted}" in
779 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
780 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
781 esac
782
783 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
784 exit 1
785fi
786
787# Some systems (e.g., one of the i386-aix systems the gas testers are
788# using) don't handle "\$" correctly, so don't use it here.
789tooldir='$(exec_prefix)'/${target_alias}
790
791if [ "${host_alias}" != "${target_alias}" ] ; then
792 if [ "${program_prefixoption}" = "" ] ; then
793 if [ "${program_suffixoption}" = "" ] ; then
794 if [ "${program_transform_nameoption}" = "" ] ; then
795 program_prefix=${target_alias}- ;
796 fi
797 fi
798 fi
799fi
800
801# Merge program_prefix and program_suffix onto program_transform_name.
802# (program_suffix used to use $, but it's hard to preserve $ through both
803# make and sh.)
804if [ "${program_suffix}" != "" ] ; then
805 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
806fi
807
808if [ "${program_prefix}" != "" ] ; then
809 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
810fi
811
812# If CC and CXX are not set in the environment, and the Makefile
813# exists, try to extract them from it. This is to handle running
814# ./config.status by hand.
ed37269d 815if [ -z "${CC}" ] && [ -r Makefile ]; then
a8298541 816 sed -n -e ':loop
817/\\$/ N
818s/\\\n//g
819t loop
820/^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
821 CC=`tail -1 Makefile.cc`
822 rm -f Makefile.cc
823fi
824
ed37269d 825if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
a8298541 826 sed -n -e ':loop
827/\\$/ N
828s/\\\n//g
829t loop
830/^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
831 CFLAGS=`tail -1 Makefile.cc`
832 rm -f Makefile.cc
833fi
834
ed37269d 835if [ -z "${CXX}" ] && [ -r Makefile ]; then
a8298541 836 sed -n -e ':loop
837/\\$/ N
838s/\\\n//g
839t loop
840/^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
841 CXX=`tail -1 Makefile.cc`
842 rm -f Makefile.cc
843fi
844
ed37269d 845if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
a8298541 846 sed -n -e ':loop
847/\\$/ N
848s/\\\n//g
849t loop
850/^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
851 CXXFLAGS=`tail -1 Makefile.cc`
852 rm -f Makefile.cc
853fi
854
855# Generate a default definition for YACC. This is used if the makefile can't
856# locate bison or byacc in objdir.
857
858for prog in 'bison -y' byacc yacc
859do
860 set dummy $prog; tmp=$2
861 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
862 for dir in $PATH; do
863 test -z "$dir" && dir=.
864 if test -f $dir/$tmp; then
865 DEFAULT_YACC="$prog"
866 break
867 fi
868 done
869 IFS="$save_ifs"
870
871 test -n "$DEFAULT_YACC" && break
872done
873
c7879c37 874# Generate a default definition for M4. This is used if the makefile can't
875# locate m4 in objdir.
876
877for prog in gm4 gnum4 m4
878do
879 set dummy $prog; tmp=$2
880 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
881 for dir in $PATH; do
882 test -z "$dir" && dir=.
883 if test -f $dir/$tmp; then
884 DEFAULT_M4="$prog"
885 break
886 fi
887 done
888 IFS="$save_ifs"
889
890 test -n "$DEFAULT_M4" && break
891done
892
a8298541 893# Generate a default definition for LEX. This is used if the makefile can't
894# locate flex in objdir.
895
896for prog in flex lex
897do
898 set dummy $prog; tmp=$2
899 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
900 for dir in $PATH; do
901 test -z "$dir" && dir=.
902 if test -f $dir/$tmp; then
903 DEFAULT_LEX="$prog"
904 break
905 fi
906 done
907 IFS="$save_ifs"
908
909 test -n "$DEFAULT_LEX" && break
910done
911
912if [ "${build}" != "${host}" ]; then
913 # If we are doing a Canadian Cross, in which the host and build systems
914 # are not the same, we set reasonable default values for the tools.
915
916 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
917 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
918 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
919 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
920 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
921 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
151ad919 922 tools="${tools} OBJCOPY OBJDUMP"
a8298541 923
924 for var in ${tools}; do
34834d2a 925 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
a8298541 926 sed -n -e ':loop
927/\\$/ N
928s/\\\n//g
929t loop
930/^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
931 < Makefile > Makefile.v
932 t=`tail -1 Makefile.v`
933 if [ -n "${t}" ]; then
34834d2a 934 eval "${var}=\${t}"
a8298541 935 fi
936 rm -f Makefile.v
937 fi
938 done
939
940 AR=${AR-${host_alias}-ar}
941 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
942 AS=${AS-${host_alias}-as}
943 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
944 BISON=${BISON-bison}
945 CC=${CC-${host_alias}-gcc}
946 CFLAGS=${CFLAGS-"-g -O2"}
947 CXX=${CXX-${host_alias}-c++}
948 CXXFLAGS=${CXXFLAGS-"-g -O2"}
949 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
950 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
951 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
952 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
953 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
954 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
955 HOST_PREFIX=${build_alias}-
956 HOST_PREFIX_1=${build_alias}-
957 LD=${LD-${host_alias}-ld}
958 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
959 MAKEINFO=${MAKEINFO-makeinfo}
960 NM=${NM-${host_alias}-nm}
961 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
962 RANLIB=${RANLIB-${host_alias}-ranlib}
963 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
964 WINDRES=${WINDRES-${host_alias}-windres}
965 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
151ad919 966 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
967 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
a8298541 968
969 if [ -z "${YACC}" ]; then
970 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
971 for dir in $PATH; do
972 test -z "$dir" && dir=.
973 if test -f $dir/bison; then
974 YACC="bison -y"
975 break
976 fi
977 if test -f $dir/byacc; then
978 YACC=byacc
979 break
980 fi
981 if test -f $dir/yacc; then
982 YACC=yacc
983 break
984 fi
985 done
986 IFS="$save_ifs"
987 if [ -z "${YACC}" ]; then
988 YACC="bison -y"
989 fi
990 fi
991
992 if [ -z "${LEX}" ]; then
993 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
994 for dir in $PATH; do
995 test -z "$dir" && dir=.
996 if test -f $dir/flex; then
997 LEX=flex
998 break
999 fi
1000 if test -f $dir/lex; then
1001 LEX=lex
1002 break
1003 fi
1004 done
1005 IFS="$save_ifs"
1006 LEX=${LEX-flex}
1007 fi
1008
1009 # Export variables which autoconf might try to set.
1010 export AS
1011 export AR
1012 export CC_FOR_BUILD
1013 export DLLTOOL
1014 export LD
1015 export NM
1016 export RANLIB
1017 export WINDRES
151ad919 1018 export OBJCOPY
1019 export OBJDUMP
a8298541 1020else
1021 # If CC is still not set, try to get gcc.
1022 if [ -z "${CC}" ]; then
1023 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1024 for dir in $PATH; do
1025 test -z "$dir" && dir=.
1026 if test -f $dir/gcc; then
1027 CC="gcc"
1028 echo 'void f(){}' > conftest.c
1029 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1030 CFLAGS=${CFLAGS-"-g -O2"}
2aabe804 1031 CXXFLAGS=${CXXFLAGS-"-g -O2"}
a8298541 1032 else
1033 CFLAGS=${CFLAGS-"-O2"}
2aabe804 1034 CXXFLAGS=${CXXFLAGS-"-O2"}
a8298541 1035 fi
1036 rm -f conftest*
1037 break
1038 fi
1039 done
1040 IFS="$save_ifs"
1041 CC=${CC-cc}
ed37269d 1042 else
1043 if test -z "${CFLAGS}"; then
1044 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1045 # is set to a version of gcc.
1046 case "${CC}" in
1047 *gcc)
1048 echo 'void f(){}' > conftest.c
1049 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1050 CFLAGS=${CFLAGS-"-g -O2"}
1051 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1052 else
1053 CFLAGS=${CFLAGS-"-O2"}
1054 CXXFLAGS=${CXXFLAGS-"-O2"}
1055 fi
1056 rm -f conftest*
1057 ;;
1058 esac
1059 fi
a8298541 1060 fi
1061
1062 CXX=${CXX-"c++"}
1063 CFLAGS=${CFLAGS-"-g"}
1064 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1065fi
1066
1067export CC
1068export CXX
1069export CFLAGS
1070export CXXFLAGS
1071
1072# FIXME: This should be in configure.in, not configure
1073case "$host" in
1074 *go32*)
1075 enable_gdbtk=no ;;
1076 *msdosdjgpp*)
1077 enable_gdbtk=no ;;
a8298541 1078esac
1079
1080# FIXME: This should be in configure.in, not configure
1081# Determine whether gdb needs tk/tcl or not.
1082if [ "$enable_gdbtk" != "no" ]; then
151ad919 1083 GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
a8298541 1084else
1085 GDB_TK=""
1086fi
1087
1088for subdir in . ${subdirs} ; do
1089
1090 # ${subdir} is relative path from . to the directory we're currently
1091 # configuring.
1092 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
1093 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
1094
1095 ### figure out what to do with srcdir
1096 case "${srcdir}" in
1097 ".") # no -srcdir option. We're building in place.
1098 makesrcdir=. ;;
1099 /*) # absolute path
1100 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1101 ;;
1102 *) # otherwise relative
1103 case "${subdir}" in
1104 .) makesrcdir=${srcdir} ;;
1105 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1106 esac
1107 ;;
1108 esac
1109
1110 if [ "${subdir}/" != "./" ] ; then
1111 Makefile=${subdir}/Makefile
1112 fi
1113
1114 if [ ! -d ${subdir} ] ; then
1115 if mkdir ${subdir} ; then
1116 true
1117 else
1118 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1119 exit 1
1120 fi
1121 fi
1122
1123 case "${removing}" in
1124 "")
1125 case "${subdir}" in
1126 .) ;;
1127 *) eval echo Building in ${subdir} ${redirect} ;;
1128 esac
1129
1130 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1131 # Set up the list of links to be made.
1132 # ${links} is the list of link names, and ${files} is the list of names to link to.
1133
1134 # Make the links.
1135 configlinks="${links}"
1136 if [ -r ${subdir}/config.status ] ; then
1137 mv -f ${subdir}/config.status ${subdir}/config.back
1138 fi
1139 while [ -n "${files}" ] ; do
1140 # set file to car of files, files to cdr of files
1141 set ${files}; file=$1; shift; files=$*
1142 set ${links}; link=$1; shift; links=$*
1143
1144 if [ ! -r ${srcdir}/${file} ] ; then
4154bda4 1145 if [ ! -r ${file} ] ; then
1146
a8298541 1147 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1148 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1149 exit 1
4154bda4 1150 else
1151 srcfile=${file}
1152 fi
1153 else
1154 srcfile=${srcdir}/${file}
a8298541 1155 fi
1156
1157 ${remove} -f ${link}
1158 # Make a symlink if possible, otherwise try a hard link
4154bda4 1159 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
a8298541 1160 true
1161 else
1162 # We need to re-remove the file because Lynx leaves a
1163 # very strange directory there when it fails an NFS symlink.
1164 ${remove} -r -f ${link}
4154bda4 1165 ${hard_link} ${srcfile} ${link}
a8298541 1166 fi
1167 if [ ! -r ${link} ] ; then
4154bda4 1168 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
a8298541 1169 exit 1
1170 fi
1171
4154bda4 1172 echo "Linked \"${link}\" to \"${srcfile}\"."
a8298541 1173 done
1174
1175 # Create a .gdbinit file which runs the one in srcdir
1176 # and tells GDB to look there for source files.
1177
1178 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1179 case ${srcdir} in
1180 .) ;;
1181 *) cat > ${subdir}/.gdbinit <<EOF
1182# ${NO_EDIT}
1183dir ${makesrcdir}
1184dir .
1185source ${makesrcdir}/.gdbinit
1186EOF
1187 ;;
1188 esac
1189 fi
1190
1191 # Install a makefile, and make it set VPATH
1192 # if necessary so that the sources are found.
1193 # Also change its value of srcdir.
1194 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1195 # been somewhat optimized and is perhaps a bit twisty.
1196
1197 # code is order so as to try to sed the smallest input files we know.
3d2749bb 1198 # so do these separately because I don't trust the order of sed -e expressions.
a8298541 1199
3d2749bb 1200 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1201 # package macros, target, host, site, and package rules.
a8298541 1202
1203 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1204
3d2749bb 1205 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1206 rm -f ${subdir}/${Makefile}.tem
1207 case "${package_makefile_rules_frag}" in
1208 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1209 *)
1210 if [ ! -f ${package_makefile_rules_frag} ] ; then
1211 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1212 fi
1213 if [ -f ${package_makefile_rules_frag} ] ; then
1214 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1215 else
1216 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1217 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1218 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1219 fi
1220 esac
1221 # working copy now in ${Makefile}.tem
1222
a8298541 1223 # Conditionalize for this site.
1224 rm -f ${Makefile}
3d2749bb 1225 case "${site}" in
1226 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
a8298541 1227 *)
1228 site_makefile_frag=${srcdir}/config/ms-${site}
1229
1230 if [ -f ${site_makefile_frag} ] ; then
3d2749bb 1231 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1232 > ${Makefile}
a8298541 1233 else
3d2749bb 1234 mv ${subdir}/Makefile.tem ${Makefile}
a8298541 1235 site_makefile_frag=
1236 fi
1237 ;;
1238 esac
1239 # working copy now in ${Makefile}
1240
1241 # Conditionalize the makefile for this host.
1242 rm -f ${subdir}/Makefile.tem
1243 case "${host_makefile_frag}" in
1244 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1245 *)
1246 if [ ! -f ${host_makefile_frag} ] ; then
1247 host_makefile_frag=${srcdir}/${host_makefile_frag}
1248 fi
1249 if [ -f ${host_makefile_frag} ] ; then
1250 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1251 else
1252 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1253 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1254 mv ${Makefile} ${subdir}/Makefile.tem
1255 fi
1256 esac
1257 # working copy now in ${subdir)/Makefile.tem
1258
1259 # Conditionalize the makefile for this target.
1260 rm -f ${Makefile}
1261 case "${target_makefile_frag}" in
1262 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1263 *)
1264 if [ ! -f ${target_makefile_frag} ] ; then
1265 target_makefile_frag=${srcdir}/${target_makefile_frag}
1266 fi
1267 if [ -f ${target_makefile_frag} ] ; then
1268 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1269 else
1270 mv ${subdir}/Makefile.tem ${Makefile}
1271 target_makefile_frag=
1272 fi
1273 ;;
1274 esac
72f9a66a 1275 # working copy now in ${Makefile}
1276
3d2749bb 1277 # Emit the default values of this package's macros.
1278 rm -f ${subdir}/Makefile.tem
72f9a66a 1279 case "${package_makefile_frag}" in
1280 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1281 *)
1282 if [ ! -f ${package_makefile_frag} ] ; then
1283 package_makefile_frag=${srcdir}/${package_makefile_frag}
1284 fi
1285 if [ -f ${package_makefile_frag} ] ; then
3d2749bb 1286 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
72f9a66a 1287 else
3d2749bb 1288 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
72f9a66a 1289 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1290 mv ${Makefile} ${subdir}/Makefile.tem
1291 fi
1292 esac
a8298541 1293 # real copy now in ${subdir}/Makefile.tem
1294
1295 # prepend warning about editting, and a bunch of variables.
1296 rm -f ${Makefile}
1297 cat > ${Makefile} <<EOF
1298# ${NO_EDIT}
1299VPATH = ${makesrcdir}
1300links = ${configlinks}
1301host_alias = ${host_alias}
1302host_cpu = ${host_cpu}
1303host_vendor = ${host_vendor}
1304host_os = ${host_os}
1305host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1306target_alias = ${target_alias}
1307target_cpu = ${target_cpu}
1308target_vendor = ${target_vendor}
1309target_os = ${target_os}
1310target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1311EOF
1312 case "${build}" in
1313 "") ;;
1314 *) cat >> ${Makefile} << EOF
1315build_alias = ${build_alias}
1316build_cpu = ${build_cpu}
1317build_vendor = ${build_vendor}
1318build_os = ${build_os}
1319build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1320EOF
1321 esac
1322
1323 case "${package_makefile_frag}" in
1324 "") ;;
1325 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1326 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1327 esac
1328
1329 case "${target_makefile_frag}" in
1330 "") ;;
1331 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1332 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1333 esac
1334
1335 case "${host_makefile_frag}" in
1336 "") ;;
1337 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1338 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1339 esac
1340
1341 if [ "${site_makefile_frag}" != "" ] ; then
1342 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1343 fi
1344
e800dd2f 1345 echo enable_shared = ${enable_shared} >> ${Makefile}
1346 echo enable_threads = ${enable_threads} >> ${Makefile}
27588c22 1347 # record if we want to rumtime library stuff installed in libsubdir.
1348 if test -z "${enable_version_specific_runtime_libs}"; then
1349 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1350 else
1351 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1352 fi
92424a17 1353
7955e3d2 1354 # Emit a macro which describes the file containing gcc's
1355 # version number.
1356 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1357 # And emit a macro defining gcc's version number.
640128ad 1358 echo gcc_version = ${gcc_version} >> ${Makefile}
1359
a8298541 1360 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1361 # remove any form feeds.
1362 if [ -z "${subdirs}" ]; then
1363 rm -f ${subdir}/Makefile.tm2
1364 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1365 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1366 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1367 rm -f ${subdir}/Makefile.tem
1368 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1369 fi
1370 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1371 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
ed37269d 1372 -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
1373 -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
1374 -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
1375 -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
1376 -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
1377 -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
1378 -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
1379 -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
1380 -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
1381 -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
1382 -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
1383 -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
a8298541 1384 -e "/^CC[ ]*=/{
1385 :loop1
1386 /\\\\$/ N
1387 s/\\\\\\n//g
1388 t loop1
1389 s%^CC[ ]*=.*$%CC = ${CC}%
1390 }" \
1391 -e "/^CXX[ ]*=/{
1392 :loop2
1393 /\\\\$/ N
1394 s/\\\\\\n//g
1395 t loop2
1396 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1397 }" \
1398 -e "/^CFLAGS[ ]*=/{
1399 :loop3
1400 /\\\\$/ N
1401 s/\\\\\\n//g
1402 t loop3
1403 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1404 }" \
1405 -e "/^CXXFLAGS[ ]*=/{
1406 :loop4
1407 /\\\\$/ N
1408 s/\\\\\\n//g
1409 t loop4
1410 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1411 }" \
1412 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
a8298541 1413 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1414 -e "s/\f//" \
1415 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1416 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1417 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1418 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
fb1c80df 1419 -e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \
a8298541 1420 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1421 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
c7879c37 1422 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
a8298541 1423 ${subdir}/Makefile.tem >> ${Makefile}
151ad919 1424
1425 sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
1426 mv -f ${Makefile}.tem ${Makefile}
a8298541 1427
1428 # If this is a Canadian Cross, preset the values of many more
1429 # tools.
1430 if [ "${build}" != "${host}" ]; then
1431 for var in ${tools}; do
34834d2a 1432 eval val=\$${var}
a8298541 1433 sed -e "/^${var}[ ]*=/{
1434 :loop1
1435 /\\\\$/ N
1436 /\\\\$/ b loop1
1437 s/\\\\\\n//g
1438 s%^${var}[ ]*=.*$%${var} = ${val}%
1439 }" ${Makefile} > ${Makefile}.tem
1440 mv -f ${Makefile}.tem ${Makefile}
1441 done
1442 fi
1443
1444 # final copy now in ${Makefile}
1445
1446 else
1447 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1448 fi
1449
1450 rm -f ${subdir}/Makefile.tem
1451
1452 case "${host_makefile_frag}" in
1453 "") using= ;;
1454 *) using="and \"${host_makefile_frag}\"" ;;
1455 esac
1456
1457 case "${target_makefile_frag}" in
1458 "") ;;
1459 *) using="${using} and \"${target_makefile_frag}\"" ;;
1460 esac
1461
1462 case "${site_makefile_frag}" in
1463 "") ;;
1464 *) using="${using} and \"${site_makefile_frag}\"" ;;
1465 esac
1466
1467 newusing=`echo "${using}" | sed 's/and/using/'`
1468 using=${newusing}
1469 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1470
1471 . ${tmpfile}.pos
1472
1473 # describe the chosen configuration in config.status.
1474 # Make that file a shellscript which will reestablish
1475 # the same configuration. Used in Makefiles to rebuild
1476 # Makefiles.
1477
1478 case "${norecursion}" in
1479 "") arguments="${arguments} --norecursion" ;;
1480 *) ;;
1481 esac
1482
1483 if [ ${subdir} = . ] ; then
1484 echo "#!/bin/sh
1485# ${NO_EDIT}
1486# This directory was configured as follows:
1487${progname}" ${arguments} "
1488# ${using}" > ${subdir}/config.new
1489 else
1490 echo "#!/bin/sh
1491# ${NO_EDIT}
1492# This directory was configured as follows:
1493cd ${invsubdir}
1494${progname}" ${arguments} "
1495# ${using}" > ${subdir}/config.new
1496 fi
1497 chmod a+x ${subdir}/config.new
1498 if [ -r ${subdir}/config.back ] ; then
1499 mv -f ${subdir}/config.back ${subdir}/config.status
1500 fi
1501 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1502 ;;
1503
1504 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1505 esac
1506done
1507
1508# If there are subdirectories, then recur.
ed37269d 1509if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1510 for configdir in ${configdirs} ${extraconfigdirs} ; do
1511
1512 # If configdir contains ',' it is
1513 # srcdir,builddir,target_alias
1514 # These come from extraconfigdirs.
1515 case ${configdir} in
1516 *,*)
1517 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1518 ;;
1519 *)
1520 cfg_dir=${configdir}
1521 bld_dir=${configdir}
1522 tgt_alias=${target_alias}
1523 ;;
1524 esac
a8298541 1525
ed37269d 1526 if [ -d ${srcdir}/${cfg_dir} ] ; then
a8298541 1527 eval echo Configuring ${configdir}... ${redirect}
1528 case "${srcdir}" in
1529 ".") ;;
1530 *)
ed37269d 1531 if [ ! -d ./${bld_dir} ] ; then
1532 if mkdir ./${bld_dir} ; then
a8298541 1533 true
1534 else
ed37269d 1535 echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
a8298541 1536 exit 1
1537 fi
1538 fi
1539 ;;
1540 esac
1541
1542 POPDIR=${PWD=`pwd`}
ed37269d 1543 cd ${bld_dir}
a8298541 1544
1545### figure out what to do with srcdir
1546 case "${srcdir}" in
1547 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1548 /*) # absolute path
ed37269d 1549 newsrcdir=${srcdir}/${cfg_dir}
a8298541 1550 srcdiroption="--srcdir=${newsrcdir}"
1551 ;;
1552 ?:*) # absolute path on win32
ed37269d 1553 newsrcdir=${srcdir}/${cfg_dir}
a8298541 1554 srcdiroption="--srcdir=${newsrcdir}"
1555 ;;
1556 *) # otherwise relative
ed37269d 1557 newsrcdir=../${srcdir}/${cfg_dir}
a8298541 1558 srcdiroption="--srcdir=${newsrcdir}"
1559 ;;
1560 esac
1561
1562 # Handle --cache-file=../XXX
1563 case "${cache_file}" in
1564 "") # empty
1565 ;;
1566 /*) # absolute path
1567 cache_file_option="--cache-file=${cache_file}"
1568 ;;
1569 ?:*) # absolute path on win32
1570 cache_file_option="--cache-file=${cache_file}"
1571 ;;
1572 *) # relative path
1573 cache_file_option="--cache-file=../${cache_file}"
1574 ;;
1575 esac
1576
1577### check for guested configure, otherwise fix possibly relative progname
1578 if [ -f ${newsrcdir}/configure ] ; then
1579 recprog=${newsrcdir}/configure
1580 elif [ -f ${newsrcdir}/configure.in ] ; then
1581 case "${progname}" in
1582 /*) recprog=${progname} ;;
1583 ?:*) recprog=${progname} ;;
1584 *) recprog=../${progname} ;;
1585 esac
1586 else
ed37269d 1587 eval echo No configuration information in ${cfg_dir} ${redirect}
a8298541 1588 recprog=
1589 fi
1590
1591### The recursion line is here.
1592 if [ ! -z "${recprog}" ] ; then
ed37269d 1593 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
a8298541 1594 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
ed37269d 1595 ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
a8298541 1596 true
1597 else
1598 echo Configure in `pwd` failed, exiting. 1>&2
1599 exit 1
1600 fi
1601 fi
1602
1603 cd ${POPDIR}
1604 fi
1605 done
1606fi
1607
4a0e2d42 1608# Remember configure arguments for later.
3e9279ee 1609if [ -d gcc ]; then
1610 cat > gcc/configargs.h <<EOF
4a0e2d42 1611/* Generated automatically. */
1612static const char configuration_arguments[] = "$original_arguments";
1613EOF
3e9279ee 1614fi
4a0e2d42 1615
a8298541 1616# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1617# and reset the trap handler.
1618rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1619trap 0
1620
1621exit 0
1622
1623#
1624# Local Variables:
1625# fill-column: 131
1626# End:
1627#
1628
1629# end of configure