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, 97, 98, 1999, 2000, 2001
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
58 enable_libstdcxx_v3=yes
62 floating_point=default
71 package_makefile_frag=
72 package_makefile_rules_frag=
79 program_transform_name=
80 program_transform_nameoption=
94 bindir='${exec_prefix}/bin'
95 sbindir='${exec_prefix}/sbin'
96 libexecdir='${exec_prefix}/libexec'
97 datadir='${prefix}/share'
98 sysconfdir='${prefix}/etc'
99 sharedstatedir='${prefix}/com'
100 localstatedir='${prefix}/var'
101 libdir='${exec_prefix}/lib'
102 includedir='${prefix}/include'
103 oldincludedir='/usr/include'
104 infodir='${prefix}/info'
105 mandir='${prefix}/man'
107 ### we might need to use some other shell than /bin/sh for running subshells
109 ### If we are on Windows, search for the shell. This will permit people
110 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
111 ### without also having to set CONFIG_SHELL. This code will work when
112 ### using bash, which sets OSTYPE.
115 if [ x${CONFIG_SHELL} = x ]; then
116 if [ ! -f /bin/sh ]; then
117 if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
118 CONFIG_SHELL=${SHELL}
121 for prog in sh sh.exe bash bash.exe; do
122 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
124 test -z "$dir" && dir=.
125 if test -f $dir/$prog; then
126 CONFIG_SHELL=$dir/$prog
132 test -n "${CONFIG_SHELL}" && break
140 config_shell=${CONFIG_SHELL-/bin/sh}
142 NO_EDIT="This file was generated automatically by configure. Do not edit."
144 ## this is a little touchy and won't always work, but...
146 ## if the argv[0] starts with a slash then it is an absolute name that can (and
147 ## must) be used as is.
149 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
150 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
154 # if PWD already has a value, it is probably wrong.
155 if [ -n "$PWD" ]; then PWD=`pwd`; fi
157 case "${progname}" in
158 /* | [A-Za-z]:[\\/]* ) ;;
161 PATH=$PATH:${PWD=`pwd`} ; export PATH
165 # Export original configure arguments for use by sub-configures.
166 TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
167 export TOPLEVEL_CONFIGURE_ARGUMENTS
174 # Break out if there are no more args
181 # Get the first arg, and shuffle
185 # Make all options have two hyphens
186 orig_option=$option # Save original for error messages
189 -*) option=-$option ;;
192 # Split out the argument for options that take them
195 optarg=`echo $option | sed -e 's/^[^=]*=//'`
196 arguments="$arguments $option"
198 # These options have mandatory values. Since we didn't find an = sign,
199 # the value must be in the next argument
200 --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
203 arguments="$arguments $option=$optarg"
206 arguments="$arguments -v"
209 arguments="$arguments $option"
213 # Now, process the options
218 diroptions="$diroptions --bindir=$optarg"
221 case "$build_alias" in
222 "") build_alias=$optarg ;;
223 *) echo '***' Can only configure for one build machine at a time. 1>&2
233 diroptions="$diroptions --datadir=$optarg"
236 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
238 disableoptions="$disableoptions $option"
246 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
247 eval "$enableopt=\$optarg"
248 enableoptions="$enableoptions '$option'"
250 --exec-prefix* | --ex*)
252 exec_prefixoption="--exec-prefix=$optarg"
262 NOHOST) host_alias=$optarg ;;
263 *) echo '***' Can only configure for one host at a time. 1>&2
270 diroptions="$diroptions --includedir=$optarg"
274 diroptions="$diroptions --infodir=$optarg"
278 diroptions="$diroptions --libdir=$optarg"
282 diroptions="$diroptions --libexecdir=$optarg"
285 localstatedir=$optarg
286 diroptions="$diroptions --localstatedir=$optarg"
290 diroptions="$diroptions --mandir=$optarg"
294 floating_pointoption="--nfp"
296 --norecursion | --no*)
300 oldincludedir=$optarg
301 diroptions="$diroptions --oldincludedir=$optarg"
305 prefixoption="--prefix=$optarg"
307 --program-prefix* | --program-p*)
308 program_prefix=$optarg
309 program_prefixoption="--program-prefix=$optarg"
311 --program-suffix* | --program-s*)
312 program_suffix=$optarg
313 program_suffixoption="--program-suffix=$optarg"
315 --program-transform-name* | --program-t*)
316 # Double any backslashes or dollar signs in the argument
317 program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
318 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
325 diroptions="$diroptions --sbindir=$optarg"
328 sharedstatedir=$optarg
329 diroptions="$diroptions --sharedstatedir=$optarg"
331 --silent | --sil* | --quiet | --q*)
332 redirect=">/dev/null"
337 site_option="--site=$optarg"
340 # Remove trailing slashes. Otherwise, when the file name gets
341 # bolted into an object file as debug info, it has two slashes
342 # in it. Ordinarily this is ok, but emacs takes double slash
343 # to mean "forget the first part".
344 srcdir=`echo $optarg | sed -e 's:/$::'`
351 diroptions="$diroptions --sysconfdir=$optarg"
354 case $target_alias in
355 NOTARGET) target_alias=$optarg ;;
356 *) echo '***' Can only configure for one target at a time. 1>&2
363 tmpdiroption="--tmpdir=$optarg"
365 --verbose | --v | --verb*)
369 --version | --V | --vers*)
370 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
379 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
380 eval $withopt="\$optarg"
381 withoptions="$withoptions $option"
384 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
386 withoutoptions="$withoutoptions $option"
389 withoptions="$withoptions --with-x"
391 --x-i* | --x-l*) other_options="$other_options $orig_option"
394 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
399 NOUNDEFS) undefs=$option ;;
400 *) echo '***' Can only configure for one host and one target at a time. 1>&2
408 # process host and target
410 # Do some error checking and defaulting for the host and target type.
412 # configure --host=HOST --target=TARGET UNDEFS
415 # 1. You aren't allowed to specify --host, --target, and undefs at the
417 # 2. Host defaults to undefs.
418 # 3. If undefs is not specified, then host defaults to the current host,
419 # as determined by config.guess.
420 # 4. Target defaults to undefs.
421 # 5. If undefs is not specified, then target defaults to host.
425 # Make sure that host, target & undefs aren't all specified at the
427 case $host_alias---$target_alias---$undefs in
428 NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
430 *) echo '***' Can only configure for one host and one target at a time. 1>&2
436 # Now, do defaulting for host.
441 # Neither --host option nor undefs were present.
443 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
444 if host_alias=`${config_shell} ${guesssys}`
446 # If the string we are going to use for
447 # the target is a prefix of the string
448 # we just guessed for the host, then
449 # assume we are running native, and force
450 # the same string for both target and host.
451 case $target_alias in
454 if expr $host_alias : $target_alias >/dev/null
456 host_alias=$target_alias
460 echo "Configuring for a ${host_alias} host."
461 arguments="--host=$host_alias $arguments"
463 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
469 arguments="--host=$host_alias $arguments"
475 # Do defaulting for target. If --target option isn't present, default
476 # to undefs. If undefs isn't present, default to host.
477 case $target_alias in
481 target_alias=$host_alias
485 arguments="--target=$target_alias $arguments"
493 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
495 echo Usage: configure [OPTIONS] [HOST]
497 echo Options: [defaults in brackets]
498 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
499 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
500 echo ' --help print this message [normal config]'
501 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
502 echo ' --host=HOST configure for HOST [determined via config.guess]'
503 echo ' --norecursion configure this directory only [recurse]'
504 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
505 echo ' --program-suffix=FOO append FOO to installed program names [""]'
506 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
507 echo ' --site=SITE configure with site-specific makefile for SITE'
508 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
509 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
510 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
511 echo ' --nfp configure for software floating point [hard float]'
512 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
513 echo ' --without-FOO package FOO is NOT available'
514 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
515 echo ' --disable-FOO do not include feature FOO'
517 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
519 if [ -r config.status ] ; then
526 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
527 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
528 ## the sed command below emulates the dirname command
529 topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
532 # this is a hack. sun4 must always be a valid host alias or this will fail.
533 if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
536 echo '***' cannot find config.sub. 1>&2
541 if ${config_shell} ${moveifchange} config.junk config.trash ; then
544 echo '***' cannot find move-if-change. 1>&2
547 rm -f config.junk config.trash
551 if [ -r configure.in ] ; then
554 if [ -r ${progname}.in ] ; then
555 srcdir=`echo ${progname} | sed 's:/configure$::'`
557 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
563 # Set srcdir to "." if that's what it is.
564 # This is important for multilib support.
565 if [ ! -d ${srcdir} ] ; then
566 echo "Invalid source directory ${srcdir}" >&2
570 srcpwd=`cd ${srcdir} ; pwd`
571 if [ "${pwd}" = "${srcpwd}" ] ; then
576 ### warn about some conflicting configurations.
581 if [ -f ${srcdir}/config.status ] ; then
582 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
587 # default exec_prefix
588 case "${exec_prefixoption}" in
589 "") exec_prefix="\$(prefix)" ;;
593 # Define the trigger file to make sure configure will re-run whenever
594 # the gcc version number changes.
595 if [ "${with_gcc_version_trigger+set}" = set ]; then
596 gcc_version_trigger="$with_gcc_version_trigger"
597 gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
599 # If gcc's sources are available, define the trigger file.
600 if [ -f ${topsrcdir}/gcc/version.c ] ; then
601 gcc_version_trigger=${topsrcdir}/gcc/version.c
602 gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
604 *--with-gcc-version-trigger=$gcc_version_trigger* )
607 # Make sure configure.in knows about this.
608 arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
611 withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
615 ### break up ${srcdir}/configure.in.
616 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
618 echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
619 # Check for a directory that's been converted to use autoconf since
620 # it was last configured.
621 if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
622 echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
623 if [ -r ${srcdir}/configure ] ; then
624 echo '***' Running the local configure script. 1>&2
625 case "${cache_file}" in
626 "") cache_file_option= ;;
627 *) cache_file_option="--cache-file=${cache_file}" ;;
629 srcdiroption="--srcdir=${srcdir}"
630 case "${build_alias}" in
632 *) buildopt="--build=${build_alias}" ;;
634 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
635 ${buildopt} --host=${host_alias} --target=${target_alias} \
636 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
637 ${srcdiroption} ${diroptions} \
638 ${program_prefixoption} ${program_suffixoption} \
639 ${program_transform_nameoption} ${site_option} \
640 ${withoptions} ${withoutoptions} \
641 ${enableoptions} ${disableoptions} ${floating_pointoption} \
642 ${cache_file_option} ${removing} ${other_options} ${redirect}
644 echo '***' There is no configure script present though. 1>&2
652 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
654 echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
661 "") TMPDIR=/tmp ; export TMPDIR ;;
665 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
666 tmpdir=${TMPDIR}/cNf$$
667 mkdir ${tmpdir} || exit 1
668 tmpfile=${tmpdir}/cNf$$
669 # Note that under many versions of sh a trap handler for 0 will *override* any
670 # exit status you explicitly specify! At this point, the only non-error exit
671 # is at the end of the script; these actions are duplicated there, minus
672 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
673 # trap handler, or you'll lose.
674 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
676 # split ${srcdir}/configure.in into common, per-host, per-target,
677 # and post-target parts. Post-target is optional.
678 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
679 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
680 if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
681 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
682 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
684 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
688 ### do common part of configure.in
690 # If the language specific compiler does not exist, but the "gcc" directory does,
691 # we will skip this directory; in this case the sub-directory's common part
692 # of configure.in will create a small shell script "skip-this-dir" containing
693 # commands to completely clean up any temporary or created files.
697 if test -f skip-this-dir; then
698 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
699 # and reset the trap handler.
701 rm -rf Makefile* ${tmpdir}
702 # Execute the final clean-up actions
703 ${config_shell} skip-this-dir
704 # and stop configuring this directory.
708 # some sanity checks on configure.in
709 case "${srctrigger}" in
711 echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
717 case "${build_alias}" in
719 if result=`${config_shell} ${configsub} ${host_alias}` ; then
720 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
721 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
722 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
723 build=${build_cpu}-${build_vendor}-${build_os}
724 build_alias=${host_alias}
728 if result=`${config_shell} ${configsub} ${build_alias}` ; then
729 buildopt="--build=${build_alias}"
730 build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
731 build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
732 build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
733 build=${build_cpu}-${build_vendor}-${build_os}
735 echo "Unrecognized build system name ${build_alias}." 1>&2
741 if result=`${config_shell} ${configsub} ${host_alias}` ; then
744 echo "Unrecognized host system name ${host_alias}." 1>&2
747 host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
748 host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
749 host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
750 host=${host_cpu}-${host_vendor}-${host_os}
754 if result=`${config_shell} ${configsub} ${target_alias}` ; then
757 echo "Unrecognized target system name ${target_alias}." 1>&2
760 target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
761 target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
762 target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
763 target=${target_cpu}-${target_vendor}-${target_os}
767 # Find the source files, if location was not specified.
772 if [ ! -r ${srctrigger} ] ; then
779 if [ ! -r ${srcdir}/${srctrigger} ] ; then
780 case "${srcdirdefaulted}" in
781 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
782 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
785 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
789 # Some systems (e.g., one of the i386-aix systems the gas testers are
790 # using) don't handle "\$" correctly, so don't use it here.
791 tooldir='$(exec_prefix)'/${target_alias}
793 if [ "${host_alias}" != "${target_alias}" ] ; then
794 if [ "${program_prefixoption}" = "" ] ; then
795 if [ "${program_suffixoption}" = "" ] ; then
796 if [ "${program_transform_nameoption}" = "" ] ; then
797 program_prefix=${target_alias}- ;
803 # Merge program_prefix and program_suffix onto program_transform_name.
804 # (program_suffix used to use $, but it's hard to preserve $ through both
806 if [ "${program_suffix}" != "" ] ; then
807 program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
810 if [ "${program_prefix}" != "" ] ; then
811 program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
814 # If CC and CXX are not set in the environment, and the Makefile
815 # exists, try to extract them from it. This is to handle running
816 # ./config.status by hand.
817 if [ -z "${CC}" ] && [ -r Makefile ]; then
822 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
823 CC=`tail -1 Makefile.cc`
827 if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
832 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
833 CFLAGS=`tail -1 Makefile.cc`
837 if [ -z "${CXX}" ] && [ -r Makefile ]; then
842 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
843 CXX=`tail -1 Makefile.cc`
847 if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
852 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
853 CXXFLAGS=`tail -1 Makefile.cc`
857 # Generate a default definition for YACC. This is used if the makefile can't
858 # locate bison or byacc in objdir.
860 for prog in 'bison -y' byacc yacc
862 set dummy $prog; tmp=$2
863 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
865 test -z "$dir" && dir=.
866 if test -f $dir/$tmp; then
873 test -n "$DEFAULT_YACC" && break
876 # Generate a default definition for M4. This is used if the makefile can't
877 # locate m4 in objdir.
879 for prog in gm4 gnum4 m4
881 set dummy $prog; tmp=$2
882 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
884 test -z "$dir" && dir=.
885 if test -f $dir/$tmp; then
892 test -n "$DEFAULT_M4" && break
895 # Generate a default definition for LEX. This is used if the makefile can't
896 # locate flex in objdir.
900 set dummy $prog; tmp=$2
901 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
903 test -z "$dir" && dir=.
904 if test -f $dir/$tmp; then
911 test -n "$DEFAULT_LEX" && break
914 if [ "${build}" != "${host}" ]; then
915 # If we are doing a Canadian Cross, in which the host and build systems
916 # are not the same, we set reasonable default values for the tools.
918 tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
919 tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
920 tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
921 tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
922 tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
923 tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
924 tools="${tools} OBJCOPY OBJDUMP"
926 for var in ${tools}; do
927 if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
932 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
933 < Makefile > Makefile.v
934 t=`tail -1 Makefile.v`
935 if [ -n "${t}" ]; then
942 AR=${AR-${host_alias}-ar}
943 AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
944 AS=${AS-${host_alias}-as}
945 AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
947 CC=${CC-${host_alias}-gcc}
948 CFLAGS=${CFLAGS-"-g -O2"}
949 CXX=${CXX-${host_alias}-c++}
950 CXXFLAGS=${CXXFLAGS-"-g -O2"}
951 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
952 CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
953 CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
954 GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj}
955 DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
956 DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
957 GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
958 HOST_PREFIX=${build_alias}-
959 HOST_PREFIX_1=${build_alias}-
960 LD=${LD-${host_alias}-ld}
961 LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
962 MAKEINFO=${MAKEINFO-makeinfo}
963 NM=${NM-${host_alias}-nm}
964 NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
965 RANLIB=${RANLIB-${host_alias}-ranlib}
966 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
967 WINDRES=${WINDRES-${host_alias}-windres}
968 WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
969 OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
970 OBJDUMP=${OBJDUMP-${host_alias}-objdump}
972 if [ -z "${YACC}" ]; then
973 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
975 test -z "$dir" && dir=.
976 if test -f $dir/bison; then
980 if test -f $dir/byacc; then
984 if test -f $dir/yacc; then
990 if [ -z "${YACC}" ]; then
995 if [ -z "${LEX}" ]; then
996 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
998 test -z "$dir" && dir=.
999 if test -f $dir/flex; then
1003 if test -f $dir/lex; then
1012 # Export variables which autoconf might try to set.
1024 # If CC is still not set, try to get gcc.
1025 if [ -z "${CC}" ]; then
1026 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
1027 for dir in $PATH; do
1028 test -z "$dir" && dir=.
1029 if test -f $dir/gcc; then
1031 echo 'void f(){}' > conftest.c
1032 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1033 CFLAGS=${CFLAGS-"-g -O2"}
1034 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1036 CFLAGS=${CFLAGS-"-O2"}
1037 CXXFLAGS=${CXXFLAGS-"-O2"}
1046 if test -z "${CFLAGS}"; then
1047 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1048 # is set to a version of gcc.
1051 echo 'void f(){}' > conftest.c
1052 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1053 CFLAGS=${CFLAGS-"-g -O2"}
1054 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1056 CFLAGS=${CFLAGS-"-O2"}
1057 CXXFLAGS=${CXXFLAGS-"-O2"}
1066 CFLAGS=${CFLAGS-"-g"}
1067 CXXFLAGS=${CXXFLAGS-"-g -O2"}
1075 # FIXME: This should be in configure.in, not configure
1083 # FIXME: This should be in configure.in, not configure
1084 # Determine whether gdb needs tk/tcl or not.
1085 if [ "$enable_gdbtk" != "no" ]; then
1086 GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
1092 if test x"${build_alias}" != x"${host_alias}"
1094 all_build_modules='$(ALL_BUILD_MODULES_LIST)'
1097 for subdir in . ${subdirs} ; do
1099 # ${subdir} is relative path from . to the directory we're currently
1101 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
1102 invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
1104 ### figure out what to do with srcdir
1106 ".") # no -srcdir option. We're building in place.
1108 /* | [A-Za-z]:[\\/]* ) # absolute path
1109 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1111 *) # otherwise relative
1113 .) makesrcdir=${srcdir} ;;
1114 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1119 if [ "${subdir}/" != "./" ] ; then
1120 Makefile=${subdir}/Makefile
1123 if [ ! -d ${subdir} ] ; then
1124 if mkdir ${subdir} ; then
1127 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1132 case "${removing}" in
1136 *) eval echo Building in ${subdir} ${redirect} ;;
1139 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1140 # Set up the list of links to be made.
1141 # ${links} is the list of link names, and ${files} is the list of names to link to.
1144 configlinks="${links}"
1145 if [ -r ${subdir}/config.status ] ; then
1146 mv -f ${subdir}/config.status ${subdir}/config.back
1148 while [ -n "${files}" ] ; do
1149 # set file to car of files, files to cdr of files
1150 set ${files}; file=$1; shift; files=$*
1151 set ${links}; link=$1; shift; links=$*
1153 if [ ! -r ${srcdir}/${file} ] ; then
1154 if [ ! -r ${file} ] ; then
1156 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1157 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1163 srcfile=${srcdir}/${file}
1166 ${remove} -f ${link}
1167 # Make a symlink if possible, otherwise try a hard link
1168 if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
1171 # We need to re-remove the file because Lynx leaves a
1172 # very strange directory there when it fails an NFS symlink.
1173 ${remove} -r -f ${link}
1174 ${hard_link} ${srcfile} ${link}
1176 if [ ! -r ${link} ] ; then
1177 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1181 echo "Linked \"${link}\" to \"${srcfile}\"."
1184 # Create a .gdbinit file which runs the one in srcdir
1185 # and tells GDB to look there for source files.
1187 if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1190 *) cat > ${subdir}/.gdbinit <<EOF
1194 source ${makesrcdir}/.gdbinit
1200 # Install a makefile, and make it set VPATH
1201 # if necessary so that the sources are found.
1202 # Also change its value of srcdir.
1203 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1204 # been somewhat optimized and is perhaps a bit twisty.
1206 # code is order so as to try to sed the smallest input files we know.
1207 # so do these separately because I don't trust the order of sed -e expressions.
1209 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1210 # package macros, target, host, site, and package rules.
1212 if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1214 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1215 rm -f ${subdir}/${Makefile}.tem
1216 case "${package_makefile_rules_frag}" in
1217 "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1219 if [ ! -f ${package_makefile_rules_frag} ] ; then
1220 package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1222 if [ -f ${package_makefile_rules_frag} ] ; then
1223 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1225 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1226 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1227 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1230 # working copy now in ${Makefile}.tem
1232 # Conditionalize for this site.
1235 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1237 site_makefile_frag=${srcdir}/config/ms-${site}
1239 if [ -f ${site_makefile_frag} ] ; then
1240 sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1243 mv ${subdir}/Makefile.tem ${Makefile}
1248 # working copy now in ${Makefile}
1250 # Conditionalize the makefile for this host.
1251 rm -f ${subdir}/Makefile.tem
1252 case "${host_makefile_frag}" in
1253 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1255 if [ ! -f ${host_makefile_frag} ] ; then
1256 host_makefile_frag=${srcdir}/${host_makefile_frag}
1258 if [ -f ${host_makefile_frag} ] ; then
1259 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1261 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1262 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1263 mv ${Makefile} ${subdir}/Makefile.tem
1266 # working copy now in ${subdir)/Makefile.tem
1268 # Conditionalize the makefile for this target.
1270 case "${target_makefile_frag}" in
1271 "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1273 if [ ! -f ${target_makefile_frag} ] ; then
1274 target_makefile_frag=${srcdir}/${target_makefile_frag}
1276 if [ -f ${target_makefile_frag} ] ; then
1277 sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1279 mv ${subdir}/Makefile.tem ${Makefile}
1280 target_makefile_frag=
1284 # working copy now in ${Makefile}
1286 # Emit the default values of this package's macros.
1287 rm -f ${subdir}/Makefile.tem
1288 case "${package_makefile_frag}" in
1289 "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1291 if [ ! -f ${package_makefile_frag} ] ; then
1292 package_makefile_frag=${srcdir}/${package_makefile_frag}
1294 if [ -f ${package_makefile_frag} ] ; then
1295 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1297 echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1298 echo '***' is missing in ${PWD=`pwd`}. 1>&2
1299 mv ${Makefile} ${subdir}/Makefile.tem
1302 # real copy now in ${subdir}/Makefile.tem
1304 # prepend warning about editing, and a bunch of variables.
1306 cat > ${Makefile} <<EOF
1308 VPATH = ${makesrcdir}
1309 links = ${configlinks}
1310 host_alias = ${host_alias}
1311 host_cpu = ${host_cpu}
1312 host_vendor = ${host_vendor}
1313 host_os = ${host_os}
1314 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1315 target_alias = ${target_alias}
1316 target_cpu = ${target_cpu}
1317 target_vendor = ${target_vendor}
1318 target_os = ${target_os}
1319 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1323 *) cat >> ${Makefile} << EOF
1324 build_alias = ${build_alias}
1325 build_cpu = ${build_cpu}
1326 build_vendor = ${build_vendor}
1327 build_os = ${build_os}
1328 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1332 case "${package_makefile_frag}" in
1334 /* | [A-Za-z]:[\\/]* ) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1335 *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1338 case "${target_makefile_frag}" in
1340 /* | [A-Za-z]:[\\/]* ) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1341 *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1344 case "${host_makefile_frag}" in
1346 /* | [A-Za-z]:[\\/]* ) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1347 *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1350 if [ "${site_makefile_frag}" != "" ] ; then
1351 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1354 echo enable_shared = ${enable_shared} >> ${Makefile}
1355 echo enable_threads = ${enable_threads} >> ${Makefile}
1356 # record if we want to rumtime library stuff installed in libsubdir.
1357 if test -z "${enable_version_specific_runtime_libs}"; then
1358 echo enable_version_specific_runtime_libs = no >> ${Makefile}
1360 echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
1363 # Emit a macro which describes the file containing gcc's
1365 echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
1366 # And emit a macro defining gcc's version number.
1367 echo gcc_version = ${gcc_version} >> ${Makefile}
1369 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1370 # remove any form feeds.
1371 if [ -z "${subdirs}" ]; then
1372 rm -f ${subdir}/Makefile.tm2
1375 s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:
1376 s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:
1379 ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1381 rm -f ${subdir}/Makefile.tem
1382 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1384 sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
1385 -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
1386 -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
1387 -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
1388 -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
1389 -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
1390 -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
1391 -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
1392 -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
1393 -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
1394 -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
1395 -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
1396 -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
1397 -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
1398 -e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \
1404 s%^CC[ ]*=.*$%CC = ${CC}%
1411 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1418 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1420 -e "/^CXXFLAGS[ ]*=/{
1425 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1427 -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
1428 -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
1430 -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
1431 -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
1432 -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
1433 -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
1434 -e "s|^build_tooldir[ ]*=.*$|build_tooldir = ${tooldir}|" \
1435 -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1436 -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1437 -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
1438 ${subdir}/Makefile.tem >> ${Makefile}
1440 sed -e "s:^GDB_TK[ ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
1441 mv -f ${Makefile}.tem ${Makefile}
1443 # If this is a Canadian Cross, preset the values of many more
1445 if [ "${build}" != "${host}" ]; then
1446 for var in ${tools}; do
1448 sed -e "/^${var}[ ]*=/{
1453 s%^${var}[ ]*=.*$%${var} = ${val}%
1454 }" ${Makefile} > ${Makefile}.tem
1455 mv -f ${Makefile}.tem ${Makefile}
1459 # final copy now in ${Makefile}
1462 echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1465 rm -f ${subdir}/Makefile.tem
1467 case "${host_makefile_frag}" in
1469 *) using="and \"${host_makefile_frag}\"" ;;
1472 case "${target_makefile_frag}" in
1474 *) using="${using} and \"${target_makefile_frag}\"" ;;
1477 case "${site_makefile_frag}" in
1479 *) using="${using} and \"${site_makefile_frag}\"" ;;
1482 newusing=`echo "${using}" | sed 's/and/using/'`
1484 echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1488 # describe the chosen configuration in config.status.
1489 # Make that file a shellscript which will reestablish
1490 # the same configuration. Used in Makefiles to rebuild
1493 case "${norecursion}" in
1494 "") arguments="${arguments} --norecursion" ;;
1498 if [ ${subdir} = . ] ; then
1501 # This directory was configured as follows:
1502 ${progname}" ${arguments} "
1503 # ${using}" > ${subdir}/config.new
1507 # This directory was configured as follows:
1509 ${progname}" ${arguments} "
1510 # ${using}" > ${subdir}/config.new
1512 chmod a+x ${subdir}/config.new
1513 if [ -r ${subdir}/config.back ] ; then
1514 mv -f ${subdir}/config.back ${subdir}/config.status
1516 ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1519 *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1523 # If there are subdirectories, then recur.
1524 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1525 for configdir in ${configdirs} ${extraconfigdirs} ; do
1527 # If configdir contains ',' it is
1528 # srcdir,builddir,target_alias
1529 # These come from extraconfigdirs.
1530 case ${configdir} in
1532 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1535 cfg_dir=${configdir}
1536 bld_dir=${configdir}
1537 tgt_alias=${target_alias}
1541 if [ -d ${srcdir}/${cfg_dir} ] ; then
1542 eval echo Configuring ${configdir}... ${redirect}
1546 if [ ! -d ./${bld_dir} ] ; then
1547 if mkdir ./${bld_dir} ; then
1550 echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
1560 ### figure out what to do with srcdir
1562 ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
1563 /* | [A-Za-z]:[\\/]* ) # absolute path
1564 newsrcdir=${srcdir}/${cfg_dir}
1565 srcdiroption="--srcdir=${newsrcdir}"
1567 *) # otherwise relative
1568 newsrcdir=../${srcdir}/${cfg_dir}
1569 srcdiroption="--srcdir=${newsrcdir}"
1573 # Handle --cache-file=../XXX
1574 case "${cache_file}" in
1577 /* | [A-Za-z]:[\\/]* ) # absolute path
1578 cache_file_option="--cache-file=${cache_file}"
1581 cache_file_option="--cache-file=../${cache_file}"
1585 ### check for guested configure, otherwise fix possibly relative progname
1586 if [ -f ${newsrcdir}/configure ] ; then
1587 recprog=${newsrcdir}/configure
1588 elif [ -f ${newsrcdir}/configure.in ] ; then
1589 case "${progname}" in
1590 /* | [A-Za-z]:[\\/]* ) recprog=${progname} ;;
1591 *) recprog=../${progname} ;;
1594 eval echo No configuration information in ${cfg_dir} ${redirect}
1598 ### The recursion line is here.
1599 if [ ! -z "${recprog}" ] ; then
1600 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1601 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1602 ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1605 echo Configure in `pwd` failed, exiting. 1>&2
1615 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1616 # and reset the trap handler.