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 # 2002 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
=
91 version
="$Revision: 1.47 $"
93 bindir
='${exec_prefix}/bin'
94 sbindir
='${exec_prefix}/sbin'
95 libexecdir
='${exec_prefix}/libexec'
96 datadir
='${prefix}/share'
97 sysconfdir
='${prefix}/etc'
98 sharedstatedir
='${prefix}/com'
99 localstatedir
='${prefix}/var'
100 libdir
='${exec_prefix}/lib'
101 includedir
='${prefix}/include'
102 oldincludedir
='/usr/include'
103 infodir
='${prefix}/info'
104 mandir
='${prefix}/man'
106 ### we might need to use some other shell than /bin/sh for running subshells
108 ### If we are on Windows, search for the shell. This will permit people
109 ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
110 ### without also having to set CONFIG_SHELL. This code will work when
111 ### using bash, which sets OSTYPE.
114 if [ x
${CONFIG_SHELL} = x
]; then
115 if [ ! -f /bin
/sh
]; then
116 if [ x
${SHELL} != x
] && [ -f ${SHELL} ]; then
117 CONFIG_SHELL
=${SHELL}
120 for prog
in sh sh.exe bash bash.exe
; do
121 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
123 test -z "$dir" && dir
=.
124 if test -f $dir/$prog; then
125 CONFIG_SHELL
=$dir/$prog
131 test -n "${CONFIG_SHELL}" && break
139 config_shell
=${CONFIG_SHELL-/bin/sh}
141 NO_EDIT
="This file was generated automatically by configure. Do not edit."
143 ## this is a little touchy and won't always work, but...
145 ## if the argv[0] starts with a slash then it is an absolute name that can (and
146 ## must) be used as is.
148 ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
149 ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
153 # if PWD already has a value, it is probably wrong.
154 if [ -n "$PWD" ]; then PWD
=`${PWDCMD-pwd}`; fi
156 case "${progname}" in
157 /* |
[A-Za-z
]:[\\/]* ) ;;
160 PATH
=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH
164 # Export original configure arguments for use by sub-configures.
165 TOPLEVEL_CONFIGURE_ARGUMENTS
="$progname $@"
166 export TOPLEVEL_CONFIGURE_ARGUMENTS
173 # Break out if there are no more args
180 # Get the first arg, and shuffle
184 # Make all options have two hyphens
185 orig_option
=$option # Save original for error messages
188 -*) option
=-$option ;;
191 # Split out the argument for options that take them
194 optarg
=`echo $option | sed -e 's/^[^=]*=//'`
195 arguments
="$arguments $option"
197 # These options have mandatory values. Since we didn't find an = sign,
198 # the value must be in the next argument
199 --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*)
202 arguments
="$arguments $option=$optarg"
205 arguments
="$arguments -v"
208 arguments
="$arguments $option"
212 # Now, process the options
217 diroptions
="$diroptions --bindir=$optarg"
220 case "$build_alias" in
221 "") build_alias
=$optarg ;;
222 *) echo '***' Can only configure
for one build machine
at a
time.
1>&2
232 diroptions
="$diroptions --datadir=$optarg"
235 enableopt
=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
237 disableoptions
="$disableoptions $option"
245 enableopt
=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
246 eval "$enableopt=\$optarg"
247 enableoptions
="$enableoptions '$option'"
249 --exec-prefix* |
--ex*)
251 exec_prefixoption
="--exec-prefix=$optarg"
261 NOHOST
) host_alias
=$optarg ;;
262 *) echo '***' Can only configure
for one
host at a
time.
1>&2
269 diroptions
="$diroptions --includedir=$optarg"
273 diroptions
="$diroptions --infodir=$optarg"
277 diroptions
="$diroptions --libdir=$optarg"
281 diroptions
="$diroptions --libexecdir=$optarg"
284 localstatedir
=$optarg
285 diroptions
="$diroptions --localstatedir=$optarg"
289 diroptions
="$diroptions --mandir=$optarg"
293 floating_pointoption
="--nfp"
295 --norecursion |
--no*)
299 oldincludedir
=$optarg
300 diroptions
="$diroptions --oldincludedir=$optarg"
304 prefixoption
="--prefix=$optarg"
306 --program-prefix* |
--program-p*)
307 program_prefix
=$optarg
308 program_prefixoption
="--program-prefix=$optarg"
310 --program-suffix* |
--program-s*)
311 program_suffix
=$optarg
312 program_suffixoption
="--program-suffix=$optarg"
314 --program-transform-name* |
--program-t*)
315 # Double any backslashes or dollar signs in the argument
316 program_transform_name
="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
317 program_transform_nameoption
="${program_transform_nameoption} --program-transform-name='$optarg'"
324 diroptions
="$diroptions --sbindir=$optarg"
327 sharedstatedir
=$optarg
328 diroptions
="$diroptions --sharedstatedir=$optarg"
330 --silent |
--sil* |
--quiet |
--q*)
331 redirect
=">/dev/null"
336 site_option
="--site=$optarg"
339 # Remove trailing slashes. Otherwise, when the file name gets
340 # bolted into an object file as debug info, it has two slashes
341 # in it. Ordinarily this is ok, but emacs takes double slash
342 # to mean "forget the first part".
343 srcdir
=`echo $optarg | sed -e 's:/$::'`
350 diroptions
="$diroptions --sysconfdir=$optarg"
353 case $target_alias in
354 NOTARGET
) target_alias
=$optarg ;;
355 *) echo '***' Can only configure
for one target
at a
time.
1>&2
362 tmpdiroption
="--tmpdir=$optarg"
364 --verbose |
--v |
--verb*)
368 --version |
--V |
--vers*)
369 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
378 withopt
=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
379 eval $withopt="\$optarg"
380 withoptions
="$withoptions $option"
383 withopt
=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
385 withoutoptions
="$withoutoptions $option"
388 withoptions
="$withoptions --with-x"
390 --x-i* |
--x-l*) other_options
="$other_options $orig_option"
393 echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
398 NOUNDEFS
) undefs
=$option ;;
399 *) echo '***' Can only configure
for one
host and one target
at a
time.
1>&2
407 # process host and target
409 # Do some error checking and defaulting for the host and target type.
411 # configure --host=HOST --target=TARGET UNDEFS
414 # 1. You aren't allowed to specify --host, --target, and undefs at the
416 # 2. Host defaults to undefs.
417 # 3. If undefs is not specified, then host defaults to the current host,
418 # as determined by config.guess.
419 # 4. Target defaults to undefs.
420 # 5. If undefs is not specified, then target defaults to host.
424 # Make sure that host, target & undefs aren't all specified at the
426 case $host_alias---$target_alias---$undefs in
427 NOHOST---
*---* |
*---NOTARGET---* |
*---*---NOUNDEFS)
429 *) echo '***' Can only configure
for one
host and one target
at a
time.
1>&2
435 # Now, do defaulting for host.
440 # Neither --host option nor undefs were present.
442 guesssys
=`echo ${progname} | sed 's/configure$/config.guess/'`
443 if host_alias
=`${config_shell} ${guesssys}`
445 # If the string we are going to use for
446 # the target is a prefix of the string
447 # we just guessed for the host, then
448 # assume we are running native, and force
449 # the same string for both target and host.
450 case $target_alias in
453 if expr $host_alias : $target_alias >/dev
/null
455 host_alias
=$target_alias
459 echo "Configuring for a ${host_alias} host."
460 arguments
="--host=$host_alias $arguments"
462 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
468 arguments
="--host=$host_alias $arguments"
474 # Do defaulting for target. If --target option isn't present, default
475 # to undefs. If undefs isn't present, default to host.
476 case $target_alias in
480 target_alias
=$host_alias
484 arguments
="--target=$target_alias $arguments"
492 if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
494 echo Usage
: configure
[OPTIONS
] [HOST
]
496 echo Options
: [defaults
in brackets
]
497 echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
498 echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
499 echo ' --help print this message [normal config]'
500 echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
501 echo ' --host=HOST configure for HOST [determined via config.guess]'
502 echo ' --norecursion configure this directory only [recurse]'
503 echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
504 echo ' --program-suffix=FOO append FOO to installed program names [""]'
505 echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
506 echo ' --site=SITE configure with site-specific makefile for SITE'
507 echo ' --srcdir=DIR find the sources in DIR [. or ..]'
508 echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
509 echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
510 echo ' --nfp configure for software floating point [hard float]'
511 echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
512 echo ' --without-FOO package FOO is NOT available'
513 echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
514 echo ' --disable-FOO do not include feature FOO'
516 echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
518 if [ -r config.status
] ; then
525 configsub
=`echo ${progname} | sed 's/configure$/config.sub/'`
526 moveifchange
=`echo ${progname} | sed 's/configure$/move-if-change/'`
527 ## the sed command below emulates the dirname command
528 topsrcdir
=`cd \`echo ${progname} |
sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\
`; ${PWDCMD-pwd}`
531 # this is a hack. sun4 must always be a valid host alias or this will fail.
532 if ${config_shell} ${configsub} sun4
>/dev
/null
2>&1 ; then
535 echo '***' cannot
find config.sub.
1>&2
540 if ${config_shell} ${moveifchange} config.junk config.trash
; then
543 echo '***' cannot
find move-if-change.
1>&2
546 rm -f config.junk config.trash
550 if [ -r configure.
in ] ; then
553 if [ -r ${progname}.
in ] ; then
554 srcdir
=`echo ${progname} | sed 's:/configure$::'`
556 echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
562 # Set srcdir to "." if that's what it is.
563 # This is important for multilib support.
564 if [ ! -d ${srcdir} ] ; then
565 echo "Invalid source directory ${srcdir}" >&2
569 srcpwd
=`cd ${srcdir} ; ${PWDCMD-pwd}`
570 if [ "${pwd}" = "${srcpwd}" ] ; then
575 ### warn about some conflicting configurations.
580 if [ -f ${srcdir}/config.status
] ; then
581 echo '***' Cannot configure here
in \"${PWD=`${PWDCMD-pwd}`}\" when
\"${srcdir}\" is currently configured.
1>&2
586 # default exec_prefix
587 case "${exec_prefixoption}" in
588 "") exec_prefix
="\$(prefix)" ;;
592 # Define the trigger file to make sure configure will re-run whenever
593 # the gcc version number changes.
594 if [ "${with_gcc_version_trigger+set}" = set ]; then
595 gcc_version_trigger
="$with_gcc_version_trigger"
596 gcc_version
=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
598 # If gcc's sources are available, define the trigger file.
599 if [ -f ${topsrcdir}/gcc
/version.c
] ; then
600 gcc_version_trigger
=${topsrcdir}/gcc
/version.c
601 gcc_version
=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'`
603 *--with-gcc-version-trigger=$gcc_version_trigger* )
606 # Make sure configure.in knows about this.
607 arguments
="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
610 withoptions
="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
614 ### break up ${srcdir}/configure.in.
615 case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
617 echo '***' ${srcdir}/configure.
in has no
\"per-host
:\" line.
1>&2
618 # Check for a directory that's been converted to use autoconf since
619 # it was last configured.
620 if grep AC_OUTPUT
${srcdir}/configure.
in >/dev
/null
; then
621 echo '***' Hmm
, looks like this directory has been autoconfiscated.
1>&2
622 if [ -r ${srcdir}/configure
] ; then
623 echo '***' Running the
local configure
script.
1>&2
624 case "${cache_file}" in
625 "") cache_file_option
= ;;
626 *) cache_file_option
="--cache-file=${cache_file}" ;;
628 srcdiroption
="--srcdir=${srcdir}"
629 case "${build_alias}" in
631 *) buildopt
="--build=${build_alias}" ;;
633 eval exec ${config_shell} ${srcdir}/configure ${verbose} \
634 ${buildopt} --host=${host_alias} --target=${target_alias} \
635 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
636 ${srcdiroption} ${diroptions} \
637 ${program_prefixoption} ${program_suffixoption} \
638 ${program_transform_nameoption} ${site_option} \
639 ${withoptions} ${withoutoptions} \
640 ${enableoptions} ${disableoptions} ${floating_pointoption} \
641 ${cache_file_option} ${removing} ${other_options} ${redirect}
643 echo '***' There is no configure
script present though.
1>&2
651 case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
653 echo '***' ${srcdir}/configure.
in has no
\"per-target
:\" line.
1>&2
660 "") TMPDIR
=/tmp
; export TMPDIR
;;
664 # keep this filename short for &%*%$*# 14 char file names and 8+3 file names
665 tmpdir
=${TMPDIR}/cNf$$
666 mkdir
${tmpdir} ||
exit 1
667 tmpfile
=${tmpdir}/cNf$$
668 # Note that under many versions of sh a trap handler for 0 will *override* any
669 # exit status you explicitly specify! At this point, the only non-error exit
670 # is at the end of the script; these actions are duplicated there, minus
671 # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
672 # trap handler, or you'll lose.
673 trap "rm -rf Makefile.tem ${tmpdir}; exit 1" 0 1 2 15
675 # split ${srcdir}/configure.in into common, per-host, per-target,
676 # and post-target parts. Post-target is optional.
677 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.
in > ${tmpfile}.com
678 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.hst
679 if grep '^# post-target:' ${srcdir}/configure.
in >/dev
/null
; then
680 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.
in > ${tmpfile}.tgt
681 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.pos
683 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.
in > ${tmpfile}.tgt
687 ### do common part of configure.in
689 # If the language specific compiler does not exist, but the "gcc" directory does,
690 # we will skip this directory; in this case the sub-directory's common part
691 # of configure.in will create a small shell script "skip-this-dir" containing
692 # commands to completely clean up any temporary or created files.
696 if test -f skip-this-dir
; then
697 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
698 # and reset the trap handler.
700 rm -rf Makefile
* ${tmpdir}
701 # Execute the final clean-up actions
702 ${config_shell} skip-this-dir
703 # and stop configuring this directory.
707 # some sanity checks on configure.in
708 case "${srctrigger}" in
710 echo '***' srctrigger not
set in ${PWD=`${PWDCMD-pwd}`}/configure.
in.
1>&2
716 case "${build_alias}" in
718 if result
=`${config_shell} ${configsub} ${host_alias}` ; then
719 build_cpu
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
720 build_vendor
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
721 build_os
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
722 build
=${build_cpu}-${build_vendor}-${build_os}
723 build_alias
=${host_alias}
727 if result
=`${config_shell} ${configsub} ${build_alias}` ; then
728 buildopt
="--build=${build_alias}"
729 build_cpu
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
730 build_vendor
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
731 build_os
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
732 build
=${build_cpu}-${build_vendor}-${build_os}
734 echo "Unrecognized build system name ${build_alias}." 1>&2
740 if result
=`${config_shell} ${configsub} ${host_alias}` ; then
743 echo "Unrecognized host system name ${host_alias}." 1>&2
746 host_cpu
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
747 host_vendor
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
748 host_os
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
749 host=${host_cpu}-${host_vendor}-${host_os}
753 if result
=`${config_shell} ${configsub} ${target_alias}` ; then
756 echo "Unrecognized target system name ${target_alias}." 1>&2
759 target_cpu
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
760 target_vendor
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
761 target_os
=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
762 target
=${target_cpu}-${target_vendor}-${target_os}
766 # Find the source files, if location was not specified.
771 if [ ! -r ${srctrigger} ] ; then
778 if [ ! -r ${srcdir}/${srctrigger} ] ; then
779 case "${srcdirdefaulted}" in
780 "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;;
781 *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;;
784 echo '***' \
(At least
${srctrigger} is missing.\
) 1>&2
788 # Some systems (e.g., one of the i386-aix systems the gas testers are
789 # using) don't handle "\$" correctly, so don't use it here.
790 tooldir
='$(exec_prefix)'/${target_alias}
792 if [ "${host_alias}" != "${target_alias}" ] ; then
793 if [ "${program_prefixoption}" = "" ] ; then
794 if [ "${program_suffixoption}" = "" ] ; then
795 if [ "${program_transform_nameoption}" = "" ] ; then
796 program_prefix
=${target_alias}- ;
802 # Merge program_prefix and program_suffix onto program_transform_name.
803 # (program_suffix used to use $, but it's hard to preserve $ through both
805 if [ "${program_suffix}" != "" ] ; then
806 program_transform_name
="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
809 if [ "${program_prefix}" != "" ] ; then
810 program_transform_name
="-e s,^,${program_prefix}, ${program_transform_name}"
813 # If CC and CXX are not set in the environment, and the Makefile
814 # exists, try to extract them from it. This is to handle running
815 # ./config.status by hand.
816 if [ -z "${CC}" ] && [ -r Makefile
]; then
821 /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
822 CC
=`tail -1 Makefile.cc`
826 if [ -z "${CFLAGS}" ] && [ -r Makefile
]; then
831 /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
832 CFLAGS
=`tail -1 Makefile.cc`
836 if [ -z "${CXX}" ] && [ -r Makefile
]; then
841 /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
842 CXX
=`tail -1 Makefile.cc`
846 if [ -z "${CXXFLAGS}" ] && [ -r Makefile
]; then
851 /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile
> Makefile.cc
852 CXXFLAGS
=`tail -1 Makefile.cc`
856 # Generate a default definition for YACC. This is used if the makefile can't
857 # locate bison or byacc in objdir.
859 for prog
in 'bison -y' byacc
yacc
861 set dummy
$prog; tmp
=$2
862 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
864 test -z "$dir" && dir
=.
865 if test -f $dir/$tmp; then
872 test -n "$DEFAULT_YACC" && break
875 # Generate a default definition for M4. This is used if the makefile can't
876 # locate m4 in objdir.
878 for prog
in gm4 gnum4
m4
880 set dummy
$prog; tmp
=$2
881 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
883 test -z "$dir" && dir
=.
884 if test -f $dir/$tmp; then
891 test -n "$DEFAULT_M4" && break
894 # Generate a default definition for LEX. This is used if the makefile can't
895 # locate flex in objdir.
899 set dummy
$prog; tmp
=$2
900 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
902 test -z "$dir" && dir
=.
903 if test -f $dir/$tmp; then
910 test -n "$DEFAULT_LEX" && break
913 if [ "${build}" != "${host}" ]; then
914 # If we are doing a Canadian Cross, in which the host and build systems
915 # are not the same, we set reasonable default values for the tools.
917 tools
="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
918 tools
="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
919 tools
="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
920 tools
="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
921 tools
="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
922 tools
="${tools} WINDRES WINDRES_FOR_TARGET YACC"
923 tools
="${tools} OBJCOPY OBJDUMP"
925 for var
in ${tools}; do
926 if eval [ -z \"\$
${var}\" ] && [ -r Makefile
]; then
931 /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
932 < Makefile
> Makefile.v
933 t
=`tail -1 Makefile.v`
934 if [ -n "${t}" ]; then
941 AR
=${AR-${host_alias}-ar}
942 AR_FOR_TARGET
=${AR_FOR_TARGET-${target_alias}-ar}
943 AS
=${AS-${host_alias}-as}
944 AS_FOR_TARGET
=${AS_FOR_TARGET-${target_alias}-as}
946 CC
=${CC-${host_alias}-gcc}
947 CFLAGS
=${CFLAGS-"-g -O2"}
948 CXX
=${CXX-${host_alias}-c++}
949 CXXFLAGS
=${CXXFLAGS-"-g -O2"}
950 CC_FOR_BUILD
=${CC_FOR_BUILD-gcc}
951 CC_FOR_TARGET
=${CC_FOR_TARGET-${target_alias}-gcc}
952 CXX_FOR_TARGET
=${CXX_FOR_TARGET-${target_alias}-c++}
953 GCJ_FOR_TARGET
=${GCJ_FOR_TARGET-${target_alias}-gcj}
954 DLLTOOL
=${DLLTOOL-${host_alias}-dlltool}
955 DLLTOOL_FOR_TARGET
=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
956 GCC_FOR_TARGET
=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
957 BUILD_PREFIX
=${build_alias}-
958 BUILD_PREFIX_1
=${build_alias}-
959 LD
=${LD-${host_alias}-ld}
960 LD_FOR_TARGET
=${LD_FOR_TARGET-${target_alias}-ld}
961 MAKEINFO
=${MAKEINFO-makeinfo}
962 NM
=${NM-${host_alias}-nm}
963 NM_FOR_TARGET
=${NM_FOR_TARGET-${target_alias}-nm}
964 RANLIB
=${RANLIB-${host_alias}-ranlib}
965 RANLIB_FOR_TARGET
=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
966 WINDRES
=${WINDRES-${host_alias}-windres}
967 WINDRES_FOR_TARGET
=${WINDRES_FOR_TARGET-${target_alias}-windres}
968 OBJCOPY
=${OBJCOPY-${host_alias}-objcopy}
969 OBJDUMP
=${OBJDUMP-${host_alias}-objdump}
971 if [ -z "${YACC}" ]; then
972 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
974 test -z "$dir" && dir
=.
975 if test -f $dir/bison
; then
979 if test -f $dir/byacc
; then
983 if test -f $dir/yacc; then
989 if [ -z "${YACC}" ]; then
994 if [ -z "${LEX}" ]; then
995 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
997 test -z "$dir" && dir
=.
998 if test -f $dir/flex
; then
1002 if test -f $dir/lex; then
1011 # Export variables which autoconf might try to set.
1023 # If CC is still not set, try to get gcc.
1024 if [ -z "${CC}" ]; then
1025 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
="${IFS}:"
1026 for dir
in $PATH; do
1027 test -z "$dir" && dir
=.
1028 if test -f $dir/gcc
; then
1030 echo 'void f(){}' > conftest.c
1031 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1032 CFLAGS
=${CFLAGS-"-g -O2"}
1033 CXXFLAGS
=${CXXFLAGS-"-g -O2"}
1035 CFLAGS
=${CFLAGS-"-O2"}
1036 CXXFLAGS
=${CXXFLAGS-"-O2"}
1045 if test -z "${CFLAGS}"; then
1046 # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
1047 # is set to a version of gcc.
1050 echo 'void f(){}' > conftest.c
1051 if test -z "`${CC} -g -c conftest.c 2>&1`"; then
1052 CFLAGS
=${CFLAGS-"-g -O2"}
1053 CXXFLAGS
=${CXXFLAGS-"-g -O2"}
1055 CFLAGS
=${CFLAGS-"-O2"}
1056 CXXFLAGS
=${CXXFLAGS-"-O2"}
1065 CFLAGS
=${CFLAGS-"-g"}
1066 CXXFLAGS
=${CXXFLAGS-"-g -O2"}
1075 if test x
"${build_alias}" != x
"${host_alias}"
1077 all_build_modules
='$(ALL_BUILD_MODULES_LIST)'
1080 case "${removing}" in
1083 # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1084 # Set up the list of links to be made.
1085 # ${links} is the list of link names, and ${files} is the list of names to link to.
1088 configlinks
="${links}"
1089 if [ -r .
/config.status
] ; then
1090 mv -f .
/config.status .
/config.back
1092 while [ -n "${files}" ] ; do
1093 # set file to car of files, files to cdr of files
1094 set ${files}; file=$1; shift; files
=$
*
1095 set ${links}; link
=$1; shift; links
=$
*
1097 if [ ! -r ${srcdir}/${file} ] ; then
1098 if [ ! -r ${file} ] ; then
1100 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1101 echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1107 srcfile
=${srcdir}/${file}
1110 ${remove} -f ${link}
1111 # Make a symlink if possible, otherwise try a hard link
1112 if ${symbolic_link} ${srcfile} ${link} >/dev
/null
2>&1 ; then
1115 # We need to re-remove the file because Lynx leaves a
1116 # very strange directory there when it fails an NFS symlink.
1117 ${remove} -r -f ${link}
1118 ${hard_link} ${srcfile} ${link}
1120 if [ ! -r ${link} ] ; then
1121 echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
1125 echo "Linked \"${link}\" to \"${srcfile}\"."
1128 # Create a .gdbinit file which runs the one in srcdir
1129 # and tells GDB to look there for source files.
1131 if [ -r ${srcdir}/.gdbinit
] ; then
1134 *) cat > .
/.gdbinit
<<EOF
1138 source ${srcdir}/.gdbinit
1144 # Install a makefile, and make it set VPATH
1145 # if necessary so that the sources are found.
1146 # Also change its value of srcdir.
1147 # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
1148 # been somewhat optimized and is perhaps a bit twisty.
1150 # code is order so as to try to sed the smallest input files we know.
1151 # so do these separately because I don't trust the order of sed -e expressions.
1153 # the five makefile fragments MUST end up in the resulting Makefile in this order:
1154 # package macros, target, host, site, and package rules.
1156 if [ -f ${srcdir}/${Makefile_in} ] ; then
1158 # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1159 rm -f .
/${Makefile}.tem
1160 case "${package_makefile_rules_frag}" in
1161 "") cp ${srcdir}/${Makefile_in} .
/Makefile.tem
;;
1163 if [ ! -f ${package_makefile_rules_frag} ] ; then
1164 package_makefile_rules_frag
=${srcdir}/${package_makefile_rules_frag}
1166 if [ -f ${package_makefile_rules_frag} ] ; then
1167 sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${Makefile_in} > ${Makefile}.tem
1169 echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1170 echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
1171 cp ${srcdir}/${Makefile_in} ./Makefile.tem
1174 # working copy now in ${Makefile}.tem
1176 # Conditionalize for this site.
1179 "") mv ./Makefile.tem ${Makefile} ;;
1181 site_makefile_frag=${srcdir}/config/ms-${site}
1183 if [ -f ${site_makefile_frag} ] ; then
1184 sed -e "/^
####/ r ${site_makefile_frag}" ./Makefile.tem \
1187 mv .
/Makefile.tem
${Makefile}
1192 # working copy now in ${Makefile}
1194 # Conditionalize the makefile for this host.
1195 rm -f .
/Makefile.tem
1196 case "${host_makefile_frag}" in
1197 "") mv ${Makefile} .
/Makefile.tem
;;
1199 if [ ! -f ${host_makefile_frag} ] ; then
1200 host_makefile_frag
=${srcdir}/${host_makefile_frag}
1202 if [ -f ${host_makefile_frag} ] ; then
1203 sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > .
/Makefile.tem
1205 echo '***' Expected
host makefile fragment
\"${host_makefile_frag}\" 1>&2
1206 echo '***' is missing
in ${PWD=`${PWDCMD-pwd}`}.
1>&2
1207 mv ${Makefile} .
/Makefile.tem
1210 # working copy now in ./Makefile.tem
1212 # Conditionalize the makefile for this target.
1214 case "${target_makefile_frag}" in
1215 "") mv .
/Makefile.tem
${Makefile} ;;
1217 if [ ! -f ${target_makefile_frag} ] ; then
1218 target_makefile_frag
=${srcdir}/${target_makefile_frag}
1220 if [ -f ${target_makefile_frag} ] ; then
1221 sed -e "/^####/ r ${target_makefile_frag}" .
/Makefile.tem
> ${Makefile}
1223 mv .
/Makefile.tem
${Makefile}
1224 target_makefile_frag
=
1228 # working copy now in ${Makefile}
1230 # Emit the default values of this package's macros.
1231 rm -f .
/Makefile.tem
1232 case "${package_makefile_frag}" in
1233 "") mv ${Makefile} .
/Makefile.tem
;;
1235 if [ ! -f ${package_makefile_frag} ] ; then
1236 package_makefile_frag
=${srcdir}/${package_makefile_frag}
1238 if [ -f ${package_makefile_frag} ] ; then
1239 sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > .
/Makefile.tem
1241 echo '***' Expected package makefile fragment
\"${package_makefile_rules_frag}\" 1>&2
1242 echo '***' is missing
in ${PWD=`${PWDCMD-pwd}`}.
1>&2
1243 mv ${Makefile} .
/Makefile.tem
1246 # real copy now in ./Makefile.tem
1248 # prepend warning about editing, and a bunch of variables.
1250 cat > ${Makefile} <<EOF
1253 links = ${configlinks}
1254 host_alias = ${host_alias}
1255 host_cpu = ${host_cpu}
1256 host_vendor = ${host_vendor}
1257 host_os = ${host_os}
1258 host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1259 target_alias = ${target_alias}
1260 target_cpu = ${target_cpu}
1261 target_vendor = ${target_vendor}
1262 target_os = ${target_os}
1263 target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1267 *) cat >> ${Makefile} << EOF
1268 build_alias = ${build_alias}
1269 build_cpu = ${build_cpu}
1270 build_vendor = ${build_vendor}
1271 build_os = ${build_os}
1272 build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1276 case "${package_makefile_frag}" in
1278 /* |
[A-Za-z
]:[\\/]* ) echo package_makefile_frag
= ${package_makefile_frag} >>${Makefile} ;;
1279 *) echo package_makefile_frag
= ${package_makefile_frag} >>${Makefile} ;;
1282 case "${target_makefile_frag}" in
1284 /* |
[A-Za-z
]:[\\/]* ) echo target_makefile_frag
= ${target_makefile_frag} >>${Makefile} ;;
1285 *) echo target_makefile_frag
= ${target_makefile_frag} >>${Makefile} ;;
1288 case "${host_makefile_frag}" in
1290 /* |
[A-Za-z
]:[\\/]* ) echo host_makefile_frag
= ${host_makefile_frag} >>${Makefile} ;;
1291 *) echo host_makefile_frag
= ${host_makefile_frag} >>${Makefile} ;;
1294 if [ "${site_makefile_frag}" != "" ] ; then
1295 echo site_makefile_frag
= ${site_makefile_frag} >>${Makefile}
1298 echo enable_shared
= ${enable_shared} >> ${Makefile}
1299 echo enable_threads
= ${enable_threads} >> ${Makefile}
1300 # record if we want to rumtime library stuff installed in libsubdir.
1301 if test -z "${enable_version_specific_runtime_libs}"; then
1302 echo enable_version_specific_runtime_libs
= no
>> ${Makefile}
1304 echo enable_version_specific_runtime_libs
= ${enable_version_specific_runtime_libs} >> ${Makefile}
1307 # Emit a macro which describes the file containing gcc's
1309 echo gcc_version_trigger
= ${gcc_version_trigger} >> ${Makefile}
1310 # And emit a macro defining gcc's version number.
1311 echo gcc_version
= ${gcc_version} >> ${Makefile}
1313 # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1314 # remove any form feeds.
1316 rm -f .
/Makefile.tm2
1319 s:@configdirs@:${configdirs}:
1322 .
/Makefile.tem
> .
/Makefile.tm2
1324 rm -f .
/Makefile.tem
1325 mv .
/Makefile.tm2 .
/Makefile.tem
1327 sed -e "s|@prefix@|${prefix}|" \
1328 -e "s|@exec_prefix@|${exec_prefix}|" \
1329 -e "s|@bindir@|${bindir}|" \
1330 -e "s|@sbindir@|${sbindir}|" \
1331 -e "s|@libexecdir@|${libexecdir}|" \
1332 -e "s|@datadir@|${datadir}|" \
1333 -e "s|@sysconfdir@|${sysconfdir}|" \
1334 -e "s|@sharedstatedir@|${sharedstatedir}|" \
1335 -e "s|@localstatedir@|${localstatedir}|" \
1336 -e "s|@libdir@|${libdir}|" \
1337 -e "s|@includedir@|${includedir}|" \
1338 -e "s|@oldincludedir@|${oldincludedir}|" \
1339 -e "s|@infodir@|${infodir}|" \
1340 -e "s|@mandir@|${mandir}|" \
1341 -e "s|@all_build_modules@|${all_build_modules}|" \
1347 s%^CC[ ]*=.*$%CC = ${CC}%
1354 s%^CXX[ ]*=.*$%CXX = ${CXX}%
1361 s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
1363 -e "/^CXXFLAGS[ ]*=/{
1368 s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1370 -e "s|@config_shell@|${config_shell}|" \
1371 -e "s|@srcdir@|${srcdir}|" \
1373 -e "s:@program_transform_name@:${program_transform_name}:" \
1374 -e "s|@tooldir@|${tooldir}|" \
1375 -e "s|@build_tooldir@|${tooldir}|" \
1376 -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \
1377 -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \
1378 -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \
1379 .
/Makefile.tem
>> ${Makefile}
1381 sed -e "s:@GDB_TK@:${GDB_TK}:" ${Makefile} >${Makefile}.tem
1382 mv -f ${Makefile}.tem ${Makefile}
1384 # If this is a Canadian Cross, preset the values of many more
1386 if [ "${build}" != "${host}" ]; then
1387 for var in ${tools}; do
1389 sed -e "/^
${var}[ ]*=/{
1394 s
%^
${var}[ ]*=.*$%${var} = ${val}%
1395 }" ${Makefile} > ${Makefile}.tem
1396 mv -f ${Makefile}.tem ${Makefile}
1400 # final copy now in ${Makefile}
1403 echo "No Makefile.
in found
in ${srcdir}, unable to configure
" 1>&2
1406 rm -f ./Makefile.tem
1408 case "${host_makefile_frag}" in
1410 *) using="and
\"${host_makefile_frag}\"" ;;
1413 case "${target_makefile_frag}" in
1415 *) using="${using} and
\"${target_makefile_frag}\"" ;;
1418 case "${site_makefile_frag}" in
1420 *) using="${using} and
\"${site_makefile_frag}\"" ;;
1423 newusing=`echo "${using}" | sed 's/and/using/'`
1425 echo "Created
\"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using}
1429 # describe the chosen configuration in config.status.
1430 # Make that file a shellscript which will reestablish
1431 # the same configuration. Used in Makefiles to rebuild
1434 case "${norecursion}" in
1435 "") arguments
="${arguments} --norecursion" ;;
1441 # This directory was configured as follows:
1442 ${progname}" ${arguments} "
1443 # ${using}" > .
/config.new
1444 chmod a
+x .
/config.new
1445 if [ -r .
/config.back
] ; then
1446 mv -f .
/config.back .
/config.status
1448 ${config_shell} ${moveifchange} .
/config.new .
/config.status
1451 *) rm -f ${Makefile} .
/config.status
${links} ;;
1454 # If there are subdirectories, then recur.
1455 if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
1456 for configdir
in ${configdirs} ${extraconfigdirs} ; do
1458 # If configdir contains ',' it is
1459 # srcdir,builddir,target_alias
1460 # These come from extraconfigdirs.
1461 case ${configdir} in
1463 eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
1466 cfg_dir
=${configdir}
1467 bld_dir
=${configdir}
1468 tgt_alias
=${target_alias}
1472 if [ -d ${srcdir}/${cfg_dir} ] ; then
1473 eval echo Configuring
${configdir}...
${redirect}
1477 if [ ! -d .
/${bld_dir} ] ; then
1478 if mkdir .
/${bld_dir} ; then
1481 echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2
1488 POPDIR
=${PWD=`${PWDCMD-pwd}`}
1491 ### figure out what to do with srcdir
1493 ".") newsrcdir
=${srcdir} ;; # no -srcdir option. We're building in place.
1494 /* |
[A-Za-z
]:[\\/]* ) # absolute path
1495 newsrcdir
=${srcdir}/${cfg_dir}
1496 srcdiroption
="--srcdir=${newsrcdir}"
1498 *) # otherwise relative
1499 newsrcdir
=..
/${srcdir}/${cfg_dir}
1500 srcdiroption
="--srcdir=${newsrcdir}"
1504 # Handle --cache-file=../XXX
1505 case "${cache_file}" in
1508 /* |
[A-Za-z
]:[\\/]* ) # absolute path
1509 cache_file_option
="--cache-file=${cache_file}"
1512 cache_file_option
="--cache-file=../${cache_file}"
1516 ### check for guested configure, otherwise fix possibly relative progname
1517 if [ -f ${newsrcdir}/configure
] ; then
1518 recprog
=${newsrcdir}/configure
1519 elif [ -f ${newsrcdir}/configure.
in ] ; then
1520 case "${progname}" in
1521 /* |
[A-Za-z
]:[\\/]* ) recprog
=${progname} ;;
1522 *) recprog
=..
/${progname} ;;
1525 eval echo No configuration information
in ${cfg_dir} ${redirect}
1529 ### The recursion line is here.
1530 if [ ! -z "${recprog}" ] ; then
1531 if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
1532 ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1533 ${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
1536 echo Configure
in `${PWDCMD-pwd}` failed
, exiting.
1>&2
1546 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1547 # and reset the trap handler.