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