* config/tc-w65.c (s_longa): Prototype. Make static, specify int arg.
[binutils.git] / configure
blob9fe331424b7d8b5cb81cc010e37bd13fa6920452
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 site=
83 site_makefile_frag=
84 site_option=
85 srcdir=
86 srctrigger=
87 target_alias=NOTARGET
88 target_makefile_frag=
89 undefs=NOUNDEFS
90 version="$Revision$"
91 x11=default
92 bindir='${exec_prefix}/bin'
93 sbindir='${exec_prefix}/sbin'
94 libexecdir='${exec_prefix}/libexec'
95 datadir='${prefix}/share'
96 sysconfdir='${prefix}/etc'
97 sharedstatedir='${prefix}/com'
98 localstatedir='${prefix}/var'
99 libdir='${exec_prefix}/lib'
100 includedir='${prefix}/include'
101 oldincludedir='/usr/include'
102 infodir='${prefix}/info'
103 mandir='${prefix}/man'
105 ### we might need to use some other shell than /bin/sh for running subshells
107 ### If we are on Windows, search for the shell. This will permit people
108 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
109 ### without also having to set CONFIG_SHELL. This code will work when
110 ### using bash, which sets OSTYPE.
111 case "${OSTYPE}" in
112 *win32*)
113 if [ x${CONFIG_SHELL} = x ]; then
114 if [ ! -f /bin/sh ]; then
115 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
116 CONFIG_SHELL=${SHELL}
117 export CONFIG_SHELL
118 else
119 for prog in sh sh.exe bash bash.exe; do
120 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
121 for dir in $PATH; do
122 test -z "$dir" && dir=.
123 if test -f $dir/$prog; then
124 CONFIG_SHELL=$dir/$prog
125 export CONFIG_SHELL
126 break
128 done
129 IFS="$save_ifs"
130 test -n "${CONFIG_SHELL}" && break
131 done
136 esac
138 config_shell=${CONFIG_SHELL-/bin/sh}
140 NO_EDIT="This file was generated automatically by configure. Do not edit."
142 ## this is a little touchy and won't always work, but...
144 ## if the argv[0] starts with a slash then it is an absolute name that can (and
145 ## must) be used as is.
147 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
148 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
151 progname=$0
152 # if PWD already has a value, it is probably wrong.
153 if [ -n "$PWD" ]; then PWD=`${PWDCMD-pwd}`; fi
155 case "${progname}" in
156 /* | [A-Za-z]:[\\/]* ) ;;
157 */*) ;;
159 PATH=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH
161 esac
163 # Export original configure arguments for use by sub-configures.
164 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
165 export TOPLEVEL_CONFIGURE_ARGUMENTS
167 # Loop over all args
169 while :
172 # Break out if there are no more args
173 case $# in
175 break
177 esac
179 # Get the first arg, and shuffle
180 option=$1
181 shift
183 # Make all options have two hyphens
184 orig_option=$option # Save original for error messages
185 case $option in
186 --*) ;;
187 -*) option=-$option ;;
188 esac
190 # Split out the argument for options that take them
191 case $option in
192 --*=*)
193 optarg=`echo $option | sed -e 's/^[^=]*=//'`
194 arguments="$arguments $option"
196 # These options have mandatory values. Since we didn't find an = sign,
197 # the value must be in the next argument
198 --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*)
199 optarg=$1
200 shift
201 arguments="$arguments $option=$optarg"
203 --v)
204 arguments="$arguments -v"
206 --*)
207 arguments="$arguments $option"
209 esac
211 # Now, process the options
212 case $option in
214 --bi*)
215 bindir=$optarg
216 diroptions="$diroptions --bindir=$optarg"
218 --build* | --bu*)
219 case "$build_alias" in
220 "") build_alias=$optarg ;;
221 *) echo '***' Can only configure for one build machine at a time. 1>&2
222 fatal=yes
224 esac
226 --cache*)
227 cache_file=$optarg
229 --da*)
230 datadir=$optarg
231 diroptions="$diroptions --datadir=$optarg"
233 --disable-*)
234 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
235 eval $enableopt=no
236 disableoptions="$disableoptions $option"
238 --enable-*)
239 case "$option" in
240 *=*) ;;
241 *) optarg=yes ;;
242 esac
244 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
245 eval "$enableopt=\$optarg"
246 enableoptions="$enableoptions '$option'"
248 --exec-prefix* | --ex*)
249 exec_prefix=$optarg
250 exec_prefixoption="--exec-prefix=$optarg"
252 --gas | --g*)
253 gas=yes
255 --help | --he*)
256 fatal=yes
258 --host* | --ho*)
259 case $host_alias in
260 NOHOST) host_alias=$optarg ;;
261 *) echo '***' Can only configure for one host at a time. 1>&2
262 fatal=yes
264 esac
266 --inc*)
267 includedir=$optarg
268 diroptions="$diroptions --includedir=$optarg"
270 --inf*)
271 infodir=$optarg
272 diroptions="$diroptions --infodir=$optarg"
274 --libd*)
275 libdir=$optarg
276 diroptions="$diroptions --libdir=$optarg"
278 --libe*)
279 libexecdir=$optarg
280 diroptions="$diroptions --libexecdir=$optarg"
282 --lo*)
283 localstatedir=$optarg
284 diroptions="$diroptions --localstatedir=$optarg"
286 --ma*)
287 mandir=$optarg
288 diroptions="$diroptions --mandir=$optarg"
290 --nfp | --nf*)
291 floating_point=no
292 floating_pointoption="--nfp"
294 --norecursion | --no*)
295 norecursion=yes
297 --ol*)
298 oldincludedir=$optarg
299 diroptions="$diroptions --oldincludedir=$optarg"
301 --prefix* | --pre*)
302 prefix=$optarg
303 prefixoption="--prefix=$optarg"
305 --program-prefix* | --program-p*)
306 program_prefix=$optarg
307 program_prefixoption="--program-prefix=$optarg"
309 --program-suffix* | --program-s*)
310 program_suffix=$optarg
311 program_suffixoption="--program-suffix=$optarg"
313 --program-transform-name* | --program-t*)
314 # Double any backslashes or dollar signs in the argument
315 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
316 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
318 --sb*)
319 sbindir=$optarg
320 diroptions="$diroptions --sbindir=$optarg"
322 --sh*)
323 sharedstatedir=$optarg
324 diroptions="$diroptions --sharedstatedir=$optarg"
326 --silent | --sil* | --quiet | --q*)
327 redirect=">/dev/null"
328 verbose=--silent
330 --site* | --sit*)
331 site=$optarg
332 site_option="--site=$optarg"
334 --srcdir*/ | --sr*/)
335 # Remove trailing slashes. Otherwise, when the file name gets
336 # bolted into an object file as debug info, it has two slashes
337 # in it. Ordinarily this is ok, but emacs takes double slash
338 # to mean "forget the first part".
339 srcdir=`echo $optarg | sed -e 's:/$::'`
341 --srcdir* | --sr*)
342 srcdir=$optarg
344 --sy*)
345 sysconfdir=$optarg
346 diroptions="$diroptions --sysconfdir=$optarg"
348 --target* | --ta*)
349 case $target_alias in
350 NOTARGET) target_alias=$optarg ;;
351 *) echo '***' Can only configure for one target at a time. 1>&2
352 fatal=yes
354 esac
356 --tmpdir* | --tm*)
357 TMPDIR=$optarg
358 tmpdiroption="--tmpdir=$optarg"
360 --verbose | --v | --verb*)
361 redirect=
362 verbose=--verbose
364 --version | --V | --vers*)
365 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
366 exit 0
368 --with-*)
369 case "$option" in
370 *=*) ;;
371 *) optarg=yes ;;
372 esac
374 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
375 eval $withopt="\$optarg"
376 withoptions="$withoptions $option"
378 --without-*)
379 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
380 eval $withopt=no
381 withoutoptions="$withoutoptions $option"
383 --x) with_x=yes
384 withoptions="$withoptions --with-x"
386 --x-i* | --x-l*) other_options="$other_options $orig_option"
388 --*)
389 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
390 exit 1
393 case $undefs in
394 NOUNDEFS) undefs=$option ;;
395 *) echo '***' Can only configure for one host and one target at a time. 1>&2
396 fatal=yes
398 esac
400 esac
401 done
403 # process host and target
405 # Do some error checking and defaulting for the host and target type.
406 # The inputs are:
407 # configure --host=HOST --target=TARGET UNDEFS
409 # The rules are:
410 # 1. You aren't allowed to specify --host, --target, and undefs at the
411 # same time.
412 # 2. Host defaults to undefs.
413 # 3. If undefs is not specified, then host defaults to the current host,
414 # as determined by config.guess.
415 # 4. Target defaults to undefs.
416 # 5. If undefs is not specified, then target defaults to host.
418 case "${fatal}" in
420 # Make sure that host, target & undefs aren't all specified at the
421 # same time.
422 case $host_alias---$target_alias---$undefs in
423 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
425 *) echo '***' Can only configure for one host and one target at a time. 1>&2
426 fatal=yes
427 break 2
429 esac
431 # Now, do defaulting for host.
432 case $host_alias in
433 NOHOST)
434 case $undefs in
435 NOUNDEFS)
436 # Neither --host option nor undefs were present.
437 # Call config.guess.
438 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
439 if host_alias=`${config_shell} ${guesssys}`
440 then
441 # If the string we are going to use for
442 # the target is a prefix of the string
443 # we just guessed for the host, then
444 # assume we are running native, and force
445 # the same string for both target and host.
446 case $target_alias in
447 NOTARGET) ;;
449 if expr $host_alias : $target_alias >/dev/null
450 then
451 host_alias=$target_alias
454 esac
455 echo "Configuring for a ${host_alias} host."
456 arguments="--host=$host_alias $arguments"
457 else
458 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
459 fatal=yes
463 host_alias=$undefs
464 arguments="--host=$host_alias $arguments"
465 undefs=NOUNDEFS
467 esac
468 esac
470 # Do defaulting for target. If --target option isn't present, default
471 # to undefs. If undefs isn't present, default to host.
472 case $target_alias in
473 NOTARGET)
474 case $undefs in
475 NOUNDEFS)
476 target_alias=$host_alias
479 target_alias=$undefs
480 arguments="--target=$target_alias $arguments"
482 esac
483 esac
485 *) ;;
486 esac
488 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
489 exec 1>&2
490 echo Usage: configure [OPTIONS] [HOST]
491 echo
492 echo Options: [defaults in brackets]
493 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
494 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
495 echo ' --help print this message [normal config]'
496 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
497 echo ' --host=HOST configure for HOST [determined via config.guess]'
498 echo ' --norecursion configure this directory only [recurse]'
499 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
500 echo ' --program-suffix=FOO append FOO to installed program names [""]'
501 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
502 echo ' --site=SITE configure with site-specific makefile for SITE'
503 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
504 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
505 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
506 echo ' --nfp configure for software floating point [hard float]'
507 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
508 echo ' --without-FOO package FOO is NOT available'
509 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
510 echo ' --disable-FOO do not include feature FOO'
511 echo
512 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
513 echo
514 if [ -r config.status ] ; then
515 cat config.status
518 exit 1
521 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
522 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
523 ## the sed command below emulates the dirname command
524 topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; ${PWDCMD-pwd}`
527 # this is a hack. sun4 must always be a valid host alias or this will fail.
528 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
529 true
530 else
531 echo '***' cannot find config.sub. 1>&2
532 exit 1
535 touch config.junk
536 if ${config_shell} ${moveifchange} config.junk config.trash ; then
537 true
538 else
539 echo '***' cannot find move-if-change. 1>&2
540 exit 1
542 rm -f config.junk config.trash
544 case "${srcdir}" in
546 if [ -r configure.in ] ; then
547 srcdir=.
548 else
549 if [ -r ${progname}.in ] ; then
550 srcdir=`echo ${progname} | sed 's:/configure$::'`
551 else
552 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
553 exit 1
558 # Set srcdir to "." if that's what it is.
559 # This is important for multilib support.
560 if [ ! -d ${srcdir} ] ; then
561 echo "Invalid source directory ${srcdir}" >&2
562 exit 1
564 pwd=`${PWDCMD-pwd}`
565 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
566 if [ "${pwd}" = "${srcpwd}" ] ; then
567 srcdir=.
569 esac
571 ### warn about some conflicting configurations.
573 case "${srcdir}" in
574 ".") ;;
576 if [ -f ${srcdir}/config.status ] ; then
577 echo '***' Cannot configure here in \"${PWD=`${PWDCMD-pwd}`}\" when \"${srcdir}\" is currently configured. 1>&2
578 exit 1
580 esac
582 # default exec_prefix
583 case "${exec_prefixoption}" in
584 "") exec_prefix="\$(prefix)" ;;
585 *) ;;
586 esac
588 ### break up ${srcdir}/configure.in.
589 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
591 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
592 # Check for a directory that's been converted to use autoconf since
593 # it was last configured.
594 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
595 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
596 if [ -r ${srcdir}/configure ] ; then
597 echo '***' Running the local configure script. 1>&2
598 case "${cache_file}" in
599 "") cache_file_option= ;;
600 *) cache_file_option="--cache-file=${cache_file}" ;;
601 esac
602 srcdiroption="--srcdir=${srcdir}"
603 case "${build_alias}" in
604 "") buildopt= ;;
605 *) buildopt="--build=${build_alias}" ;;
606 esac
607 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
608 ${buildopt} --host=${host_alias} --target=${target_alias} \
609 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
610 ${srcdiroption} ${diroptions} \
611 ${program_prefixoption} ${program_suffixoption} \
612 ${program_transform_nameoption} ${site_option} \
613 ${withoptions} ${withoutoptions} \
614 ${enableoptions} ${disableoptions} ${floating_pointoption} \
615 ${cache_file_option} ${other_options} ${redirect}
616 else
617 echo '***' There is no configure script present though. 1>&2
620 exit 1
622 *) ;;
623 esac
625 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
627 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
628 exit 1
630 *) ;;
631 esac
633 case "${TMPDIR}" in
634 "") TMPDIR=/tmp ; export TMPDIR ;;
635 *) ;;
636 esac
638 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
639 tmpdir=${TMPDIR}/cNf$$
640 mkdir ${tmpdir} || exit 1
641 tmpfile=${tmpdir}/cNf$$
642 # Note that under many versions of sh a trap handler for 0 will *override* any
643 # exit status you explicitly specify! At this point, the only non-error exit
644 # is at the end of the script; these actions are duplicated there, minus
645 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
646 # trap handler, or you'll lose.
647 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
649 # split ${srcdir}/configure.in into common, per-host, per-target,
650 # and post-target parts. Post-target is optional.
651 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
652 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
653 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
654 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
655 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
656 else
657 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
658 echo >${tmpfile}.pos
661 ### do common part of configure.in
663 . ${tmpfile}.com
665 # some sanity checks on configure.in
666 case "${srctrigger}" in
668 echo '***' srctrigger not set in ${PWD=`${PWDCMD-pwd}`}/configure.in. 1>&2
669 exit 1
671 *) ;;
672 esac
674 case "${build_alias}" in
676 if result=`${config_shell} ${configsub} ${host_alias}` ; then
677 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
678 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
679 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
680 build=${build_cpu}-${build_vendor}-${build_os}
681 build_alias=${host_alias}
685 if result=`${config_shell} ${configsub} ${build_alias}` ; then
686 buildopt="--build=${build_alias}"
687 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
688 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
689 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
690 build=${build_cpu}-${build_vendor}-${build_os}
691 else
692 echo "Unrecognized build system name ${build_alias}." 1>&2
693 exit 1
696 esac
698 if result=`${config_shell} ${configsub} ${host_alias}` ; then
699 true
700 else
701 echo "Unrecognized host system name ${host_alias}." 1>&2
702 exit 1
704 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
705 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
706 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
707 host=${host_cpu}-${host_vendor}-${host_os}
709 . ${tmpfile}.hst
711 if result=`${config_shell} ${configsub} ${target_alias}` ; then
712 true
713 else
714 echo "Unrecognized target system name ${target_alias}." 1>&2
715 exit 1
717 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
718 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
719 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
720 target=${target_cpu}-${target_vendor}-${target_os}
722 . ${tmpfile}.tgt
724 # Find the source files, if location was not specified.
725 case "${srcdir}" in
727 srcdirdefaulted=1
728 srcdir=.
729 if [ ! -r ${srctrigger} ] ; then
730 srcdir=..
733 *) ;;
734 esac
736 if [ ! -r ${srcdir}/${srctrigger} ] ; then
737 case "${srcdirdefaulted}" in
738 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;;
739 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;;
740 esac
742 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
743 exit 1
746 # Some systems (e.g., one of the i386-aix systems the gas testers are
747 # using) don't handle "\$" correctly, so don't use it here.
748 tooldir='$(exec_prefix)'/${target_alias}
750 if [ "${host_alias}" != "${target_alias}" ] ; then
751 if [ "${program_prefixoption}" = "" ] ; then
752 if [ "${program_suffixoption}" = "" ] ; then
753 if [ "${program_transform_nameoption}" = "" ] ; then
754 program_prefix=${target_alias}- ;
760 # Merge program_prefix and program_suffix onto program_transform_name.
761 # (program_suffix used to use $, but it's hard to preserve $ through both
762 # make and sh.)
763 if [ "${program_suffix}" != "" ] ; then
764 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
767 if [ "${program_prefix}" != "" ] ; then
768 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
771 # If CC and CXX are not set in the environment, and the Makefile
772 # exists, try to extract them from it. This is to handle running
773 # ./config.status by hand.
774 if [ -z "${CC}" ] && [ -r Makefile ]; then
775 sed -n -e ':loop
776 /\\$/ N
777 s/\\\n//g
778 t loop
779 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
780 CC=`tail -1 Makefile.cc`
781 rm -f Makefile.cc
784 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
785 sed -n -e ':loop
786 /\\$/ N
787 s/\\\n//g
788 t loop
789 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
790 CFLAGS=`tail -1 Makefile.cc`
791 rm -f Makefile.cc
794 if [ -z "${CXX}" ] && [ -r Makefile ]; then
795 sed -n -e ':loop
796 /\\$/ N
797 s/\\\n//g
798 t loop
799 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
800 CXX=`tail -1 Makefile.cc`
801 rm -f Makefile.cc
804 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
805 sed -n -e ':loop
806 /\\$/ N
807 s/\\\n//g
808 t loop
809 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
810 CXXFLAGS=`tail -1 Makefile.cc`
811 rm -f Makefile.cc
814 # Generate a default definition for YACC. This is used if the makefile can't
815 # locate bison or byacc in objdir.
817 for prog in 'bison -y' byacc yacc
819 set dummy $prog; tmp=$2
820 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
821 for dir in $PATH; do
822 test -z "$dir" && dir=.
823 if test -f $dir/$tmp; then
824 DEFAULT_YACC="$prog"
825 break
827 done
828 IFS="$save_ifs"
830 test -n "$DEFAULT_YACC" && break
831 done
833 # Generate a default definition for M4. This is used if the makefile can't
834 # locate m4 in objdir.
836 for prog in gm4 gnum4 m4
838 set dummy $prog; tmp=$2
839 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
840 for dir in $PATH; do
841 test -z "$dir" && dir=.
842 if test -f $dir/$tmp; then
843 DEFAULT_M4="$prog"
844 break
846 done
847 IFS="$save_ifs"
849 test -n "$DEFAULT_M4" && break
850 done
852 # Generate a default definition for LEX. This is used if the makefile can't
853 # locate flex in objdir.
855 for prog in flex lex
857 set dummy $prog; tmp=$2
858 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
859 for dir in $PATH; do
860 test -z "$dir" && dir=.
861 if test -f $dir/$tmp; then
862 DEFAULT_LEX="$prog"
863 break
865 done
866 IFS="$save_ifs"
868 test -n "$DEFAULT_LEX" && break
869 done
872 if [ "${build}" != "${host}" ]; then
873 # If we are doing a Canadian Cross, in which the host and build systems
874 # are not the same, we set reasonable default values for the tools.
875 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
876 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
877 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
878 tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
879 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
880 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
881 tools="${tools} OBJCOPY OBJDUMP"
883 for var in ${tools}; do
884 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
885 sed -n -e ':loop
886 /\\$/ N
887 s/\\\n//g
888 t loop
889 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
890 < Makefile > Makefile.v
891 t=`tail -1 Makefile.v`
892 if [ -n "${t}" ]; then
893 eval "${var}=\${t}"
895 rm -f Makefile.v
897 done
899 AR=${AR-${host_alias}-ar}
900 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
901 AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
902 AS=${AS-${host_alias}-as}
903 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
904 BISON=${BISON-bison}
905 CC=${CC-${host_alias}-gcc}
906 CFLAGS=${CFLAGS-"-g -O2"}
907 CXX=${CXX-${host_alias}-c++}
908 CXXFLAGS=${CXXFLAGS-"-g -O2"}
909 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
910 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
911 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
912 GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
913 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
914 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
915 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
916 BUILD_PREFIX=${build_alias}-
917 BUILD_PREFIX_1=${build_alias}-
918 LD=${LD-${host_alias}-ld}
919 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
920 MAKEINFO=${MAKEINFO-makeinfo}
921 NM=${NM-${host_alias}-nm}
922 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
923 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
924 RANLIB=${RANLIB-${host_alias}-ranlib}
925 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
926 WINDRES=${WINDRES-${host_alias}-windres}
927 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
928 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
929 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
931 if [ -z "${YACC}" ]; then
932 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
933 for dir in $PATH; do
934 test -z "$dir" && dir=.
935 if test -f $dir/bison; then
936 YACC="bison -y"
937 break
939 if test -f $dir/byacc; then
940 YACC=byacc
941 break
943 if test -f $dir/yacc; then
944 YACC=yacc
945 break
947 done
948 IFS="$save_ifs"
949 if [ -z "${YACC}" ]; then
950 YACC="bison -y"
954 if [ -z "${LEX}" ]; then
955 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
956 for dir in $PATH; do
957 test -z "$dir" && dir=.
958 if test -f $dir/flex; then
959 LEX=flex
960 break
962 if test -f $dir/lex; then
963 LEX=lex
964 break
966 done
967 IFS="$save_ifs"
968 LEX=${LEX-flex}
971 # Export variables which autoconf might try to set.
972 export AS
973 export AR
974 export CC_FOR_BUILD
975 export DLLTOOL
976 export LD
977 export NM
978 export RANLIB
979 export WINDRES
980 export OBJCOPY
981 export OBJDUMP
982 else
983 # Set reasonable default values for some tools even if not Canadian.
984 # Of course, these are different reasonable default values, originally
985 # specified directly in the Makefile.
986 # We don't export, so that autoconf can do its job.
987 # Note that all these settings are above the fragment inclusion point
988 # in Makefile.in, so can still be overridden by fragments.
989 # This is all going to change when we autoconfiscate...
991 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
992 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
993 tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
994 tools="${tools} NM_FOR_TARGET RANLIB_FOR_TARGET"
995 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
997 AR=ar
998 AR_FOR_TARGET='\$(USUAL_AR_FOR_TARGET)'
999 AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
1000 AS=as
1001 AS_FOR_TARGET='\$(USUAL_AS_FOR_TARGET)'
1002 BISON='$(USUAL_BISON)'
1003 CC_FOR_BUILD='\$(CC)'
1004 DLLTOOL=dlltool
1005 DLLTOOL_FOR_TARGET='\$(USUAL_DLLTOOL_FOR_TARGET)'
1006 GCC_FOR_TARGET='\$(USUAL_GCC_FOR_TARGET)'
1007 BUILD_PREFIX=
1008 BUILD_PREFIX_1=loser-
1009 LD=ld
1010 LD_FOR_TARGET='\$(USUAL_LD_FOR_TARGET)'
1011 MAKEINFO='\$(USUAL_MAKEINFO)'
1012 NM=nm
1013 NM_FOR_TARGET='\$(USUAL_NM_FOR_TARGET)'
1014 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
1015 RANLIB_FOR_TARGET='\$(USUAL_RANLIB_FOR_TARGET)'
1016 WINDRES=windres
1017 WINDRES_FOR_TARGET='\$(USUAL_WINDRES_FOR_TARGET)'
1018 LEX='\$(USUAL_LEX)'
1019 YACC='\$(USUAL_YACC)'
1021 # If CC is still not set, try to get gcc.
1022 if [ -z "${CC}" ]; then
1023 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1024 for dir in $PATH; do
1025 test -z "$dir" && dir=.
1026 if test -f $dir/gcc; then
1027 CC="gcc"
1028 echo 'void f(){}' > conftest.c
1029 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1030 CFLAGS=${CFLAGS-"-g -O2"}
1031 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1032 else
1033 CFLAGS=${CFLAGS-"-O2"}
1034 CXXFLAGS=${CXXFLAGS-"-O2"}
1036 rm -f conftest*
1037 break
1039 done
1040 IFS="$save_ifs"
1041 CC=${CC-cc}
1042 else
1043 if test -z "${CFLAGS}"; then
1044 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1045 # is set to a version of gcc.
1046 case "${CC}" in
1047 *gcc)
1048 echo 'void f(){}' > conftest.c
1049 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1050 CFLAGS=${CFLAGS-"-g -O2"}
1051 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1052 else
1053 CFLAGS=${CFLAGS-"-O2"}
1054 CXXFLAGS=${CXXFLAGS-"-O2"}
1056 rm -f conftest*
1058 esac
1062 CXX=${CXX-"c++"}
1063 CFLAGS=${CFLAGS-"-g"}
1064 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1067 export CC
1068 export CXX
1069 export CFLAGS
1070 export CXXFLAGS
1072 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1073 # Set up the list of links to be made.
1074 # ${links} is the list of link names, and ${files} is the list of names to link to.
1076 # Make the links.
1077 configlinks="${links}"
1078 if [ -r ./config.status ] ; then
1079 mv -f ./config.status ./config.back
1081 while [ -n "${files}" ] ; do
1082 # set file to car of files, files to cdr of files
1083 set ${files}; file=$1; shift; files=$*
1084 set ${links}; link=$1; shift; links=$*
1086 if [ ! -r ${srcdir}/${file} ] ; then
1087 if [ ! -r ${file} ] ; then
1088 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1089 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1090 exit 1
1091 else
1092 srcfile=${file}
1094 else
1095 srcfile=${srcdir}/${file}
1098 ${remove} -f ${link}
1099 # Make a symlink if possible, otherwise try a hard link
1100 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1101 true
1102 else
1103 # We need to re-remove the file because Lynx leaves a
1104 # very strange directory there when it fails an NFS symlink.
1105 ${remove} -r -f ${link}
1106 ${hard_link} ${srcfile} ${link}
1108 if [ ! -r ${link} ] ; then
1109 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1110 exit 1
1113 echo "Linked \"${link}\" to \"${srcfile}\"."
1114 done
1116 # Create a .gdbinit file which runs the one in srcdir
1117 # and tells GDB to look there for source files.
1119 if [ -r ${srcdir}/.gdbinit ] ; then
1120 case ${srcdir} in
1121 .) ;;
1122 *) cat > ./.gdbinit <<EOF
1123 # ${NO_EDIT}
1124 dir ${srcdir}
1125 dir .
1126 source ${srcdir}/.gdbinit
1129 esac
1132 # Install a makefile, and make it set VPATH
1133 # if necessary so that the sources are found.
1134 # Also change its value of srcdir.
1135 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1136 # been somewhat optimized and is perhaps a bit twisty.
1138 # code is order so as to try to sed the smallest input files we know.
1139 # so do these separately because I don't trust the order of sed -e expressions.
1141 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1142 # package macros, target, host, site, and package rules.
1144 if [ -f ${srcdir}/${Makefile_in} ] ; then
1146 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1147 rm -f ./${Makefile}.tem
1148 case "${package_makefile_rules_frag}" in
1149 "") cp ${srcdir}/${Makefile_in} ./Makefile.tem ;;
1151 if [ ! -f ${package_makefile_rules_frag} ] ; then
1152 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1154 if [ -f ${package_makefile_rules_frag} ] ; then
1155 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${Makefile_in} > ${Makefile}.tem
1156 else
1157 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1158 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1159 cp ${srcdir}/${Makefile_in} ./Makefile.tem
1161 esac
1162 # working copy now in ${Makefile}.tem
1164 # Conditionalize for this site.
1165 rm -f ${Makefile}
1166 case "${site}" in
1167 "") mv ./Makefile.tem ${Makefile} ;;
1169 site_makefile_frag=${srcdir}/config/ms-${site}
1171 if [ -f ${site_makefile_frag} ] ; then
1172 sed -e "/^####/ r ${site_makefile_frag}" ./Makefile.tem > ${Makefile}
1173 else
1174 mv ./Makefile.tem ${Makefile}
1175 site_makefile_frag=
1178 esac
1179 # working copy now in ${Makefile}
1181 # Conditionalize the makefile for this host.
1182 rm -f ./Makefile.tem
1183 case "${host_makefile_frag}" in
1184 "") mv ${Makefile} ./Makefile.tem ;;
1186 if [ ! -f ${host_makefile_frag} ] ; then
1187 host_makefile_frag=${srcdir}/${host_makefile_frag}
1189 if [ -f ${host_makefile_frag} ] ; then
1190 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ./Makefile.tem
1191 else
1192 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1193 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1194 mv ${Makefile} ./Makefile.tem
1196 esac
1197 # working copy now in ./Makefile.tem
1199 # Conditionalize the makefile for this target.
1200 rm -f ${Makefile}
1201 case "${target_makefile_frag}" in
1202 "") mv ./Makefile.tem ${Makefile} ;;
1204 if [ ! -f ${target_makefile_frag} ] ; then
1205 target_makefile_frag=${srcdir}/${target_makefile_frag}
1207 if [ -f ${target_makefile_frag} ] ; then
1208 sed -e "/^####/ r ${target_makefile_frag}" ./Makefile.tem > ${Makefile}
1209 else
1210 mv ./Makefile.tem ${Makefile}
1211 target_makefile_frag=
1214 esac
1215 # working copy now in ${Makefile}
1217 # Emit the default values of this package's macros.
1218 rm -f ./Makefile.tem
1219 case "${package_makefile_frag}" in
1220 "") mv ${Makefile} ./Makefile.tem ;;
1222 if [ ! -f ${package_makefile_frag} ] ; then
1223 package_makefile_frag=${srcdir}/${package_makefile_frag}
1225 if [ -f ${package_makefile_frag} ] ; then
1226 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ./Makefile.tem
1227 else
1228 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1229 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1230 mv ${Makefile} ./Makefile.tem
1232 esac
1233 # real copy now in ./Makefile.tem
1235 # record if we want runtime library stuff installed in libsubdir.
1236 # Blank means no.
1237 if test -z "${enable_version_specific_runtime_libs}"; then
1238 enable_version_specific_runtime_libs=no
1241 sed -e "s|@configlinks@|${configlinks}|" \
1242 -e "s|@build_alias@|${build_alias}|" \
1243 -e "s|@build_cpu@|${build_cpu}|" \
1244 -e "s|@build_vendor@|${build_vendor}|" \
1245 -e "s|@build_os@|${build_os}|" \
1246 -e "s|@host_alias@|${host_alias}|" \
1247 -e "s|@host_cpu@|${host_cpu}|" \
1248 -e "s|@host_vendor@|${host_vendor}|" \
1249 -e "s|@host_os@|${host_os}|" \
1250 -e "s|@target_alias@|${target_alias}|" \
1251 -e "s|@target_cpu@|${target_cpu}|" \
1252 -e "s|@target_vendor@|${target_vendor}|" \
1253 -e "s|@target_os@|${target_os}|" \
1254 -e "s|@target_makefile_frag@|${target_makefile_frag}|" \
1255 -e "s|@host_makefile_frag@|${host_makefile_frag}|" \
1256 -e "s|@enable_shared@|${enable_shared}|" \
1257 -e "s|@enable_threads@|${enable_threads}|" \
1258 -e "s|@enable_version_specific_runtime_libs@|${enable_version_specific_runtime_libs}|" \
1259 -e "s|@gcc_version_trigger@|${gcc_version_trigger}|" \
1260 -e "s|@gcc_version@|${gcc_version}|" \
1261 ./Makefile.tem > ${Makefile}
1262 mv -f ${Makefile} ./Makefile.tem
1263 # Real copy now in Makefile.tem; no prologue.
1265 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1266 # remove any form feeds.
1267 sed -e "s|@configdirs@|${configdirs}|" \
1268 -e "s|@prefix@|${prefix}|" \
1269 -e "s|@exec_prefix@|${exec_prefix}|" \
1270 -e "s|@bindir@|${bindir}|" \
1271 -e "s|@sbindir@|${sbindir}|" \
1272 -e "s|@libexecdir@|${libexecdir}|" \
1273 -e "s|@datadir@|${datadir}|" \
1274 -e "s|@sysconfdir@|${sysconfdir}|" \
1275 -e "s|@sharedstatedir@|${sharedstatedir}|" \
1276 -e "s|@localstatedir@|${localstatedir}|" \
1277 -e "s|@libdir@|${libdir}|" \
1278 -e "s|@includedir@|${includedir}|" \
1279 -e "s|@oldincludedir@|${oldincludedir}|" \
1280 -e "s|@infodir@|${infodir}|" \
1281 -e "s|@mandir@|${mandir}|" \
1282 -e "/^CC[ ]*=/{
1283 :loop1
1284 /\\\\$/ N
1285 s/\\\\\\n//g
1286 t loop1
1287 s%^CC[ ]*=.*$%CC = ${CC}%
1288 }" \
1289 -e "/^CXX[ ]*=/{
1290 :loop2
1291 /\\\\$/ N
1292 s/\\\\\\n//g
1293 t loop2
1294 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1295 }" \
1296 -e "/^CFLAGS[ ]*=/{
1297 :loop3
1298 /\\\\$/ N
1299 s/\\\\\\n//g
1300 t loop3
1301 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1302 }" \
1303 -e "/^CXXFLAGS[ ]*=/{
1304 :loop4
1305 /\\\\$/ N
1306 s/\\\\\\n//g
1307 t loop4
1308 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1309 }" \
1310 -e "s|@config_shell@|${config_shell}|" \
1311 -e "s|@srcdir@|${srcdir}|" \
1312 -e "s/\f//" \
1313 -e "s:@program_transform_name@:${program_transform_name}:" \
1314 -e "s|@tooldir@|${tooldir}|" \
1315 -e "s|@build_tooldir@|${tooldir}|" \
1316 -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \
1317 -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \
1318 -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \
1319 ./Makefile.tem > ${Makefile}
1321 # If this is a Canadian Cross, preset the values of many more
1322 # tools.
1323 if [ "${build}" != "${host}" ]; then
1324 for var in ${tools}; do
1325 eval val=\$${var}
1326 sed -e "/^${var}[ ]*=/{
1327 :loop1
1328 /\\\\$/ N
1329 /\\\\$/ b loop1
1330 s/\\\\\\n//g
1331 s%^${var}[ ]*=.*$%${var} = ${val}%
1332 }" ${Makefile} > ${Makefile}.tem
1333 mv -f ${Makefile}.tem ${Makefile}
1334 done
1336 # If this is NOT a Canadian Cross, preset the values of some more
1337 # tools. The above line should get merged into this, but this
1338 # substitutes *once* where the above substitutes *globally*; that
1339 # needs to be worked out before the merger. The issue is in Makefile
1340 # fragment elements (ick, yuck, ugh).
1341 if [ "${build}" = "${host}" ]; then
1342 for var in ${tools}; do
1343 eval val=\$${var}
1344 sed -e "s%@${var}@%${val}%" ${Makefile} > ${Makefile}.tem
1345 mv -f ${Makefile}.tem ${Makefile}
1346 done
1349 # final copy now in ${Makefile}
1351 else
1352 echo "No Makefile.in found in ${srcdir}/., unable to configure" 1>&2
1355 rm -f ./Makefile.tem
1357 case "${host_makefile_frag}" in
1358 "") using= ;;
1359 *) using="and \"${host_makefile_frag}\"" ;;
1360 esac
1362 case "${target_makefile_frag}" in
1363 "") ;;
1364 *) using="${using} and \"${target_makefile_frag}\"" ;;
1365 esac
1367 case "${site_makefile_frag}" in
1368 "") ;;
1369 *) using="${using} and \"${site_makefile_frag}\"" ;;
1370 esac
1372 newusing=`echo "${using}" | sed 's/and/using/'`
1373 using=${newusing}
1374 echo "Created \"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using}
1376 . ${tmpfile}.pos
1378 # describe the chosen configuration in config.status.
1379 # Make that file a shellscript which will reestablish
1380 # the same configuration. Used in Makefiles to rebuild
1381 # Makefiles.
1383 case "${norecursion}" in
1384 "") arguments="${arguments} --norecursion" ;;
1385 *) ;;
1386 esac
1388 echo "#!/bin/sh
1389 # ${NO_EDIT}
1390 # This directory was configured as follows:
1391 ${progname}" ${arguments} "
1392 # ${using}" > ./config.new
1393 chmod a+x ./config.new
1394 if [ -r ./config.back ] ; then
1395 mv -f ./config.back ./config.status
1397 ${config_shell} ${moveifchange} ./config.new ./config.status
1399 # If there are subdirectories, then recur.
1400 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1401 for configdir in ${configdirs} ${extraconfigdirs} ; do
1403 # If configdir contains ',' it is
1404 # srcdir,builddir,target_alias
1405 # These come from extraconfigdirs.
1406 case ${configdir} in
1407 *,*)
1408 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1411 cfg_dir=${configdir}
1412 bld_dir=${configdir}
1413 tgt_alias=${target_alias}
1415 esac
1417 if [ -d ${srcdir}/${cfg_dir} ] ; then
1418 eval echo Configuring ${configdir}... ${redirect}
1419 case "${srcdir}" in
1420 ".") ;;
1422 if [ ! -d ./${bld_dir} ] ; then
1423 if mkdir ./${bld_dir} ; then
1424 true
1425 else
1426 echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2
1427 exit 1
1431 esac
1433 POPDIR=${PWD=`${PWDCMD-pwd}`}
1434 cd ${bld_dir}
1436 ### figure out what to do with srcdir
1437 case "${srcdir}" in
1438 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1439 /* | [A-Za-z]:[\\/]* ) # absolute path
1440 newsrcdir=${srcdir}/${cfg_dir}
1441 srcdiroption="--srcdir=${newsrcdir}"
1443 *) # otherwise relative
1444 newsrcdir=../${srcdir}/${cfg_dir}
1445 srcdiroption="--srcdir=${newsrcdir}"
1447 esac
1449 # Handle --cache-file=../XXX
1450 case "${cache_file}" in
1451 "") # empty
1453 /* | [A-Za-z]:[\\/]* ) # absolute path
1454 cache_file_option="--cache-file=${cache_file}"
1456 *) # relative path
1457 cache_file_option="--cache-file=../${cache_file}"
1459 esac
1461 ### check for guested configure, otherwise fix possibly relative progname
1462 if [ -f ${newsrcdir}/configure ] ; then
1463 recprog=${newsrcdir}/configure
1464 elif [ -f ${newsrcdir}/configure.in ] ; then
1465 case "${progname}" in
1466 /* | [A-Za-z]:[\\/]* ) recprog=${progname} ;;
1467 *) recprog=../${progname} ;;
1468 esac
1469 else
1470 eval echo No configuration information in ${cfg_dir} ${redirect}
1471 recprog=
1474 ### The recursion line is here.
1475 if [ ! -z "${recprog}" ] ; then
1476 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1477 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1478 ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${other_options} ${redirect} ; then
1479 true
1480 else
1481 echo Configure in `${PWDCMD-pwd}` failed, exiting. 1>&2
1482 exit 1
1486 cd ${POPDIR}
1488 done
1491 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1492 # and reset the trap handler.
1493 rm -rf ${tmpdir}
1494 trap 0
1496 exit 0
1499 # Local Variables:
1500 # fill-column: 131
1501 # End:
1504 # end of configure