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