3 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
6 # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
7 # Free Software Foundation, Inc.
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.
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.
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.
23 # This file was originally written by K. Richard Pixley.
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 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
43 #symbolic_link="echo ln -s"
45 # clear some things potentially inherited from environment.
48 Makefile_in=Makefile.in
51 cache_file=config.cache
57 floating_point=default
65 package_makefile_frag=
66 package_makefile_rules_frag=
73 program_transform_name=
74 program_transform_nameoption=
86 version="$Revision: 1.22 $"
89 ### we might need to use some other shell than /bin/sh for running subshells
91 ### If we are on Windows, search for the shell. This will permit people
92 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
93 ### without also having to set CONFIG_SHELL. This code will work when
94 ### using bash, which sets OSTYPE.
97 if [ x${CONFIG_SHELL} = x ]; then
98 if [ ! -f /bin/sh ]; then
99 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
100 CONFIG_SHELL=${SHELL}
103 for prog in sh sh.exe bash bash.exe; do
104 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
106 test -z "$dir" && dir=.
107 if test -f $dir/$prog; then
108 CONFIG_SHELL=$dir/$prog
114 test -n "${CONFIG_SHELL}" && break
122 config_shell=${CONFIG_SHELL-/bin/sh}
124 NO_EDIT="This file was generated automatically by configure. Do not edit."
126 ## this is a little touchy and won't always work, but...
128 ## if the argv[0] starts with a slash then it is an absolute name that can (and
129 ## must) be used as is.
131 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
132 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
136 # if PWD already has a value, it is probably wrong.
137 if [ -n "$PWD" ]; then PWD=`pwd`; fi
139 case "${progname}" in
143 PATH=$PATH:${PWD=`pwd`} ; export PATH
152 # Break out if there are no more args
159 # Get the first arg, and shuffle
163 # Make all options have two hyphens
164 orig_option=$option # Save original for error messages
167 -*) option=-$option ;;
170 # Split out the argument for options that take them
173 optarg=`echo $option | sed -e 's/^[^=]*=//'`
174 arguments="$arguments $option"
176 # These options have mandatory values. Since we didn't find an = sign,
177 # the value must be in the next argument
178 --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*)
181 arguments="$arguments $option=$optarg"
184 arguments="$arguments -v"
187 arguments="$arguments $option"
191 # Now, process the options
195 case "$build_alias" in
196 "") build_alias=$optarg ;;
197 *) echo '***' Can only configure for one build machine at a time. 1>&2
206 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
208 disableoptions="$disableoptions $option"
216 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
217 eval "$enableopt='$optarg'"
218 enableoptions="$enableoptions '$option'"
220 --exec-prefix* | --ex*)
222 exec_prefixoption="--exec-prefix=$optarg"
232 NOHOST) host_alias=$optarg ;;
233 *) echo '***' Can only configure for one host at a time. 1>&2
240 floating_pointoption="--nfp"
242 --norecursion | --no*)
247 prefixoption="--prefix=$optarg"
249 --program-prefix* | --program-p*)
250 program_prefix=$optarg
251 program_prefixoption="--program-prefix=$optarg"
253 --program-suffix* | --program-s*)
254 program_suffix=$optarg
255 program_suffixoption="--program-suffix=$optarg"
257 --program-transform-name* | --program-t*)
258 # Double any backslashes or dollar signs in the argument
259 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
260 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
265 --silent | --sil* | --quiet | --q*)
266 redirect=">/dev/null"
271 site_option="--site=$optarg"
274 # Remove trailing slashes. Otherwise, when the file name gets
275 # bolted into an object file as debug info, it has two slashes
276 # in it. Ordinarily this is ok, but emacs takes double slash
277 # to mean "forget the first part".
278 srcdir=`echo $optarg | sed -e 's:/$::'`
284 case $target_alias in
285 NOTARGET) target_alias=$optarg ;;
286 *) echo '***' Can only configure for one target at a time. 1>&2
293 tmpdiroption="--tmpdir=$optarg"
295 --verbose | --v | --verb*)
299 --version | --V | --vers*)
300 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
309 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
310 eval $withopt="$optarg"
311 withoptions="$withoptions $option"
314 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
316 withoutoptions="$withoutoptions $option"
319 withoptions="$withoptions --with-x"
321 --x-i* | --x-l*) other_options="$other_options $orig_option"
323 --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
324 # These options were added to autoconf for emacs.
327 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
332 NOUNDEFS) undefs=$option ;;
333 *) echo '***' Can only configure for one host and one target at a time. 1>&2
341 # process host and target
343 # Do some error checking and defaulting for the host and target type.
345 # configure --host=HOST --target=TARGET UNDEFS
348 # 1. You aren't allowed to specify --host, --target, and undefs at the
350 # 2. Host defaults to undefs.
351 # 3. If undefs is not specified, then host defaults to the current host,
352 # as determined by config.guess.
353 # 4. Target defaults to undefs.
354 # 5. If undefs is not specified, then target defaults to host.
358 # Make sure that host, target & undefs aren't all specified at the
360 case $host_alias---$target_alias---$undefs in
361 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
363 *) echo '***' Can only configure for one host and one target at a time. 1>&2
369 # Now, do defaulting for host.
374 # Neither --host option nor undefs were present.
376 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
377 if host_alias=`${config_shell} ${guesssys}`
379 # If the string we are going to use for
380 # the target is a prefix of the string
381 # we just guessed for the host, then
382 # assume we are running native, and force
383 # the same string for both target and host.
384 case $target_alias in
387 if expr $host_alias : $target_alias >/dev/null
389 host_alias=$target_alias
393 echo "Configuring for a ${host_alias} host." 1>&2
394 arguments="--host=$host_alias $arguments"
396 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
402 arguments="--host=$host_alias $arguments"
408 # Do defaulting for target. If --target option isn't present, default
409 # to undefs. If undefs isn't present, default to host.
410 case $target_alias in
414 target_alias=$host_alias
418 arguments="--target=$target_alias $arguments"
426 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
428 echo Usage: configure [OPTIONS] [HOST]
430 echo Options: [defaults in brackets]
431 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
432 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
433 echo ' --help print this message [normal config]'
434 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
435 echo ' --host=HOST configure for HOST [determined via config.guess]'
436 echo ' --norecursion configure this directory only [recurse]'
437 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
438 echo ' --program-suffix=FOO append FOO to installed program names [""]'
439 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
440 echo ' --site=SITE configure with site-specific makefile for SITE'
441 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
442 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
443 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
444 echo ' --nfp configure for software floating point [hard float]'
445 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
446 echo ' --without-FOO package FOO is NOT available'
447 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
448 echo ' --disable-FOO do not include feature FOO'
450 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
452 if [ -r config.status ] ; then
459 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
460 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
462 # this is a hack. sun4 must always be a valid host alias or this will fail.
463 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
466 echo '***' cannot find config.sub. 1>&2
471 if ${config_shell} ${moveifchange} config.junk config.trash ; then
474 echo '***' cannot find move-if-change. 1>&2
477 rm -f config.junk config.trash
481 if [ -r configure.in ] ; then
484 if [ -r ${progname}.in ] ; then
485 srcdir=`echo ${progname} | sed 's:/configure$::'`
487 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
493 # Set srcdir to "." if that's what it is.
494 # This is important for multilib support.
495 if [ ! -d ${srcdir} ] ; then
496 echo "Invalid source directory ${srcdir}" >&2
500 srcpwd=`cd ${srcdir} ; pwd`
501 if [ "${pwd}" = "${srcpwd}" ] ; then
506 ### warn about some conflicting configurations.
511 if [ -f ${srcdir}/config.status ] ; then
512 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
517 # default exec_prefix
518 case "${exec_prefixoption}" in
519 "") exec_prefix="\$(prefix)" ;;
523 ### break up ${srcdir}/configure.in.
524 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
526 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
527 # Check for a directory that's been converted to use autoconf since
528 # it was last configured.
529 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
530 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
531 if [ -r ${srcdir}/configure ] ; then
532 echo '***' Running the local configure script. 1>&2
533 case "${cache_file}" in
534 "") cache_file_option= ;;
535 *) cache_file_option="--cache-file=${cache_file}" ;;
537 srcdiroption="--srcdir=${srcdir}"
538 case "${build_alias}" in
540 *) buildopt="--build=${build_alias}" ;;
542 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
543 ${buildopt} --host=${host_alias} --target=${target_alias} \
544 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
546 ${program_prefixoption} ${program_suffixoption} \
547 ${program_transform_nameoption} ${site_option} \
548 ${withoptions} ${withoutoptions} \
549 ${enableoptions} ${disableoptions} ${floating_pointoption} \
550 ${cache_file_option} ${removing} ${other_options} ${redirect}
552 echo '***' There is no configure script present though. 1>&2
560 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
562 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
569 "") TMPDIR=/tmp ; export TMPDIR ;;
573 # keep this filename short for &%*%$*# 14 char file names
574 tmpfile=${TMPDIR}/cONf$$
575 # Note that under many versions of sh a trap handler for 0 will *override* any
576 # exit status you explicitly specify! At this point, the only non-error exit
577 # is at the end of the script; these actions are duplicated there, minus
578 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
579 # trap handler, or you'll lose.
580 trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
582 # split ${srcdir}/configure.in into common, per-host, per-target,
583 # and post-target parts. Post-target is optional.
584 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
585 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
586 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
587 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
588 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
590 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
594 ### do common part of configure.in
598 # some sanity checks on configure.in
599 case "${srctrigger}" in
601 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
607 case "${build_alias}" in
609 if result=`${config_shell} ${configsub} ${host_alias}` ; then
610 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
611 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
612 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
613 build=${build_cpu}-${build_vendor}-${build_os}
614 build_alias=${host_alias}
618 if result=`${config_shell} ${configsub} ${build_alias}` ; then
619 buildopt="--build=${build_alias}"
620 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
621 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
622 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
623 build=${build_cpu}-${build_vendor}-${build_os}
625 echo "Unrecognized build system name ${build_alias}." 1>&2
631 if result=`${config_shell} ${configsub} ${host_alias}` ; then
634 echo "Unrecognized host system name ${host_alias}." 1>&2
637 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
638 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
639 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
640 host=${host_cpu}-${host_vendor}-${host_os}
644 if result=`${config_shell} ${configsub} ${target_alias}` ; then
647 echo "Unrecognized target system name ${target_alias}." 1>&2
650 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
651 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
652 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
653 target=${target_cpu}-${target_vendor}-${target_os}
657 # Find the source files, if location was not specified.
662 if [ ! -r ${srctrigger} ] ; then
669 if [ ! -r ${srcdir}/${srctrigger} ] ; then
670 case "${srcdirdefaulted}" in
671 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
672 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
675 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
679 # Some systems (e.g., one of the i386-aix systems the gas testers are
680 # using) don't handle "\$" correctly, so don't use it here.
681 tooldir='$(exec_prefix)'/${target_alias}
683 if [ "${host_alias}" != "${target_alias}" ] ; then
684 if [ "${program_prefixoption}" = "" ] ; then
685 if [ "${program_suffixoption}" = "" ] ; then
686 if [ "${program_transform_nameoption}" = "" ] ; then
687 program_prefix=${target_alias}- ;
693 # Merge program_prefix and program_suffix onto program_transform_name.
694 # (program_suffix used to use $, but it's hard to preserve $ through both
696 if [ "${program_suffix}" != "" ] ; then
697 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
700 if [ "${program_prefix}" != "" ] ; then
701 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
704 # Check whether --with-gcc-version was given.
705 if [ "${with_gcc_version+set}" = set ]; then
706 gcc_version="$with_gcc_version"
708 if [ "${srcdir}" = "." ] ; then
709 if [ "${with_target_subdir}" != "." ] ; then
710 topsrcdir=${with_multisrctop}../..
712 topsrcdir=${with_multisrctop}..
716 */*/* ) # Need to do this only in subdirectories.
717 topsrcdir=${srcdir}/..
719 * ) # We are already in the topsrcdir.
724 # If gcc's sources are available, extract its version number which is used by
726 if [ -f ${topsrcdir}/gcc/version.c ] ; then
727 gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${topsrcdir}/gcc/version.c`
731 # If CC and CXX are not set in the environment, and the Makefile
732 # exists, try to extract them from it. This is to handle running
733 # ./config.status by hand.
734 if [ -z "${CC}" -a -r Makefile ]; then
739 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
740 CC=`tail -1 Makefile.cc`
744 if [ -z "${CFLAGS}" -a -r Makefile ]; then
749 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
750 CFLAGS=`tail -1 Makefile.cc`
754 if [ -z "${CXX}" -a -r Makefile ]; then
759 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
760 CXX=`tail -1 Makefile.cc`
764 if [ -z "${CXXFLAGS}" -a -r Makefile ]; then
769 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
770 CXXFLAGS=`tail -1 Makefile.cc`
774 # Generate a default definition for YACC. This is used if the makefile can't
775 # locate bison or byacc in objdir.
777 for prog in 'bison -y' byacc yacc
779 set dummy $prog; tmp=$2
780 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
782 test -z "$dir" && dir=.
783 if test -f $dir/$tmp; then
790 test -n "$DEFAULT_YACC" && break
793 # Generate a default definition for M4. This is used if the makefile can't
794 # locate m4 in objdir.
796 for prog in gm4 gnum4 m4
798 set dummy $prog; tmp=$2
799 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
801 test -z "$dir" && dir=.
802 if test -f $dir/$tmp; then
809 test -n "$DEFAULT_M4" && break
812 # Generate a default definition for LEX. This is used if the makefile can't
813 # locate flex in objdir.
817 set dummy $prog; tmp=$2
818 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
820 test -z "$dir" && dir=.
821 if test -f $dir/$tmp; then
828 test -n "$DEFAULT_LEX" && break
831 if [ "${build}" != "${host}" ]; then
832 # If we are doing a Canadian Cross, in which the host and build systems
833 # are not the same, we set reasonable default values for the tools.
835 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
836 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
837 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
838 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
839 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
840 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
842 for var in ${tools}; do
843 if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
848 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
849 < Makefile > Makefile.v
850 t=`tail -1 Makefile.v`
851 if [ -n "${t}" ]; then
858 AR=${AR-${host_alias}-ar}
859 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
860 AS=${AS-${host_alias}-as}
861 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
863 CC=${CC-${host_alias}-gcc}
864 CFLAGS=${CFLAGS-"-g -O2"}
865 CXX=${CXX-${host_alias}-c++}
866 CXXFLAGS=${CXXFLAGS-"-g -O2"}
867 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
868 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
869 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
870 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
871 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
872 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
873 HOST_PREFIX=${build_alias}-
874 HOST_PREFIX_1=${build_alias}-
875 LD=${LD-${host_alias}-ld}
876 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
877 MAKEINFO=${MAKEINFO-makeinfo}
878 NM=${NM-${host_alias}-nm}
879 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
880 RANLIB=${RANLIB-${host_alias}-ranlib}
881 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
882 WINDRES=${WINDRES-${host_alias}-windres}
883 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
885 if [ -z "${YACC}" ]; then
886 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
888 test -z "$dir" && dir=.
889 if test -f $dir/bison; then
893 if test -f $dir/byacc; then
897 if test -f $dir/yacc; then
903 if [ -z "${YACC}" ]; then
908 if [ -z "${LEX}" ]; then
909 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
911 test -z "$dir" && dir=.
912 if test -f $dir/flex; then
916 if test -f $dir/lex; then
925 # Export variables which autoconf might try to set.
935 # If CC is still not set, try to get gcc.
936 if [ -z "${CC}" ]; then
937 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
939 test -z "$dir" && dir=.
940 if test -f $dir/gcc; then
942 echo 'void f(){}' > conftest.c
943 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
944 CFLAGS=${CFLAGS-"-g -O2"}
945 CXXFLAGS=${CXXFLAGS-"-g -O2"}
947 CFLAGS=${CFLAGS-"-O2"}
948 CXXFLAGS=${CXXFLAGS-"-O2"}
959 CFLAGS=${CFLAGS-"-g"}
960 CXXFLAGS=${CXXFLAGS-"-g -O2"}
968 # FIXME: This should be in configure.in, not configure
978 # FIXME: This should be in configure.in, not configure
979 # Determine whether gdb needs tk/tcl or not.
980 if [ "$enable_gdbtk" != "no" ]; then
981 GDB_TK="all-tcl all-tk all-itcl all-tix"
986 for subdir in . ${subdirs} ; do
988 # ${subdir} is relative path from . to the directory we're currently
990 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
991 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
993 ### figure out what to do with srcdir
995 ".") # no -srcdir option. We're building in place.
998 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1000 *) # otherwise relative
1002 .) makesrcdir=${srcdir} ;;
1003 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1008 if [ "${subdir}/" != "./" ] ; then
1009 Makefile=${subdir}/Makefile
1012 if [ ! -d ${subdir} ] ; then
1013 if mkdir ${subdir} ; then
1016 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1021 case "${removing}" in
1025 *) eval echo Building in ${subdir} ${redirect} ;;
1028 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1029 # Set up the list of links to be made.
1030 # ${links} is the list of link names, and ${files} is the list of names to link to.
1033 configlinks="${links}"
1034 if [ -r ${subdir}/config.status ] ; then
1035 mv -f ${subdir}/config.status ${subdir}/config.back
1037 while [ -n "${files}" ] ; do
1038 # set file to car of files, files to cdr of files
1039 set ${files}; file=$1; shift; files=$*
1040 set ${links}; link=$1; shift; links=$*
1042 if [ ! -r ${srcdir}/${file} ] ; then
1043 if [ ! -r ${file} ] ; then
1045 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1046 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1052 srcfile=${srcdir}/${file}
1055 ${remove} -f ${link}
1056 # Make a symlink if possible, otherwise try a hard link
1057 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1060 # We need to re-remove the file because Lynx leaves a
1061 # very strange directory there when it fails an NFS symlink.
1062 ${remove} -r -f ${link}
1063 ${hard_link} ${srcfile} ${link}
1065 if [ ! -r ${link} ] ; then
1066 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1070 echo "Linked \"${link}\" to \"${srcfile}\"."
1073 # Create a .gdbinit file which runs the one in srcdir
1074 # and tells GDB to look there for source files.
1076 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1079 *) cat > ${subdir}/.gdbinit <<EOF
1083 source ${makesrcdir}/.gdbinit
1089 # Install a makefile, and make it set VPATH
1090 # if necessary so that the sources are found.
1091 # Also change its value of srcdir.
1092 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1093 # been somewhat optimized and is perhaps a bit twisty.
1095 # code is order so as to try to sed the smallest input files we know.
1096 # so do these separately because I don't trust the order of sed -e expressions.
1098 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1099 # package macros, target, host, site, and package rules.
1101 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1103 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1104 rm -f ${subdir}/${Makefile}.tem
1105 case "${package_makefile_rules_frag}" in
1106 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1108 if [ ! -f ${package_makefile_rules_frag} ] ; then
1109 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1111 if [ -f ${package_makefile_rules_frag} ] ; then
1112 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1114 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1115 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1116 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1119 # working copy now in ${Makefile}.tem
1121 # Conditionalize for this site.
1124 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1126 site_makefile_frag=${srcdir}/config/ms-${site}
1128 if [ -f ${site_makefile_frag} ] ; then
1129 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1132 mv ${subdir}/Makefile.tem ${Makefile}
1137 # working copy now in ${Makefile}
1139 # Conditionalize the makefile for this host.
1140 rm -f ${subdir}/Makefile.tem
1141 case "${host_makefile_frag}" in
1142 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1144 if [ ! -f ${host_makefile_frag} ] ; then
1145 host_makefile_frag=${srcdir}/${host_makefile_frag}
1147 if [ -f ${host_makefile_frag} ] ; then
1148 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1150 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1151 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1152 mv ${Makefile} ${subdir}/Makefile.tem
1155 # working copy now in ${subdir)/Makefile.tem
1157 # Conditionalize the makefile for this target.
1159 case "${target_makefile_frag}" in
1160 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1162 if [ ! -f ${target_makefile_frag} ] ; then
1163 target_makefile_frag=${srcdir}/${target_makefile_frag}
1165 if [ -f ${target_makefile_frag} ] ; then
1166 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1168 mv ${subdir}/Makefile.tem ${Makefile}
1169 target_makefile_frag=
1173 # working copy now in ${Makefile}
1175 # Emit the default values of this package's macros.
1176 rm -f ${subdir}/Makefile.tem
1177 case "${package_makefile_frag}" in
1178 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1180 if [ ! -f ${package_makefile_frag} ] ; then
1181 package_makefile_frag=${srcdir}/${package_makefile_frag}
1183 if [ -f ${package_makefile_frag} ] ; then
1184 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1186 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1187 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1188 mv ${Makefile} ${subdir}/Makefile.tem
1191 # real copy now in ${subdir}/Makefile.tem
1193 # prepend warning about editting, and a bunch of variables.
1195 cat > ${Makefile} <<EOF
1197 VPATH = ${makesrcdir}
1198 links = ${configlinks}
1199 host_alias = ${host_alias}
1200 host_cpu = ${host_cpu}
1201 host_vendor = ${host_vendor}
1202 host_os = ${host_os}
1203 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1204 target_alias = ${target_alias}
1205 target_cpu = ${target_cpu}
1206 target_vendor = ${target_vendor}
1207 target_os = ${target_os}
1208 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1212 *) cat >> ${Makefile} << EOF
1213 build_alias = ${build_alias}
1214 build_cpu = ${build_cpu}
1215 build_vendor = ${build_vendor}
1216 build_os = ${build_os}
1217 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1221 case "${package_makefile_frag}" in
1223 /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1224 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1227 case "${target_makefile_frag}" in
1229 /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1230 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1233 case "${host_makefile_frag}" in
1235 /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1236 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1239 if [ "${site_makefile_frag}" != "" ] ; then
1240 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1243 # provide a proper gxx_include_dir to all subdirs.
1244 # Note, if you change the default, make sure to fix both here
1245 # and in the gcc subdirectory.
1246 if test -z "${with_gxx_include_dir}"; then
1247 if test x${enable_version_specific_runtime_libs} = xyes; then
1248 echo gxx_include_dir = '${libsubdir}/include/g++' >> ${Makefile}
1250 echo gxx_include_dir = '${prefix}/include/g++' >> ${Makefile}
1253 echo gxx_include_dir = ${with_gxx_include_dir} >> ${Makefile}
1256 # record if we want to build shared libs.
1257 if test -z "${enable_shared}"; then
1258 echo enable_shared = no >> ${Makefile}
1260 echo enable_shared = ${enable_shared} >> ${Makefile}
1262 # record if we want to rumtime library stuff installed in libsubdir.
1263 if test -z "${enable_version_specific_runtime_libs}"; then
1264 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1266 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1269 # Emit a macro which is used to build the libsubdir macro where
1270 # compiler specific stuff can be found/installed.
1271 # FIXME: This works only if gcc's sources are available in a gcc
1273 echo gcc_version = ${gcc_version} >> ${Makefile}
1275 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1276 # remove any form feeds.
1277 if [ -z "${subdirs}" ]; then
1278 rm -f ${subdir}/Makefile.tm2
1279 sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
1280 -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1281 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1282 rm -f ${subdir}/Makefile.tem
1283 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1285 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1286 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1292 s%^CC[ ]*=.*$%CC = ${CC}%
1299 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1306 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1308 -e "/^CXXFLAGS[ ]*=/{
1313 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1315 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
1316 -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" \
1317 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1319 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1320 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1321 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1322 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1323 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1324 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1325 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1326 ${subdir}/Makefile.tem >> ${Makefile}
1328 # If this is a Canadian Cross, preset the values of many more
1330 if [ "${build}" != "${host}" ]; then
1331 for var in ${tools}; do
1332 val=`eval 'echo $'"${var}"`
1333 sed -e "/^${var}[ ]*=/{
1338 s%^${var}[ ]*=.*$%${var} = ${val}%
1339 }" ${Makefile} > ${Makefile}.tem
1340 mv -f ${Makefile}.tem ${Makefile}
1344 # final copy now in ${Makefile}
1347 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1350 rm -f ${subdir}/Makefile.tem
1352 case "${host_makefile_frag}" in
1354 *) using="and \"${host_makefile_frag}\"" ;;
1357 case "${target_makefile_frag}" in
1359 *) using="${using} and \"${target_makefile_frag}\"" ;;
1362 case "${site_makefile_frag}" in
1364 *) using="${using} and \"${site_makefile_frag}\"" ;;
1367 newusing=`echo "${using}" | sed 's/and/using/'`
1369 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1373 # describe the chosen configuration in config.status.
1374 # Make that file a shellscript which will reestablish
1375 # the same configuration. Used in Makefiles to rebuild
1378 case "${norecursion}" in
1379 "") arguments="${arguments} --norecursion" ;;
1383 if [ ${subdir} = . ] ; then
1386 # This directory was configured as follows:
1387 ${progname}" ${arguments} "
1388 # ${using}" > ${subdir}/config.new
1392 # This directory was configured as follows:
1394 ${progname}" ${arguments} "
1395 # ${using}" > ${subdir}/config.new
1397 chmod a+x ${subdir}/config.new
1398 if [ -r ${subdir}/config.back ] ; then
1399 mv -f ${subdir}/config.back ${subdir}/config.status
1401 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1404 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1408 # If there are subdirectories, then recur.
1409 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1410 for configdir in ${configdirs} ; do
1412 if [ -d ${srcdir}/${configdir} ] ; then
1413 eval echo Configuring ${configdir}... ${redirect}
1417 if [ ! -d ./${configdir} ] ; then
1418 if mkdir ./${configdir} ; then
1421 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1431 ### figure out what to do with srcdir
1433 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1435 newsrcdir=${srcdir}/${configdir}
1436 srcdiroption="--srcdir=${newsrcdir}"
1438 ?:*) # absolute path on win32
1439 newsrcdir=${srcdir}/${configdir}
1440 srcdiroption="--srcdir=${newsrcdir}"
1442 *) # otherwise relative
1443 newsrcdir=../${srcdir}/${configdir}
1444 srcdiroption="--srcdir=${newsrcdir}"
1448 # Handle --cache-file=../XXX
1449 case "${cache_file}" in
1453 cache_file_option="--cache-file=${cache_file}"
1455 ?:*) # absolute path on win32
1456 cache_file_option="--cache-file=${cache_file}"
1459 cache_file_option="--cache-file=../${cache_file}"
1463 ### check for guested configure, otherwise fix possibly relative progname
1464 if [ -f ${newsrcdir}/configure ] ; then
1465 recprog=${newsrcdir}/configure
1466 elif [ -f ${newsrcdir}/configure.in ] ; then
1467 case "${progname}" in
1468 /*) recprog=${progname} ;;
1469 ?:*) recprog=${progname} ;;
1470 *) recprog=../${progname} ;;
1473 eval echo No configuration information in ${configdir} ${redirect}
1477 ### The recursion line is here.
1478 if [ ! -z "${recprog}" ] ; then
1479 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1480 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1481 ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} --with-gcc-version=${gcc_version} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1484 echo Configure in `pwd` failed, exiting. 1>&2
1494 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1495 # and reset the trap handler.
1496 rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos