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