Do not consider a THEN block ending in an indirect jump for conditional compilation...
[official-gcc.git] / configure
blobe0d60261c70d1df4b21fed20a7c9c51cb215f14e
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.27 $"
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 # process host and target
405 # Do some error checking and defaulting for the host and target type.
406 # The inputs are:
407 # configure --host=HOST --target=TARGET UNDEFS
409 # The rules are:
410 # 1. You aren't allowed to specify --host, --target, and undefs at the
411 # same time.
412 # 2. Host defaults to undefs.
413 # 3. If undefs is not specified, then host defaults to the current host,
414 # as determined by config.guess.
415 # 4. Target defaults to undefs.
416 # 5. If undefs is not specified, then target defaults to host.
418 case "${fatal}" in
420 # Make sure that host, target & undefs aren't all specified at the
421 # same time.
422 case $host_alias---$target_alias---$undefs in
423 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
425 *) echo '***' Can only configure for one host and one target at a time. 1>&2
426 fatal=yes
427 break 2
429 esac
431 # Now, do defaulting for host.
432 case $host_alias in
433 NOHOST)
434 case $undefs in
435 NOUNDEFS)
436 # Neither --host option nor undefs were present.
437 # Call config.guess.
438 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
439 if host_alias=`${config_shell} ${guesssys}`
440 then
441 # If the string we are going to use for
442 # the target is a prefix of the string
443 # we just guessed for the host, then
444 # assume we are running native, and force
445 # the same string for both target and host.
446 case $target_alias in
447 NOTARGET) ;;
449 if expr $host_alias : $target_alias >/dev/null
450 then
451 host_alias=$target_alias
454 esac
455 echo "Configuring for a ${host_alias} host." 1>&2
456 arguments="--host=$host_alias $arguments"
457 else
458 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
459 fatal=yes
463 host_alias=$undefs
464 arguments="--host=$host_alias $arguments"
465 undefs=NOUNDEFS
467 esac
468 esac
470 # Do defaulting for target. If --target option isn't present, default
471 # to undefs. If undefs isn't present, default to host.
472 case $target_alias in
473 NOTARGET)
474 case $undefs in
475 NOUNDEFS)
476 target_alias=$host_alias
479 target_alias=$undefs
480 arguments="--target=$target_alias $arguments"
482 esac
483 esac
485 *) ;;
486 esac
488 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
489 exec 1>&2
490 echo Usage: configure [OPTIONS] [HOST]
491 echo
492 echo Options: [defaults in brackets]
493 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
494 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
495 echo ' --help print this message [normal config]'
496 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
497 echo ' --host=HOST configure for HOST [determined via config.guess]'
498 echo ' --norecursion configure this directory only [recurse]'
499 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
500 echo ' --program-suffix=FOO append FOO to installed program names [""]'
501 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
502 echo ' --site=SITE configure with site-specific makefile for SITE'
503 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
504 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
505 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
506 echo ' --nfp configure for software floating point [hard float]'
507 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
508 echo ' --without-FOO package FOO is NOT available'
509 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
510 echo ' --disable-FOO do not include feature FOO'
511 echo
512 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
513 echo
514 if [ -r config.status ] ; then
515 cat config.status
518 exit 1
521 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
522 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
523 ## the sed command below emulates the dirname command
524 topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
527 # this is a hack. sun4 must always be a valid host alias or this will fail.
528 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
529 true
530 else
531 echo '***' cannot find config.sub. 1>&2
532 exit 1
535 touch config.junk
536 if ${config_shell} ${moveifchange} config.junk config.trash ; then
537 true
538 else
539 echo '***' cannot find move-if-change. 1>&2
540 exit 1
542 rm -f config.junk config.trash
544 case "${srcdir}" in
546 if [ -r configure.in ] ; then
547 srcdir=.
548 else
549 if [ -r ${progname}.in ] ; then
550 srcdir=`echo ${progname} | sed 's:/configure$::'`
551 else
552 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
553 exit 1
558 # Set srcdir to "." if that's what it is.
559 # This is important for multilib support.
560 if [ ! -d ${srcdir} ] ; then
561 echo "Invalid source directory ${srcdir}" >&2
562 exit 1
564 pwd=`pwd`
565 srcpwd=`cd ${srcdir} ; pwd`
566 if [ "${pwd}" = "${srcpwd}" ] ; then
567 srcdir=.
569 esac
571 ### warn about some conflicting configurations.
573 case "${srcdir}" in
574 ".") ;;
576 if [ -f ${srcdir}/config.status ] ; then
577 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
578 exit 1
580 esac
582 # default exec_prefix
583 case "${exec_prefixoption}" in
584 "") exec_prefix="\$(prefix)" ;;
585 *) ;;
586 esac
588 # Define the trigger file to make sure configure will re-run whenever
589 # the gcc version number changes.
590 if [ "${with_gcc_version_trigger+set}" = set ]; then
591 gcc_version_trigger="$with_gcc_version_trigger"
592 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
593 else
594 # If gcc's sources are available, define the trigger file.
595 if [ -f ${topsrcdir}/gcc/version.c ] ; then
596 gcc_version_trigger=${topsrcdir}/gcc/version.c
597 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
598 case "$arguments" in
599 *--with-gcc-version-trigger=$gcc_version_trigger* )
602 # Make sure configure.in knows about this.
603 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
605 esac
606 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
610 ### break up ${srcdir}/configure.in.
611 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
613 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
614 # Check for a directory that's been converted to use autoconf since
615 # it was last configured.
616 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
617 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
618 if [ -r ${srcdir}/configure ] ; then
619 echo '***' Running the local configure script. 1>&2
620 case "${cache_file}" in
621 "") cache_file_option= ;;
622 *) cache_file_option="--cache-file=${cache_file}" ;;
623 esac
624 srcdiroption="--srcdir=${srcdir}"
625 case "${build_alias}" in
626 "") buildopt= ;;
627 *) buildopt="--build=${build_alias}" ;;
628 esac
629 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
630 ${buildopt} --host=${host_alias} --target=${target_alias} \
631 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
632 ${srcdiroption} ${diroptions} \
633 ${program_prefixoption} ${program_suffixoption} \
634 ${program_transform_nameoption} ${site_option} \
635 ${withoptions} ${withoutoptions} \
636 ${enableoptions} ${disableoptions} ${floating_pointoption} \
637 ${cache_file_option} ${removing} ${other_options} ${redirect}
638 else
639 echo '***' There is no configure script present though. 1>&2
642 exit 1
644 *) ;;
645 esac
647 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
649 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
650 exit 1
652 *) ;;
653 esac
655 case "${TMPDIR}" in
656 "") TMPDIR=/tmp ; export TMPDIR ;;
657 *) ;;
658 esac
660 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
661 tmpfile=${TMPDIR}/cNf$$
662 # Note that under many versions of sh a trap handler for 0 will *override* any
663 # exit status you explicitly specify! At this point, the only non-error exit
664 # is at the end of the script; these actions are duplicated there, minus
665 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
666 # trap handler, or you'll lose.
667 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
669 # split ${srcdir}/configure.in into common, per-host, per-target,
670 # and post-target parts. Post-target is optional.
671 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
672 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
673 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
674 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
675 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
676 else
677 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
678 echo >${tmpfile}.pos
681 ### do common part of configure.in
683 # If the language specific compiler does not exist, but the "gcc" directory does,
684 # we will skip this directory; in this case the sub-directory's common part
685 # of configure.in will create a small shell script "skip-this-dir" containing
686 # commands to completely clean up any temporary or created files.
688 . ${tmpfile}.com
690 if test -f skip-this-dir; then
691 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
692 # and reset the trap handler.
693 trap 0
694 rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
695 # Execute the final clean-up actions
696 ${config_shell} skip-this-dir
697 # and stop configuring this directory.
698 exit 0
701 # some sanity checks on configure.in
702 case "${srctrigger}" in
704 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
705 exit 1
707 *) ;;
708 esac
710 case "${build_alias}" in
712 if result=`${config_shell} ${configsub} ${host_alias}` ; then
713 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
714 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
715 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
716 build=${build_cpu}-${build_vendor}-${build_os}
717 build_alias=${host_alias}
721 if result=`${config_shell} ${configsub} ${build_alias}` ; then
722 buildopt="--build=${build_alias}"
723 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
724 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
725 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
726 build=${build_cpu}-${build_vendor}-${build_os}
727 else
728 echo "Unrecognized build system name ${build_alias}." 1>&2
729 exit 1
732 esac
734 if result=`${config_shell} ${configsub} ${host_alias}` ; then
735 true
736 else
737 echo "Unrecognized host system name ${host_alias}." 1>&2
738 exit 1
740 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
741 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
742 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
743 host=${host_cpu}-${host_vendor}-${host_os}
745 . ${tmpfile}.hst
747 if result=`${config_shell} ${configsub} ${target_alias}` ; then
748 true
749 else
750 echo "Unrecognized target system name ${target_alias}." 1>&2
751 exit 1
753 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
754 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
755 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
756 target=${target_cpu}-${target_vendor}-${target_os}
758 . ${tmpfile}.tgt
760 # Find the source files, if location was not specified.
761 case "${srcdir}" in
763 srcdirdefaulted=1
764 srcdir=.
765 if [ ! -r ${srctrigger} ] ; then
766 srcdir=..
769 *) ;;
770 esac
772 if [ ! -r ${srcdir}/${srctrigger} ] ; then
773 case "${srcdirdefaulted}" in
774 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
775 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
776 esac
778 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
779 exit 1
782 # Some systems (e.g., one of the i386-aix systems the gas testers are
783 # using) don't handle "\$" correctly, so don't use it here.
784 tooldir='$(exec_prefix)'/${target_alias}
786 if [ "${host_alias}" != "${target_alias}" ] ; then
787 if [ "${program_prefixoption}" = "" ] ; then
788 if [ "${program_suffixoption}" = "" ] ; then
789 if [ "${program_transform_nameoption}" = "" ] ; then
790 program_prefix=${target_alias}- ;
796 # Merge program_prefix and program_suffix onto program_transform_name.
797 # (program_suffix used to use $, but it's hard to preserve $ through both
798 # make and sh.)
799 if [ "${program_suffix}" != "" ] ; then
800 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
803 if [ "${program_prefix}" != "" ] ; then
804 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
807 # If CC and CXX are not set in the environment, and the Makefile
808 # exists, try to extract them from it. This is to handle running
809 # ./config.status by hand.
810 if [ -z "${CC}" ] && [ -r Makefile ]; then
811 sed -n -e ':loop
812 /\\$/ N
813 s/\\\n//g
814 t loop
815 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
816 CC=`tail -1 Makefile.cc`
817 rm -f Makefile.cc
820 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
821 sed -n -e ':loop
822 /\\$/ N
823 s/\\\n//g
824 t loop
825 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
826 CFLAGS=`tail -1 Makefile.cc`
827 rm -f Makefile.cc
830 if [ -z "${CXX}" ] && [ -r Makefile ]; then
831 sed -n -e ':loop
832 /\\$/ N
833 s/\\\n//g
834 t loop
835 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
836 CXX=`tail -1 Makefile.cc`
837 rm -f Makefile.cc
840 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
841 sed -n -e ':loop
842 /\\$/ N
843 s/\\\n//g
844 t loop
845 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
846 CXXFLAGS=`tail -1 Makefile.cc`
847 rm -f Makefile.cc
850 # Generate a default definition for YACC. This is used if the makefile can't
851 # locate bison or byacc in objdir.
853 for prog in 'bison -y' byacc yacc
855 set dummy $prog; tmp=$2
856 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
857 for dir in $PATH; do
858 test -z "$dir" && dir=.
859 if test -f $dir/$tmp; then
860 DEFAULT_YACC="$prog"
861 break
863 done
864 IFS="$save_ifs"
866 test -n "$DEFAULT_YACC" && break
867 done
869 # Generate a default definition for M4. This is used if the makefile can't
870 # locate m4 in objdir.
872 for prog in gm4 gnum4 m4
874 set dummy $prog; tmp=$2
875 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
876 for dir in $PATH; do
877 test -z "$dir" && dir=.
878 if test -f $dir/$tmp; then
879 DEFAULT_M4="$prog"
880 break
882 done
883 IFS="$save_ifs"
885 test -n "$DEFAULT_M4" && break
886 done
888 # Generate a default definition for LEX. This is used if the makefile can't
889 # locate flex in objdir.
891 for prog in flex lex
893 set dummy $prog; tmp=$2
894 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
895 for dir in $PATH; do
896 test -z "$dir" && dir=.
897 if test -f $dir/$tmp; then
898 DEFAULT_LEX="$prog"
899 break
901 done
902 IFS="$save_ifs"
904 test -n "$DEFAULT_LEX" && break
905 done
907 if [ "${build}" != "${host}" ]; then
908 # If we are doing a Canadian Cross, in which the host and build systems
909 # are not the same, we set reasonable default values for the tools.
911 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
912 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
913 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
914 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
915 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
916 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
917 tools="${tools} OBJCOPY OBJDUMP"
919 for var in ${tools}; do
920 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
921 sed -n -e ':loop
922 /\\$/ N
923 s/\\\n//g
924 t loop
925 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
926 < Makefile > Makefile.v
927 t=`tail -1 Makefile.v`
928 if [ -n "${t}" ]; then
929 eval "${var}=\${t}"
931 rm -f Makefile.v
933 done
935 AR=${AR-${host_alias}-ar}
936 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
937 AS=${AS-${host_alias}-as}
938 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
939 BISON=${BISON-bison}
940 CC=${CC-${host_alias}-gcc}
941 CFLAGS=${CFLAGS-"-g -O2"}
942 CXX=${CXX-${host_alias}-c++}
943 CXXFLAGS=${CXXFLAGS-"-g -O2"}
944 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
945 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
946 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
947 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
948 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
949 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
950 HOST_PREFIX=${build_alias}-
951 HOST_PREFIX_1=${build_alias}-
952 LD=${LD-${host_alias}-ld}
953 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
954 MAKEINFO=${MAKEINFO-makeinfo}
955 NM=${NM-${host_alias}-nm}
956 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
957 RANLIB=${RANLIB-${host_alias}-ranlib}
958 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
959 WINDRES=${WINDRES-${host_alias}-windres}
960 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
961 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
962 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
964 if [ -z "${YACC}" ]; then
965 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
966 for dir in $PATH; do
967 test -z "$dir" && dir=.
968 if test -f $dir/bison; then
969 YACC="bison -y"
970 break
972 if test -f $dir/byacc; then
973 YACC=byacc
974 break
976 if test -f $dir/yacc; then
977 YACC=yacc
978 break
980 done
981 IFS="$save_ifs"
982 if [ -z "${YACC}" ]; then
983 YACC="bison -y"
987 if [ -z "${LEX}" ]; then
988 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
989 for dir in $PATH; do
990 test -z "$dir" && dir=.
991 if test -f $dir/flex; then
992 LEX=flex
993 break
995 if test -f $dir/lex; then
996 LEX=lex
997 break
999 done
1000 IFS="$save_ifs"
1001 LEX=${LEX-flex}
1004 # Export variables which autoconf might try to set.
1005 export AS
1006 export AR
1007 export CC_FOR_BUILD
1008 export DLLTOOL
1009 export LD
1010 export NM
1011 export RANLIB
1012 export WINDRES
1013 export OBJCOPY
1014 export OBJDUMP
1015 else
1016 # If CC is still not set, try to get gcc.
1017 if [ -z "${CC}" ]; then
1018 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1019 for dir in $PATH; do
1020 test -z "$dir" && dir=.
1021 if test -f $dir/gcc; then
1022 CC="gcc"
1023 echo 'void f(){}' > conftest.c
1024 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1025 CFLAGS=${CFLAGS-"-g -O2"}
1026 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1027 else
1028 CFLAGS=${CFLAGS-"-O2"}
1029 CXXFLAGS=${CXXFLAGS-"-O2"}
1031 rm -f conftest*
1032 break
1034 done
1035 IFS="$save_ifs"
1036 CC=${CC-cc}
1037 else
1038 if test -z "${CFLAGS}"; then
1039 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1040 # is set to a version of gcc.
1041 case "${CC}" in
1042 *gcc)
1043 echo 'void f(){}' > conftest.c
1044 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1045 CFLAGS=${CFLAGS-"-g -O2"}
1046 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1047 else
1048 CFLAGS=${CFLAGS-"-O2"}
1049 CXXFLAGS=${CXXFLAGS-"-O2"}
1051 rm -f conftest*
1053 esac
1057 CXX=${CXX-"c++"}
1058 CFLAGS=${CFLAGS-"-g"}
1059 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1062 export CC
1063 export CXX
1064 export CFLAGS
1065 export CXXFLAGS
1067 # FIXME: This should be in configure.in, not configure
1068 case "$host" in
1069 *go32*)
1070 enable_gdbtk=no ;;
1071 *msdosdjgpp*)
1072 enable_gdbtk=no ;;
1073 esac
1075 # FIXME: This should be in configure.in, not configure
1076 # Determine whether gdb needs tk/tcl or not.
1077 if [ "$enable_gdbtk" != "no" ]; then
1078 GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
1079 else
1080 GDB_TK=""
1083 for subdir in . ${subdirs} ; do
1085 # ${subdir} is relative path from . to the directory we're currently
1086 # configuring.
1087 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
1088 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
1090 ### figure out what to do with srcdir
1091 case "${srcdir}" in
1092 ".") # no -srcdir option. We're building in place.
1093 makesrcdir=. ;;
1094 /*) # absolute path
1095 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1097 *) # otherwise relative
1098 case "${subdir}" in
1099 .) makesrcdir=${srcdir} ;;
1100 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1101 esac
1103 esac
1105 if [ "${subdir}/" != "./" ] ; then
1106 Makefile=${subdir}/Makefile
1109 if [ ! -d ${subdir} ] ; then
1110 if mkdir ${subdir} ; then
1111 true
1112 else
1113 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1114 exit 1
1118 case "${removing}" in
1120 case "${subdir}" in
1121 .) ;;
1122 *) eval echo Building in ${subdir} ${redirect} ;;
1123 esac
1125 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1126 # Set up the list of links to be made.
1127 # ${links} is the list of link names, and ${files} is the list of names to link to.
1129 # Make the links.
1130 configlinks="${links}"
1131 if [ -r ${subdir}/config.status ] ; then
1132 mv -f ${subdir}/config.status ${subdir}/config.back
1134 while [ -n "${files}" ] ; do
1135 # set file to car of files, files to cdr of files
1136 set ${files}; file=$1; shift; files=$*
1137 set ${links}; link=$1; shift; links=$*
1139 if [ ! -r ${srcdir}/${file} ] ; then
1140 if [ ! -r ${file} ] ; then
1142 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1143 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1144 exit 1
1145 else
1146 srcfile=${file}
1148 else
1149 srcfile=${srcdir}/${file}
1152 ${remove} -f ${link}
1153 # Make a symlink if possible, otherwise try a hard link
1154 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1155 true
1156 else
1157 # We need to re-remove the file because Lynx leaves a
1158 # very strange directory there when it fails an NFS symlink.
1159 ${remove} -r -f ${link}
1160 ${hard_link} ${srcfile} ${link}
1162 if [ ! -r ${link} ] ; then
1163 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1164 exit 1
1167 echo "Linked \"${link}\" to \"${srcfile}\"."
1168 done
1170 # Create a .gdbinit file which runs the one in srcdir
1171 # and tells GDB to look there for source files.
1173 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1174 case ${srcdir} in
1175 .) ;;
1176 *) cat > ${subdir}/.gdbinit <<EOF
1177 # ${NO_EDIT}
1178 dir ${makesrcdir}
1179 dir .
1180 source ${makesrcdir}/.gdbinit
1183 esac
1186 # Install a makefile, and make it set VPATH
1187 # if necessary so that the sources are found.
1188 # Also change its value of srcdir.
1189 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1190 # been somewhat optimized and is perhaps a bit twisty.
1192 # code is order so as to try to sed the smallest input files we know.
1193 # so do these separately because I don't trust the order of sed -e expressions.
1195 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1196 # package macros, target, host, site, and package rules.
1198 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1200 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1201 rm -f ${subdir}/${Makefile}.tem
1202 case "${package_makefile_rules_frag}" in
1203 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1205 if [ ! -f ${package_makefile_rules_frag} ] ; then
1206 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1208 if [ -f ${package_makefile_rules_frag} ] ; then
1209 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1210 else
1211 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1212 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1213 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1215 esac
1216 # working copy now in ${Makefile}.tem
1218 # Conditionalize for this site.
1219 rm -f ${Makefile}
1220 case "${site}" in
1221 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1223 site_makefile_frag=${srcdir}/config/ms-${site}
1225 if [ -f ${site_makefile_frag} ] ; then
1226 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1227 > ${Makefile}
1228 else
1229 mv ${subdir}/Makefile.tem ${Makefile}
1230 site_makefile_frag=
1233 esac
1234 # working copy now in ${Makefile}
1236 # Conditionalize the makefile for this host.
1237 rm -f ${subdir}/Makefile.tem
1238 case "${host_makefile_frag}" in
1239 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1241 if [ ! -f ${host_makefile_frag} ] ; then
1242 host_makefile_frag=${srcdir}/${host_makefile_frag}
1244 if [ -f ${host_makefile_frag} ] ; then
1245 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1246 else
1247 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1248 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1249 mv ${Makefile} ${subdir}/Makefile.tem
1251 esac
1252 # working copy now in ${subdir)/Makefile.tem
1254 # Conditionalize the makefile for this target.
1255 rm -f ${Makefile}
1256 case "${target_makefile_frag}" in
1257 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1259 if [ ! -f ${target_makefile_frag} ] ; then
1260 target_makefile_frag=${srcdir}/${target_makefile_frag}
1262 if [ -f ${target_makefile_frag} ] ; then
1263 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1264 else
1265 mv ${subdir}/Makefile.tem ${Makefile}
1266 target_makefile_frag=
1269 esac
1270 # working copy now in ${Makefile}
1272 # Emit the default values of this package's macros.
1273 rm -f ${subdir}/Makefile.tem
1274 case "${package_makefile_frag}" in
1275 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1277 if [ ! -f ${package_makefile_frag} ] ; then
1278 package_makefile_frag=${srcdir}/${package_makefile_frag}
1280 if [ -f ${package_makefile_frag} ] ; then
1281 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1282 else
1283 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1284 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1285 mv ${Makefile} ${subdir}/Makefile.tem
1287 esac
1288 # real copy now in ${subdir}/Makefile.tem
1290 # prepend warning about editting, and a bunch of variables.
1291 rm -f ${Makefile}
1292 cat > ${Makefile} <<EOF
1293 # ${NO_EDIT}
1294 VPATH = ${makesrcdir}
1295 links = ${configlinks}
1296 host_alias = ${host_alias}
1297 host_cpu = ${host_cpu}
1298 host_vendor = ${host_vendor}
1299 host_os = ${host_os}
1300 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1301 target_alias = ${target_alias}
1302 target_cpu = ${target_cpu}
1303 target_vendor = ${target_vendor}
1304 target_os = ${target_os}
1305 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1307 case "${build}" in
1308 "") ;;
1309 *) cat >> ${Makefile} << EOF
1310 build_alias = ${build_alias}
1311 build_cpu = ${build_cpu}
1312 build_vendor = ${build_vendor}
1313 build_os = ${build_os}
1314 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1316 esac
1318 case "${package_makefile_frag}" in
1319 "") ;;
1320 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1321 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1322 esac
1324 case "${target_makefile_frag}" in
1325 "") ;;
1326 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1327 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1328 esac
1330 case "${host_makefile_frag}" in
1331 "") ;;
1332 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1333 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1334 esac
1336 if [ "${site_makefile_frag}" != "" ] ; then
1337 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1340 echo enable_shared = ${enable_shared} >> ${Makefile}
1341 echo enable_threads = ${enable_threads} >> ${Makefile}
1342 # record if we want to rumtime library stuff installed in libsubdir.
1343 if test -z "${enable_version_specific_runtime_libs}"; then
1344 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1345 else
1346 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1349 # Emit a macro which describes the file containing gcc's
1350 # version number.
1351 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1352 # And emit a macro defining gcc's version number.
1353 echo gcc_version = ${gcc_version} >> ${Makefile}
1355 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1356 # remove any form feeds.
1357 if [ -z "${subdirs}" ]; then
1358 rm -f ${subdir}/Makefile.tm2
1359 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1360 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1361 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1362 rm -f ${subdir}/Makefile.tem
1363 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1365 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1366 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1367 -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
1368 -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
1369 -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
1370 -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
1371 -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
1372 -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
1373 -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
1374 -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
1375 -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
1376 -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
1377 -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
1378 -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
1379 -e "/^CC[ ]*=/{
1380 :loop1
1381 /\\\\$/ N
1382 s/\\\\\\n//g
1383 t loop1
1384 s%^CC[ ]*=.*$%CC = ${CC}%
1385 }" \
1386 -e "/^CXX[ ]*=/{
1387 :loop2
1388 /\\\\$/ N
1389 s/\\\\\\n//g
1390 t loop2
1391 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1392 }" \
1393 -e "/^CFLAGS[ ]*=/{
1394 :loop3
1395 /\\\\$/ N
1396 s/\\\\\\n//g
1397 t loop3
1398 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1399 }" \
1400 -e "/^CXXFLAGS[ ]*=/{
1401 :loop4
1402 /\\\\$/ N
1403 s/\\\\\\n//g
1404 t loop4
1405 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1406 }" \
1407 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
1408 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1409 -e "s/\f//" \
1410 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1411 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1412 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1413 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1414 -e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \
1415 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1416 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1417 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1418 ${subdir}/Makefile.tem >> ${Makefile}
1420 sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
1421 mv -f ${Makefile}.tem ${Makefile}
1423 # If this is a Canadian Cross, preset the values of many more
1424 # tools.
1425 if [ "${build}" != "${host}" ]; then
1426 for var in ${tools}; do
1427 eval val=\$${var}
1428 sed -e "/^${var}[ ]*=/{
1429 :loop1
1430 /\\\\$/ N
1431 /\\\\$/ b loop1
1432 s/\\\\\\n//g
1433 s%^${var}[ ]*=.*$%${var} = ${val}%
1434 }" ${Makefile} > ${Makefile}.tem
1435 mv -f ${Makefile}.tem ${Makefile}
1436 done
1439 # final copy now in ${Makefile}
1441 else
1442 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1445 rm -f ${subdir}/Makefile.tem
1447 case "${host_makefile_frag}" in
1448 "") using= ;;
1449 *) using="and \"${host_makefile_frag}\"" ;;
1450 esac
1452 case "${target_makefile_frag}" in
1453 "") ;;
1454 *) using="${using} and \"${target_makefile_frag}\"" ;;
1455 esac
1457 case "${site_makefile_frag}" in
1458 "") ;;
1459 *) using="${using} and \"${site_makefile_frag}\"" ;;
1460 esac
1462 newusing=`echo "${using}" | sed 's/and/using/'`
1463 using=${newusing}
1464 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1466 . ${tmpfile}.pos
1468 # describe the chosen configuration in config.status.
1469 # Make that file a shellscript which will reestablish
1470 # the same configuration. Used in Makefiles to rebuild
1471 # Makefiles.
1473 case "${norecursion}" in
1474 "") arguments="${arguments} --norecursion" ;;
1475 *) ;;
1476 esac
1478 if [ ${subdir} = . ] ; then
1479 echo "#!/bin/sh
1480 # ${NO_EDIT}
1481 # This directory was configured as follows:
1482 ${progname}" ${arguments} "
1483 # ${using}" > ${subdir}/config.new
1484 else
1485 echo "#!/bin/sh
1486 # ${NO_EDIT}
1487 # This directory was configured as follows:
1488 cd ${invsubdir}
1489 ${progname}" ${arguments} "
1490 # ${using}" > ${subdir}/config.new
1492 chmod a+x ${subdir}/config.new
1493 if [ -r ${subdir}/config.back ] ; then
1494 mv -f ${subdir}/config.back ${subdir}/config.status
1496 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1499 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1500 esac
1501 done
1503 # If there are subdirectories, then recur.
1504 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1505 for configdir in ${configdirs} ${extraconfigdirs} ; do
1507 # If configdir contains ',' it is
1508 # srcdir,builddir,target_alias
1509 # These come from extraconfigdirs.
1510 case ${configdir} in
1511 *,*)
1512 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1515 cfg_dir=${configdir}
1516 bld_dir=${configdir}
1517 tgt_alias=${target_alias}
1519 esac
1521 if [ -d ${srcdir}/${cfg_dir} ] ; then
1522 eval echo Configuring ${configdir}... ${redirect}
1523 case "${srcdir}" in
1524 ".") ;;
1526 if [ ! -d ./${bld_dir} ] ; then
1527 if mkdir ./${bld_dir} ; then
1528 true
1529 else
1530 echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
1531 exit 1
1535 esac
1537 POPDIR=${PWD=`pwd`}
1538 cd ${bld_dir}
1540 ### figure out what to do with srcdir
1541 case "${srcdir}" in
1542 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1543 /*) # absolute path
1544 newsrcdir=${srcdir}/${cfg_dir}
1545 srcdiroption="--srcdir=${newsrcdir}"
1547 ?:*) # absolute path on win32
1548 newsrcdir=${srcdir}/${cfg_dir}
1549 srcdiroption="--srcdir=${newsrcdir}"
1551 *) # otherwise relative
1552 newsrcdir=../${srcdir}/${cfg_dir}
1553 srcdiroption="--srcdir=${newsrcdir}"
1555 esac
1557 # Handle --cache-file=../XXX
1558 case "${cache_file}" in
1559 "") # empty
1561 /*) # absolute path
1562 cache_file_option="--cache-file=${cache_file}"
1564 ?:*) # absolute path on win32
1565 cache_file_option="--cache-file=${cache_file}"
1567 *) # relative path
1568 cache_file_option="--cache-file=../${cache_file}"
1570 esac
1572 ### check for guested configure, otherwise fix possibly relative progname
1573 if [ -f ${newsrcdir}/configure ] ; then
1574 recprog=${newsrcdir}/configure
1575 elif [ -f ${newsrcdir}/configure.in ] ; then
1576 case "${progname}" in
1577 /*) recprog=${progname} ;;
1578 ?:*) recprog=${progname} ;;
1579 *) recprog=../${progname} ;;
1580 esac
1581 else
1582 eval echo No configuration information in ${cfg_dir} ${redirect}
1583 recprog=
1586 ### The recursion line is here.
1587 if [ ! -z "${recprog}" ] ; then
1588 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1589 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1590 ${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
1591 true
1592 else
1593 echo Configure in `pwd` failed, exiting. 1>&2
1594 exit 1
1598 cd ${POPDIR}
1600 done
1603 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1604 # and reset the trap handler.
1605 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1606 trap 0
1608 exit 0
1611 # Local Variables:
1612 # fill-column: 131
1613 # End:
1616 # end of configure