2002-11-29 Nathanael Nerode <neroden@gcc.gnu.org>
[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, 95, 96, 97, 98, 1999, 2000, 2001,
7 # 2002 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 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'
104
105 ### we might need to use some other shell than /bin/sh for running subshells
106
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
127 fi
128 done
129 IFS="$save_ifs"
130 test -n "${CONFIG_SHELL}" && break
131 done
132 fi
133 fi
134 fi
135 ;;
136 esac
137
138 config_shell=${CONFIG_SHELL-/bin/sh}
139
140 NO_EDIT="This file was generated automatically by configure. Do not edit."
141
142 ## this is a little touchy and won't always work, but...
143 ##
144 ## if the argv[0] starts with a slash then it is an absolute name that can (and
145 ## must) be used as is.
146 ##
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.
149 ##
150
151 progname=$0
152 # if PWD already has a value, it is probably wrong.
153 if [ -n "$PWD" ]; then PWD=`${PWDCMD-pwd}`; fi
154
155 case "${progname}" in
156 /* | [A-Za-z]:[\\/]* ) ;;
157 */*) ;;
158 *)
159 PATH=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH
160 ;;
161 esac
162
163 # Export original configure arguments for use by sub-configures.
164 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
165 export TOPLEVEL_CONFIGURE_ARGUMENTS
166
167 # Loop over all args
168
169 while :
170 do
171
172 # Break out if there are no more args
173 case $# in
174 0)
175 break
176 ;;
177 esac
178
179 # Get the first arg, and shuffle
180 option=$1
181 shift
182
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
189
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"
195 ;;
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"
202 ;;
203 --v)
204 arguments="$arguments -v"
205 ;;
206 --*)
207 arguments="$arguments $option"
208 ;;
209 esac
210
211 # Now, process the options
212 case $option in
213
214 --bi*)
215 bindir=$optarg
216 diroptions="$diroptions --bindir=$optarg"
217 ;;
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
223 ;;
224 esac
225 ;;
226 --cache*)
227 cache_file=$optarg
228 ;;
229 --da*)
230 datadir=$optarg
231 diroptions="$diroptions --datadir=$optarg"
232 ;;
233 --disable-*)
234 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
235 eval $enableopt=no
236 disableoptions="$disableoptions $option"
237 ;;
238 --enable-*)
239 case "$option" in
240 *=*) ;;
241 *) optarg=yes ;;
242 esac
243
244 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
245 eval "$enableopt=\$optarg"
246 enableoptions="$enableoptions '$option'"
247 ;;
248 --exec-prefix* | --ex*)
249 exec_prefix=$optarg
250 exec_prefixoption="--exec-prefix=$optarg"
251 ;;
252 --gas | --g*)
253 gas=yes
254 ;;
255 --help | --he*)
256 fatal=yes
257 ;;
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
263 ;;
264 esac
265 ;;
266 --inc*)
267 includedir=$optarg
268 diroptions="$diroptions --includedir=$optarg"
269 ;;
270 --inf*)
271 infodir=$optarg
272 diroptions="$diroptions --infodir=$optarg"
273 ;;
274 --libd*)
275 libdir=$optarg
276 diroptions="$diroptions --libdir=$optarg"
277 ;;
278 --libe*)
279 libexecdir=$optarg
280 diroptions="$diroptions --libexecdir=$optarg"
281 ;;
282 --lo*)
283 localstatedir=$optarg
284 diroptions="$diroptions --localstatedir=$optarg"
285 ;;
286 --ma*)
287 mandir=$optarg
288 diroptions="$diroptions --mandir=$optarg"
289 ;;
290 --nfp | --nf*)
291 floating_point=no
292 floating_pointoption="--nfp"
293 ;;
294 --norecursion | --no*)
295 norecursion=yes
296 ;;
297 --ol*)
298 oldincludedir=$optarg
299 diroptions="$diroptions --oldincludedir=$optarg"
300 ;;
301 --prefix* | --pre*)
302 prefix=$optarg
303 prefixoption="--prefix=$optarg"
304 ;;
305 --program-prefix* | --program-p*)
306 program_prefix=$optarg
307 program_prefixoption="--program-prefix=$optarg"
308 ;;
309 --program-suffix* | --program-s*)
310 program_suffix=$optarg
311 program_suffixoption="--program-suffix=$optarg"
312 ;;
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'"
317 ;;
318 --sb*)
319 sbindir=$optarg
320 diroptions="$diroptions --sbindir=$optarg"
321 ;;
322 --sh*)
323 sharedstatedir=$optarg
324 diroptions="$diroptions --sharedstatedir=$optarg"
325 ;;
326 --silent | --sil* | --quiet | --q*)
327 redirect=">/dev/null"
328 verbose=--silent
329 ;;
330 --site* | --sit*)
331 site=$optarg
332 site_option="--site=$optarg"
333 ;;
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:/$::'`
340 ;;
341 --srcdir* | --sr*)
342 srcdir=$optarg
343 ;;
344 --sy*)
345 sysconfdir=$optarg
346 diroptions="$diroptions --sysconfdir=$optarg"
347 ;;
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
353 ;;
354 esac
355 ;;
356 --tmpdir* | --tm*)
357 TMPDIR=$optarg
358 tmpdiroption="--tmpdir=$optarg"
359 ;;
360 --verbose | --v | --verb*)
361 redirect=
362 verbose=--verbose
363 ;;
364 --version | --V | --vers*)
365 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
366 exit 0
367 ;;
368 --with-*)
369 case "$option" in
370 *=*) ;;
371 *) optarg=yes ;;
372 esac
373
374 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
375 eval $withopt="\$optarg"
376 withoptions="$withoptions $option"
377 ;;
378 --without-*)
379 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
380 eval $withopt=no
381 withoutoptions="$withoutoptions $option"
382 ;;
383 --x) with_x=yes
384 withoptions="$withoptions --with-x"
385 ;;
386 --x-i* | --x-l*) other_options="$other_options $orig_option"
387 ;;
388 --*)
389 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
390 exit 1
391 ;;
392 *)
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
397 ;;
398 esac
399 ;;
400 esac
401 done
402
403 # process host and target
404
405 # Do some error checking and defaulting for the host and target type.
406 # The inputs are:
407 # configure --host=HOST --target=TARGET UNDEFS
408 #
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.
417
418 case "${fatal}" in
419 "")
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)
424 ;;
425 *) echo '***' Can only configure for one host and one target at a time. 1>&2
426 fatal=yes
427 break 2
428 ;;
429 esac
430
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) ;;
448 *)
449 if expr $host_alias : $target_alias >/dev/null
450 then
451 host_alias=$target_alias
452 fi
453 ;;
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
460 fi
461 ;;
462 *)
463 host_alias=$undefs
464 arguments="--host=$host_alias $arguments"
465 undefs=NOUNDEFS
466 ;;
467 esac
468 esac
469
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
477 ;;
478 *)
479 target_alias=$undefs
480 arguments="--target=$target_alias $arguments"
481 ;;
482 esac
483 esac
484 ;;
485 *) ;;
486 esac
487
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
516 fi
517
518 exit 1
519 fi
520
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}`
525
526
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
533 fi
534
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
541 fi
542 rm -f config.junk config.trash
543
544 case "${srcdir}" in
545 "")
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
554 fi
555 fi
556 ;;
557 *)
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
563 fi
564 pwd=`${PWDCMD-pwd}`
565 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
566 if [ "${pwd}" = "${srcpwd}" ] ; then
567 srcdir=.
568 fi
569 esac
570
571 ### warn about some conflicting configurations.
572
573 case "${srcdir}" in
574 ".") ;;
575 *)
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
579 fi
580 esac
581
582 # default exec_prefix
583 case "${exec_prefixoption}" in
584 "") exec_prefix="\$(prefix)" ;;
585 *) ;;
586 esac
587
588 # Define the trigger file to make sure configure will re-run whenever
589 # the gcc version number changes.
590 if [ "${with_gcc_version_trigger+set}" = set ]; then
591 gcc_version_trigger="$with_gcc_version_trigger"
592 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
593 else
594 # If gcc's sources are available, define the trigger file.
595 if [ -f ${topsrcdir}/gcc/version.c ] ; then
596 gcc_version_trigger=${topsrcdir}/gcc/version.c
597 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
598 case "$arguments" in
599 *--with-gcc-version-trigger=$gcc_version_trigger* )
600 ;;
601 * )
602 # Make sure configure.in knows about this.
603 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
604 ;;
605 esac
606 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
607 fi
608 fi
609
610 ### break up ${srcdir}/configure.in.
611 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
612 "")
613 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
614 # Check for a directory that's been converted to use autoconf since
615 # it was last configured.
616 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
617 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
618 if [ -r ${srcdir}/configure ] ; then
619 echo '***' Running the local configure script. 1>&2
620 case "${cache_file}" in
621 "") cache_file_option= ;;
622 *) cache_file_option="--cache-file=${cache_file}" ;;
623 esac
624 srcdiroption="--srcdir=${srcdir}"
625 case "${build_alias}" in
626 "") buildopt= ;;
627 *) buildopt="--build=${build_alias}" ;;
628 esac
629 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
630 ${buildopt} --host=${host_alias} --target=${target_alias} \
631 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
632 ${srcdiroption} ${diroptions} \
633 ${program_prefixoption} ${program_suffixoption} \
634 ${program_transform_nameoption} ${site_option} \
635 ${withoptions} ${withoutoptions} \
636 ${enableoptions} ${disableoptions} ${floating_pointoption} \
637 ${cache_file_option} ${other_options} ${redirect}
638 else
639 echo '***' There is no configure script present though. 1>&2
640 fi
641 fi
642 exit 1
643 ;;
644 *) ;;
645 esac
646
647 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
648 "")
649 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
650 exit 1
651 ;;
652 *) ;;
653 esac
654
655 case "${TMPDIR}" in
656 "") TMPDIR=/tmp ; export TMPDIR ;;
657 *) ;;
658 esac
659
660 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
661 tmpdir=${TMPDIR}/cNf$$
662 mkdir ${tmpdir} || exit 1
663 tmpfile=${tmpdir}/cNf$$
664 # Note that under many versions of sh a trap handler for 0 will *override* any
665 # exit status you explicitly specify! At this point, the only non-error exit
666 # is at the end of the script; these actions are duplicated there, minus
667 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
668 # trap handler, or you'll lose.
669 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
670
671 # split ${srcdir}/configure.in into common, per-host, per-target,
672 # and post-target parts. Post-target is optional.
673 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
674 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
675 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
676 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
677 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
678 else
679 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
680 echo >${tmpfile}.pos
681 fi
682
683 ### do common part of configure.in
684
685 # If the language specific compiler does not exist, but the "gcc" directory does,
686 # we will skip this directory; in this case the sub-directory's common part
687 # of configure.in will create a small shell script "skip-this-dir" containing
688 # commands to completely clean up any temporary or created files.
689
690 . ${tmpfile}.com
691
692 if test -f skip-this-dir; then
693 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
694 # and reset the trap handler.
695 trap 0
696 rm -rf Makefile* ${tmpdir}
697 # Execute the final clean-up actions
698 ${config_shell} skip-this-dir
699 # and stop configuring this directory.
700 exit 0
701 fi
702
703 # some sanity checks on configure.in
704 case "${srctrigger}" in
705 "")
706 echo '***' srctrigger not set in ${PWD=`${PWDCMD-pwd}`}/configure.in. 1>&2
707 exit 1
708 ;;
709 *) ;;
710 esac
711
712 case "${build_alias}" in
713 "")
714 if result=`${config_shell} ${configsub} ${host_alias}` ; then
715 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
716 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
717 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
718 build=${build_cpu}-${build_vendor}-${build_os}
719 build_alias=${host_alias}
720 fi
721 ;;
722 *)
723 if result=`${config_shell} ${configsub} ${build_alias}` ; then
724 buildopt="--build=${build_alias}"
725 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
726 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
727 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
728 build=${build_cpu}-${build_vendor}-${build_os}
729 else
730 echo "Unrecognized build system name ${build_alias}." 1>&2
731 exit 1
732 fi
733 ;;
734 esac
735
736 if result=`${config_shell} ${configsub} ${host_alias}` ; then
737 true
738 else
739 echo "Unrecognized host system name ${host_alias}." 1>&2
740 exit 1
741 fi
742 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
743 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
744 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
745 host=${host_cpu}-${host_vendor}-${host_os}
746
747 . ${tmpfile}.hst
748
749 if result=`${config_shell} ${configsub} ${target_alias}` ; then
750 true
751 else
752 echo "Unrecognized target system name ${target_alias}." 1>&2
753 exit 1
754 fi
755 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
756 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
757 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
758 target=${target_cpu}-${target_vendor}-${target_os}
759
760 . ${tmpfile}.tgt
761
762 # Find the source files, if location was not specified.
763 case "${srcdir}" in
764 "")
765 srcdirdefaulted=1
766 srcdir=.
767 if [ ! -r ${srctrigger} ] ; then
768 srcdir=..
769 fi
770 ;;
771 *) ;;
772 esac
773
774 if [ ! -r ${srcdir}/${srctrigger} ] ; then
775 case "${srcdirdefaulted}" in
776 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;;
777 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;;
778 esac
779
780 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
781 exit 1
782 fi
783
784 # Some systems (e.g., one of the i386-aix systems the gas testers are
785 # using) don't handle "\$" correctly, so don't use it here.
786 tooldir='$(exec_prefix)'/${target_alias}
787
788 if [ "${host_alias}" != "${target_alias}" ] ; then
789 if [ "${program_prefixoption}" = "" ] ; then
790 if [ "${program_suffixoption}" = "" ] ; then
791 if [ "${program_transform_nameoption}" = "" ] ; then
792 program_prefix=${target_alias}- ;
793 fi
794 fi
795 fi
796 fi
797
798 # Merge program_prefix and program_suffix onto program_transform_name.
799 # (program_suffix used to use $, but it's hard to preserve $ through both
800 # make and sh.)
801 if [ "${program_suffix}" != "" ] ; then
802 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
803 fi
804
805 if [ "${program_prefix}" != "" ] ; then
806 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
807 fi
808
809 # If CC and CXX are not set in the environment, and the Makefile
810 # exists, try to extract them from it. This is to handle running
811 # ./config.status by hand.
812 if [ -z "${CC}" ] && [ -r Makefile ]; then
813 sed -n -e ':loop
814 /\\$/ N
815 s/\\\n//g
816 t loop
817 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
818 CC=`tail -1 Makefile.cc`
819 rm -f Makefile.cc
820 fi
821
822 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
823 sed -n -e ':loop
824 /\\$/ N
825 s/\\\n//g
826 t loop
827 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
828 CFLAGS=`tail -1 Makefile.cc`
829 rm -f Makefile.cc
830 fi
831
832 if [ -z "${CXX}" ] && [ -r Makefile ]; then
833 sed -n -e ':loop
834 /\\$/ N
835 s/\\\n//g
836 t loop
837 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
838 CXX=`tail -1 Makefile.cc`
839 rm -f Makefile.cc
840 fi
841
842 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
843 sed -n -e ':loop
844 /\\$/ N
845 s/\\\n//g
846 t loop
847 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
848 CXXFLAGS=`tail -1 Makefile.cc`
849 rm -f Makefile.cc
850 fi
851
852 # Generate a default definition for YACC. This is used if the makefile can't
853 # locate bison or byacc in objdir.
854
855 for prog in 'bison -y' byacc yacc
856 do
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_YACC="$prog"
863 break
864 fi
865 done
866 IFS="$save_ifs"
867
868 test -n "$DEFAULT_YACC" && break
869 done
870
871 # Generate a default definition for M4. This is used if the makefile can't
872 # locate m4 in objdir.
873
874 for prog in gm4 gnum4 m4
875 do
876 set dummy $prog; tmp=$2
877 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
878 for dir in $PATH; do
879 test -z "$dir" && dir=.
880 if test -f $dir/$tmp; then
881 DEFAULT_M4="$prog"
882 break
883 fi
884 done
885 IFS="$save_ifs"
886
887 test -n "$DEFAULT_M4" && break
888 done
889
890 # Generate a default definition for LEX. This is used if the makefile can't
891 # locate flex in objdir.
892
893 for prog in flex lex
894 do
895 set dummy $prog; tmp=$2
896 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
897 for dir in $PATH; do
898 test -z "$dir" && dir=.
899 if test -f $dir/$tmp; then
900 DEFAULT_LEX="$prog"
901 break
902 fi
903 done
904 IFS="$save_ifs"
905
906 test -n "$DEFAULT_LEX" && break
907 done
908
909
910 if [ "${build}" != "${host}" ]; then
911 # If we are doing a Canadian Cross, in which the host and build systems
912 # are not the same, we set reasonable default values for the tools.
913 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
914 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
915 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
916 tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
917 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
918 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
919 tools="${tools} OBJCOPY OBJDUMP"
920
921 for var in ${tools}; do
922 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
923 sed -n -e ':loop
924 /\\$/ N
925 s/\\\n//g
926 t loop
927 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
928 < Makefile > Makefile.v
929 t=`tail -1 Makefile.v`
930 if [ -n "${t}" ]; then
931 eval "${var}=\${t}"
932 fi
933 rm -f Makefile.v
934 fi
935 done
936
937 AR=${AR-${host_alias}-ar}
938 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
939 AS=${AS-${host_alias}-as}
940 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
941 BISON=${BISON-bison}
942 CC=${CC-${host_alias}-gcc}
943 CFLAGS=${CFLAGS-"-g -O2"}
944 CXX=${CXX-${host_alias}-c++}
945 CXXFLAGS=${CXXFLAGS-"-g -O2"}
946 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
947 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
948 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
949 GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
950 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
951 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
952 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
953 BUILD_PREFIX=${build_alias}-
954 BUILD_PREFIX_1=${build_alias}-
955 LD=${LD-${host_alias}-ld}
956 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
957 MAKEINFO=${MAKEINFO-makeinfo}
958 NM=${NM-${host_alias}-nm}
959 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
960 RANLIB=${RANLIB-${host_alias}-ranlib}
961 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
962 WINDRES=${WINDRES-${host_alias}-windres}
963 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
964 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
965 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
966
967 if [ -z "${YACC}" ]; then
968 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
969 for dir in $PATH; do
970 test -z "$dir" && dir=.
971 if test -f $dir/bison; then
972 YACC="bison -y"
973 break
974 fi
975 if test -f $dir/byacc; then
976 YACC=byacc
977 break
978 fi
979 if test -f $dir/yacc; then
980 YACC=yacc
981 break
982 fi
983 done
984 IFS="$save_ifs"
985 if [ -z "${YACC}" ]; then
986 YACC="bison -y"
987 fi
988 fi
989
990 if [ -z "${LEX}" ]; then
991 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
992 for dir in $PATH; do
993 test -z "$dir" && dir=.
994 if test -f $dir/flex; then
995 LEX=flex
996 break
997 fi
998 if test -f $dir/lex; then
999 LEX=lex
1000 break
1001 fi
1002 done
1003 IFS="$save_ifs"
1004 LEX=${LEX-flex}
1005 fi
1006
1007 # Export variables which autoconf might try to set.
1008 export AS
1009 export AR
1010 export CC_FOR_BUILD
1011 export DLLTOOL
1012 export LD
1013 export NM
1014 export RANLIB
1015 export WINDRES
1016 export OBJCOPY
1017 export OBJDUMP
1018 else
1019 # Set reasonable default values for some tools even if not Canadian.
1020 # Of course, these are different reasonable default values, originally
1021 # specified directly in the Makefile.
1022 # We don't export, so that autoconf can do its job.
1023 # Note that all these settings are above the fragment inclusion point
1024 # in Makefile.in, so can still be overridden by fragments.
1025 # This is all going to change when we autoconfiscate...
1026
1027 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
1028 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
1029 tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
1030 tools="${tools} NM_FOR_TARGET RANLIB_FOR_TARGET"
1031 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
1032
1033 AR=ar
1034 AR_FOR_TARGET='\$(USUAL_AR_FOR_TARGET)'
1035 AS=as
1036 AS_FOR_TARGET='\$(USUAL_AS_FOR_TARGET)'
1037 BISON='$(USUAL_BISON)'
1038 CC_FOR_BUILD='\$(CC)'
1039 DLLTOOL=dlltool
1040 DLLTOOL_FOR_TARGET='\$(USUAL_DLLTOOL_FOR_TARGET)'
1041 GCC_FOR_TARGET='\$(USUAL_GCC_FOR_TARGET)'
1042 BUILD_PREFIX=
1043 BUILD_PREFIX_1=loser-
1044 LD=ld
1045 LD_FOR_TARGET='\$(USUAL_LD_FOR_TARGET)'
1046 MAKEINFO='\$(USUAL_MAKEINFO)'
1047 NM=nm
1048 NM_FOR_TARGET='\$(USUAL_NM_FOR_TARGET)'
1049 RANLIB_FOR_TARGET='\$(USUAL_RANLIB_FOR_TARGET)'
1050 WINDRES=windres
1051 WINDRES_FOR_TARGET='\$(USUAL_WINDRES_FOR_TARGET)'
1052 LEX='\$(USUAL_LEX)'
1053 YACC='\$(USUAL_YACC)'
1054
1055 # If CC is still not set, try to get gcc.
1056 if [ -z "${CC}" ]; then
1057 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1058 for dir in $PATH; do
1059 test -z "$dir" && dir=.
1060 if test -f $dir/gcc; then
1061 CC="gcc"
1062 echo 'void f(){}' > conftest.c
1063 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1064 CFLAGS=${CFLAGS-"-g -O2"}
1065 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1066 else
1067 CFLAGS=${CFLAGS-"-O2"}
1068 CXXFLAGS=${CXXFLAGS-"-O2"}
1069 fi
1070 rm -f conftest*
1071 break
1072 fi
1073 done
1074 IFS="$save_ifs"
1075 CC=${CC-cc}
1076 else
1077 if test -z "${CFLAGS}"; then
1078 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1079 # is set to a version of gcc.
1080 case "${CC}" in
1081 *gcc)
1082 echo 'void f(){}' > conftest.c
1083 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1084 CFLAGS=${CFLAGS-"-g -O2"}
1085 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1086 else
1087 CFLAGS=${CFLAGS-"-O2"}
1088 CXXFLAGS=${CXXFLAGS-"-O2"}
1089 fi
1090 rm -f conftest*
1091 ;;
1092 esac
1093 fi
1094 fi
1095
1096 CXX=${CXX-"c++"}
1097 CFLAGS=${CFLAGS-"-g"}
1098 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1099 fi
1100
1101 export CC
1102 export CXX
1103 export CFLAGS
1104 export CXXFLAGS
1105
1106 all_build_modules=
1107 if test x"${build_alias}" != x"${host_alias}"
1108 then
1109 all_build_modules='$(ALL_BUILD_MODULES_LIST)'
1110 fi
1111
1112 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1113 # Set up the list of links to be made.
1114 # ${links} is the list of link names, and ${files} is the list of names to link to.
1115
1116 # Make the links.
1117 configlinks="${links}"
1118 if [ -r ./config.status ] ; then
1119 mv -f ./config.status ./config.back
1120 fi
1121 while [ -n "${files}" ] ; do
1122 # set file to car of files, files to cdr of files
1123 set ${files}; file=$1; shift; files=$*
1124 set ${links}; link=$1; shift; links=$*
1125
1126 if [ ! -r ${srcdir}/${file} ] ; then
1127 if [ ! -r ${file} ] ; then
1128 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1129 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1130 exit 1
1131 else
1132 srcfile=${file}
1133 fi
1134 else
1135 srcfile=${srcdir}/${file}
1136 fi
1137
1138 ${remove} -f ${link}
1139 # Make a symlink if possible, otherwise try a hard link
1140 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1141 true
1142 else
1143 # We need to re-remove the file because Lynx leaves a
1144 # very strange directory there when it fails an NFS symlink.
1145 ${remove} -r -f ${link}
1146 ${hard_link} ${srcfile} ${link}
1147 fi
1148 if [ ! -r ${link} ] ; then
1149 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1150 exit 1
1151 fi
1152
1153 echo "Linked \"${link}\" to \"${srcfile}\"."
1154 done
1155
1156 # Create a .gdbinit file which runs the one in srcdir
1157 # and tells GDB to look there for source files.
1158
1159 if [ -r ${srcdir}/.gdbinit ] ; then
1160 case ${srcdir} in
1161 .) ;;
1162 *) cat > ./.gdbinit <<EOF
1163 # ${NO_EDIT}
1164 dir ${srcdir}
1165 dir .
1166 source ${srcdir}/.gdbinit
1167 EOF
1168 ;;
1169 esac
1170 fi
1171
1172 # Install a makefile, and make it set VPATH
1173 # if necessary so that the sources are found.
1174 # Also change its value of srcdir.
1175 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1176 # been somewhat optimized and is perhaps a bit twisty.
1177
1178 # code is order so as to try to sed the smallest input files we know.
1179 # so do these separately because I don't trust the order of sed -e expressions.
1180
1181 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1182 # package macros, target, host, site, and package rules.
1183
1184 if [ -f ${srcdir}/${Makefile_in} ] ; then
1185
1186 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1187 rm -f ./${Makefile}.tem
1188 case "${package_makefile_rules_frag}" in
1189 "") cp ${srcdir}/${Makefile_in} ./Makefile.tem ;;
1190 *)
1191 if [ ! -f ${package_makefile_rules_frag} ] ; then
1192 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1193 fi
1194 if [ -f ${package_makefile_rules_frag} ] ; then
1195 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${Makefile_in} > ${Makefile}.tem
1196 else
1197 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1198 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1199 cp ${srcdir}/${Makefile_in} ./Makefile.tem
1200 fi
1201 esac
1202 # working copy now in ${Makefile}.tem
1203
1204 # Conditionalize for this site.
1205 rm -f ${Makefile}
1206 case "${site}" in
1207 "") mv ./Makefile.tem ${Makefile} ;;
1208 *)
1209 site_makefile_frag=${srcdir}/config/ms-${site}
1210
1211 if [ -f ${site_makefile_frag} ] ; then
1212 sed -e "/^####/ r ${site_makefile_frag}" ./Makefile.tem > ${Makefile}
1213 else
1214 mv ./Makefile.tem ${Makefile}
1215 site_makefile_frag=
1216 fi
1217 ;;
1218 esac
1219 # working copy now in ${Makefile}
1220
1221 # Conditionalize the makefile for this host.
1222 rm -f ./Makefile.tem
1223 case "${host_makefile_frag}" in
1224 "") mv ${Makefile} ./Makefile.tem ;;
1225 *)
1226 if [ ! -f ${host_makefile_frag} ] ; then
1227 host_makefile_frag=${srcdir}/${host_makefile_frag}
1228 fi
1229 if [ -f ${host_makefile_frag} ] ; then
1230 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ./Makefile.tem
1231 else
1232 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1233 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1234 mv ${Makefile} ./Makefile.tem
1235 fi
1236 esac
1237 # working copy now in ./Makefile.tem
1238
1239 # Conditionalize the makefile for this target.
1240 rm -f ${Makefile}
1241 case "${target_makefile_frag}" in
1242 "") mv ./Makefile.tem ${Makefile} ;;
1243 *)
1244 if [ ! -f ${target_makefile_frag} ] ; then
1245 target_makefile_frag=${srcdir}/${target_makefile_frag}
1246 fi
1247 if [ -f ${target_makefile_frag} ] ; then
1248 sed -e "/^####/ r ${target_makefile_frag}" ./Makefile.tem > ${Makefile}
1249 else
1250 mv ./Makefile.tem ${Makefile}
1251 target_makefile_frag=
1252 fi
1253 ;;
1254 esac
1255 # working copy now in ${Makefile}
1256
1257 # Emit the default values of this package's macros.
1258 rm -f ./Makefile.tem
1259 case "${package_makefile_frag}" in
1260 "") mv ${Makefile} ./Makefile.tem ;;
1261 *)
1262 if [ ! -f ${package_makefile_frag} ] ; then
1263 package_makefile_frag=${srcdir}/${package_makefile_frag}
1264 fi
1265 if [ -f ${package_makefile_frag} ] ; then
1266 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ./Makefile.tem
1267 else
1268 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1269 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1270 mv ${Makefile} ./Makefile.tem
1271 fi
1272 esac
1273 # real copy now in ./Makefile.tem
1274
1275 # prepend warning about editing, and a bunch of variables.
1276 rm -f ${Makefile}
1277 cat > ${Makefile} <<EOF
1278 # ${NO_EDIT}
1279 VPATH = ${srcdir}
1280 links = ${configlinks}
1281 host_alias = ${host_alias}
1282 host_cpu = ${host_cpu}
1283 host_vendor = ${host_vendor}
1284 host_os = ${host_os}
1285 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1286 target_alias = ${target_alias}
1287 target_cpu = ${target_cpu}
1288 target_vendor = ${target_vendor}
1289 target_os = ${target_os}
1290 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1291 EOF
1292 case "${build}" in
1293 "") ;;
1294 *) cat >> ${Makefile} << EOF
1295 build_alias = ${build_alias}
1296 build_cpu = ${build_cpu}
1297 build_vendor = ${build_vendor}
1298 build_os = ${build_os}
1299 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1300 EOF
1301 esac
1302
1303 case "${package_makefile_frag}" in
1304 "") ;;
1305 /* | [A-Za-z]:[\\/]* ) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1306 *) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1307 esac
1308
1309 case "${target_makefile_frag}" in
1310 "") ;;
1311 /* | [A-Za-z]:[\\/]* ) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1312 *) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1313 esac
1314
1315 case "${host_makefile_frag}" in
1316 "") ;;
1317 /* | [A-Za-z]:[\\/]* ) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1318 *) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1319 esac
1320
1321 if [ "${site_makefile_frag}" != "" ] ; then
1322 echo site_makefile_frag = ${site_makefile_frag} >>${Makefile}
1323 fi
1324
1325 echo enable_shared = ${enable_shared} >> ${Makefile}
1326 echo enable_threads = ${enable_threads} >> ${Makefile}
1327 # record if we want to rumtime library stuff installed in libsubdir.
1328 if test -z "${enable_version_specific_runtime_libs}"; then
1329 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1330 else
1331 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1332 fi
1333
1334 # Emit a macro which describes the file containing gcc's
1335 # version number.
1336 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1337 # And emit a macro defining gcc's version number.
1338 echo gcc_version = ${gcc_version} >> ${Makefile}
1339
1340 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1341 # remove any form feeds.
1342 rm -f ./Makefile.tm2
1343 sedtemp=sed.$$
1344 cat >$sedtemp <<EOF
1345 s:@configdirs@:${configdirs}:
1346 EOF
1347 sed -f $sedtemp ./Makefile.tem > ./Makefile.tm2
1348 rm -f $sedtemp
1349 rm -f ./Makefile.tem
1350 mv ./Makefile.tm2 ./Makefile.tem
1351 sed -e "s|@prefix@|${prefix}|" \
1352 -e "s|@exec_prefix@|${exec_prefix}|" \
1353 -e "s|@bindir@|${bindir}|" \
1354 -e "s|@sbindir@|${sbindir}|" \
1355 -e "s|@libexecdir@|${libexecdir}|" \
1356 -e "s|@datadir@|${datadir}|" \
1357 -e "s|@sysconfdir@|${sysconfdir}|" \
1358 -e "s|@sharedstatedir@|${sharedstatedir}|" \
1359 -e "s|@localstatedir@|${localstatedir}|" \
1360 -e "s|@libdir@|${libdir}|" \
1361 -e "s|@includedir@|${includedir}|" \
1362 -e "s|@oldincludedir@|${oldincludedir}|" \
1363 -e "s|@infodir@|${infodir}|" \
1364 -e "s|@mandir@|${mandir}|" \
1365 -e "s|@all_build_modules@|${all_build_modules}|" \
1366 -e "/^CC[ ]*=/{
1367 :loop1
1368 /\\\\$/ N
1369 s/\\\\\\n//g
1370 t loop1
1371 s%^CC[ ]*=.*$%CC = ${CC}%
1372 }" \
1373 -e "/^CXX[ ]*=/{
1374 :loop2
1375 /\\\\$/ N
1376 s/\\\\\\n//g
1377 t loop2
1378 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1379 }" \
1380 -e "/^CFLAGS[ ]*=/{
1381 :loop3
1382 /\\\\$/ N
1383 s/\\\\\\n//g
1384 t loop3
1385 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1386 }" \
1387 -e "/^CXXFLAGS[ ]*=/{
1388 :loop4
1389 /\\\\$/ N
1390 s/\\\\\\n//g
1391 t loop4
1392 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1393 }" \
1394 -e "s|@config_shell@|${config_shell}|" \
1395 -e "s|@srcdir@|${srcdir}|" \
1396 -e "s/\f//" \
1397 -e "s:@program_transform_name@:${program_transform_name}:" \
1398 -e "s|@tooldir@|${tooldir}|" \
1399 -e "s|@build_tooldir@|${tooldir}|" \
1400 -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \
1401 -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \
1402 -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \
1403 ./Makefile.tem >> ${Makefile}
1404 sed -e "s:@GDB_TK@:${GDB_TK}:" ${Makefile} >${Makefile}.tem
1405 mv -f ${Makefile}.tem ${Makefile}
1406
1407 # If this is a Canadian Cross, preset the values of many more
1408 # tools.
1409 if [ "${build}" != "${host}" ]; then
1410 for var in ${tools}; do
1411 eval val=\$${var}
1412 sed -e "/^${var}[ ]*=/{
1413 :loop1
1414 /\\\\$/ N
1415 /\\\\$/ b loop1
1416 s/\\\\\\n//g
1417 s%^${var}[ ]*=.*$%${var} = ${val}%
1418 }" ${Makefile} > ${Makefile}.tem
1419 mv -f ${Makefile}.tem ${Makefile}
1420 done
1421 fi
1422 # If this is NOT a Canadian Cross, preset the values of some more
1423 # tools. The above line should get merged into this, but this
1424 # substitutes *once* where the above substitutes *globally*; that
1425 # needs to be worked out before the merger. The issue is in Makefile
1426 # fragment elements (ick, yuck, ugh).
1427 if [ "${build}" = "${host}" ]; then
1428 for var in ${tools}; do
1429 eval val=\$${var}
1430 sed -e "s%@${var}@%${val}%" ${Makefile} > ${Makefile}.tem
1431 mv -f ${Makefile}.tem ${Makefile}
1432 done
1433 fi
1434
1435 # final copy now in ${Makefile}
1436
1437 else
1438 echo "No Makefile.in found in ${srcdir}/., unable to configure" 1>&2
1439 fi
1440
1441 rm -f ./Makefile.tem
1442
1443 case "${host_makefile_frag}" in
1444 "") using= ;;
1445 *) using="and \"${host_makefile_frag}\"" ;;
1446 esac
1447
1448 case "${target_makefile_frag}" in
1449 "") ;;
1450 *) using="${using} and \"${target_makefile_frag}\"" ;;
1451 esac
1452
1453 case "${site_makefile_frag}" in
1454 "") ;;
1455 *) using="${using} and \"${site_makefile_frag}\"" ;;
1456 esac
1457
1458 newusing=`echo "${using}" | sed 's/and/using/'`
1459 using=${newusing}
1460 echo "Created \"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using}
1461
1462 . ${tmpfile}.pos
1463
1464 # describe the chosen configuration in config.status.
1465 # Make that file a shellscript which will reestablish
1466 # the same configuration. Used in Makefiles to rebuild
1467 # Makefiles.
1468
1469 case "${norecursion}" in
1470 "") arguments="${arguments} --norecursion" ;;
1471 *) ;;
1472 esac
1473
1474 echo "#!/bin/sh
1475 # ${NO_EDIT}
1476 # This directory was configured as follows:
1477 ${progname}" ${arguments} "
1478 # ${using}" > ./config.new
1479 chmod a+x ./config.new
1480 if [ -r ./config.back ] ; then
1481 mv -f ./config.back ./config.status
1482 fi
1483 ${config_shell} ${moveifchange} ./config.new ./config.status
1484
1485 # If there are subdirectories, then recur.
1486 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1487 for configdir in ${configdirs} ${extraconfigdirs} ; do
1488
1489 # If configdir contains ',' it is
1490 # srcdir,builddir,target_alias
1491 # These come from extraconfigdirs.
1492 case ${configdir} in
1493 *,*)
1494 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1495 ;;
1496 *)
1497 cfg_dir=${configdir}
1498 bld_dir=${configdir}
1499 tgt_alias=${target_alias}
1500 ;;
1501 esac
1502
1503 if [ -d ${srcdir}/${cfg_dir} ] ; then
1504 eval echo Configuring ${configdir}... ${redirect}
1505 case "${srcdir}" in
1506 ".") ;;
1507 *)
1508 if [ ! -d ./${bld_dir} ] ; then
1509 if mkdir ./${bld_dir} ; then
1510 true
1511 else
1512 echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2
1513 exit 1
1514 fi
1515 fi
1516 ;;
1517 esac
1518
1519 POPDIR=${PWD=`${PWDCMD-pwd}`}
1520 cd ${bld_dir}
1521
1522 ### figure out what to do with srcdir
1523 case "${srcdir}" in
1524 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1525 /* | [A-Za-z]:[\\/]* ) # absolute path
1526 newsrcdir=${srcdir}/${cfg_dir}
1527 srcdiroption="--srcdir=${newsrcdir}"
1528 ;;
1529 *) # otherwise relative
1530 newsrcdir=../${srcdir}/${cfg_dir}
1531 srcdiroption="--srcdir=${newsrcdir}"
1532 ;;
1533 esac
1534
1535 # Handle --cache-file=../XXX
1536 case "${cache_file}" in
1537 "") # empty
1538 ;;
1539 /* | [A-Za-z]:[\\/]* ) # absolute path
1540 cache_file_option="--cache-file=${cache_file}"
1541 ;;
1542 *) # relative path
1543 cache_file_option="--cache-file=../${cache_file}"
1544 ;;
1545 esac
1546
1547 ### check for guested configure, otherwise fix possibly relative progname
1548 if [ -f ${newsrcdir}/configure ] ; then
1549 recprog=${newsrcdir}/configure
1550 elif [ -f ${newsrcdir}/configure.in ] ; then
1551 case "${progname}" in
1552 /* | [A-Za-z]:[\\/]* ) recprog=${progname} ;;
1553 *) recprog=../${progname} ;;
1554 esac
1555 else
1556 eval echo No configuration information in ${cfg_dir} ${redirect}
1557 recprog=
1558 fi
1559
1560 ### The recursion line is here.
1561 if [ ! -z "${recprog}" ] ; then
1562 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1563 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1564 ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${other_options} ${redirect} ; then
1565 true
1566 else
1567 echo Configure in `${PWDCMD-pwd}` failed, exiting. 1>&2
1568 exit 1
1569 fi
1570 fi
1571
1572 cd ${POPDIR}
1573 fi
1574 done
1575 fi
1576
1577 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1578 # and reset the trap handler.
1579 rm -rf ${tmpdir}
1580 trap 0
1581
1582 exit 0
1583
1584 #
1585 # Local Variables:
1586 # fill-column: 131
1587 # End:
1588 #
1589
1590 # end of configure
This page took 0.062971 seconds and 4 git commands to generate.