4 # Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
6 #This file is part of GNU.
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.
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.
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. */
22 # Please email any bugs, comments, and/or additions to this file to:
23 # configure@cygnus.com
26 # Shell script to create proper links to machine-dependent files in
27 # preparation for compilation.
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.
34 # NOTE: This script contains support for a Cygnus experimental feature, called
35 # +subdirs, which is currently, tentatively, de-supported.
37 export PATH ||
(echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh
$0 $argv; kill $$
)
46 #symbolic_link="echo ln -s"
48 # clear some things potentially inherited from environment.
51 Makefile_in
=Makefile.
in
59 floating_point
=default
85 NO_EDIT
="This file was generated automatically by configure. Do not edit."
87 ## this is a little touchy and won't always work, but...
89 ## if the argv[0] starts with a slash then it is an absolute name that can be
92 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
93 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
95 ## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
101 if echo $0 |
grep '^/' > /dev
/null
; then
103 elif echo $0 |
grep '/' > /dev
/null
; then
107 PATH
=$PATH:${PWD} ; export PATH
112 # handle things that might have args following as separate words
113 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix
=
114 elif [ -n "${next_datadir}" ] ; then datadir=${arg} ; datadiroption="-datadir=${datadir}" ; next_datadir
=
115 elif [ -n "${next_site}" ] ; then site
=${arg} ; next_site
=
116 elif [ -n "${next_srcdir}" ] ; then srcdir
=${arg} ; next_srcdir
=
117 elif [ -n "${next_target}" ] ; then
121 newtargets
="${targets} ${arg}"
122 targets
="${newtargets}"
125 echo '***' Can only configure
for one target
at a
time.
129 elif [ -n "${next_tmpdir}" ] ; then
131 tmpdiroption
="--tmpdir=${arg}"
136 -datadir=* |
--datadir=* |
--datadi=* |
--datad=* |
--data=* |
--dat=* |
--da=* |
--d=*)
137 datadir
=`echo ${arg} | sed 's/^[-a-z]*=//'`
140 -datadir |
--datadir |
--datadi |
--datad |
--data |
--dat |
--da |
--d)
149 -host=* |
--host=* |
--hos=* |
--ho=*)
152 newhosts
="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`"
156 echo '***' Can only configure
for one
host at a
time.
164 -norecursion |
--no*)
167 -prefix=* |
--prefix=* |
--prefi=* |
--pref=* |
--pre=* |
--pr=* |
--p=*)
168 prefix
=`echo ${arg} | sed 's/^[-a-z]*=//'`
171 -prefix |
--prefix |
--prefi |
--pref |
--pre |
--pr |
--p)
174 -recurring |
--recurring |
--recurrin |
--recurri |
--recurr |
--recur |
--recu |
--rec |
--re)
176 arguments
=`echo ${arguments} | sed "s:${arg}::"`
181 -site=* |
--site=* |
--sit=* |
--si=*)
182 site
=`echo ${arg} | sed 's/^[-a-z]*=//'`
184 -site |
--site |
--sit |
--si)
187 -srcdir=* |
--srcdir=* |
--srcdi=* |
--srcd=* |
--src=* |
--sr=*)
188 srcdir
=`echo ${arg} | sed 's/^[-a-z]*=//'`
190 -srcdir |
--srcdir |
--srcdi |
--srcd |
--src |
--sr)
193 -target=* |
--target=* |
--targe=* |
--targ=* |
--tar=* |
--ta=*)
196 newtargets
="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
197 targets
="${newtargets}"
200 echo '***' Can only configure
for one target
at a
time.
205 -target |
--target |
--targe |
--targ |
--tar |
--ta)
208 -tmpdir=* |
--tmpdir=* |
--tmpdi=* |
--tmpd=* |
--tmp=* |
--tm=*)
210 TMPDIR
=`echo ${arg} | sed 's/^[-a-z]*=//'`
212 -tmpdir |
--tmpdir |
--tmpdi |
--tmpd |
--tmp |
--tm)
218 -version |
-V |
--version |
--V)
219 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
225 echo "Unrecognized option: \"${arg}\"".
;
232 newundefs
="${undefs} ${arg}"
236 echo '***' Can only configure
for one
host and one target
at a
time.
245 # process host and target
248 # # Complain if an arg is missing
249 # if [ -z "${hosts}" ] ; then
251 # echo "configure: No HOST specified." ;
256 ### This is a bit twisted.
257 ### * if all three are specified, this is an error.
258 ### * if we have neither hosts, nor unadorned args, this is an error.
259 ### * if no hosts are specified, then the unadorned args are hosts, but if
260 ### there were none, this is an error.
261 ### * if no targets are specified, then the unadorned args are targets, but if
262 ### there were no unadorned args, then the hosts are also targets.
264 if [ -n "${hosts}" -a -n "${targets}" -a -n "${undefs}" ] ; then
265 echo '***' Can only configure
for one
host and one target
at a
time.
267 elif [ -z "${hosts}" -a -z "${undefs}" ] ; then
268 echo '***' You must tell me
for which host you want to configure.
272 "") hosts
=${undefs} ;;
279 "") targets
=${hosts} ;;
280 *) targets
=${undefs} ;;
290 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
291 (echo "Usage: configure HOST" ;
293 echo "Options: [defaults in brackets]" ;
294 echo " -datadir=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
295 echo " -gas configure the compilers for use with gas. [native as]" ;
296 echo " -help print this message. [normal config]" ;
297 echo " -lang=LANG configure to build LANG. [gcc]" ;
298 echo " -nfp configure the compilers default to soft floating point. [hard float]" ;
299 echo " -norecursion configure this directory only. [recurse]" ;
300 echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
301 echo " -rm remove this configuration. [build a configuration]" ;
302 echo " -site configure with site specific makefile" ;
303 echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
304 echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ;
305 echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
307 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
310 if [ -r config.status
] ; then
317 configsub
=`echo ${progname} | sed 's/configure$/config.sub/'`
319 if ${configsub} `echo ${hosts} | sed -e 's/ .*//'` >/dev
/null
2>&1 ; then
322 echo '***' cannot
find config.sub.
328 if [ -r configure.
in ] ; then
331 echo '***' "Can't find configure.in. Try using -srcdir=some_dir"
341 "") datadir
="$(prefix)/lib" ;;
345 ### break up ${srcdir}/configure.in.
346 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
348 echo '***' ${srcdir}/configure.
in has no
"per-host:" line.
1>&2
354 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
356 echo '***' ${srcdir}/configure.
in has no
"per-target:" line.
1>&2
363 "") TMPDIR
=/tmp
; export TMPDIR
;;
367 # keep this filename short for &%*%$*# 14 char file names
368 tmpfile
=${TMPDIR}/cONf$$
369 trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
371 # split ${srcdir}/configure.in into common, per-host, per-target,
372 # and post-target parts. Post-target is optional.
373 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.
in > ${tmpfile}.com
374 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.hst
375 if grep '^# post-target:' ${srcdir}/configure.
in >/dev
/null
; then
376 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.tgt
377 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.pos
379 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.tgt
383 ### do common part of configure.in
387 # some sanity checks on configure.in
388 case "${srctrigger}" in
390 echo '***' srctrigger not
set in ${PWD}/configure.
in.
396 for host in ${hosts} ; do
398 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
405 result
=`${configsub} ${host}`
406 host_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
407 host_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
408 host_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
409 host=${host_cpu}-${host_vendor}-${host_os}
413 for target
in ${targets} ; do
415 target_alias
=${target}
416 result
=`${configsub} ${target}`
417 target_cpu
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
418 target_vendor
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
419 target_os
=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
420 target
=${target_cpu}-${target_vendor}-${target_os}
424 case "${host_alias}" in
425 "${target_alias}") subdirname
=H-
${host_alias} ;;
426 *) subdirname
=X-
${host_alias}-${target_alias} ;;
429 case "${namesubdir}" in
431 *) subdirname
=${namesubdir} ;;
434 case "${removing}" in
436 # Find the source files, if location was not specified.
441 if [ ! -r ${srctrigger} ] ; then
448 if [ ! -r ${srcdir}/${srctrigger} ] ; then
449 case "${srcdirdefaulted}" in
450 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
451 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
454 echo '***' \
(At least
${srctrigger} is missing.\
) 1>&2
458 # Set up the list of links to be made.
459 # ${links} is the list of link names, and ${files} is the list of names to link to.
462 while [ -n "${files}" ] ; do
463 # set file to car of files, files to cdr of files
464 set ${files}; file=$1; shift; files
=$
*
465 set ${links}; link
=$1; shift; links
=$
*
467 if [ ! -r ${srcdir}/${file} ] ; then
468 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
469 echo '***' "since the file \"${file}\" does not exist." 1>&2
475 # Make a symlink if possible, otherwise try a hard link
476 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
478 if [ ! -r ${link} ] ; then
479 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
485 *) echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
489 # Create a .gdbinit file which runs the one in srcdir
490 # and tells GDB to look there for source files.
492 if [ -r ${srcdir}/.gdbinit
] ; then
496 *) cat > .gdbinit
<<EOF
497 # ${NO_EDIT} > .gdbinit
500 source ${srcdir}/.gdbinit
506 # Install a makefile, and make it set VPATH
507 # if necessary so that the sources are found.
508 # Also change its value of srcdir.
509 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
510 # been somewhat optimized and is perhaps a bit twisty.
512 # code is order so as to try to sed the smallest input files we know.
514 # the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
515 # so do these separately because I don't trust the order of sed -e expressions.
517 # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
519 "") cp ${srcdir}/${Makefile_in} Makefile.tem
;;
521 site_makefile_frag
=${srcdir}/config
/ms-
${site}
523 if [ -f ${site_makefile_frag} ] ; then
524 sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
527 cp ${srcdir}/${Makefile_in} Makefile.tem
532 # working copy now in Makefile.tem
534 # Conditionalize the makefile for this host.
535 case "${host_makefile_frag}" in
536 "") mv Makefile.tem ${Makefile} ;;
538 host_makefile_frag=${srcdir}/${host_makefile_frag}
539 if [ -f ${host_makefile_frag} ] ; then
540 sed -e "/^
####/ r ${host_makefile_frag}" Makefile.tem > ${Makefile}
542 echo '***' Expected
host makefile fragment
\"${host_makefile_frag}\" 1>&2
543 echo '***' is missing
in ${PWD}.
1>&2
544 mv Makefile.tem
${Makefile}
547 # working copy now in ${Makefile}
549 # Conditionalize the makefile for this target.
550 case "${target_makefile_frag}" in
551 "") mv ${Makefile} Makefile.tem
;;
553 target_makefile_frag
=${srcdir}/${target_makefile_frag}
554 if [ -f ${target_makefile_frag} ] ; then
555 sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} >> Makefile.tem
557 mv ${Makefile} Makefile.tem
558 target_makefile_frag
=
562 # real copy now in Makefile.tem
564 # prepend warning about editting, and a bunch of variables.
565 # fixme-someday: remove the subdir/unsubdir lines.
566 cat > ${Makefile} <<EOF
568 host_alias = ${host_alias}
569 host_cpu = ${host_cpu}
570 host_vendor = ${host_vendor}
572 target_alias = ${target_alias}
573 target_cpu = ${target_cpu}
574 target_vendor = ${target_vendor}
575 target_os = ${target_os}
576 target_makefile_frag = ${target_makefile_frag}
577 host_makefile_frag = ${host_makefile_frag}
578 site_makefile_frag = ${site_makefile_frag}
584 # fixme: this shouldn't be in configure.
585 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
587 "${target}") echo "ALL=all.internal" >> ${Makefile} ;;
589 echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
590 echo "ALL=all.cross" >> ${Makefile}
594 # reset prefix, datadir, srcdir, SUBDIRS, NONSUBDIRS, remove any form
596 sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
597 -e "s:^datadir[ ]*=.*$:datadir = ${datadir}:" \
598 -e "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" \
599 -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
600 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
601 -e "s/\f//" Makefile.tem
>> ${Makefile}
602 # final copy now in ${Makefile}
606 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
607 case "${host_makefile_frag}" in
609 *) using
="and \"${host_makefile_frag}\"" ;;
612 case "${target_makefile_frag}" in
614 *) using
="${using} and \"${target_makefile_frag}\"" ;;
617 case "${site_makefile_frag}" in
619 *) using
="${using} and \"${site_makefile_frag}\"" ;;
622 echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" |
sed 's/and/using/'`
627 # describe the chosen configuration in config.status.
628 # Make that file a shellscript which will reestablish
629 # the same configuration. Used in Makefiles to rebuild
632 case "${norecursion}" in
633 "") arguments="${arguments} -norecursion" ;;
639 # ${PWD} was configured as follows:
640 ${progname}" ${arguments} "
641 # ${using}" > config.status
642 chmod a+x config.status
644 *) rm -f ${Makefile} config.status ${links} ;;
647 # If there are subdirectories, then recur.
648 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
649 for configdir in ${configdirs} ; do
652 *) echo Configuring ${configdir}... ;;
655 if [ -d ${srcdir}/${configdir} ] ; then
659 if [ ! -d ./${configdir} ] ; then
668 ### figure out what to do with srcdir & guest configure
670 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
672 newsrcdir=${srcdir}/${configdir}
673 srcdiroption="-srcdir=${newsrcdir}"
675 *) # otherwise relative
676 newsrcdir=../${srcdir}/${configdir}
677 srcdiroption="-srcdir=${newsrcdir}"
681 ### The recursion line is here.
682 if [ -f ${newsrcdir}/configure ] ; then
683 recprog=${newsrcdir}/configure
688 if ${recprog} -recurring ${host_alias} -target=${target_alias} \
689 ${verbose} ${subdirs} ${removing} ${prefixoption} \
690 ${tmpdiroption} ${namesubdiroption} ${datadiroption} \
691 ${srcdiroption} ; then
701 *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
706 done # for each target
711 # trap cmd above handles this now:
712 #rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
This page took 0.049967 seconds and 4 git commands to generate.