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