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