]> gcc.gnu.org Git - gcc.git/blob - configure
888886704264c98a192d7e6bd98bb96ed9ece903
[gcc.git] / configure
1 #!/bin/sh
2
3 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
4
5 # Configuration script
6 # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
7 # Free Software Foundation, Inc.
8
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.
13 #
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.
18 #
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.
22
23 # This file was originally written by K. Richard Pixley.
24
25 #
26 # Shell script to create proper links to machine-dependent files in
27 # preparation for compilation.
28 #
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.
32 #
33
34 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
35
36 remove=rm
37 hard_link=ln
38 symbolic_link='ln -s'
39
40 #for Test
41 #remove="echo rm"
42 #hard_link="echo ln"
43 #symbolic_link="echo ln -s"
44
45 # clear some things potentially inherited from environment.
46
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 exec_prefix=
55 exec_prefixoption=
56 fatal=
57 floating_point=default
58 gas=default
59 gcc_version=UNKNOWN
60 host_alias=NOHOST
61 host_makefile_frag=
62 moveifchange=
63 norecursion=
64 other_options=
65 package_makefile_frag=
66 package_makefile_rules_frag=
67 prefix=/usr/local
68 progname=
69 program_prefix=
70 program_prefixoption=
71 program_suffix=
72 program_suffixoption=
73 program_transform_name=
74 program_transform_nameoption=
75 redirect=">/dev/null"
76 removing=
77 site=
78 site_makefile_frag=
79 site_option=
80 srcdir=
81 srctrigger=
82 subdirs=
83 target_alias=NOTARGET
84 target_makefile_frag=
85 undefs=NOUNDEFS
86 version="$Revision: 1.22 $"
87 x11=default
88
89 ### we might need to use some other shell than /bin/sh for running subshells
90
91 ### If we are on Windows, search for the shell. This will permit people
92 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
93 ### without also having to set CONFIG_SHELL. This code will work when
94 ### using bash, which sets OSTYPE.
95 case "${OSTYPE}" in
96 *win32*)
97 if [ x${CONFIG_SHELL} = x ]; then
98 if [ ! -f /bin/sh ]; then
99 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
100 CONFIG_SHELL=${SHELL}
101 export CONFIG_SHELL
102 else
103 for prog in sh sh.exe bash bash.exe; do
104 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
105 for dir in $PATH; do
106 test -z "$dir" && dir=.
107 if test -f $dir/$prog; then
108 CONFIG_SHELL=$dir/$prog
109 export CONFIG_SHELL
110 break
111 fi
112 done
113 IFS="$save_ifs"
114 test -n "${CONFIG_SHELL}" && break
115 done
116 fi
117 fi
118 fi
119 ;;
120 esac
121
122 config_shell=${CONFIG_SHELL-/bin/sh}
123
124 NO_EDIT="This file was generated automatically by configure. Do not edit."
125
126 ## this is a little touchy and won't always work, but...
127 ##
128 ## if the argv[0] starts with a slash then it is an absolute name that can (and
129 ## must) be used as is.
130 ##
131 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
132 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
133 ##
134
135 progname=$0
136 # if PWD already has a value, it is probably wrong.
137 if [ -n "$PWD" ]; then PWD=`pwd`; fi
138
139 case "${progname}" in
140 /*) ;;
141 */*) ;;
142 *)
143 PATH=$PATH:${PWD=`pwd`} ; export PATH
144 ;;
145 esac
146
147 # Loop over all args
148
149 while :
150 do
151
152 # Break out if there are no more args
153 case $# in
154 0)
155 break
156 ;;
157 esac
158
159 # Get the first arg, and shuffle
160 option=$1
161 shift
162
163 # Make all options have two hyphens
164 orig_option=$option # Save original for error messages
165 case $option in
166 --*) ;;
167 -*) option=-$option ;;
168 esac
169
170 # Split out the argument for options that take them
171 case $option in
172 --*=*)
173 optarg=`echo $option | sed -e 's/^[^=]*=//'`
174 arguments="$arguments $option"
175 ;;
176 # These options have mandatory values. Since we didn't find an = sign,
177 # the value must be in the next argument
178 --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*)
179 optarg=$1
180 shift
181 arguments="$arguments $option=$optarg"
182 ;;
183 --v)
184 arguments="$arguments -v"
185 ;;
186 --*)
187 arguments="$arguments $option"
188 ;;
189 esac
190
191 # Now, process the options
192 case $option in
193
194 --build* | --bu*)
195 case "$build_alias" in
196 "") build_alias=$optarg ;;
197 *) echo '***' Can only configure for one build machine at a time. 1>&2
198 fatal=yes
199 ;;
200 esac
201 ;;
202 --cache*)
203 cache_file=$optarg
204 ;;
205 --disable-*)
206 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
207 eval $enableopt=no
208 disableoptions="$disableoptions $option"
209 ;;
210 --enable-*)
211 case "$option" in
212 *=*) ;;
213 *) optarg=yes ;;
214 esac
215
216 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
217 eval "$enableopt='$optarg'"
218 enableoptions="$enableoptions '$option'"
219 ;;
220 --exec-prefix* | --ex*)
221 exec_prefix=$optarg
222 exec_prefixoption="--exec-prefix=$optarg"
223 ;;
224 --gas | --g*)
225 gas=yes
226 ;;
227 --help | --he*)
228 fatal=yes
229 ;;
230 --host* | --ho*)
231 case $host_alias in
232 NOHOST) host_alias=$optarg ;;
233 *) echo '***' Can only configure for one host at a time. 1>&2
234 fatal=yes
235 ;;
236 esac
237 ;;
238 --nfp | --nf*)
239 floating_point=no
240 floating_pointoption="--nfp"
241 ;;
242 --norecursion | --no*)
243 norecursion=yes
244 ;;
245 --prefix* | --pre*)
246 prefix=$optarg
247 prefixoption="--prefix=$optarg"
248 ;;
249 --program-prefix* | --program-p*)
250 program_prefix=$optarg
251 program_prefixoption="--program-prefix=$optarg"
252 ;;
253 --program-suffix* | --program-s*)
254 program_suffix=$optarg
255 program_suffixoption="--program-suffix=$optarg"
256 ;;
257 --program-transform-name* | --program-t*)
258 # Double any backslashes or dollar signs in the argument
259 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
260 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
261 ;;
262 --rm)
263 removing=--rm
264 ;;
265 --silent | --sil* | --quiet | --q*)
266 redirect=">/dev/null"
267 verbose=--silent
268 ;;
269 --site* | --sit*)
270 site=$optarg
271 site_option="--site=$optarg"
272 ;;
273 --srcdir*/ | --sr*/)
274 # Remove trailing slashes. Otherwise, when the file name gets
275 # bolted into an object file as debug info, it has two slashes
276 # in it. Ordinarily this is ok, but emacs takes double slash
277 # to mean "forget the first part".
278 srcdir=`echo $optarg | sed -e 's:/$::'`
279 ;;
280 --srcdir* | --sr*)
281 srcdir=$optarg
282 ;;
283 --target* | --ta*)
284 case $target_alias in
285 NOTARGET) target_alias=$optarg ;;
286 *) echo '***' Can only configure for one target at a time. 1>&2
287 fatal=yes
288 ;;
289 esac
290 ;;
291 --tmpdir* | --tm*)
292 TMPDIR=$optarg
293 tmpdiroption="--tmpdir=$optarg"
294 ;;
295 --verbose | --v | --verb*)
296 redirect=
297 verbose=--verbose
298 ;;
299 --version | --V | --vers*)
300 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
301 exit 0
302 ;;
303 --with-*)
304 case "$option" in
305 *=*) ;;
306 *) optarg=yes ;;
307 esac
308
309 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
310 eval $withopt="$optarg"
311 withoptions="$withoptions $option"
312 ;;
313 --without-*)
314 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
315 eval $withopt=no
316 withoutoptions="$withoutoptions $option"
317 ;;
318 --x) with_x=yes
319 withoptions="$withoptions --with-x"
320 ;;
321 --x-i* | --x-l*) other_options="$other_options $orig_option"
322 ;;
323 --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
324 # These options were added to autoconf for emacs.
325 ;;
326 --*)
327 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
328 exit 1
329 ;;
330 *)
331 case $undefs in
332 NOUNDEFS) undefs=$option ;;
333 *) echo '***' Can only configure for one host and one target at a time. 1>&2
334 fatal=yes
335 ;;
336 esac
337 ;;
338 esac
339 done
340
341 # process host and target
342
343 # Do some error checking and defaulting for the host and target type.
344 # The inputs are:
345 # configure --host=HOST --target=TARGET UNDEFS
346 #
347 # The rules are:
348 # 1. You aren't allowed to specify --host, --target, and undefs at the
349 # same time.
350 # 2. Host defaults to undefs.
351 # 3. If undefs is not specified, then host defaults to the current host,
352 # as determined by config.guess.
353 # 4. Target defaults to undefs.
354 # 5. If undefs is not specified, then target defaults to host.
355
356 case "${fatal}" in
357 "")
358 # Make sure that host, target & undefs aren't all specified at the
359 # same time.
360 case $host_alias---$target_alias---$undefs in
361 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
362 ;;
363 *) echo '***' Can only configure for one host and one target at a time. 1>&2
364 fatal=yes
365 break 2
366 ;;
367 esac
368
369 # Now, do defaulting for host.
370 case $host_alias in
371 NOHOST)
372 case $undefs in
373 NOUNDEFS)
374 # Neither --host option nor undefs were present.
375 # Call config.guess.
376 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
377 if host_alias=`${config_shell} ${guesssys}`
378 then
379 # If the string we are going to use for
380 # the target is a prefix of the string
381 # we just guessed for the host, then
382 # assume we are running native, and force
383 # the same string for both target and host.
384 case $target_alias in
385 NOTARGET) ;;
386 *)
387 if expr $host_alias : $target_alias >/dev/null
388 then
389 host_alias=$target_alias
390 fi
391 ;;
392 esac
393 echo "Configuring for a ${host_alias} host." 1>&2
394 arguments="--host=$host_alias $arguments"
395 else
396 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
397 fatal=yes
398 fi
399 ;;
400 *)
401 host_alias=$undefs
402 arguments="--host=$host_alias $arguments"
403 undefs=NOUNDEFS
404 ;;
405 esac
406 esac
407
408 # Do defaulting for target. If --target option isn't present, default
409 # to undefs. If undefs isn't present, default to host.
410 case $target_alias in
411 NOTARGET)
412 case $undefs in
413 NOUNDEFS)
414 target_alias=$host_alias
415 ;;
416 *)
417 target_alias=$undefs
418 arguments="--target=$target_alias $arguments"
419 ;;
420 esac
421 esac
422 ;;
423 *) ;;
424 esac
425
426 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
427 exec 1>&2
428 echo Usage: configure [OPTIONS] [HOST]
429 echo
430 echo Options: [defaults in brackets]
431 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
432 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
433 echo ' --help print this message [normal config]'
434 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
435 echo ' --host=HOST configure for HOST [determined via config.guess]'
436 echo ' --norecursion configure this directory only [recurse]'
437 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
438 echo ' --program-suffix=FOO append FOO to installed program names [""]'
439 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
440 echo ' --site=SITE configure with site-specific makefile for SITE'
441 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
442 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
443 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
444 echo ' --nfp configure for software floating point [hard float]'
445 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
446 echo ' --without-FOO package FOO is NOT available'
447 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
448 echo ' --disable-FOO do not include feature FOO'
449 echo
450 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
451 echo
452 if [ -r config.status ] ; then
453 cat config.status
454 fi
455
456 exit 1
457 fi
458
459 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
460 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
461
462 # this is a hack. sun4 must always be a valid host alias or this will fail.
463 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
464 true
465 else
466 echo '***' cannot find config.sub. 1>&2
467 exit 1
468 fi
469
470 touch config.junk
471 if ${config_shell} ${moveifchange} config.junk config.trash ; then
472 true
473 else
474 echo '***' cannot find move-if-change. 1>&2
475 exit 1
476 fi
477 rm -f config.junk config.trash
478
479 case "${srcdir}" in
480 "")
481 if [ -r configure.in ] ; then
482 srcdir=.
483 else
484 if [ -r ${progname}.in ] ; then
485 srcdir=`echo ${progname} | sed 's:/configure$::'`
486 else
487 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
488 exit 1
489 fi
490 fi
491 ;;
492 *)
493 # Set srcdir to "." if that's what it is.
494 # This is important for multilib support.
495 if [ ! -d ${srcdir} ] ; then
496 echo "Invalid source directory ${srcdir}" >&2
497 exit 1
498 fi
499 pwd=`pwd`
500 srcpwd=`cd ${srcdir} ; pwd`
501 if [ "${pwd}" = "${srcpwd}" ] ; then
502 srcdir=.
503 fi
504 esac
505
506 ### warn about some conflicting configurations.
507
508 case "${srcdir}" in
509 ".") ;;
510 *)
511 if [ -f ${srcdir}/config.status ] ; then
512 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
513 exit 1
514 fi
515 esac
516
517 # default exec_prefix
518 case "${exec_prefixoption}" in
519 "") exec_prefix="\$(prefix)" ;;
520 *) ;;
521 esac
522
523 ### break up ${srcdir}/configure.in.
524 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
525 "")
526 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
527 # Check for a directory that's been converted to use autoconf since
528 # it was last configured.
529 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
530 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
531 if [ -r ${srcdir}/configure ] ; then
532 echo '***' Running the local configure script. 1>&2
533 case "${cache_file}" in
534 "") cache_file_option= ;;
535 *) cache_file_option="--cache-file=${cache_file}" ;;
536 esac
537 srcdiroption="--srcdir=${srcdir}"
538 case "${build_alias}" in
539 "") buildopt= ;;
540 *) buildopt="--build=${build_alias}" ;;
541 esac
542 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
543 ${buildopt} --host=${host_alias} --target=${target_alias} \
544 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
545 ${srcdiroption} \
546 ${program_prefixoption} ${program_suffixoption} \
547 ${program_transform_nameoption} ${site_option} \
548 ${withoptions} ${withoutoptions} \
549 ${enableoptions} ${disableoptions} ${floating_pointoption} \
550 ${cache_file_option} ${removing} ${other_options} ${redirect}
551 else
552 echo '***' There is no configure script present though. 1>&2
553 fi
554 fi
555 exit 1
556 ;;
557 *) ;;
558 esac
559
560 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
561 "")
562 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
563 exit 1
564 ;;
565 *) ;;
566 esac
567
568 case "${TMPDIR}" in
569 "") TMPDIR=/tmp ; export TMPDIR ;;
570 *) ;;
571 esac
572
573 # keep this filename short for &%*%$*# 14 char file names
574 tmpfile=${TMPDIR}/cONf$$
575 # Note that under many versions of sh a trap handler for 0 will *override* any
576 # exit status you explicitly specify! At this point, the only non-error exit
577 # is at the end of the script; these actions are duplicated there, minus
578 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
579 # trap handler, or you'll lose.
580 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
581
582 # split ${srcdir}/configure.in into common, per-host, per-target,
583 # and post-target parts. Post-target is optional.
584 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
585 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
586 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
587 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
588 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
589 else
590 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
591 echo >${tmpfile}.pos
592 fi
593
594 ### do common part of configure.in
595
596 . ${tmpfile}.com
597
598 # some sanity checks on configure.in
599 case "${srctrigger}" in
600 "")
601 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
602 exit 1
603 ;;
604 *) ;;
605 esac
606
607 case "${build_alias}" in
608 "")
609 if result=`${config_shell} ${configsub} ${host_alias}` ; then
610 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
611 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
612 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
613 build=${build_cpu}-${build_vendor}-${build_os}
614 build_alias=${host_alias}
615 fi
616 ;;
617 *)
618 if result=`${config_shell} ${configsub} ${build_alias}` ; then
619 buildopt="--build=${build_alias}"
620 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
621 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
622 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
623 build=${build_cpu}-${build_vendor}-${build_os}
624 else
625 echo "Unrecognized build system name ${build_alias}." 1>&2
626 exit 1
627 fi
628 ;;
629 esac
630
631 if result=`${config_shell} ${configsub} ${host_alias}` ; then
632 true
633 else
634 echo "Unrecognized host system name ${host_alias}." 1>&2
635 exit 1
636 fi
637 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
638 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
639 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
640 host=${host_cpu}-${host_vendor}-${host_os}
641
642 . ${tmpfile}.hst
643
644 if result=`${config_shell} ${configsub} ${target_alias}` ; then
645 true
646 else
647 echo "Unrecognized target system name ${target_alias}." 1>&2
648 exit 1
649 fi
650 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
651 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
652 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
653 target=${target_cpu}-${target_vendor}-${target_os}
654
655 . ${tmpfile}.tgt
656
657 # Find the source files, if location was not specified.
658 case "${srcdir}" in
659 "")
660 srcdirdefaulted=1
661 srcdir=.
662 if [ ! -r ${srctrigger} ] ; then
663 srcdir=..
664 fi
665 ;;
666 *) ;;
667 esac
668
669 if [ ! -r ${srcdir}/${srctrigger} ] ; then
670 case "${srcdirdefaulted}" in
671 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
672 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
673 esac
674
675 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
676 exit 1
677 fi
678
679 # Some systems (e.g., one of the i386-aix systems the gas testers are
680 # using) don't handle "\$" correctly, so don't use it here.
681 tooldir='$(exec_prefix)'/${target_alias}
682
683 if [ "${host_alias}" != "${target_alias}" ] ; then
684 if [ "${program_prefixoption}" = "" ] ; then
685 if [ "${program_suffixoption}" = "" ] ; then
686 if [ "${program_transform_nameoption}" = "" ] ; then
687 program_prefix=${target_alias}- ;
688 fi
689 fi
690 fi
691 fi
692
693 # Merge program_prefix and program_suffix onto program_transform_name.
694 # (program_suffix used to use $, but it's hard to preserve $ through both
695 # make and sh.)
696 if [ "${program_suffix}" != "" ] ; then
697 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
698 fi
699
700 if [ "${program_prefix}" != "" ] ; then
701 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
702 fi
703
704 # If gcc's sources are available, extract its version number which is used by
705 # $libsubdir.
706 if [ -f $srcdir/gcc/version.c ]; then
707 gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${srcdir}/gcc/version.c`
708 fi
709
710 # If CC and CXX are not set in the environment, and the Makefile
711 # exists, try to extract them from it. This is to handle running
712 # ./config.status by hand.
713 if [ -z "${CC}" -a -r Makefile ]; then
714 sed -n -e ':loop
715 /\\$/ N
716 s/\\\n//g
717 t loop
718 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
719 CC=`tail -1 Makefile.cc`
720 rm -f Makefile.cc
721 fi
722
723 if [ -z "${CFLAGS}" -a -r Makefile ]; then
724 sed -n -e ':loop
725 /\\$/ N
726 s/\\\n//g
727 t loop
728 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
729 CFLAGS=`tail -1 Makefile.cc`
730 rm -f Makefile.cc
731 fi
732
733 if [ -z "${CXX}" -a -r Makefile ]; then
734 sed -n -e ':loop
735 /\\$/ N
736 s/\\\n//g
737 t loop
738 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
739 CXX=`tail -1 Makefile.cc`
740 rm -f Makefile.cc
741 fi
742
743 if [ -z "${CXXFLAGS}" -a -r Makefile ]; then
744 sed -n -e ':loop
745 /\\$/ N
746 s/\\\n//g
747 t loop
748 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
749 CXXFLAGS=`tail -1 Makefile.cc`
750 rm -f Makefile.cc
751 fi
752
753 # Generate a default definition for YACC. This is used if the makefile can't
754 # locate bison or byacc in objdir.
755
756 for prog in 'bison -y' byacc yacc
757 do
758 set dummy $prog; tmp=$2
759 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
760 for dir in $PATH; do
761 test -z "$dir" && dir=.
762 if test -f $dir/$tmp; then
763 DEFAULT_YACC="$prog"
764 break
765 fi
766 done
767 IFS="$save_ifs"
768
769 test -n "$DEFAULT_YACC" && break
770 done
771
772 # Generate a default definition for M4. This is used if the makefile can't
773 # locate m4 in objdir.
774
775 for prog in gm4 gnum4 m4
776 do
777 set dummy $prog; tmp=$2
778 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
779 for dir in $PATH; do
780 test -z "$dir" && dir=.
781 if test -f $dir/$tmp; then
782 DEFAULT_M4="$prog"
783 break
784 fi
785 done
786 IFS="$save_ifs"
787
788 test -n "$DEFAULT_M4" && break
789 done
790
791 # Generate a default definition for LEX. This is used if the makefile can't
792 # locate flex in objdir.
793
794 for prog in flex lex
795 do
796 set dummy $prog; tmp=$2
797 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
798 for dir in $PATH; do
799 test -z "$dir" && dir=.
800 if test -f $dir/$tmp; then
801 DEFAULT_LEX="$prog"
802 break
803 fi
804 done
805 IFS="$save_ifs"
806
807 test -n "$DEFAULT_LEX" && break
808 done
809
810 if [ "${build}" != "${host}" ]; then
811 # If we are doing a Canadian Cross, in which the host and build systems
812 # are not the same, we set reasonable default values for the tools.
813
814 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
815 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
816 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
817 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
818 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
819 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
820
821 for var in ${tools}; do
822 if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
823 sed -n -e ':loop
824 /\\$/ N
825 s/\\\n//g
826 t loop
827 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
828 < Makefile > Makefile.v
829 t=`tail -1 Makefile.v`
830 if [ -n "${t}" ]; then
831 eval "${var}='${t}'"
832 fi
833 rm -f Makefile.v
834 fi
835 done
836
837 AR=${AR-${host_alias}-ar}
838 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
839 AS=${AS-${host_alias}-as}
840 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
841 BISON=${BISON-bison}
842 CC=${CC-${host_alias}-gcc}
843 CFLAGS=${CFLAGS-"-g -O2"}
844 CXX=${CXX-${host_alias}-c++}
845 CXXFLAGS=${CXXFLAGS-"-g -O2"}
846 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
847 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
848 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
849 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
850 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
851 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
852 HOST_PREFIX=${build_alias}-
853 HOST_PREFIX_1=${build_alias}-
854 LD=${LD-${host_alias}-ld}
855 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
856 MAKEINFO=${MAKEINFO-makeinfo}
857 NM=${NM-${host_alias}-nm}
858 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
859 RANLIB=${RANLIB-${host_alias}-ranlib}
860 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
861 WINDRES=${WINDRES-${host_alias}-windres}
862 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
863
864 if [ -z "${YACC}" ]; then
865 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
866 for dir in $PATH; do
867 test -z "$dir" && dir=.
868 if test -f $dir/bison; then
869 YACC="bison -y"
870 break
871 fi
872 if test -f $dir/byacc; then
873 YACC=byacc
874 break
875 fi
876 if test -f $dir/yacc; then
877 YACC=yacc
878 break
879 fi
880 done
881 IFS="$save_ifs"
882 if [ -z "${YACC}" ]; then
883 YACC="bison -y"
884 fi
885 fi
886
887 if [ -z "${LEX}" ]; then
888 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
889 for dir in $PATH; do
890 test -z "$dir" && dir=.
891 if test -f $dir/flex; then
892 LEX=flex
893 break
894 fi
895 if test -f $dir/lex; then
896 LEX=lex
897 break
898 fi
899 done
900 IFS="$save_ifs"
901 LEX=${LEX-flex}
902 fi
903
904 # Export variables which autoconf might try to set.
905 export AS
906 export AR
907 export CC_FOR_BUILD
908 export DLLTOOL
909 export LD
910 export NM
911 export RANLIB
912 export WINDRES
913 else
914 # If CC is still not set, try to get gcc.
915 if [ -z "${CC}" ]; then
916 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
917 for dir in $PATH; do
918 test -z "$dir" && dir=.
919 if test -f $dir/gcc; then
920 CC="gcc"
921 echo 'void f(){}' > conftest.c
922 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
923 CFLAGS=${CFLAGS-"-g -O2"}
924 CXXFLAGS=${CXXFLAGS-"-g -O2"}
925 else
926 CFLAGS=${CFLAGS-"-O2"}
927 CXXFLAGS=${CXXFLAGS-"-O2"}
928 fi
929 rm -f conftest*
930 break
931 fi
932 done
933 IFS="$save_ifs"
934 CC=${CC-cc}
935 fi
936
937 CXX=${CXX-"c++"}
938 CFLAGS=${CFLAGS-"-g"}
939 CXXFLAGS=${CXXFLAGS-"-g -O2"}
940 fi
941
942 export CC
943 export CXX
944 export CFLAGS
945 export CXXFLAGS
946
947 # FIXME: This should be in configure.in, not configure
948 case "$host" in
949 *go32*)
950 enable_gdbtk=no ;;
951 *msdosdjgpp*)
952 enable_gdbtk=no ;;
953 *cygwin32*)
954 enable_gdbtk=no ;;
955 esac
956
957 # FIXME: This should be in configure.in, not configure
958 # Determine whether gdb needs tk/tcl or not.
959 if [ "$enable_gdbtk" != "no" ]; then
960 GDB_TK="all-tcl all-tk all-itcl all-tix"
961 else
962 GDB_TK=""
963 fi
964
965 for subdir in . ${subdirs} ; do
966
967 # ${subdir} is relative path from . to the directory we're currently
968 # configuring.
969 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
970 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
971
972 ### figure out what to do with srcdir
973 case "${srcdir}" in
974 ".") # no -srcdir option. We're building in place.
975 makesrcdir=. ;;
976 /*) # absolute path
977 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
978 ;;
979 *) # otherwise relative
980 case "${subdir}" in
981 .) makesrcdir=${srcdir} ;;
982 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
983 esac
984 ;;
985 esac
986
987 if [ "${subdir}/" != "./" ] ; then
988 Makefile=${subdir}/Makefile
989 fi
990
991 if [ ! -d ${subdir} ] ; then
992 if mkdir ${subdir} ; then
993 true
994 else
995 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
996 exit 1
997 fi
998 fi
999
1000 case "${removing}" in
1001 "")
1002 case "${subdir}" in
1003 .) ;;
1004 *) eval echo Building in ${subdir} ${redirect} ;;
1005 esac
1006
1007 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1008 # Set up the list of links to be made.
1009 # ${links} is the list of link names, and ${files} is the list of names to link to.
1010
1011 # Make the links.
1012 configlinks="${links}"
1013 if [ -r ${subdir}/config.status ] ; then
1014 mv -f ${subdir}/config.status ${subdir}/config.back
1015 fi
1016 while [ -n "${files}" ] ; do
1017 # set file to car of files, files to cdr of files
1018 set ${files}; file=$1; shift; files=$*
1019 set ${links}; link=$1; shift; links=$*
1020
1021 if [ ! -r ${srcdir}/${file} ] ; then
1022 if [ ! -r ${file} ] ; then
1023
1024 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1025 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1026 exit 1
1027 else
1028 srcfile=${file}
1029 fi
1030 else
1031 srcfile=${srcdir}/${file}
1032 fi
1033
1034 ${remove} -f ${link}
1035 # Make a symlink if possible, otherwise try a hard link
1036 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1037 true
1038 else
1039 # We need to re-remove the file because Lynx leaves a
1040 # very strange directory there when it fails an NFS symlink.
1041 ${remove} -r -f ${link}
1042 ${hard_link} ${srcfile} ${link}
1043 fi
1044 if [ ! -r ${link} ] ; then
1045 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1046 exit 1
1047 fi
1048
1049 echo "Linked \"${link}\" to \"${srcfile}\"."
1050 done
1051
1052 # Create a .gdbinit file which runs the one in srcdir
1053 # and tells GDB to look there for source files.
1054
1055 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1056 case ${srcdir} in
1057 .) ;;
1058 *) cat > ${subdir}/.gdbinit <<EOF
1059 # ${NO_EDIT}
1060 dir ${makesrcdir}
1061 dir .
1062 source ${makesrcdir}/.gdbinit
1063 EOF
1064 ;;
1065 esac
1066 fi
1067
1068 # Install a makefile, and make it set VPATH
1069 # if necessary so that the sources are found.
1070 # Also change its value of srcdir.
1071 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1072 # been somewhat optimized and is perhaps a bit twisty.
1073
1074 # code is order so as to try to sed the smallest input files we know.
1075 # so do these separately because I don't trust the order of sed -e expressions.
1076
1077 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1078 # package macros, target, host, site, and package rules.
1079
1080 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1081
1082 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1083 rm -f ${subdir}/${Makefile}.tem
1084 case "${package_makefile_rules_frag}" in
1085 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1086 *)
1087 if [ ! -f ${package_makefile_rules_frag} ] ; then
1088 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1089 fi
1090 if [ -f ${package_makefile_rules_frag} ] ; then
1091 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1092 else
1093 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1094 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1095 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1096 fi
1097 esac
1098 # working copy now in ${Makefile}.tem
1099
1100 # Conditionalize for this site.
1101 rm -f ${Makefile}
1102 case "${site}" in
1103 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1104 *)
1105 site_makefile_frag=${srcdir}/config/ms-${site}
1106
1107 if [ -f ${site_makefile_frag} ] ; then
1108 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1109 > ${Makefile}
1110 else
1111 mv ${subdir}/Makefile.tem ${Makefile}
1112 site_makefile_frag=
1113 fi
1114 ;;
1115 esac
1116 # working copy now in ${Makefile}
1117
1118 # Conditionalize the makefile for this host.
1119 rm -f ${subdir}/Makefile.tem
1120 case "${host_makefile_frag}" in
1121 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1122 *)
1123 if [ ! -f ${host_makefile_frag} ] ; then
1124 host_makefile_frag=${srcdir}/${host_makefile_frag}
1125 fi
1126 if [ -f ${host_makefile_frag} ] ; then
1127 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1128 else
1129 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1130 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1131 mv ${Makefile} ${subdir}/Makefile.tem
1132 fi
1133 esac
1134 # working copy now in ${subdir)/Makefile.tem
1135
1136 # Conditionalize the makefile for this target.
1137 rm -f ${Makefile}
1138 case "${target_makefile_frag}" in
1139 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1140 *)
1141 if [ ! -f ${target_makefile_frag} ] ; then
1142 target_makefile_frag=${srcdir}/${target_makefile_frag}
1143 fi
1144 if [ -f ${target_makefile_frag} ] ; then
1145 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1146 else
1147 mv ${subdir}/Makefile.tem ${Makefile}
1148 target_makefile_frag=
1149 fi
1150 ;;
1151 esac
1152 # working copy now in ${Makefile}
1153
1154 # Emit the default values of this package's macros.
1155 rm -f ${subdir}/Makefile.tem
1156 case "${package_makefile_frag}" in
1157 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1158 *)
1159 if [ ! -f ${package_makefile_frag} ] ; then
1160 package_makefile_frag=${srcdir}/${package_makefile_frag}
1161 fi
1162 if [ -f ${package_makefile_frag} ] ; then
1163 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1164 else
1165 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1166 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1167 mv ${Makefile} ${subdir}/Makefile.tem
1168 fi
1169 esac
1170 # real copy now in ${subdir}/Makefile.tem
1171
1172 # prepend warning about editting, and a bunch of variables.
1173 rm -f ${Makefile}
1174 cat > ${Makefile} <<EOF
1175 # ${NO_EDIT}
1176 VPATH = ${makesrcdir}
1177 links = ${configlinks}
1178 host_alias = ${host_alias}
1179 host_cpu = ${host_cpu}
1180 host_vendor = ${host_vendor}
1181 host_os = ${host_os}
1182 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1183 target_alias = ${target_alias}
1184 target_cpu = ${target_cpu}
1185 target_vendor = ${target_vendor}
1186 target_os = ${target_os}
1187 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1188 EOF
1189 case "${build}" in
1190 "") ;;
1191 *) cat >> ${Makefile} << EOF
1192 build_alias = ${build_alias}
1193 build_cpu = ${build_cpu}
1194 build_vendor = ${build_vendor}
1195 build_os = ${build_os}
1196 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1197 EOF
1198 esac
1199
1200 case "${package_makefile_frag}" in
1201 "") ;;
1202 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1203 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1204 esac
1205
1206 case "${target_makefile_frag}" in
1207 "") ;;
1208 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1209 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1210 esac
1211
1212 case "${host_makefile_frag}" in
1213 "") ;;
1214 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1215 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1216 esac
1217
1218 if [ "${site_makefile_frag}" != "" ] ; then
1219 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1220 fi
1221
1222 # provide a proper gxx_include_dir to all subdirs.
1223 # Note, if you change the default, make sure to fix both here
1224 # and in the gcc subdirectory.
1225 if test -z "${with_gxx_include_dir}"; then
1226 echo gxx_include_dir = '${prefix}/include/g++' >> ${Makefile}
1227 else
1228 echo gxx_include_dir = ${with_gxx_include_dir} >> ${Makefile}
1229 fi
1230
1231 # record if we want to build shared libs.
1232 if test -z "${enable_shared}"; then
1233 echo enable_shared = no >> ${Makefile}
1234 else
1235 echo enable_shared = ${enable_shared} >> ${Makefile}
1236 fi
1237
1238 # Emit a macro which is used to build the libsubdir macro where
1239 # compiler specific stuff can be found/installed.
1240 # FIXME: This works only if gcc's sources are available in a gcc
1241 # subdirectory!
1242 echo gcc_version = ${gcc_version} >> ${Makefile}
1243
1244 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1245 # remove any form feeds.
1246 if [ -z "${subdirs}" ]; then
1247 rm -f ${subdir}/Makefile.tm2
1248 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1249 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1250 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1251 rm -f ${subdir}/Makefile.tem
1252 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1253 fi
1254 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1255 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1256 -e "/^CC[ ]*=/{
1257 :loop1
1258 /\\\\$/ N
1259 s/\\\\\\n//g
1260 t loop1
1261 s%^CC[ ]*=.*$%CC = ${CC}%
1262 }" \
1263 -e "/^CXX[ ]*=/{
1264 :loop2
1265 /\\\\$/ N
1266 s/\\\\\\n//g
1267 t loop2
1268 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1269 }" \
1270 -e "/^CFLAGS[ ]*=/{
1271 :loop3
1272 /\\\\$/ N
1273 s/\\\\\\n//g
1274 t loop3
1275 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1276 }" \
1277 -e "/^CXXFLAGS[ ]*=/{
1278 :loop4
1279 /\\\\$/ N
1280 s/\\\\\\n//g
1281 t loop4
1282 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1283 }" \
1284 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
1285 -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" \
1286 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1287 -e "s/\f//" \
1288 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1289 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1290 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1291 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1292 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1293 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1294 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1295 ${subdir}/Makefile.tem >> ${Makefile}
1296
1297 # If this is a Canadian Cross, preset the values of many more
1298 # tools.
1299 if [ "${build}" != "${host}" ]; then
1300 for var in ${tools}; do
1301 val=`eval 'echo $'"${var}"`
1302 sed -e "/^${var}[ ]*=/{
1303 :loop1
1304 /\\\\$/ N
1305 /\\\\$/ b loop1
1306 s/\\\\\\n//g
1307 s%^${var}[ ]*=.*$%${var} = ${val}%
1308 }" ${Makefile} > ${Makefile}.tem
1309 mv -f ${Makefile}.tem ${Makefile}
1310 done
1311 fi
1312
1313 # final copy now in ${Makefile}
1314
1315 else
1316 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1317 fi
1318
1319 rm -f ${subdir}/Makefile.tem
1320
1321 case "${host_makefile_frag}" in
1322 "") using= ;;
1323 *) using="and \"${host_makefile_frag}\"" ;;
1324 esac
1325
1326 case "${target_makefile_frag}" in
1327 "") ;;
1328 *) using="${using} and \"${target_makefile_frag}\"" ;;
1329 esac
1330
1331 case "${site_makefile_frag}" in
1332 "") ;;
1333 *) using="${using} and \"${site_makefile_frag}\"" ;;
1334 esac
1335
1336 newusing=`echo "${using}" | sed 's/and/using/'`
1337 using=${newusing}
1338 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1339
1340 . ${tmpfile}.pos
1341
1342 # describe the chosen configuration in config.status.
1343 # Make that file a shellscript which will reestablish
1344 # the same configuration. Used in Makefiles to rebuild
1345 # Makefiles.
1346
1347 case "${norecursion}" in
1348 "") arguments="${arguments} --norecursion" ;;
1349 *) ;;
1350 esac
1351
1352 if [ ${subdir} = . ] ; then
1353 echo "#!/bin/sh
1354 # ${NO_EDIT}
1355 # This directory was configured as follows:
1356 ${progname}" ${arguments} "
1357 # ${using}" > ${subdir}/config.new
1358 else
1359 echo "#!/bin/sh
1360 # ${NO_EDIT}
1361 # This directory was configured as follows:
1362 cd ${invsubdir}
1363 ${progname}" ${arguments} "
1364 # ${using}" > ${subdir}/config.new
1365 fi
1366 chmod a+x ${subdir}/config.new
1367 if [ -r ${subdir}/config.back ] ; then
1368 mv -f ${subdir}/config.back ${subdir}/config.status
1369 fi
1370 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1371 ;;
1372
1373 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1374 esac
1375 done
1376
1377 # If there are subdirectories, then recur.
1378 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1379 for configdir in ${configdirs} ; do
1380
1381 if [ -d ${srcdir}/${configdir} ] ; then
1382 eval echo Configuring ${configdir}... ${redirect}
1383 case "${srcdir}" in
1384 ".") ;;
1385 *)
1386 if [ ! -d ./${configdir} ] ; then
1387 if mkdir ./${configdir} ; then
1388 true
1389 else
1390 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1391 exit 1
1392 fi
1393 fi
1394 ;;
1395 esac
1396
1397 POPDIR=${PWD=`pwd`}
1398 cd ${configdir}
1399
1400 ### figure out what to do with srcdir
1401 case "${srcdir}" in
1402 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1403 /*) # absolute path
1404 newsrcdir=${srcdir}/${configdir}
1405 srcdiroption="--srcdir=${newsrcdir}"
1406 ;;
1407 ?:*) # absolute path on win32
1408 newsrcdir=${srcdir}/${configdir}
1409 srcdiroption="--srcdir=${newsrcdir}"
1410 ;;
1411 *) # otherwise relative
1412 newsrcdir=../${srcdir}/${configdir}
1413 srcdiroption="--srcdir=${newsrcdir}"
1414 ;;
1415 esac
1416
1417 # Handle --cache-file=../XXX
1418 case "${cache_file}" in
1419 "") # empty
1420 ;;
1421 /*) # absolute path
1422 cache_file_option="--cache-file=${cache_file}"
1423 ;;
1424 ?:*) # absolute path on win32
1425 cache_file_option="--cache-file=${cache_file}"
1426 ;;
1427 *) # relative path
1428 cache_file_option="--cache-file=../${cache_file}"
1429 ;;
1430 esac
1431
1432 ### check for guested configure, otherwise fix possibly relative progname
1433 if [ -f ${newsrcdir}/configure ] ; then
1434 recprog=${newsrcdir}/configure
1435 elif [ -f ${newsrcdir}/configure.in ] ; then
1436 case "${progname}" in
1437 /*) recprog=${progname} ;;
1438 ?:*) recprog=${progname} ;;
1439 *) recprog=../${progname} ;;
1440 esac
1441 else
1442 eval echo No configuration information in ${configdir} ${redirect}
1443 recprog=
1444 fi
1445
1446 ### The recursion line is here.
1447 if [ ! -z "${recprog}" ] ; then
1448 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1449 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1450 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1451 true
1452 else
1453 echo Configure in `pwd` failed, exiting. 1>&2
1454 exit 1
1455 fi
1456 fi
1457
1458 cd ${POPDIR}
1459 fi
1460 done
1461 fi
1462
1463 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1464 # and reset the trap handler.
1465 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1466 trap 0
1467
1468 exit 0
1469
1470 #
1471 # Local Variables:
1472 # fill-column: 131
1473 # End:
1474 #
1475
1476 # end of configure
This page took 0.111932 seconds and 5 git commands to generate.