2002-09-29 Nathanael Nerode <neroden@gcc.gnu.org>
[binutils.git] / configure
bloba0179c04c3d7d93bbef341169dfaa3ac667a99ca
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 # 2002 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 target_alias=NOTARGET
89 target_makefile_frag=
90 undefs=NOUNDEFS
91 version="$Revision$"
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=`${PWDCMD-pwd}`; fi
156 case "${progname}" in
157 /* | [A-Za-z]:[\\/]* ) ;;
158 */*) ;;
160 PATH=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH
162 esac
164 # Export original configure arguments for use by sub-configures.
165 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
166 export TOPLEVEL_CONFIGURE_ARGUMENTS
168 # Loop over all args
170 while :
173 # Break out if there are no more args
174 case $# in
176 break
178 esac
180 # Get the first arg, and shuffle
181 option=$1
182 shift
184 # Make all options have two hyphens
185 orig_option=$option # Save original for error messages
186 case $option in
187 --*) ;;
188 -*) option=-$option ;;
189 esac
191 # Split out the argument for options that take them
192 case $option in
193 --*=*)
194 optarg=`echo $option | sed -e 's/^[^=]*=//'`
195 arguments="$arguments $option"
197 # These options have mandatory values. Since we didn't find an = sign,
198 # the value must be in the next argument
199 --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*)
200 optarg=$1
201 shift
202 arguments="$arguments $option=$optarg"
204 --v)
205 arguments="$arguments -v"
207 --*)
208 arguments="$arguments $option"
210 esac
212 # Now, process the options
213 case $option in
215 --bi*)
216 bindir=$optarg
217 diroptions="$diroptions --bindir=$optarg"
219 --build* | --bu*)
220 case "$build_alias" in
221 "") build_alias=$optarg ;;
222 *) echo '***' Can only configure for one build machine at a time. 1>&2
223 fatal=yes
225 esac
227 --cache*)
228 cache_file=$optarg
230 --da*)
231 datadir=$optarg
232 diroptions="$diroptions --datadir=$optarg"
234 --disable-*)
235 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
236 eval $enableopt=no
237 disableoptions="$disableoptions $option"
239 --enable-*)
240 case "$option" in
241 *=*) ;;
242 *) optarg=yes ;;
243 esac
245 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
246 eval "$enableopt=\$optarg"
247 enableoptions="$enableoptions '$option'"
249 --exec-prefix* | --ex*)
250 exec_prefix=$optarg
251 exec_prefixoption="--exec-prefix=$optarg"
253 --gas | --g*)
254 gas=yes
256 --help | --he*)
257 fatal=yes
259 --host* | --ho*)
260 case $host_alias in
261 NOHOST) host_alias=$optarg ;;
262 *) echo '***' Can only configure for one host at a time. 1>&2
263 fatal=yes
265 esac
267 --inc*)
268 includedir=$optarg
269 diroptions="$diroptions --includedir=$optarg"
271 --inf*)
272 infodir=$optarg
273 diroptions="$diroptions --infodir=$optarg"
275 --libd*)
276 libdir=$optarg
277 diroptions="$diroptions --libdir=$optarg"
279 --libe*)
280 libexecdir=$optarg
281 diroptions="$diroptions --libexecdir=$optarg"
283 --lo*)
284 localstatedir=$optarg
285 diroptions="$diroptions --localstatedir=$optarg"
287 --ma*)
288 mandir=$optarg
289 diroptions="$diroptions --mandir=$optarg"
291 --nfp | --nf*)
292 floating_point=no
293 floating_pointoption="--nfp"
295 --norecursion | --no*)
296 norecursion=yes
298 --ol*)
299 oldincludedir=$optarg
300 diroptions="$diroptions --oldincludedir=$optarg"
302 --prefix* | --pre*)
303 prefix=$optarg
304 prefixoption="--prefix=$optarg"
306 --program-prefix* | --program-p*)
307 program_prefix=$optarg
308 program_prefixoption="--program-prefix=$optarg"
310 --program-suffix* | --program-s*)
311 program_suffix=$optarg
312 program_suffixoption="--program-suffix=$optarg"
314 --program-transform-name* | --program-t*)
315 # Double any backslashes or dollar signs in the argument
316 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
317 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
319 --rm)
320 removing=--rm
322 --sb*)
323 sbindir=$optarg
324 diroptions="$diroptions --sbindir=$optarg"
326 --sh*)
327 sharedstatedir=$optarg
328 diroptions="$diroptions --sharedstatedir=$optarg"
330 --silent | --sil* | --quiet | --q*)
331 redirect=">/dev/null"
332 verbose=--silent
334 --site* | --sit*)
335 site=$optarg
336 site_option="--site=$optarg"
338 --srcdir*/ | --sr*/)
339 # Remove trailing slashes. Otherwise, when the file name gets
340 # bolted into an object file as debug info, it has two slashes
341 # in it. Ordinarily this is ok, but emacs takes double slash
342 # to mean "forget the first part".
343 srcdir=`echo $optarg | sed -e 's:/$::'`
345 --srcdir* | --sr*)
346 srcdir=$optarg
348 --sy*)
349 sysconfdir=$optarg
350 diroptions="$diroptions --sysconfdir=$optarg"
352 --target* | --ta*)
353 case $target_alias in
354 NOTARGET) target_alias=$optarg ;;
355 *) echo '***' Can only configure for one target at a time. 1>&2
356 fatal=yes
358 esac
360 --tmpdir* | --tm*)
361 TMPDIR=$optarg
362 tmpdiroption="--tmpdir=$optarg"
364 --verbose | --v | --verb*)
365 redirect=
366 verbose=--verbose
368 --version | --V | --vers*)
369 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
370 exit 0
372 --with-*)
373 case "$option" in
374 *=*) ;;
375 *) optarg=yes ;;
376 esac
378 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
379 eval $withopt="\$optarg"
380 withoptions="$withoptions $option"
382 --without-*)
383 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
384 eval $withopt=no
385 withoutoptions="$withoutoptions $option"
387 --x) with_x=yes
388 withoptions="$withoptions --with-x"
390 --x-i* | --x-l*) other_options="$other_options $orig_option"
392 --*)
393 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
394 exit 1
397 case $undefs in
398 NOUNDEFS) undefs=$option ;;
399 *) echo '***' Can only configure for one host and one target at a time. 1>&2
400 fatal=yes
402 esac
404 esac
405 done
407 # process host and target
409 # Do some error checking and defaulting for the host and target type.
410 # The inputs are:
411 # configure --host=HOST --target=TARGET UNDEFS
413 # The rules are:
414 # 1. You aren't allowed to specify --host, --target, and undefs at the
415 # same time.
416 # 2. Host defaults to undefs.
417 # 3. If undefs is not specified, then host defaults to the current host,
418 # as determined by config.guess.
419 # 4. Target defaults to undefs.
420 # 5. If undefs is not specified, then target defaults to host.
422 case "${fatal}" in
424 # Make sure that host, target & undefs aren't all specified at the
425 # same time.
426 case $host_alias---$target_alias---$undefs in
427 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
429 *) echo '***' Can only configure for one host and one target at a time. 1>&2
430 fatal=yes
431 break 2
433 esac
435 # Now, do defaulting for host.
436 case $host_alias in
437 NOHOST)
438 case $undefs in
439 NOUNDEFS)
440 # Neither --host option nor undefs were present.
441 # Call config.guess.
442 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
443 if host_alias=`${config_shell} ${guesssys}`
444 then
445 # If the string we are going to use for
446 # the target is a prefix of the string
447 # we just guessed for the host, then
448 # assume we are running native, and force
449 # the same string for both target and host.
450 case $target_alias in
451 NOTARGET) ;;
453 if expr $host_alias : $target_alias >/dev/null
454 then
455 host_alias=$target_alias
458 esac
459 echo "Configuring for a ${host_alias} host."
460 arguments="--host=$host_alias $arguments"
461 else
462 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
463 fatal=yes
467 host_alias=$undefs
468 arguments="--host=$host_alias $arguments"
469 undefs=NOUNDEFS
471 esac
472 esac
474 # Do defaulting for target. If --target option isn't present, default
475 # to undefs. If undefs isn't present, default to host.
476 case $target_alias in
477 NOTARGET)
478 case $undefs in
479 NOUNDEFS)
480 target_alias=$host_alias
483 target_alias=$undefs
484 arguments="--target=$target_alias $arguments"
486 esac
487 esac
489 *) ;;
490 esac
492 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
493 exec 1>&2
494 echo Usage: configure [OPTIONS] [HOST]
495 echo
496 echo Options: [defaults in brackets]
497 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
498 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
499 echo ' --help print this message [normal config]'
500 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
501 echo ' --host=HOST configure for HOST [determined via config.guess]'
502 echo ' --norecursion configure this directory only [recurse]'
503 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
504 echo ' --program-suffix=FOO append FOO to installed program names [""]'
505 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
506 echo ' --site=SITE configure with site-specific makefile for SITE'
507 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
508 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
509 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
510 echo ' --nfp configure for software floating point [hard float]'
511 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
512 echo ' --without-FOO package FOO is NOT available'
513 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
514 echo ' --disable-FOO do not include feature FOO'
515 echo
516 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
517 echo
518 if [ -r config.status ] ; then
519 cat config.status
522 exit 1
525 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
526 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
527 ## the sed command below emulates the dirname command
528 topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; ${PWDCMD-pwd}`
531 # this is a hack. sun4 must always be a valid host alias or this will fail.
532 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
533 true
534 else
535 echo '***' cannot find config.sub. 1>&2
536 exit 1
539 touch config.junk
540 if ${config_shell} ${moveifchange} config.junk config.trash ; then
541 true
542 else
543 echo '***' cannot find move-if-change. 1>&2
544 exit 1
546 rm -f config.junk config.trash
548 case "${srcdir}" in
550 if [ -r configure.in ] ; then
551 srcdir=.
552 else
553 if [ -r ${progname}.in ] ; then
554 srcdir=`echo ${progname} | sed 's:/configure$::'`
555 else
556 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
557 exit 1
562 # Set srcdir to "." if that's what it is.
563 # This is important for multilib support.
564 if [ ! -d ${srcdir} ] ; then
565 echo "Invalid source directory ${srcdir}" >&2
566 exit 1
568 pwd=`${PWDCMD-pwd}`
569 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
570 if [ "${pwd}" = "${srcpwd}" ] ; then
571 srcdir=.
573 esac
575 ### warn about some conflicting configurations.
577 case "${srcdir}" in
578 ".") ;;
580 if [ -f ${srcdir}/config.status ] ; then
581 echo '***' Cannot configure here in \"${PWD=`${PWDCMD-pwd}`}\" when \"${srcdir}\" is currently configured. 1>&2
582 exit 1
584 esac
586 # default exec_prefix
587 case "${exec_prefixoption}" in
588 "") exec_prefix="\$(prefix)" ;;
589 *) ;;
590 esac
592 # Define the trigger file to make sure configure will re-run whenever
593 # the gcc version number changes.
594 if [ "${with_gcc_version_trigger+set}" = set ]; then
595 gcc_version_trigger="$with_gcc_version_trigger"
596 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
597 else
598 # If gcc's sources are available, define the trigger file.
599 if [ -f ${topsrcdir}/gcc/version.c ] ; then
600 gcc_version_trigger=${topsrcdir}/gcc/version.c
601 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
602 case "$arguments" in
603 *--with-gcc-version-trigger=$gcc_version_trigger* )
606 # Make sure configure.in knows about this.
607 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
609 esac
610 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
614 ### break up ${srcdir}/configure.in.
615 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
617 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
618 # Check for a directory that's been converted to use autoconf since
619 # it was last configured.
620 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
621 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
622 if [ -r ${srcdir}/configure ] ; then
623 echo '***' Running the local configure script. 1>&2
624 case "${cache_file}" in
625 "") cache_file_option= ;;
626 *) cache_file_option="--cache-file=${cache_file}" ;;
627 esac
628 srcdiroption="--srcdir=${srcdir}"
629 case "${build_alias}" in
630 "") buildopt= ;;
631 *) buildopt="--build=${build_alias}" ;;
632 esac
633 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
634 ${buildopt} --host=${host_alias} --target=${target_alias} \
635 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
636 ${srcdiroption} ${diroptions} \
637 ${program_prefixoption} ${program_suffixoption} \
638 ${program_transform_nameoption} ${site_option} \
639 ${withoptions} ${withoutoptions} \
640 ${enableoptions} ${disableoptions} ${floating_pointoption} \
641 ${cache_file_option} ${removing} ${other_options} ${redirect}
642 else
643 echo '***' There is no configure script present though. 1>&2
646 exit 1
648 *) ;;
649 esac
651 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
653 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
654 exit 1
656 *) ;;
657 esac
659 case "${TMPDIR}" in
660 "") TMPDIR=/tmp ; export TMPDIR ;;
661 *) ;;
662 esac
664 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
665 tmpdir=${TMPDIR}/cNf$$
666 mkdir ${tmpdir} || exit 1
667 tmpfile=${tmpdir}/cNf$$
668 # Note that under many versions of sh a trap handler for 0 will *override* any
669 # exit status you explicitly specify! At this point, the only non-error exit
670 # is at the end of the script; these actions are duplicated there, minus
671 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
672 # trap handler, or you'll lose.
673 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
675 # split ${srcdir}/configure.in into common, per-host, per-target,
676 # and post-target parts. Post-target is optional.
677 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
678 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
679 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
680 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
681 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
682 else
683 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
684 echo >${tmpfile}.pos
687 ### do common part of configure.in
689 # If the language specific compiler does not exist, but the "gcc" directory does,
690 # we will skip this directory; in this case the sub-directory's common part
691 # of configure.in will create a small shell script "skip-this-dir" containing
692 # commands to completely clean up any temporary or created files.
694 . ${tmpfile}.com
696 if test -f skip-this-dir; then
697 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
698 # and reset the trap handler.
699 trap 0
700 rm -rf Makefile* ${tmpdir}
701 # Execute the final clean-up actions
702 ${config_shell} skip-this-dir
703 # and stop configuring this directory.
704 exit 0
707 # some sanity checks on configure.in
708 case "${srctrigger}" in
710 echo '***' srctrigger not set in ${PWD=`${PWDCMD-pwd}`}/configure.in. 1>&2
711 exit 1
713 *) ;;
714 esac
716 case "${build_alias}" in
718 if result=`${config_shell} ${configsub} ${host_alias}` ; then
719 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
720 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
721 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
722 build=${build_cpu}-${build_vendor}-${build_os}
723 build_alias=${host_alias}
727 if result=`${config_shell} ${configsub} ${build_alias}` ; then
728 buildopt="--build=${build_alias}"
729 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
730 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
731 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
732 build=${build_cpu}-${build_vendor}-${build_os}
733 else
734 echo "Unrecognized build system name ${build_alias}." 1>&2
735 exit 1
738 esac
740 if result=`${config_shell} ${configsub} ${host_alias}` ; then
741 true
742 else
743 echo "Unrecognized host system name ${host_alias}." 1>&2
744 exit 1
746 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
747 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
748 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
749 host=${host_cpu}-${host_vendor}-${host_os}
751 . ${tmpfile}.hst
753 if result=`${config_shell} ${configsub} ${target_alias}` ; then
754 true
755 else
756 echo "Unrecognized target system name ${target_alias}." 1>&2
757 exit 1
759 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
760 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
761 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
762 target=${target_cpu}-${target_vendor}-${target_os}
764 . ${tmpfile}.tgt
766 # Find the source files, if location was not specified.
767 case "${srcdir}" in
769 srcdirdefaulted=1
770 srcdir=.
771 if [ ! -r ${srctrigger} ] ; then
772 srcdir=..
775 *) ;;
776 esac
778 if [ ! -r ${srcdir}/${srctrigger} ] ; then
779 case "${srcdirdefaulted}" in
780 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;;
781 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;;
782 esac
784 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
785 exit 1
788 # Some systems (e.g., one of the i386-aix systems the gas testers are
789 # using) don't handle "\$" correctly, so don't use it here.
790 tooldir='$(exec_prefix)'/${target_alias}
792 if [ "${host_alias}" != "${target_alias}" ] ; then
793 if [ "${program_prefixoption}" = "" ] ; then
794 if [ "${program_suffixoption}" = "" ] ; then
795 if [ "${program_transform_nameoption}" = "" ] ; then
796 program_prefix=${target_alias}- ;
802 # Merge program_prefix and program_suffix onto program_transform_name.
803 # (program_suffix used to use $, but it's hard to preserve $ through both
804 # make and sh.)
805 if [ "${program_suffix}" != "" ] ; then
806 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
809 if [ "${program_prefix}" != "" ] ; then
810 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
813 # If CC and CXX are not set in the environment, and the Makefile
814 # exists, try to extract them from it. This is to handle running
815 # ./config.status by hand.
816 if [ -z "${CC}" ] && [ -r Makefile ]; then
817 sed -n -e ':loop
818 /\\$/ N
819 s/\\\n//g
820 t loop
821 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
822 CC=`tail -1 Makefile.cc`
823 rm -f Makefile.cc
826 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
827 sed -n -e ':loop
828 /\\$/ N
829 s/\\\n//g
830 t loop
831 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
832 CFLAGS=`tail -1 Makefile.cc`
833 rm -f Makefile.cc
836 if [ -z "${CXX}" ] && [ -r Makefile ]; then
837 sed -n -e ':loop
838 /\\$/ N
839 s/\\\n//g
840 t loop
841 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
842 CXX=`tail -1 Makefile.cc`
843 rm -f Makefile.cc
846 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
847 sed -n -e ':loop
848 /\\$/ N
849 s/\\\n//g
850 t loop
851 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
852 CXXFLAGS=`tail -1 Makefile.cc`
853 rm -f Makefile.cc
856 # Generate a default definition for YACC. This is used if the makefile can't
857 # locate bison or byacc in objdir.
859 for prog in 'bison -y' byacc yacc
861 set dummy $prog; tmp=$2
862 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
863 for dir in $PATH; do
864 test -z "$dir" && dir=.
865 if test -f $dir/$tmp; then
866 DEFAULT_YACC="$prog"
867 break
869 done
870 IFS="$save_ifs"
872 test -n "$DEFAULT_YACC" && break
873 done
875 # Generate a default definition for M4. This is used if the makefile can't
876 # locate m4 in objdir.
878 for prog in gm4 gnum4 m4
880 set dummy $prog; tmp=$2
881 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
882 for dir in $PATH; do
883 test -z "$dir" && dir=.
884 if test -f $dir/$tmp; then
885 DEFAULT_M4="$prog"
886 break
888 done
889 IFS="$save_ifs"
891 test -n "$DEFAULT_M4" && break
892 done
894 # Generate a default definition for LEX. This is used if the makefile can't
895 # locate flex in objdir.
897 for prog in flex lex
899 set dummy $prog; tmp=$2
900 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
901 for dir in $PATH; do
902 test -z "$dir" && dir=.
903 if test -f $dir/$tmp; then
904 DEFAULT_LEX="$prog"
905 break
907 done
908 IFS="$save_ifs"
910 test -n "$DEFAULT_LEX" && break
911 done
913 if [ "${build}" != "${host}" ]; then
914 # If we are doing a Canadian Cross, in which the host and build systems
915 # are not the same, we set reasonable default values for the tools.
917 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
918 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
919 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
920 tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
921 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
922 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
923 tools="${tools} OBJCOPY OBJDUMP"
925 for var in ${tools}; do
926 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
927 sed -n -e ':loop
928 /\\$/ N
929 s/\\\n//g
930 t loop
931 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
932 < Makefile > Makefile.v
933 t=`tail -1 Makefile.v`
934 if [ -n "${t}" ]; then
935 eval "${var}=\${t}"
937 rm -f Makefile.v
939 done
941 AR=${AR-${host_alias}-ar}
942 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
943 AS=${AS-${host_alias}-as}
944 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
945 BISON=${BISON-bison}
946 CC=${CC-${host_alias}-gcc}
947 CFLAGS=${CFLAGS-"-g -O2"}
948 CXX=${CXX-${host_alias}-c++}
949 CXXFLAGS=${CXXFLAGS-"-g -O2"}
950 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
951 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
952 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
953 GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
954 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
955 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
956 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
957 BUILD_PREFIX=${build_alias}-
958 BUILD_PREFIX_1=${build_alias}-
959 LD=${LD-${host_alias}-ld}
960 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
961 MAKEINFO=${MAKEINFO-makeinfo}
962 NM=${NM-${host_alias}-nm}
963 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
964 RANLIB=${RANLIB-${host_alias}-ranlib}
965 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
966 WINDRES=${WINDRES-${host_alias}-windres}
967 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
968 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
969 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
971 if [ -z "${YACC}" ]; then
972 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
973 for dir in $PATH; do
974 test -z "$dir" && dir=.
975 if test -f $dir/bison; then
976 YACC="bison -y"
977 break
979 if test -f $dir/byacc; then
980 YACC=byacc
981 break
983 if test -f $dir/yacc; then
984 YACC=yacc
985 break
987 done
988 IFS="$save_ifs"
989 if [ -z "${YACC}" ]; then
990 YACC="bison -y"
994 if [ -z "${LEX}" ]; then
995 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
996 for dir in $PATH; do
997 test -z "$dir" && dir=.
998 if test -f $dir/flex; then
999 LEX=flex
1000 break
1002 if test -f $dir/lex; then
1003 LEX=lex
1004 break
1006 done
1007 IFS="$save_ifs"
1008 LEX=${LEX-flex}
1011 # Export variables which autoconf might try to set.
1012 export AS
1013 export AR
1014 export CC_FOR_BUILD
1015 export DLLTOOL
1016 export LD
1017 export NM
1018 export RANLIB
1019 export WINDRES
1020 export OBJCOPY
1021 export OBJDUMP
1022 else
1023 # If CC is still not set, try to get gcc.
1024 if [ -z "${CC}" ]; then
1025 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1026 for dir in $PATH; do
1027 test -z "$dir" && dir=.
1028 if test -f $dir/gcc; then
1029 CC="gcc"
1030 echo 'void f(){}' > conftest.c
1031 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1032 CFLAGS=${CFLAGS-"-g -O2"}
1033 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1034 else
1035 CFLAGS=${CFLAGS-"-O2"}
1036 CXXFLAGS=${CXXFLAGS-"-O2"}
1038 rm -f conftest*
1039 break
1041 done
1042 IFS="$save_ifs"
1043 CC=${CC-cc}
1044 else
1045 if test -z "${CFLAGS}"; then
1046 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1047 # is set to a version of gcc.
1048 case "${CC}" in
1049 *gcc)
1050 echo 'void f(){}' > conftest.c
1051 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1052 CFLAGS=${CFLAGS-"-g -O2"}
1053 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1054 else
1055 CFLAGS=${CFLAGS-"-O2"}
1056 CXXFLAGS=${CXXFLAGS-"-O2"}
1058 rm -f conftest*
1060 esac
1064 CXX=${CXX-"c++"}
1065 CFLAGS=${CFLAGS-"-g"}
1066 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1069 export CC
1070 export CXX
1071 export CFLAGS
1072 export CXXFLAGS
1074 all_build_modules=
1075 if test x"${build_alias}" != x"${host_alias}"
1076 then
1077 all_build_modules='$(ALL_BUILD_MODULES_LIST)'
1080 case "${removing}" in
1083 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1084 # Set up the list of links to be made.
1085 # ${links} is the list of link names, and ${files} is the list of names to link to.
1087 # Make the links.
1088 configlinks="${links}"
1089 if [ -r ./config.status ] ; then
1090 mv -f ./config.status ./config.back
1092 while [ -n "${files}" ] ; do
1093 # set file to car of files, files to cdr of files
1094 set ${files}; file=$1; shift; files=$*
1095 set ${links}; link=$1; shift; links=$*
1097 if [ ! -r ${srcdir}/${file} ] ; then
1098 if [ ! -r ${file} ] ; then
1100 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1101 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1102 exit 1
1103 else
1104 srcfile=${file}
1106 else
1107 srcfile=${srcdir}/${file}
1110 ${remove} -f ${link}
1111 # Make a symlink if possible, otherwise try a hard link
1112 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1113 true
1114 else
1115 # We need to re-remove the file because Lynx leaves a
1116 # very strange directory there when it fails an NFS symlink.
1117 ${remove} -r -f ${link}
1118 ${hard_link} ${srcfile} ${link}
1120 if [ ! -r ${link} ] ; then
1121 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1122 exit 1
1125 echo "Linked \"${link}\" to \"${srcfile}\"."
1126 done
1128 # Create a .gdbinit file which runs the one in srcdir
1129 # and tells GDB to look there for source files.
1131 if [ -r ${srcdir}/.gdbinit ] ; then
1132 case ${srcdir} in
1133 .) ;;
1134 *) cat > ./.gdbinit <<EOF
1135 # ${NO_EDIT}
1136 dir ${srcdir}
1137 dir .
1138 source ${srcdir}/.gdbinit
1141 esac
1144 # Install a makefile, and make it set VPATH
1145 # if necessary so that the sources are found.
1146 # Also change its value of srcdir.
1147 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1148 # been somewhat optimized and is perhaps a bit twisty.
1150 # code is order so as to try to sed the smallest input files we know.
1151 # so do these separately because I don't trust the order of sed -e expressions.
1153 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1154 # package macros, target, host, site, and package rules.
1156 if [ -f ${srcdir}/${Makefile_in} ] ; then
1158 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1159 rm -f ./${Makefile}.tem
1160 case "${package_makefile_rules_frag}" in
1161 "") cp ${srcdir}/${Makefile_in} ./Makefile.tem ;;
1163 if [ ! -f ${package_makefile_rules_frag} ] ; then
1164 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1166 if [ -f ${package_makefile_rules_frag} ] ; then
1167 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${Makefile_in} > ${Makefile}.tem
1168 else
1169 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1170 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1171 cp ${srcdir}/${Makefile_in} ./Makefile.tem
1173 esac
1174 # working copy now in ${Makefile}.tem
1176 # Conditionalize for this site.
1177 rm -f ${Makefile}
1178 case "${site}" in
1179 "") mv ./Makefile.tem ${Makefile} ;;
1181 site_makefile_frag=${srcdir}/config/ms-${site}
1183 if [ -f ${site_makefile_frag} ] ; then
1184 sed -e "/^####/ r ${site_makefile_frag}" ./Makefile.tem \
1185 > ${Makefile}
1186 else
1187 mv ./Makefile.tem ${Makefile}
1188 site_makefile_frag=
1191 esac
1192 # working copy now in ${Makefile}
1194 # Conditionalize the makefile for this host.
1195 rm -f ./Makefile.tem
1196 case "${host_makefile_frag}" in
1197 "") mv ${Makefile} ./Makefile.tem ;;
1199 if [ ! -f ${host_makefile_frag} ] ; then
1200 host_makefile_frag=${srcdir}/${host_makefile_frag}
1202 if [ -f ${host_makefile_frag} ] ; then
1203 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ./Makefile.tem
1204 else
1205 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1206 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1207 mv ${Makefile} ./Makefile.tem
1209 esac
1210 # working copy now in ./Makefile.tem
1212 # Conditionalize the makefile for this target.
1213 rm -f ${Makefile}
1214 case "${target_makefile_frag}" in
1215 "") mv ./Makefile.tem ${Makefile} ;;
1217 if [ ! -f ${target_makefile_frag} ] ; then
1218 target_makefile_frag=${srcdir}/${target_makefile_frag}
1220 if [ -f ${target_makefile_frag} ] ; then
1221 sed -e "/^####/ r ${target_makefile_frag}" ./Makefile.tem > ${Makefile}
1222 else
1223 mv ./Makefile.tem ${Makefile}
1224 target_makefile_frag=
1227 esac
1228 # working copy now in ${Makefile}
1230 # Emit the default values of this package's macros.
1231 rm -f ./Makefile.tem
1232 case "${package_makefile_frag}" in
1233 "") mv ${Makefile} ./Makefile.tem ;;
1235 if [ ! -f ${package_makefile_frag} ] ; then
1236 package_makefile_frag=${srcdir}/${package_makefile_frag}
1238 if [ -f ${package_makefile_frag} ] ; then
1239 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ./Makefile.tem
1240 else
1241 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1242 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1243 mv ${Makefile} ./Makefile.tem
1245 esac
1246 # real copy now in ./Makefile.tem
1248 # prepend warning about editing, and a bunch of variables.
1249 rm -f ${Makefile}
1250 cat > ${Makefile} <<EOF
1251 # ${NO_EDIT}
1252 VPATH = ${srcdir}
1253 links = ${configlinks}
1254 host_alias = ${host_alias}
1255 host_cpu = ${host_cpu}
1256 host_vendor = ${host_vendor}
1257 host_os = ${host_os}
1258 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1259 target_alias = ${target_alias}
1260 target_cpu = ${target_cpu}
1261 target_vendor = ${target_vendor}
1262 target_os = ${target_os}
1263 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1265 case "${build}" in
1266 "") ;;
1267 *) cat >> ${Makefile} << EOF
1268 build_alias = ${build_alias}
1269 build_cpu = ${build_cpu}
1270 build_vendor = ${build_vendor}
1271 build_os = ${build_os}
1272 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1274 esac
1276 case "${package_makefile_frag}" in
1277 "") ;;
1278 /* | [A-Za-z]:[\\/]* ) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1279 *) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1280 esac
1282 case "${target_makefile_frag}" in
1283 "") ;;
1284 /* | [A-Za-z]:[\\/]* ) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1285 *) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1286 esac
1288 case "${host_makefile_frag}" in
1289 "") ;;
1290 /* | [A-Za-z]:[\\/]* ) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1291 *) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1292 esac
1294 if [ "${site_makefile_frag}" != "" ] ; then
1295 echo site_makefile_frag = ${site_makefile_frag} >>${Makefile}
1298 echo enable_shared = ${enable_shared} >> ${Makefile}
1299 echo enable_threads = ${enable_threads} >> ${Makefile}
1300 # record if we want to rumtime library stuff installed in libsubdir.
1301 if test -z "${enable_version_specific_runtime_libs}"; then
1302 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1303 else
1304 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1307 # Emit a macro which describes the file containing gcc's
1308 # version number.
1309 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1310 # And emit a macro defining gcc's version number.
1311 echo gcc_version = ${gcc_version} >> ${Makefile}
1313 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1314 # remove any form feeds.
1315 if [ -z "" ]; then
1316 rm -f ./Makefile.tm2
1317 sedtemp=sed.$$
1318 cat >$sedtemp <<EOF
1319 s:@configdirs@:${configdirs}:
1321 sed -f $sedtemp \
1322 ./Makefile.tem > ./Makefile.tm2
1323 rm -f $sedtemp
1324 rm -f ./Makefile.tem
1325 mv ./Makefile.tm2 ./Makefile.tem
1327 sed -e "s|@prefix@|${prefix}|" \
1328 -e "s|@exec_prefix@|${exec_prefix}|" \
1329 -e "s|@bindir@|${bindir}|" \
1330 -e "s|@sbindir@|${sbindir}|" \
1331 -e "s|@libexecdir@|${libexecdir}|" \
1332 -e "s|@datadir@|${datadir}|" \
1333 -e "s|@sysconfdir@|${sysconfdir}|" \
1334 -e "s|@sharedstatedir@|${sharedstatedir}|" \
1335 -e "s|@localstatedir@|${localstatedir}|" \
1336 -e "s|@libdir@|${libdir}|" \
1337 -e "s|@includedir@|${includedir}|" \
1338 -e "s|@oldincludedir@|${oldincludedir}|" \
1339 -e "s|@infodir@|${infodir}|" \
1340 -e "s|@mandir@|${mandir}|" \
1341 -e "s|@all_build_modules@|${all_build_modules}|" \
1342 -e "/^CC[ ]*=/{
1343 :loop1
1344 /\\\\$/ N
1345 s/\\\\\\n//g
1346 t loop1
1347 s%^CC[ ]*=.*$%CC = ${CC}%
1348 }" \
1349 -e "/^CXX[ ]*=/{
1350 :loop2
1351 /\\\\$/ N
1352 s/\\\\\\n//g
1353 t loop2
1354 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1355 }" \
1356 -e "/^CFLAGS[ ]*=/{
1357 :loop3
1358 /\\\\$/ N
1359 s/\\\\\\n//g
1360 t loop3
1361 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1362 }" \
1363 -e "/^CXXFLAGS[ ]*=/{
1364 :loop4
1365 /\\\\$/ N
1366 s/\\\\\\n//g
1367 t loop4
1368 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1369 }" \
1370 -e "s|@config_shell@|${config_shell}|" \
1371 -e "s|@srcdir@|${srcdir}|" \
1372 -e "s/\f//" \
1373 -e "s:@program_transform_name@:${program_transform_name}:" \
1374 -e "s|@tooldir@|${tooldir}|" \
1375 -e "s|@build_tooldir@|${tooldir}|" \
1376 -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \
1377 -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \
1378 -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \
1379 ./Makefile.tem >> ${Makefile}
1381 sed -e "s:@GDB_TK@:${GDB_TK}:" ${Makefile} >${Makefile}.tem
1382 mv -f ${Makefile}.tem ${Makefile}
1384 # If this is a Canadian Cross, preset the values of many more
1385 # tools.
1386 if [ "${build}" != "${host}" ]; then
1387 for var in ${tools}; do
1388 eval val=\$${var}
1389 sed -e "/^${var}[ ]*=/{
1390 :loop1
1391 /\\\\$/ N
1392 /\\\\$/ b loop1
1393 s/\\\\\\n//g
1394 s%^${var}[ ]*=.*$%${var} = ${val}%
1395 }" ${Makefile} > ${Makefile}.tem
1396 mv -f ${Makefile}.tem ${Makefile}
1397 done
1400 # final copy now in ${Makefile}
1402 else
1403 echo "No Makefile.in found in ${srcdir}, unable to configure" 1>&2
1406 rm -f ./Makefile.tem
1408 case "${host_makefile_frag}" in
1409 "") using= ;;
1410 *) using="and \"${host_makefile_frag}\"" ;;
1411 esac
1413 case "${target_makefile_frag}" in
1414 "") ;;
1415 *) using="${using} and \"${target_makefile_frag}\"" ;;
1416 esac
1418 case "${site_makefile_frag}" in
1419 "") ;;
1420 *) using="${using} and \"${site_makefile_frag}\"" ;;
1421 esac
1423 newusing=`echo "${using}" | sed 's/and/using/'`
1424 using=${newusing}
1425 echo "Created \"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using}
1427 . ${tmpfile}.pos
1429 # describe the chosen configuration in config.status.
1430 # Make that file a shellscript which will reestablish
1431 # the same configuration. Used in Makefiles to rebuild
1432 # Makefiles.
1434 case "${norecursion}" in
1435 "") arguments="${arguments} --norecursion" ;;
1436 *) ;;
1437 esac
1439 echo "#!/bin/sh
1440 # ${NO_EDIT}
1441 # This directory was configured as follows:
1442 ${progname}" ${arguments} "
1443 # ${using}" > ./config.new
1444 chmod a+x ./config.new
1445 if [ -r ./config.back ] ; then
1446 mv -f ./config.back ./config.status
1448 ${config_shell} ${moveifchange} ./config.new ./config.status
1451 *) rm -f ${Makefile} ./config.status ${links} ;;
1452 esac
1454 # If there are subdirectories, then recur.
1455 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1456 for configdir in ${configdirs} ${extraconfigdirs} ; do
1458 # If configdir contains ',' it is
1459 # srcdir,builddir,target_alias
1460 # These come from extraconfigdirs.
1461 case ${configdir} in
1462 *,*)
1463 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1466 cfg_dir=${configdir}
1467 bld_dir=${configdir}
1468 tgt_alias=${target_alias}
1470 esac
1472 if [ -d ${srcdir}/${cfg_dir} ] ; then
1473 eval echo Configuring ${configdir}... ${redirect}
1474 case "${srcdir}" in
1475 ".") ;;
1477 if [ ! -d ./${bld_dir} ] ; then
1478 if mkdir ./${bld_dir} ; then
1479 true
1480 else
1481 echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2
1482 exit 1
1486 esac
1488 POPDIR=${PWD=`${PWDCMD-pwd}`}
1489 cd ${bld_dir}
1491 ### figure out what to do with srcdir
1492 case "${srcdir}" in
1493 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1494 /* | [A-Za-z]:[\\/]* ) # absolute path
1495 newsrcdir=${srcdir}/${cfg_dir}
1496 srcdiroption="--srcdir=${newsrcdir}"
1498 *) # otherwise relative
1499 newsrcdir=../${srcdir}/${cfg_dir}
1500 srcdiroption="--srcdir=${newsrcdir}"
1502 esac
1504 # Handle --cache-file=../XXX
1505 case "${cache_file}" in
1506 "") # empty
1508 /* | [A-Za-z]:[\\/]* ) # absolute path
1509 cache_file_option="--cache-file=${cache_file}"
1511 *) # relative path
1512 cache_file_option="--cache-file=../${cache_file}"
1514 esac
1516 ### check for guested configure, otherwise fix possibly relative progname
1517 if [ -f ${newsrcdir}/configure ] ; then
1518 recprog=${newsrcdir}/configure
1519 elif [ -f ${newsrcdir}/configure.in ] ; then
1520 case "${progname}" in
1521 /* | [A-Za-z]:[\\/]* ) recprog=${progname} ;;
1522 *) recprog=../${progname} ;;
1523 esac
1524 else
1525 eval echo No configuration information in ${cfg_dir} ${redirect}
1526 recprog=
1529 ### The recursion line is here.
1530 if [ ! -z "${recprog}" ] ; then
1531 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1532 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1533 ${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
1534 true
1535 else
1536 echo Configure in `${PWDCMD-pwd}` failed, exiting. 1>&2
1537 exit 1
1541 cd ${POPDIR}
1543 done
1546 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1547 # and reset the trap handler.
1548 rm -rf ${tmpdir}
1549 trap 0
1551 exit 0
1554 # Local Variables:
1555 # fill-column: 131
1556 # End:
1559 # end of configure