use relative paths for configure and srcdir when possible

This commit is contained in:
K. Richard Pixley 1992-03-11 05:50:05 +00:00
parent 7fcfdcf774
commit c1e4672ca0
2 changed files with 378 additions and 339 deletions

View File

@ -1,4 +1,57 @@
Mon Feb 24 17:08:01 1992 K. Richard Pixley (rich@rtl.cygnus.com) Tue Mar 10 21:49:18 1992 K. Richard Pixley (rich@mars.cygnus.com)
* configure: use relative paths for configure and srcdir whenever
possible.
Tue Mar 10 18:01:55 1992 Per Bothner (bothner@cygnus.com)
* Makefile.in: Fix libg++ rule to check for gcc directory
before using gcc/gcc. Also pass XTRAFLAGS.
Thu Mar 5 21:45:07 1992 K. Richard Pixley (rich@sendai)
* Makefile.in: added stmp-files so that directories aren't polled
when they are already built.
* configure.texi: fixed a node pointer problem.
Thu Mar 5 12:05:58 1992 Stu Grossman (grossman at cygnus.com)
* config.sub configure.in config/.Sanitize config/mh-irix4
gdb/.Sanitize gdb/configure.in gdb/mips-tdep.c gdb/mipsread.c
gdb/procfs.c gdb/signame.h gdb/tm-irix3.h gdb/tm-mips.h
gdb/xm-irix4.h gdb/config/.Sanitize gdb/config/mt-irix3
gdb/config/mh-irix4 texinfo/configure.in: Port to SGI Irix-4.x.
Wed Mar 4 02:57:46 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* configure: -recurring becomes -silent. corrected help message
for -site= option.
* Makefile.in: mkdir $(exec_prefix) and $(tooldir).
Tue Mar 3 14:51:21 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* configure: when building Makefile for crosses, replace
tooldir and program_prefix. default srcdir from location of
config.sub. remove "for host in hosts" and "for target in
targets" loops.
Wed Feb 26 19:48:25 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* Makefile.in: Do not pass bindir or mandir to cvs.
Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
* Makefile.in, configure.in: removed traces of namesubdir,
-subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
copyrights to '92, changed some from Cygnus to FSF.
* configure.texi: remove most references to multiple hosts,
multiple targets, subdirs, etc.
* configure.man: removed rcsid. reference config.sub not
config.subr.
* Makefile.in: mkdir $(infodir) on install-info. * Makefile.in: mkdir $(infodir) on install-info.

662
configure vendored
View File

@ -3,8 +3,6 @@
# Configuration script # Configuration script
# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc. # Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
#This file is part of GNU.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
@ -22,6 +20,8 @@
# Please email any bugs, comments, and/or additions to this file to: # Please email any bugs, comments, and/or additions to this file to:
# configure@cygnus.com # configure@cygnus.com
# This file was written by K. Richard Pixley.
# #
# Shell script to create proper links to machine-dependent files in # Shell script to create proper links to machine-dependent files in
# preparation for compilation. # preparation for compilation.
@ -31,9 +31,6 @@
# config.status is removed. # config.status is removed.
# #
# NOTE: This script contains support for a Cygnus experimental feature, called
# +subdirs, which is currently, tentatively, de-supported.
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$) export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
remove=rm remove=rm
@ -50,16 +47,14 @@ symbolic_link='ln -s'
Makefile=Makefile Makefile=Makefile
Makefile_in=Makefile.in Makefile_in=Makefile.in
arguments=$* arguments=$*
commontargets=
configdirs= configdirs=
datadir= exec_prefix=
datadiroption= exec_prefixoption=
defaulttargets=
fatal= fatal=
floating_point=default floating_point=default
gas=default gas=default
host_alias=
host_makefile_frag= host_makefile_frag=
hosts=
next_host= next_host=
next_prefix= next_prefix=
next_site= next_site=
@ -69,14 +64,14 @@ next_tmpdir=
norecursion= norecursion=
prefix=/usr/local prefix=/usr/local
progname= progname=
recurring= program_prefix=
removing= program_prefix_option=
silent=
site_makefile_frag= site_makefile_frag=
srcdir= srcdir=
srctrigger= srctrigger=
target= target_alias=
target_makefile_frag= target_makefile_frag=
targets=
undefinedargs= undefinedargs=
verbose= verbose=
version="$Revision$" version="$Revision$"
@ -86,40 +81,43 @@ NO_EDIT="This file was generated automatically by configure. Do not edit."
## this is a little touchy and won't always work, but... ## this is a little touchy and won't always work, but...
## ##
## if the argv[0] starts with a slash then it is an absolute name that can be ## if the argv[0] starts with a slash then it is an absolute name that can (and
## used as is. ## must) be used as is.
## ##
## otherwise, if argv[0] has no slash in it, we can assume that it is on the ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
## path. Since PATH might include "." we also add `pwd` to the end of PATH. ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
## ##
## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
## path.
##
PWD=`pwd` PWD=`pwd`
progname=$0
if echo $0 | grep '^/' > /dev/null ; then case "${progname}" in
progname=$0 /*) ;;
elif echo $0 | grep '/' > /dev/null ; then */*) ;;
progname=${PWD}/$0 *)
else
progname=$0
PATH=$PATH:${PWD} ; export PATH PATH=$PATH:${PWD} ; export PATH
fi ;;
esac
for arg in $*; for arg in $*;
do do
# handle things that might have args following as separate words # handle things that might have args following as separate words
if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix= if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
elif [ -n "${next_datadir}" ] ; then datadir=${arg} ; datadiroption="-datadir=${datadir}" ; next_datadir= elif [ -n "${next_exec_prefix}" ] ; then
exec_prefix=${arg}
exec_prefixoption="-exec_prefix=${exec_prefix}"
next_exec_prefix=
elif [ -n "${next_site}" ] ; then site=${arg} ; next_site= elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir= elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=
elif [ -n "${next_program_prefix}" ] ; then
program_prefix=${arg}
program_prefixoption="-program_prefix=${program_prefix}"
next_program_prefix=
elif [ -n "${next_target}" ] ; then elif [ -n "${next_target}" ] ; then
next_target= next_target=
case "${targets}" in case "${target_alias}" in
"") "")
newtargets="${targets} ${arg}" target_alias="${arg}"
targets="${newtargets}"
;; ;;
*) *)
echo '***' Can only configure for one target at a time. echo '***' Can only configure for one target at a time.
@ -133,12 +131,12 @@ do
else else
case ${arg} in case ${arg} in
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* | --da=* | --d=*) -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
datadir=`echo ${arg} | sed 's/^[-a-z]*=//'` exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
datadiroption=${arg} exec_prefixoption=${arg}
;; ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da | --d) -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
next_datadir=yes next_exec_prefix=yes
;; ;;
-gas | --g*) -gas | --g*)
gas=yes gas=yes
@ -147,10 +145,9 @@ do
fatal=true fatal=true
;; ;;
-host=* | --host=* | --hos=* | --ho=*) -host=* | --host=* | --hos=* | --ho=*)
case "${hosts}" in case "${host_alias}" in
"") "")
newhosts="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`" host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
hosts="${newhosts}"
;; ;;
*) *)
echo '***' Can only configure for one host at a time. echo '***' Can only configure for one host at a time.
@ -164,24 +161,28 @@ do
-norecursion | --no*) -norecursion | --no*)
norecursion=true norecursion=true
;; ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
prefix=`echo ${arg} | sed 's/^[-a-z]*=//'` prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
prefixoption=${arg} prefixoption=${arg}
;; ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p) -prefix | --prefix | --prefi | --pref | --pre)
next_prefix=yes next_prefix=yes
;; ;;
-recurring | --recurring | --recurrin | --recurri | --recurr | --recur | --recu | --rec | --re) -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | --program_=* | --program=* | --progra=* | --progr=* | --prog=* | --pro=*)
recurring=true program_prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
arguments=`echo ${arguments} | sed "s:${arg}::"` program_prefixoption=${arg}
;; ;;
-rm | --rm) -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | --program_ | --program | --progra | --progr | --prog | --pro)
removing=${arg} next_program_prefix=yes
;;
-s | -silent | --silent | --silen | --sile | --sil)
silent=true
arguments=`echo ${arguments} | sed "s:${arg}::"`
;; ;;
-site=* | --site=* | --sit=* | --si=*) -site=* | --site=* | --sit=* | --si=*)
site=`echo ${arg} | sed 's/^[-a-z]*=//'` site=`echo ${arg} | sed 's/^[-a-z]*=//'`
;; ;;
-site | --site | --sit | --si) -site | --site | --sit)
next_site=yes next_site=yes
;; ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@ -191,11 +192,8 @@ do
next_srcdir=yes next_srcdir=yes
;; ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*) -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
case "${targets}" in case "${target_alias}" in
"") "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
newtargets="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
targets="${newtargets}"
;;
*) *)
echo '***' Can only configure for one target at a time. echo '***' Can only configure for one target at a time.
fatal=yes fatal=yes
@ -229,8 +227,7 @@ do
*) *)
case "${undefs}" in case "${undefs}" in
"") "")
newundefs="${undefs} ${arg}" undefs="${arg}"
undefs=${newundefs}
;; ;;
*) *)
echo '***' Can only configure for one host and one target at a time. echo '***' Can only configure for one host and one target at a time.
@ -246,7 +243,7 @@ done
case "${fatal}" in case "${fatal}" in
"") "")
# # Complain if an arg is missing # # Complain if an arg is missing
# if [ -z "${hosts}" ] ; then # if [ -z "${host_alias}" ] ; then
# (echo ; # (echo ;
# echo "configure: No HOST specified." ; # echo "configure: No HOST specified." ;
# echo) 1>&2 # echo) 1>&2
@ -261,23 +258,23 @@ case "${fatal}" in
### * if no targets are specified, then the unadorned args are targets, but if ### * if no targets are specified, then the unadorned args are targets, but if
### there were no unadorned args, then the hosts are also targets. ### there were no unadorned args, then the hosts are also targets.
if [ -n "${hosts}" -a -n "${targets}" -a -n "${undefs}" ] ; then if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ] ; then
echo '***' Can only configure for one host and one target at a time. echo '***' Can only configure for one host and one target at a time.
fatal=yes fatal=yes
elif [ -z "${hosts}" -a -z "${undefs}" ] ; then elif [ -z "${host_alias}" -a -z "${undefs}" ] ; then
echo '***' You must tell me for which host you want to configure. echo '***' You must tell me for which host you want to configure.
fatal=yes fatal=yes
else else
case "${hosts}" in case "${host_alias}" in
"") hosts=${undefs} ;; "") host_alias=${undefs} ;;
*) ;; *) ;;
esac esac
case "${targets}" in case "${target_alias}" in
"") "")
case "${undefs}" in case "${undefs}" in
"") targets=${hosts} ;; "") target_alias=${host_alias} ;;
*) targets=${undefs} ;; *) target_alias=${undefs} ;;
esac esac
;; ;;
*) ;; *) ;;
@ -287,22 +284,22 @@ case "${fatal}" in
*) ;; *) ;;
esac esac
if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
(echo "Usage: configure HOST" ; (echo "Usage: configure HOST" ;
echo ; echo ;
echo "Options: [defaults in brackets]" ; echo "Options: [defaults in brackets]" ;
echo " -datadir=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ; echo " -exec_prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
echo " -gas configure the compilers for use with gas. [native as]" ; echo " -gas configure the compilers for use with gas. [native as]" ;
echo " -help print this message. [normal config]" ; echo " -help print this message. [normal config]" ;
echo " -lang=LANG configure to build LANG. [gcc]" ; echo " -lang=LANG configure to build LANG. [gcc]" ;
echo " -nfp configure the compilers default to soft floating point. [hard float]" ; echo " -nfp configure the compilers default to soft floating point. [hard float]" ;
echo " -norecursion configure this directory only. [recurse]" ; echo " -norecursion configure this directory only. [recurse]" ;
echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ; echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
echo " -rm remove this configuration. [build a configuration]" ; echo " -program_prefix=FOO install programs with FOO prepended to their names. [ \"\" ]" ;
echo " -site configure with site specific makefile" ; echo " -site=SITE configure with site specific makefile for SITE" ;
echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ; echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ; echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ;
echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ; echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
echo ; echo ;
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
) 1>&2 ) 1>&2
@ -316,7 +313,7 @@ fi
configsub=`echo ${progname} | sed 's/configure$/config.sub/'` configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
if ${configsub} `echo ${hosts} | sed -e 's/ .*//'` >/dev/null 2>&1 ; then if ${configsub} `echo ${host_alias} | sed -e 's/ .*//'` >/dev/null 2>&1 ; then
true true
else else
echo '***' cannot find config.sub. echo '***' cannot find config.sub.
@ -328,17 +325,21 @@ case "${srcdir}" in
if [ -r configure.in ] ; then if [ -r configure.in ] ; then
srcdir=. srcdir=.
else else
echo '***' "Can't find configure.in. Try using -srcdir=some_dir" if [ -r ${progname}.in ] ; then
exit 1 srcdir=`echo ${progname} | sed 's:/configure$::'`
else
echo '***' "Can't find configure.in. Try using -srcdir=some_dir"
exit 1
fi
fi fi
;; ;;
*) ;; *) ;;
esac esac
# default datadir # default exec_prefix
case "${datadir}" in case "${exec_prefix}" in
"") datadir="$(prefix)/lib" ;; "") exec_prefix="${prefix}" ;;
*) ;; *) ;;
esac esac
@ -393,177 +394,153 @@ case "${srctrigger}" in
*) ;; *) ;;
esac esac
for host in ${hosts} ; do result=`${configsub} ${host_alias}`
# Default other arg host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
targets=${host} host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
defaulttargets=true host=${host_cpu}-${host_vendor}-${host_os}
. ${tmpfile}.hst
result=`${configsub} ${target_alias}`
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
target=${target_cpu}-${target_vendor}-${target_os}
. ${tmpfile}.tgt
# Find the source files, if location was not specified.
case "${srcdir}" in
"")
srcdirdefaulted=1
srcdir=.
if [ ! -r ${srctrigger} ] ; then
srcdir=..
fi
;;
*) ;;
esac
if [ ! -r ${srcdir}/${srctrigger} ] ; then
case "${srcdirdefaulted}" in
"") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
*) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
esac
echo '***' \(At least ${srctrigger} is missing.\) 1>&2
exit 1
fi
# Set up the list of links to be made.
# ${links} is the list of link names, and ${files} is the list of names to link to.
# Make the links.
configlinks="${links}"
while [ -n "${files}" ] ; do
# set file to car of files, files to cdr of files
set ${files}; file=$1; shift; files=$*
set ${links}; link=$1; shift; links=$*
if [ ! -r ${srcdir}/${file} ] ; then
echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
echo '***' "since the file \"${file}\" does not exist." 1>&2
exit 1
fi fi
host_alias=${host} ${remove} -f ${link}
rm -f config.status
# Make a symlink if possible, otherwise try a hard link
${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
result=`${configsub} ${host}` if [ ! -r ${link} ] ; then
host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` exit 1
host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` fi
host=${host_cpu}-${host_vendor}-${host_os}
. ${tmpfile}.hst case "${verbose}" in
"") ;;
*) echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
esac
done
for target in ${targets} ; do # Create a .gdbinit file which runs the one in srcdir
# and tells GDB to look there for source files.
target_alias=${target} if [ -r ${srcdir}/.gdbinit ] ; then
result=`${configsub} ${target}` case ${srcdir} in
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` .)
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` ;;
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` *) cat > .gdbinit <<EOF
target=${target_cpu}-${target_vendor}-${target_os}
. ${tmpfile}.tgt
case "${host_alias}" in
"${target_alias}") subdirname=H-${host_alias} ;;
*) subdirname=X-${host_alias}-${target_alias} ;;
esac
case "${namesubdir}" in
"") ;;
*) subdirname=${namesubdir} ;;
esac
case "${removing}" in
"")
# Find the source files, if location was not specified.
case "${srcdir}" in
"")
srcdirdefaulted=1
srcdir=.
if [ ! -r ${srctrigger} ] ; then
srcdir=..
fi
;;
*) ;;
esac
if [ ! -r ${srcdir}/${srctrigger} ] ; then
case "${srcdirdefaulted}" in
"") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2 ;;
*) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2 ;;
esac
echo '***' \(At least ${srctrigger} is missing.\) 1>&2
exit 1
fi
# Set up the list of links to be made.
# ${links} is the list of link names, and ${files} is the list of names to link to.
# Make the links.
while [ -n "${files}" ] ; do
# set file to car of files, files to cdr of files
set ${files}; file=$1; shift; files=$*
set ${links}; link=$1; shift; links=$*
if [ ! -r ${srcdir}/${file} ] ; then
echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
echo '***' "since the file \"${file}\" does not exist." 1>&2
exit 1
fi
${remove} -f ${link}
rm -f config.status
# Make a symlink if possible, otherwise try a hard link
${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
if [ ! -r ${link} ] ; then
echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
exit 1
fi
case "${verbose}" in
"") ;;
*) echo "Linked \"${link}\" to \"${srcdir}/${file}\"." ;;
esac
done
# Create a .gdbinit file which runs the one in srcdir
# and tells GDB to look there for source files.
if [ -r ${srcdir}/.gdbinit ] ; then
case ${srcdir} in
.)
;;
*) cat > .gdbinit <<EOF
# ${NO_EDIT} > .gdbinit # ${NO_EDIT} > .gdbinit
dir . dir .
dir ${srcdir} dir ${srcdir}
source ${srcdir}/.gdbinit source ${srcdir}/.gdbinit
EOF EOF
;; ;;
esac esac
fi fi
# Install a makefile, and make it set VPATH # Install a makefile, and make it set VPATH
# if necessary so that the sources are found. # if necessary so that the sources are found.
# Also change its value of srcdir. # Also change its value of srcdir.
# NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
# been somewhat optimized and is perhaps a bit twisty. # been somewhat optimized and is perhaps a bit twisty.
# code is order so as to try to sed the smallest input files we know. # code is order so as to try to sed the smallest input files we know.
# the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site. # the three makefile fragments MUST end up in the resulting Makefile in this order: target, host, and site.
# so do these separately because I don't trust the order of sed -e expressions. # so do these separately because I don't trust the order of sed -e expressions.
# Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
case "${site}" in case "${site}" in
"") cp ${srcdir}/${Makefile_in} Makefile.tem ;; "") cp ${srcdir}/${Makefile_in} Makefile.tem ;;
*) *)
site_makefile_frag=${srcdir}/config/ms-${site} site_makefile_frag=${srcdir}/config/ms-${site}
if [ -f ${site_makefile_frag} ] ; then if [ -f ${site_makefile_frag} ] ; then
sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \ sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${Makefile_in} \
>> Makefile.tem > Makefile.tem
else else
cp ${srcdir}/${Makefile_in} Makefile.tem cp ${srcdir}/${Makefile_in} Makefile.tem
site_makefile_frag= site_makefile_frag=
fi fi
;; ;;
esac esac
# working copy now in Makefile.tem # working copy now in Makefile.tem
# Conditionalize the makefile for this host. # Conditionalize the makefile for this host.
case "${host_makefile_frag}" in case "${host_makefile_frag}" in
"") mv Makefile.tem ${Makefile} ;; "") mv Makefile.tem ${Makefile} ;;
*) *)
host_makefile_frag=${srcdir}/${host_makefile_frag} host_makefile_frag=${srcdir}/${host_makefile_frag}
if [ -f ${host_makefile_frag} ] ; then if [ -f ${host_makefile_frag} ] ; then
sed -e "/^####/ r ${host_makefile_frag}" Makefile.tem > ${Makefile} sed -e "/^####/ r ${host_makefile_frag}" Makefile.tem > ${Makefile}
else else
echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2 echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
echo '***' is missing in ${PWD}. 1>&2 echo '***' is missing in ${PWD}. 1>&2
mv Makefile.tem ${Makefile} mv Makefile.tem ${Makefile}
fi fi
esac esac
# working copy now in ${Makefile} # working copy now in ${Makefile}
# Conditionalize the makefile for this target. # Conditionalize the makefile for this target.
case "${target_makefile_frag}" in case "${target_makefile_frag}" in
"") mv ${Makefile} Makefile.tem ;; "") mv ${Makefile} Makefile.tem ;;
*) *)
target_makefile_frag=${srcdir}/${target_makefile_frag} target_makefile_frag=${srcdir}/${target_makefile_frag}
if [ -f ${target_makefile_frag} ] ; then if [ -f ${target_makefile_frag} ] ; then
sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} >> Makefile.tem sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > Makefile.tem
else else
mv ${Makefile} Makefile.tem mv ${Makefile} Makefile.tem
target_makefile_frag= target_makefile_frag=
fi fi
;; ;;
esac esac
# real copy now in Makefile.tem # real copy now in Makefile.tem
# prepend warning about editting, and a bunch of variables. # prepend warning about editting, and a bunch of variables.
# fixme-someday: remove the subdir/unsubdir lines. cat > ${Makefile} <<EOF
cat > ${Makefile} <<EOF
# ${NO_EDIT} # ${NO_EDIT}
host_alias = ${host_alias} host_alias = ${host_alias}
host_cpu = ${host_cpu} host_cpu = ${host_cpu}
@ -576,135 +553,144 @@ target_os = ${target_os}
target_makefile_frag = ${target_makefile_frag} target_makefile_frag = ${target_makefile_frag}
host_makefile_frag = ${host_makefile_frag} host_makefile_frag = ${host_makefile_frag}
site_makefile_frag = ${site_makefile_frag} site_makefile_frag = ${site_makefile_frag}
links = ${configlinks}
VPATH = ${srcdir} VPATH = ${srcdir}
subdir =
unsubdir = .
EOF EOF
# fixme: this shouldn't be in configure. # fixme: this shouldn't be in configure.
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler. # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
case "${host}" in case "${host_alias}" in
"${target}") echo "ALL=all.internal" >> ${Makefile} ;; "${target_alias}")
*) tooldir="$(libdir)"
echo "CROSS=-DCROSS_COMPILE" >> ${Makefile} echo "ALL=all.internal" >> ${Makefile}
echo "ALL=all.cross" >> ${Makefile} ;;
;; *)
esac echo "CROSS=-DCROSS_COMPILE" >> ${Makefile}
echo "ALL=all.cross" >> ${Makefile}
case "${program_prefix}" in
"") program_prefix=${target_alias}- ;;
*) ;;
esac
# reset prefix, datadir, srcdir, SUBDIRS, NONSUBDIRS, remove any form tooldir="$(libdir)/${target_alias}"
# feeds. ;;
sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \ esac
-e "s:^datadir[ ]*=.*$:datadir = ${datadir}:" \
-e "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" \
-e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
-e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
-e "s/ //" Makefile.tem >> ${Makefile}
# final copy now in ${Makefile}
rm Makefile.tem # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, remove any form
# feeds.
sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \
-e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \
-e "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" \
-e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
-e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
-e "s/ //" \
-e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
-e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \
Makefile.tem >> ${Makefile}
# final copy now in ${Makefile}
if [ -n "${verbose}" -o -z "${recurring}" ] ; then rm Makefile.tem
case "${host_makefile_frag}" in
"") using= ;;
*) using="and \"${host_makefile_frag}\"" ;;
esac
case "${target_makefile_frag}" in if [ -n "${verbose}" -o -z "${silent}" ] ; then
"") ;; case "${host_makefile_frag}" in
*) using="${using} and \"${target_makefile_frag}\"" ;; "") using= ;;
esac *) using="and \"${host_makefile_frag}\"" ;;
esac
case "${site_makefile_frag}" in case "${target_makefile_frag}" in
"") ;; "") ;;
*) using="${using} and \"${site_makefile_frag}\"" ;; *) using="${using} and \"${target_makefile_frag}\"" ;;
esac esac
echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'` case "${site_makefile_frag}" in
fi "") ;;
*) using="${using} and \"${site_makefile_frag}\"" ;;
esac
. ${tmpfile}.pos echo "Created \"${Makefile}\" in" ${PWD} `echo "${using}" | sed 's/and/using/'`
fi
# describe the chosen configuration in config.status. . ${tmpfile}.pos
# Make that file a shellscript which will reestablish
# the same configuration. Used in Makefiles to rebuild
# Makefiles.
case "${norecursion}" in # describe the chosen configuration in config.status.
"") arguments="${arguments} -norecursion" ;; # Make that file a shellscript which will reestablish
*) ;; # the same configuration. Used in Makefiles to rebuild
esac # Makefiles.
echo "#!/bin/sh case "${norecursion}" in
"") arguments="${arguments} -norecursion" ;;
*) ;;
esac
echo "#!/bin/sh
# ${NO_EDIT} # ${NO_EDIT}
# ${PWD} was configured as follows: # ${PWD} was configured as follows:
${progname}" ${arguments} " ${progname}" ${arguments} "
# ${using}" > config.status # ${using}" > config.status
chmod a+x config.status chmod a+x config.status
;;
*) rm -f ${Makefile} config.status ${links} ;; # If there are subdirectories, then recur.
if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
for configdir in ${configdirs} ; do
case "${verbose}" in
"") ;;
*) echo Configuring ${configdir}... ;;
esac esac
# If there are subdirectories, then recur. if [ -d ${srcdir}/${configdir} ] ; then
if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then case "${srcdir}" in
for configdir in ${configdirs} ; do ".") ;;
case "${verbose}" in *)
"") ;; if [ ! -d ./${configdir} ] ; then
*) echo Configuring ${configdir}... ;; mkdir ./${configdir}
fi
;;
esac
POPDIR=${PWD}
cd ${configdir}
### figure out what to do with srcdir
case "${srcdir}" in
".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
/*) # absolute path
newsrcdir=${srcdir}/${configdir}
srcdiroption="-srcdir=${newsrcdir}"
;;
*) # otherwise relative
newsrcdir=../${srcdir}/${configdir}
srcdiroption="-srcdir=${newsrcdir}"
;;
esac
### check for guested configure, otherwise fix possibly relative progname
if [ -f ${newsrcdir}/configure ] ; then
recprog=${newsrcdir}/configure
else
case "${progname}" in
/*) recprog=${progname} ;;
*) recprog=../${progname} ;;
esac esac
fi
if [ -d ${srcdir}/${configdir} ] ; then
case "${srcdir}" in
".") ;;
*)
if [ ! -d ./${configdir} ] ; then
mkdir ./${configdir}
fi
;;
esac
POPDIR=${PWD}
cd ${configdir}
### figure out what to do with srcdir & guest configure
case "${srcdir}" in
".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
/*) # absolute path
newsrcdir=${srcdir}/${configdir}
srcdiroption="-srcdir=${newsrcdir}"
;;
*) # otherwise relative
newsrcdir=../${srcdir}/${configdir}
srcdiroption="-srcdir=${newsrcdir}"
;;
esac
### The recursion line is here. ### The recursion line is here.
if [ -f ${newsrcdir}/configure ] ; then if ${recprog} -s ${host_alias} -target=${target_alias} \
recprog=${newsrcdir}/configure ${verbose} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
else ${srcdiroption} ${program_prefixoption} ; then
recprog=${progname} true
fi else
exit 1
fi
if ${recprog} -recurring ${host_alias} -target=${target_alias} \ cd ${POPDIR}
${verbose} ${subdirs} ${removing} ${prefixoption} \ else
${tmpdiroption} ${namesubdiroption} ${datadiroption} \ case "${verbose}" in
${srcdiroption} ; then "") ;;
true *) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
else esac
exit 1
fi
cd ${POPDIR}
else
case "${verbose}" in
"") ;;
*) echo Warning: source directory \"${srcdir}/${configdir}\" is missing. ;;
esac
fi
done
fi fi
done # for each target done
done # for each host fi
### clean up. ### clean up.