Daily bump.
[official-gcc.git] / configure
blob0debecf173feaeafbbb7bb0a9a3d2b6cf9e21a0f
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, 2000, 2001
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 enable_libstdcxx_v3=yes
59 exec_prefix=
60 exec_prefixoption=
61 fatal=
62 floating_point=default
63 gas=default
64 gcc_version=
65 gcc_version_trigger=
66 host_alias=NOHOST
67 host_makefile_frag=
68 moveifchange=
69 norecursion=
70 other_options=
71 package_makefile_frag=
72 package_makefile_rules_frag=
73 prefix=/usr/local
74 progname=
75 program_prefix=
76 program_prefixoption=
77 program_suffix=
78 program_suffixoption=
79 program_transform_name=
80 program_transform_nameoption=
81 redirect=
82 removing=
83 site=
84 site_makefile_frag=
85 site_option=
86 srcdir=
87 srctrigger=
88 subdirs=
89 target_alias=NOTARGET
90 target_makefile_frag=
91 undefs=NOUNDEFS
92 version="$Revision: 1.40.6.2 $"
93 x11=default
94 bindir='${exec_prefix}/bin'
95 sbindir='${exec_prefix}/sbin'
96 libexecdir='${exec_prefix}/libexec'
97 datadir='${prefix}/share'
98 sysconfdir='${prefix}/etc'
99 sharedstatedir='${prefix}/com'
100 localstatedir='${prefix}/var'
101 libdir='${exec_prefix}/lib'
102 includedir='${prefix}/include'
103 oldincludedir='/usr/include'
104 infodir='${prefix}/info'
105 mandir='${prefix}/man'
107 ### we might need to use some other shell than /bin/sh for running subshells
109 ### If we are on Windows, search for the shell. This will permit people
110 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
111 ### without also having to set CONFIG_SHELL. This code will work when
112 ### using bash, which sets OSTYPE.
113 case "${OSTYPE}" in
114 *win32*)
115 if [ x${CONFIG_SHELL} = x ]; then
116 if [ ! -f /bin/sh ]; then
117 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
118 CONFIG_SHELL=${SHELL}
119 export CONFIG_SHELL
120 else
121 for prog in sh sh.exe bash bash.exe; do
122 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
123 for dir in $PATH; do
124 test -z "$dir" && dir=.
125 if test -f $dir/$prog; then
126 CONFIG_SHELL=$dir/$prog
127 export CONFIG_SHELL
128 break
130 done
131 IFS="$save_ifs"
132 test -n "${CONFIG_SHELL}" && break
133 done
138 esac
140 config_shell=${CONFIG_SHELL-/bin/sh}
142 NO_EDIT="This file was generated automatically by configure. Do not edit."
144 ## this is a little touchy and won't always work, but...
146 ## if the argv[0] starts with a slash then it is an absolute name that can (and
147 ## must) be used as is.
149 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
150 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
153 progname=$0
154 # if PWD already has a value, it is probably wrong.
155 if [ -n "$PWD" ]; then PWD=`pwd`; fi
157 case "${progname}" in
158 /* | [A-Za-z]:[\\/]* ) ;;
159 */*) ;;
161 PATH=$PATH:${PWD=`pwd`} ; export PATH
163 esac
165 # Export original configure arguments for use by sub-configures.
166 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
167 export TOPLEVEL_CONFIGURE_ARGUMENTS
169 # Loop over all args
171 while :
174 # Break out if there are no more args
175 case $# in
177 break
179 esac
181 # Get the first arg, and shuffle
182 option=$1
183 shift
185 # Make all options have two hyphens
186 orig_option=$option # Save original for error messages
187 case $option in
188 --*) ;;
189 -*) option=-$option ;;
190 esac
192 # Split out the argument for options that take them
193 case $option in
194 --*=*)
195 optarg=`echo $option | sed -e 's/^[^=]*=//'`
196 arguments="$arguments $option"
198 # These options have mandatory values. Since we didn't find an = sign,
199 # the value must be in the next argument
200 --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*)
201 optarg=$1
202 shift
203 arguments="$arguments $option=$optarg"
205 --v)
206 arguments="$arguments -v"
208 --*)
209 arguments="$arguments $option"
211 esac
213 # Now, process the options
214 case $option in
216 --bi*)
217 bindir=$optarg
218 diroptions="$diroptions --bindir=$optarg"
220 --build* | --bu*)
221 case "$build_alias" in
222 "") build_alias=$optarg ;;
223 *) echo '***' Can only configure for one build machine at a time. 1>&2
224 fatal=yes
226 esac
228 --cache*)
229 cache_file=$optarg
231 --da*)
232 datadir=$optarg
233 diroptions="$diroptions --datadir=$optarg"
235 --disable-*)
236 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
237 eval $enableopt=no
238 disableoptions="$disableoptions $option"
240 --enable-*)
241 case "$option" in
242 *=*) ;;
243 *) optarg=yes ;;
244 esac
246 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
247 eval "$enableopt=\$optarg"
248 enableoptions="$enableoptions '$option'"
250 --exec-prefix* | --ex*)
251 exec_prefix=$optarg
252 exec_prefixoption="--exec-prefix=$optarg"
254 --gas | --g*)
255 gas=yes
257 --help | --he*)
258 fatal=yes
260 --host* | --ho*)
261 case $host_alias in
262 NOHOST) host_alias=$optarg ;;
263 *) echo '***' Can only configure for one host at a time. 1>&2
264 fatal=yes
266 esac
268 --inc*)
269 includedir=$optarg
270 diroptions="$diroptions --includedir=$optarg"
272 --inf*)
273 infodir=$optarg
274 diroptions="$diroptions --infodir=$optarg"
276 --libd*)
277 libdir=$optarg
278 diroptions="$diroptions --libdir=$optarg"
280 --libe*)
281 libexecdir=$optarg
282 diroptions="$diroptions --libexecdir=$optarg"
284 --lo*)
285 localstatedir=$optarg
286 diroptions="$diroptions --localstatedir=$optarg"
288 --ma*)
289 mandir=$optarg
290 diroptions="$diroptions --mandir=$optarg"
292 --nfp | --nf*)
293 floating_point=no
294 floating_pointoption="--nfp"
296 --norecursion | --no*)
297 norecursion=yes
299 --ol*)
300 oldincludedir=$optarg
301 diroptions="$diroptions --oldincludedir=$optarg"
303 --prefix* | --pre*)
304 prefix=$optarg
305 prefixoption="--prefix=$optarg"
307 --program-prefix* | --program-p*)
308 program_prefix=$optarg
309 program_prefixoption="--program-prefix=$optarg"
311 --program-suffix* | --program-s*)
312 program_suffix=$optarg
313 program_suffixoption="--program-suffix=$optarg"
315 --program-transform-name* | --program-t*)
316 # Double any backslashes or dollar signs in the argument
317 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
318 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
320 --rm)
321 removing=--rm
323 --sb*)
324 sbindir=$optarg
325 diroptions="$diroptions --sbindir=$optarg"
327 --sh*)
328 sharedstatedir=$optarg
329 diroptions="$diroptions --sharedstatedir=$optarg"
331 --silent | --sil* | --quiet | --q*)
332 redirect=">/dev/null"
333 verbose=--silent
335 --site* | --sit*)
336 site=$optarg
337 site_option="--site=$optarg"
339 --srcdir*/ | --sr*/)
340 # Remove trailing slashes. Otherwise, when the file name gets
341 # bolted into an object file as debug info, it has two slashes
342 # in it. Ordinarily this is ok, but emacs takes double slash
343 # to mean "forget the first part".
344 srcdir=`echo $optarg | sed -e 's:/$::'`
346 --srcdir* | --sr*)
347 srcdir=$optarg
349 --sy*)
350 sysconfdir=$optarg
351 diroptions="$diroptions --sysconfdir=$optarg"
353 --target* | --ta*)
354 case $target_alias in
355 NOTARGET) target_alias=$optarg ;;
356 *) echo '***' Can only configure for one target at a time. 1>&2
357 fatal=yes
359 esac
361 --tmpdir* | --tm*)
362 TMPDIR=$optarg
363 tmpdiroption="--tmpdir=$optarg"
365 --verbose | --v | --verb*)
366 redirect=
367 verbose=--verbose
369 --version | --V | --vers*)
370 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
371 exit 0
373 --with-*)
374 case "$option" in
375 *=*) ;;
376 *) optarg=yes ;;
377 esac
379 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
380 eval $withopt="\$optarg"
381 withoptions="$withoptions $option"
383 --without-*)
384 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
385 eval $withopt=no
386 withoutoptions="$withoutoptions $option"
388 --x) with_x=yes
389 withoptions="$withoptions --with-x"
391 --x-i* | --x-l*) other_options="$other_options $orig_option"
393 --*)
394 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
395 exit 1
398 case $undefs in
399 NOUNDEFS) undefs=$option ;;
400 *) echo '***' Can only configure for one host and one target at a time. 1>&2
401 fatal=yes
403 esac
405 esac
406 done
408 # process host and target
410 # Do some error checking and defaulting for the host and target type.
411 # The inputs are:
412 # configure --host=HOST --target=TARGET UNDEFS
414 # The rules are:
415 # 1. You aren't allowed to specify --host, --target, and undefs at the
416 # same time.
417 # 2. Host defaults to undefs.
418 # 3. If undefs is not specified, then host defaults to the current host,
419 # as determined by config.guess.
420 # 4. Target defaults to undefs.
421 # 5. If undefs is not specified, then target defaults to host.
423 case "${fatal}" in
425 # Make sure that host, target & undefs aren't all specified at the
426 # same time.
427 case $host_alias---$target_alias---$undefs in
428 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
430 *) echo '***' Can only configure for one host and one target at a time. 1>&2
431 fatal=yes
432 break 2
434 esac
436 # Now, do defaulting for host.
437 case $host_alias in
438 NOHOST)
439 case $undefs in
440 NOUNDEFS)
441 # Neither --host option nor undefs were present.
442 # Call config.guess.
443 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
444 if host_alias=`${config_shell} ${guesssys}`
445 then
446 # If the string we are going to use for
447 # the target is a prefix of the string
448 # we just guessed for the host, then
449 # assume we are running native, and force
450 # the same string for both target and host.
451 case $target_alias in
452 NOTARGET) ;;
454 if expr $host_alias : $target_alias >/dev/null
455 then
456 host_alias=$target_alias
459 esac
460 echo "Configuring for a ${host_alias} host."
461 arguments="--host=$host_alias $arguments"
462 else
463 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
464 fatal=yes
468 host_alias=$undefs
469 arguments="--host=$host_alias $arguments"
470 undefs=NOUNDEFS
472 esac
473 esac
475 # Do defaulting for target. If --target option isn't present, default
476 # to undefs. If undefs isn't present, default to host.
477 case $target_alias in
478 NOTARGET)
479 case $undefs in
480 NOUNDEFS)
481 target_alias=$host_alias
484 target_alias=$undefs
485 arguments="--target=$target_alias $arguments"
487 esac
488 esac
490 *) ;;
491 esac
493 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
494 exec 1>&2
495 echo Usage: configure [OPTIONS] [HOST]
496 echo
497 echo Options: [defaults in brackets]
498 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
499 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
500 echo ' --help print this message [normal config]'
501 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
502 echo ' --host=HOST configure for HOST [determined via config.guess]'
503 echo ' --norecursion configure this directory only [recurse]'
504 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
505 echo ' --program-suffix=FOO append FOO to installed program names [""]'
506 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
507 echo ' --site=SITE configure with site-specific makefile for SITE'
508 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
509 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
510 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
511 echo ' --nfp configure for software floating point [hard float]'
512 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
513 echo ' --without-FOO package FOO is NOT available'
514 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
515 echo ' --disable-FOO do not include feature FOO'
516 echo
517 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
518 echo
519 if [ -r config.status ] ; then
520 cat config.status
523 exit 1
526 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
527 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
528 ## the sed command below emulates the dirname command
529 topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
532 # this is a hack. sun4 must always be a valid host alias or this will fail.
533 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
534 true
535 else
536 echo '***' cannot find config.sub. 1>&2
537 exit 1
540 touch config.junk
541 if ${config_shell} ${moveifchange} config.junk config.trash ; then
542 true
543 else
544 echo '***' cannot find move-if-change. 1>&2
545 exit 1
547 rm -f config.junk config.trash
549 case "${srcdir}" in
551 if [ -r configure.in ] ; then
552 srcdir=.
553 else
554 if [ -r ${progname}.in ] ; then
555 srcdir=`echo ${progname} | sed 's:/configure$::'`
556 else
557 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
558 exit 1
563 # Set srcdir to "." if that's what it is.
564 # This is important for multilib support.
565 if [ ! -d ${srcdir} ] ; then
566 echo "Invalid source directory ${srcdir}" >&2
567 exit 1
569 pwd=`pwd`
570 srcpwd=`cd ${srcdir} ; pwd`
571 if [ "${pwd}" = "${srcpwd}" ] ; then
572 srcdir=.
574 esac
576 # If it's an in-source build, make a directory and configure there instead.
577 # Name the build directory after the host for clarity's sake. Remember that
578 # name for the redirecting makefile's use, since the makefile shouldn't have
579 # to duplicate the work of figuring out host_alias.
581 # Also remember if this is a native build or not. Variations on "or not"
582 # are performed later in this script so we can't test them here. In
583 # particular, build_alias will still be empty unless specified by the user,
584 # so do not try in-source builds when making a host-x-host compiler.
585 # For a cross compile, "make all" = "all". Otherwise, "all" = "bootstrap".
586 if test "${srcdir}" = "." ; then
587 builddir=${host_alias}
588 if test ! -d ${builddir}; then
589 mkdir ${builddir} || exit 1
591 if test ${host_alias} != ${target_alias}; then
592 t=all
593 else
594 t=bootstrap
596 # stamp-builddir is too long for #$&!*@ 8.3 filesystems
597 echo "builddir=${builddir}" > s-buildd
598 echo "defaulttarget=$t" >> s-buildd
599 cd ${builddir}
600 exec ${config_shell} ../configure $arguments
603 ### warn about some conflicting configurations.
605 case "${srcdir}" in
606 ".") ;;
608 if [ -f ${srcdir}/config.status ] ; then
609 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
610 exit 1
612 esac
614 # default exec_prefix
615 case "${exec_prefixoption}" in
616 "") exec_prefix="\$(prefix)" ;;
617 *) ;;
618 esac
620 # Define the trigger file to make sure configure will re-run whenever
621 # the gcc version number changes.
622 if [ "${with_gcc_version_trigger+set}" = set ]; then
623 gcc_version_trigger="$with_gcc_version_trigger"
624 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
625 else
626 # If gcc's sources are available, define the trigger file.
627 if [ -f ${topsrcdir}/gcc/version.c ] ; then
628 gcc_version_trigger=${topsrcdir}/gcc/version.c
629 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
630 case "$arguments" in
631 *--with-gcc-version-trigger=$gcc_version_trigger* )
634 # Make sure configure.in knows about this.
635 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
637 esac
638 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
642 ### break up ${srcdir}/configure.in.
643 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
645 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
646 # Check for a directory that's been converted to use autoconf since
647 # it was last configured.
648 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
649 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
650 if [ -r ${srcdir}/configure ] ; then
651 echo '***' Running the local configure script. 1>&2
652 case "${cache_file}" in
653 "") cache_file_option= ;;
654 *) cache_file_option="--cache-file=${cache_file}" ;;
655 esac
656 srcdiroption="--srcdir=${srcdir}"
657 case "${build_alias}" in
658 "") buildopt= ;;
659 *) buildopt="--build=${build_alias}" ;;
660 esac
661 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
662 ${buildopt} --host=${host_alias} --target=${target_alias} \
663 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
664 ${srcdiroption} ${diroptions} \
665 ${program_prefixoption} ${program_suffixoption} \
666 ${program_transform_nameoption} ${site_option} \
667 ${withoptions} ${withoutoptions} \
668 ${enableoptions} ${disableoptions} ${floating_pointoption} \
669 ${cache_file_option} ${removing} ${other_options} ${redirect}
670 else
671 echo '***' There is no configure script present though. 1>&2
674 exit 1
676 *) ;;
677 esac
679 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
681 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
682 exit 1
684 *) ;;
685 esac
687 case "${TMPDIR}" in
688 "") TMPDIR=/tmp ; export TMPDIR ;;
689 *) ;;
690 esac
692 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
693 tmpdir=${TMPDIR}/cNf$$
694 mkdir ${tmpdir} || exit 1
695 tmpfile=${tmpdir}/cNf$$
696 # Note that under many versions of sh a trap handler for 0 will *override* any
697 # exit status you explicitly specify! At this point, the only non-error exit
698 # is at the end of the script; these actions are duplicated there, minus
699 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
700 # trap handler, or you'll lose.
701 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
703 # split ${srcdir}/configure.in into common, per-host, per-target,
704 # and post-target parts. Post-target is optional.
705 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
706 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
707 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
708 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
709 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
710 else
711 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
712 echo >${tmpfile}.pos
715 ### do common part of configure.in
717 # If the language specific compiler does not exist, but the "gcc" directory does,
718 # we will skip this directory; in this case the sub-directory's common part
719 # of configure.in will create a small shell script "skip-this-dir" containing
720 # commands to completely clean up any temporary or created files.
722 . ${tmpfile}.com
724 if test -f skip-this-dir; then
725 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
726 # and reset the trap handler.
727 trap 0
728 rm -rf Makefile* ${tmpdir}
729 # Execute the final clean-up actions
730 ${config_shell} skip-this-dir
731 # and stop configuring this directory.
732 exit 0
735 # some sanity checks on configure.in
736 case "${srctrigger}" in
738 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
739 exit 1
741 *) ;;
742 esac
744 case "${build_alias}" in
746 if result=`${config_shell} ${configsub} ${host_alias}` ; then
747 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
748 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
749 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
750 build=${build_cpu}-${build_vendor}-${build_os}
751 build_alias=${host_alias}
755 if result=`${config_shell} ${configsub} ${build_alias}` ; then
756 buildopt="--build=${build_alias}"
757 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
758 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
759 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
760 build=${build_cpu}-${build_vendor}-${build_os}
761 else
762 echo "Unrecognized build system name ${build_alias}." 1>&2
763 exit 1
766 esac
768 if result=`${config_shell} ${configsub} ${host_alias}` ; then
769 true
770 else
771 echo "Unrecognized host system name ${host_alias}." 1>&2
772 exit 1
774 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
775 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
776 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
777 host=${host_cpu}-${host_vendor}-${host_os}
779 . ${tmpfile}.hst
781 if result=`${config_shell} ${configsub} ${target_alias}` ; then
782 true
783 else
784 echo "Unrecognized target system name ${target_alias}." 1>&2
785 exit 1
787 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
788 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
789 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
790 target=${target_cpu}-${target_vendor}-${target_os}
792 . ${tmpfile}.tgt
794 # Find the source files, if location was not specified.
795 case "${srcdir}" in
797 srcdirdefaulted=1
798 srcdir=.
799 if [ ! -r ${srctrigger} ] ; then
800 srcdir=..
803 *) ;;
804 esac
806 if [ ! -r ${srcdir}/${srctrigger} ] ; then
807 case "${srcdirdefaulted}" in
808 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
809 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
810 esac
812 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
813 exit 1
816 # Some systems (e.g., one of the i386-aix systems the gas testers are
817 # using) don't handle "\$" correctly, so don't use it here.
818 tooldir='$(exec_prefix)'/${target_alias}
820 if [ "${host_alias}" != "${target_alias}" ] ; then
821 if [ "${program_prefixoption}" = "" ] ; then
822 if [ "${program_suffixoption}" = "" ] ; then
823 if [ "${program_transform_nameoption}" = "" ] ; then
824 program_prefix=${target_alias}- ;
830 # Merge program_prefix and program_suffix onto program_transform_name.
831 # (program_suffix used to use $, but it's hard to preserve $ through both
832 # make and sh.)
833 if [ "${program_suffix}" != "" ] ; then
834 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
837 if [ "${program_prefix}" != "" ] ; then
838 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
841 # If CC and CXX are not set in the environment, and the Makefile
842 # exists, try to extract them from it. This is to handle running
843 # ./config.status by hand.
844 if [ -z "${CC}" ] && [ -r Makefile ]; then
845 sed -n -e ':loop
846 /\\$/ N
847 s/\\\n//g
848 t loop
849 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
850 CC=`tail -1 Makefile.cc`
851 rm -f Makefile.cc
854 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
855 sed -n -e ':loop
856 /\\$/ N
857 s/\\\n//g
858 t loop
859 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
860 CFLAGS=`tail -1 Makefile.cc`
861 rm -f Makefile.cc
864 if [ -z "${CXX}" ] && [ -r Makefile ]; then
865 sed -n -e ':loop
866 /\\$/ N
867 s/\\\n//g
868 t loop
869 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
870 CXX=`tail -1 Makefile.cc`
871 rm -f Makefile.cc
874 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
875 sed -n -e ':loop
876 /\\$/ N
877 s/\\\n//g
878 t loop
879 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
880 CXXFLAGS=`tail -1 Makefile.cc`
881 rm -f Makefile.cc
884 # Generate a default definition for YACC. This is used if the makefile can't
885 # locate bison or byacc in objdir.
887 for prog in 'bison -y' byacc yacc
889 set dummy $prog; tmp=$2
890 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
891 for dir in $PATH; do
892 test -z "$dir" && dir=.
893 if test -f $dir/$tmp; then
894 DEFAULT_YACC="$prog"
895 break
897 done
898 IFS="$save_ifs"
900 test -n "$DEFAULT_YACC" && break
901 done
903 # Generate a default definition for M4. This is used if the makefile can't
904 # locate m4 in objdir.
906 for prog in gm4 gnum4 m4
908 set dummy $prog; tmp=$2
909 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
910 for dir in $PATH; do
911 test -z "$dir" && dir=.
912 if test -f $dir/$tmp; then
913 DEFAULT_M4="$prog"
914 break
916 done
917 IFS="$save_ifs"
919 test -n "$DEFAULT_M4" && break
920 done
922 # Generate a default definition for LEX. This is used if the makefile can't
923 # locate flex in objdir.
925 for prog in flex lex
927 set dummy $prog; tmp=$2
928 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
929 for dir in $PATH; do
930 test -z "$dir" && dir=.
931 if test -f $dir/$tmp; then
932 DEFAULT_LEX="$prog"
933 break
935 done
936 IFS="$save_ifs"
938 test -n "$DEFAULT_LEX" && break
939 done
941 if [ "${build}" != "${host}" ]; then
942 # If we are doing a Canadian Cross, in which the host and build systems
943 # are not the same, we set reasonable default values for the tools.
945 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
946 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
947 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
948 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
949 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
950 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
951 tools="${tools} OBJCOPY OBJDUMP"
953 for var in ${tools}; do
954 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
955 sed -n -e ':loop
956 /\\$/ N
957 s/\\\n//g
958 t loop
959 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
960 < Makefile > Makefile.v
961 t=`tail -1 Makefile.v`
962 if [ -n "${t}" ]; then
963 eval "${var}=\${t}"
965 rm -f Makefile.v
967 done
969 AR=${AR-${host_alias}-ar}
970 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
971 AS=${AS-${host_alias}-as}
972 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
973 BISON=${BISON-bison}
974 CC=${CC-${host_alias}-gcc}
975 CFLAGS=${CFLAGS-"-g -O2"}
976 CXX=${CXX-${host_alias}-c++}
977 CXXFLAGS=${CXXFLAGS-"-g -O2"}
978 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
979 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
980 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
981 GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
982 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
983 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
984 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
985 HOST_PREFIX=${build_alias}-
986 HOST_PREFIX_1=${build_alias}-
987 LD=${LD-${host_alias}-ld}
988 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
989 MAKEINFO=${MAKEINFO-makeinfo}
990 NM=${NM-${host_alias}-nm}
991 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
992 RANLIB=${RANLIB-${host_alias}-ranlib}
993 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
994 WINDRES=${WINDRES-${host_alias}-windres}
995 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
996 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
997 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
999 if [ -z "${YACC}" ]; then
1000 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1001 for dir in $PATH; do
1002 test -z "$dir" && dir=.
1003 if test -f $dir/bison; then
1004 YACC="bison -y"
1005 break
1007 if test -f $dir/byacc; then
1008 YACC=byacc
1009 break
1011 if test -f $dir/yacc; then
1012 YACC=yacc
1013 break
1015 done
1016 IFS="$save_ifs"
1017 if [ -z "${YACC}" ]; then
1018 YACC="bison -y"
1022 if [ -z "${LEX}" ]; then
1023 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1024 for dir in $PATH; do
1025 test -z "$dir" && dir=.
1026 if test -f $dir/flex; then
1027 LEX=flex
1028 break
1030 if test -f $dir/lex; then
1031 LEX=lex
1032 break
1034 done
1035 IFS="$save_ifs"
1036 LEX=${LEX-flex}
1039 # Export variables which autoconf might try to set.
1040 export AS
1041 export AR
1042 export CC_FOR_BUILD
1043 export DLLTOOL
1044 export LD
1045 export NM
1046 export RANLIB
1047 export WINDRES
1048 export OBJCOPY
1049 export OBJDUMP
1050 else
1051 # If CC is still not set, try to get gcc.
1052 if [ -z "${CC}" ]; then
1053 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1054 for dir in $PATH; do
1055 test -z "$dir" && dir=.
1056 if test -f $dir/gcc; then
1057 CC="gcc"
1058 echo 'void f(){}' > conftest.c
1059 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1060 CFLAGS=${CFLAGS-"-g -O2"}
1061 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1062 else
1063 CFLAGS=${CFLAGS-"-O2"}
1064 CXXFLAGS=${CXXFLAGS-"-O2"}
1066 rm -f conftest*
1067 break
1069 done
1070 IFS="$save_ifs"
1071 CC=${CC-cc}
1072 else
1073 if test -z "${CFLAGS}"; then
1074 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1075 # is set to a version of gcc.
1076 case "${CC}" in
1077 *gcc)
1078 echo 'void f(){}' > conftest.c
1079 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1080 CFLAGS=${CFLAGS-"-g -O2"}
1081 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1082 else
1083 CFLAGS=${CFLAGS-"-O2"}
1084 CXXFLAGS=${CXXFLAGS-"-O2"}
1086 rm -f conftest*
1088 esac
1092 CXX=${CXX-"c++"}
1093 CFLAGS=${CFLAGS-"-g"}
1094 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1097 export CC
1098 export CXX
1099 export CFLAGS
1100 export CXXFLAGS
1102 # FIXME: This should be in configure.in, not configure
1103 case "$host" in
1104 *go32*)
1105 enable_gdbtk=no ;;
1106 *msdosdjgpp*)
1107 enable_gdbtk=no ;;
1108 esac
1110 # FIXME: This should be in configure.in, not configure
1111 # Determine whether gdb needs tk/tcl or not.
1112 if [ "$enable_gdbtk" != "no" ]; then
1113 GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
1114 else
1115 GDB_TK=""
1118 all_build_modules=
1119 if test x"${build_alias}" != x"${host_alias}"
1120 then
1121 all_build_modules='$(ALL_BUILD_MODULES_LIST)'
1124 for subdir in . ${subdirs} ; do
1126 # ${subdir} is relative path from . to the directory we're currently
1127 # configuring.
1128 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
1129 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
1131 ### figure out what to do with srcdir
1132 case "${srcdir}" in
1133 ".") # no -srcdir option. We're building in place.
1134 makesrcdir=. ;;
1135 /* | [A-Za-z]:[\\/]* ) # absolute path
1136 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1138 *) # otherwise relative
1139 case "${subdir}" in
1140 .) makesrcdir=${srcdir} ;;
1141 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1142 esac
1144 esac
1146 if [ "${subdir}/" != "./" ] ; then
1147 Makefile=${subdir}/Makefile
1150 if [ ! -d ${subdir} ] ; then
1151 if mkdir ${subdir} ; then
1152 true
1153 else
1154 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1155 exit 1
1159 case "${removing}" in
1161 case "${subdir}" in
1162 .) ;;
1163 *) eval echo Building in ${subdir} ${redirect} ;;
1164 esac
1166 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1167 # Set up the list of links to be made.
1168 # ${links} is the list of link names, and ${files} is the list of names to link to.
1170 # Make the links.
1171 configlinks="${links}"
1172 if [ -r ${subdir}/config.status ] ; then
1173 mv -f ${subdir}/config.status ${subdir}/config.back
1175 while [ -n "${files}" ] ; do
1176 # set file to car of files, files to cdr of files
1177 set ${files}; file=$1; shift; files=$*
1178 set ${links}; link=$1; shift; links=$*
1180 if [ ! -r ${srcdir}/${file} ] ; then
1181 if [ ! -r ${file} ] ; then
1183 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1184 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1185 exit 1
1186 else
1187 srcfile=${file}
1189 else
1190 srcfile=${srcdir}/${file}
1193 ${remove} -f ${link}
1194 # Make a symlink if possible, otherwise try a hard link
1195 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1196 true
1197 else
1198 # We need to re-remove the file because Lynx leaves a
1199 # very strange directory there when it fails an NFS symlink.
1200 ${remove} -r -f ${link}
1201 ${hard_link} ${srcfile} ${link}
1203 if [ ! -r ${link} ] ; then
1204 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1205 exit 1
1208 echo "Linked \"${link}\" to \"${srcfile}\"."
1209 done
1211 # Create a .gdbinit file which runs the one in srcdir
1212 # and tells GDB to look there for source files.
1214 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1215 case ${srcdir} in
1216 .) ;;
1217 *) cat > ${subdir}/.gdbinit <<EOF
1218 # ${NO_EDIT}
1219 dir ${makesrcdir}
1220 dir .
1221 source ${makesrcdir}/.gdbinit
1224 esac
1227 # Install a makefile, and make it set VPATH
1228 # if necessary so that the sources are found.
1229 # Also change its value of srcdir.
1230 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1231 # been somewhat optimized and is perhaps a bit twisty.
1233 # code is order so as to try to sed the smallest input files we know.
1234 # so do these separately because I don't trust the order of sed -e expressions.
1236 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1237 # package macros, target, host, site, and package rules.
1239 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1241 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1242 rm -f ${subdir}/${Makefile}.tem
1243 case "${package_makefile_rules_frag}" in
1244 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1246 if [ ! -f ${package_makefile_rules_frag} ] ; then
1247 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1249 if [ -f ${package_makefile_rules_frag} ] ; then
1250 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1251 else
1252 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1253 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1254 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1256 esac
1257 # working copy now in ${Makefile}.tem
1259 # Conditionalize for this site.
1260 rm -f ${Makefile}
1261 case "${site}" in
1262 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1264 site_makefile_frag=${srcdir}/config/ms-${site}
1266 if [ -f ${site_makefile_frag} ] ; then
1267 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1268 > ${Makefile}
1269 else
1270 mv ${subdir}/Makefile.tem ${Makefile}
1271 site_makefile_frag=
1274 esac
1275 # working copy now in ${Makefile}
1277 # Conditionalize the makefile for this host.
1278 rm -f ${subdir}/Makefile.tem
1279 case "${host_makefile_frag}" in
1280 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1282 if [ ! -f ${host_makefile_frag} ] ; then
1283 host_makefile_frag=${srcdir}/${host_makefile_frag}
1285 if [ -f ${host_makefile_frag} ] ; then
1286 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1287 else
1288 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1289 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1290 mv ${Makefile} ${subdir}/Makefile.tem
1292 esac
1293 # working copy now in ${subdir)/Makefile.tem
1295 # Conditionalize the makefile for this target.
1296 rm -f ${Makefile}
1297 case "${target_makefile_frag}" in
1298 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1300 if [ ! -f ${target_makefile_frag} ] ; then
1301 target_makefile_frag=${srcdir}/${target_makefile_frag}
1303 if [ -f ${target_makefile_frag} ] ; then
1304 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1305 else
1306 mv ${subdir}/Makefile.tem ${Makefile}
1307 target_makefile_frag=
1310 esac
1311 # working copy now in ${Makefile}
1313 # Emit the default values of this package's macros.
1314 rm -f ${subdir}/Makefile.tem
1315 case "${package_makefile_frag}" in
1316 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1318 if [ ! -f ${package_makefile_frag} ] ; then
1319 package_makefile_frag=${srcdir}/${package_makefile_frag}
1321 if [ -f ${package_makefile_frag} ] ; then
1322 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1323 else
1324 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1325 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1326 mv ${Makefile} ${subdir}/Makefile.tem
1328 esac
1329 # real copy now in ${subdir}/Makefile.tem
1331 # prepend warning about editing, and a bunch of variables.
1332 rm -f ${Makefile}
1333 cat > ${Makefile} <<EOF
1334 # ${NO_EDIT}
1335 VPATH = ${makesrcdir}
1336 links = ${configlinks}
1337 host_alias = ${host_alias}
1338 host_cpu = ${host_cpu}
1339 host_vendor = ${host_vendor}
1340 host_os = ${host_os}
1341 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1342 target_alias = ${target_alias}
1343 target_cpu = ${target_cpu}
1344 target_vendor = ${target_vendor}
1345 target_os = ${target_os}
1346 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1348 case "${build}" in
1349 "") ;;
1350 *) cat >> ${Makefile} << EOF
1351 build_alias = ${build_alias}
1352 build_cpu = ${build_cpu}
1353 build_vendor = ${build_vendor}
1354 build_os = ${build_os}
1355 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1357 esac
1359 case "${package_makefile_frag}" in
1360 "") ;;
1361 /* | [A-Za-z]:[\\/]* ) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1362 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1363 esac
1365 case "${target_makefile_frag}" in
1366 "") ;;
1367 /* | [A-Za-z]:[\\/]* ) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1368 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1369 esac
1371 case "${host_makefile_frag}" in
1372 "") ;;
1373 /* | [A-Za-z]:[\\/]* ) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1374 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1375 esac
1377 if [ "${site_makefile_frag}" != "" ] ; then
1378 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1381 echo enable_shared = ${enable_shared} >> ${Makefile}
1382 echo enable_threads = ${enable_threads} >> ${Makefile}
1383 # record if we want to rumtime library stuff installed in libsubdir.
1384 if test -z "${enable_version_specific_runtime_libs}"; then
1385 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1386 else
1387 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1390 # Emit a macro which describes the file containing gcc's
1391 # version number.
1392 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1393 # And emit a macro defining gcc's version number.
1394 echo gcc_version = ${gcc_version} >> ${Makefile}
1396 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1397 # remove any form feeds.
1398 if [ -z "${subdirs}" ]; then
1399 rm -f ${subdir}/Makefile.tm2
1400 sedtemp=sed.$$
1401 cat >$sedtemp <<EOF
1402 s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:
1403 s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:
1405 sed -f $sedtemp \
1406 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1407 rm -f $sedtemp
1408 rm -f ${subdir}/Makefile.tem
1409 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1411 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1412 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1413 -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
1414 -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
1415 -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
1416 -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
1417 -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
1418 -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
1419 -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
1420 -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
1421 -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
1422 -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
1423 -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
1424 -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
1425 -e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \
1426 -e "/^CC[ ]*=/{
1427 :loop1
1428 /\\\\$/ N
1429 s/\\\\\\n//g
1430 t loop1
1431 s%^CC[ ]*=.*$%CC = ${CC}%
1432 }" \
1433 -e "/^CXX[ ]*=/{
1434 :loop2
1435 /\\\\$/ N
1436 s/\\\\\\n//g
1437 t loop2
1438 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1439 }" \
1440 -e "/^CFLAGS[ ]*=/{
1441 :loop3
1442 /\\\\$/ N
1443 s/\\\\\\n//g
1444 t loop3
1445 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1446 }" \
1447 -e "/^CXXFLAGS[ ]*=/{
1448 :loop4
1449 /\\\\$/ N
1450 s/\\\\\\n//g
1451 t loop4
1452 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1453 }" \
1454 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
1455 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1456 -e "s/\f//" \
1457 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1458 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1459 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1460 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1461 -e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \
1462 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1463 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1464 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1465 ${subdir}/Makefile.tem >> ${Makefile}
1467 sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
1468 mv -f ${Makefile}.tem ${Makefile}
1470 # If this is a Canadian Cross, preset the values of many more
1471 # tools.
1472 if [ "${build}" != "${host}" ]; then
1473 for var in ${tools}; do
1474 eval val=\$${var}
1475 sed -e "/^${var}[ ]*=/{
1476 :loop1
1477 /\\\\$/ N
1478 /\\\\$/ b loop1
1479 s/\\\\\\n//g
1480 s%^${var}[ ]*=.*$%${var} = ${val}%
1481 }" ${Makefile} > ${Makefile}.tem
1482 mv -f ${Makefile}.tem ${Makefile}
1483 done
1486 # final copy now in ${Makefile}
1488 else
1489 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1492 rm -f ${subdir}/Makefile.tem
1494 case "${host_makefile_frag}" in
1495 "") using= ;;
1496 *) using="and \"${host_makefile_frag}\"" ;;
1497 esac
1499 case "${target_makefile_frag}" in
1500 "") ;;
1501 *) using="${using} and \"${target_makefile_frag}\"" ;;
1502 esac
1504 case "${site_makefile_frag}" in
1505 "") ;;
1506 *) using="${using} and \"${site_makefile_frag}\"" ;;
1507 esac
1509 newusing=`echo "${using}" | sed 's/and/using/'`
1510 using=${newusing}
1511 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1513 . ${tmpfile}.pos
1515 # describe the chosen configuration in config.status.
1516 # Make that file a shellscript which will reestablish
1517 # the same configuration. Used in Makefiles to rebuild
1518 # Makefiles.
1520 case "${norecursion}" in
1521 "") arguments="${arguments} --norecursion" ;;
1522 *) ;;
1523 esac
1525 if [ ${subdir} = . ] ; then
1526 echo "#!/bin/sh
1527 # ${NO_EDIT}
1528 # This directory was configured as follows:
1529 ${progname}" ${arguments} "
1530 # ${using}" > ${subdir}/config.new
1531 else
1532 echo "#!/bin/sh
1533 # ${NO_EDIT}
1534 # This directory was configured as follows:
1535 cd ${invsubdir}
1536 ${progname}" ${arguments} "
1537 # ${using}" > ${subdir}/config.new
1539 chmod a+x ${subdir}/config.new
1540 if [ -r ${subdir}/config.back ] ; then
1541 mv -f ${subdir}/config.back ${subdir}/config.status
1543 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1546 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1547 esac
1548 done
1550 # If there are subdirectories, then recur.
1551 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1552 for configdir in ${configdirs} ${extraconfigdirs} ; do
1554 # If configdir contains ',' it is
1555 # srcdir,builddir,target_alias
1556 # These come from extraconfigdirs.
1557 case ${configdir} in
1558 *,*)
1559 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1562 cfg_dir=${configdir}
1563 bld_dir=${configdir}
1564 tgt_alias=${target_alias}
1566 esac
1568 if [ -d ${srcdir}/${cfg_dir} ] ; then
1569 eval echo Configuring ${configdir}... ${redirect}
1570 case "${srcdir}" in
1571 ".") ;;
1573 if [ ! -d ./${bld_dir} ] ; then
1574 if mkdir ./${bld_dir} ; then
1575 true
1576 else
1577 echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
1578 exit 1
1582 esac
1584 POPDIR=${PWD=`pwd`}
1585 cd ${bld_dir}
1587 ### figure out what to do with srcdir
1588 case "${srcdir}" in
1589 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1590 /* | [A-Za-z]:[\\/]* ) # absolute path
1591 newsrcdir=${srcdir}/${cfg_dir}
1592 srcdiroption="--srcdir=${newsrcdir}"
1594 *) # otherwise relative
1595 newsrcdir=../${srcdir}/${cfg_dir}
1596 srcdiroption="--srcdir=${newsrcdir}"
1598 esac
1600 # Handle --cache-file=../XXX
1601 case "${cache_file}" in
1602 "") # empty
1604 /* | [A-Za-z]:[\\/]* ) # absolute path
1605 cache_file_option="--cache-file=${cache_file}"
1607 *) # relative path
1608 cache_file_option="--cache-file=../${cache_file}"
1610 esac
1612 ### check for guested configure, otherwise fix possibly relative progname
1613 if [ -f ${newsrcdir}/configure ] ; then
1614 recprog=${newsrcdir}/configure
1615 elif [ -f ${newsrcdir}/configure.in ] ; then
1616 case "${progname}" in
1617 /* | [A-Za-z]:[\\/]* ) recprog=${progname} ;;
1618 *) recprog=../${progname} ;;
1619 esac
1620 else
1621 eval echo No configuration information in ${cfg_dir} ${redirect}
1622 recprog=
1625 ### The recursion line is here.
1626 if [ ! -z "${recprog}" ] ; then
1627 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1628 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1629 ${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
1630 true
1631 else
1632 echo Configure in `pwd` failed, exiting. 1>&2
1633 exit 1
1637 cd ${POPDIR}
1639 done
1642 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1643 # and reset the trap handler.
1644 rm -rf ${tmpdir}
1645 trap 0
1647 exit 0
1650 # Local Variables:
1651 # fill-column: 131
1652 # End:
1655 # end of configure