2007-07-01 19:04:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-05-01 16:16:53 +00:00
|
|
|
myname="${0##*/}"
|
|
|
|
|
2008-12-22 18:21:51 +00:00
|
|
|
VERSION=$( cat .version )
|
|
|
|
DATE=$( date +%Y%m%d )
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2007-07-01 20:52:34 +00:00
|
|
|
PREFIX_DEFAULT=/usr/local
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
BINDIR_set=
|
|
|
|
LIBDIR_set=
|
|
|
|
DOCDIR_set=
|
|
|
|
MANDIR_set=
|
2007-07-22 17:44:27 +00:00
|
|
|
LOCAL_set=
|
2009-05-01 16:16:53 +00:00
|
|
|
FORCE=
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-07-07 21:22:25 +00:00
|
|
|
do_quit=
|
2008-06-25 08:34:47 +00:00
|
|
|
|
2008-07-16 21:59:49 +00:00
|
|
|
# Simply print the error message, and exit. Obvious, he?
|
|
|
|
do_error() {
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${myname}: ${@}\n"
|
2008-07-16 21:59:49 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2008-07-07 21:22:25 +00:00
|
|
|
# Given an option string and the following argument,
|
|
|
|
# echoes the value of the option.
|
|
|
|
# If --var=val => echoes val and returns 0, meaning second arg was not consumed
|
|
|
|
# If --var val => echoes val and returns non null, meaning second arg was used
|
2007-07-01 19:04:20 +00:00
|
|
|
get_optval(){
|
|
|
|
case "$1" in
|
|
|
|
--*=?*)
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${1#*=}"
|
2008-12-22 18:21:51 +00:00
|
|
|
return 0
|
2007-07-01 19:04:20 +00:00
|
|
|
;;
|
|
|
|
*)
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${2}"
|
2008-12-22 18:21:51 +00:00
|
|
|
return 1
|
2007-07-01 19:04:20 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2008-07-07 21:22:25 +00:00
|
|
|
# The set_xxx functions will set the corresponding configuration variable
|
|
|
|
# They return 0 if second arg was not consumed, and non-zero if it was consumed.
|
2007-07-01 19:04:20 +00:00
|
|
|
set_prefix() {
|
2008-12-22 18:21:51 +00:00
|
|
|
PREFIX="$( get_optval "$1" "$2" )"
|
2007-07-01 19:04:20 +00:00
|
|
|
}
|
|
|
|
set_bindir() {
|
|
|
|
BINDIR_set=1
|
2008-12-22 18:21:51 +00:00
|
|
|
BINDIR="$( get_optval "$1" "$2" )"
|
2007-07-01 19:04:20 +00:00
|
|
|
}
|
|
|
|
set_libdir() {
|
|
|
|
LIBDIR_set=1
|
2008-12-22 18:21:51 +00:00
|
|
|
LIBDIR="$( get_optval "$1" "$2" )"
|
2007-07-01 19:04:20 +00:00
|
|
|
}
|
|
|
|
set_docdir() {
|
|
|
|
DOCDIR_set=1
|
2008-12-22 18:21:51 +00:00
|
|
|
DOCDIR="$( get_optval "$1" "$2" )"
|
2007-07-01 19:04:20 +00:00
|
|
|
}
|
|
|
|
set_mandir() {
|
|
|
|
MANDIR_set=1
|
2008-12-22 18:21:51 +00:00
|
|
|
MANDIR="$( get_optval "$1" "$2" )"
|
2007-07-01 19:04:20 +00:00
|
|
|
}
|
2009-01-18 15:08:28 +00:00
|
|
|
set_tool() {
|
|
|
|
local var_name="${1%%=*}"
|
|
|
|
var_name="${var_name#--with-}"
|
|
|
|
eval ${var_name}="\$( get_optval "$1" "$2" )"
|
2008-06-25 08:34:47 +00:00
|
|
|
}
|
|
|
|
|
2009-05-01 16:16:53 +00:00
|
|
|
# var_list is a list of variables, each one holding a path to a
|
|
|
|
# tool, either detected by ./configure, or specified by the user.
|
|
|
|
var_list=""
|
|
|
|
|
|
|
|
# This function adds a variable name to the above list of variable names.
|
|
|
|
# $1: the name of the variable to add to the list
|
|
|
|
add_to_var_list() {
|
|
|
|
var_list="${var_list} ${1}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# A function to test for required tools/headers/libraries
|
|
|
|
# $*: [prog|inc|lib]=<name[ name...]>
|
|
|
|
# the name(s) of tool(s) to test for
|
|
|
|
# mandatory
|
|
|
|
# eg: prog=bash prog="curl wget"
|
|
|
|
# $*: var=<var_name>
|
|
|
|
# the name of the variable to test and set
|
|
|
|
# optional
|
|
|
|
# eg: var=bash if ${bash} is set and non-null, use that,
|
|
|
|
# else check for bash and set bash=$(which bash)
|
|
|
|
# $*: ver=<regexp>
|
|
|
|
# for each 'prog', test if $(prog --version) matches 'regexp'
|
|
|
|
# optional
|
|
|
|
# eg: ver='^GNU bash, version [34]\.'
|
|
|
|
# $*: err=<error_message>
|
|
|
|
# the error message to print if tool is missing
|
|
|
|
# optional, defaults to: '${prog}: none found'
|
|
|
|
# eg: err="'bash' 3.x or above was not found"
|
|
|
|
has_or_abort() {
|
|
|
|
local prog inc lib
|
|
|
|
local var ver err
|
|
|
|
local val
|
|
|
|
local item
|
|
|
|
local where
|
2009-05-02 18:23:58 +00:00
|
|
|
local status
|
2009-05-01 16:16:53 +00:00
|
|
|
|
|
|
|
for item in "${@}"; do
|
|
|
|
case "${item}" in
|
|
|
|
prog=*|inc=*|lib=*|var=*|ver=*|err=*)
|
|
|
|
eval ${item%%=*}="'${item#*=}'"
|
|
|
|
;;
|
|
|
|
*) do_error "has_or_abort: incorrect parameters: '$@'";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${prog}:${inc}:${lib}" in
|
|
|
|
?*::)
|
|
|
|
for item in ${prog}; do
|
|
|
|
printf "Checking for '${item}'... "
|
|
|
|
if [ -n "${var}" ]; then
|
|
|
|
eval val="\${${var}}"
|
|
|
|
if [ -n "${val}" ]; then
|
|
|
|
printf "${val} (cached)\n"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
where="$( which "${item}" 2>/dev/null )"
|
|
|
|
if [ -z "${where}" ]; then
|
2009-05-02 18:23:58 +00:00
|
|
|
printf "no\n"
|
2009-05-01 16:16:53 +00:00
|
|
|
continue
|
|
|
|
elif [ -n "${ver}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
str=$( "${where}" --version 2>&1 |grep -E "${ver}" |head -n 1 )
|
2009-05-01 16:16:53 +00:00
|
|
|
if [ -z "${str}" ]; then
|
2009-05-02 18:23:58 +00:00
|
|
|
printf "no\n"
|
2009-05-01 16:16:53 +00:00
|
|
|
unset where
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
2009-05-02 18:23:58 +00:00
|
|
|
status="${where}"
|
2009-05-01 16:16:53 +00:00
|
|
|
break
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
:?*:)
|
2009-05-02 18:23:58 +00:00
|
|
|
for item in ${inc}; do
|
|
|
|
printf "Checking for '${item}'... "
|
|
|
|
if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
|
|
|
|
where="${item}"
|
|
|
|
status=yes
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
printf "no\n"
|
|
|
|
done
|
2009-05-01 16:16:53 +00:00
|
|
|
;;
|
|
|
|
::?*)
|
2009-05-02 21:50:09 +00:00
|
|
|
for item in ${lib}; do
|
|
|
|
printf "Checking for '${item}'... "
|
|
|
|
where="$( gcc -print-file-name="${item}" )"
|
|
|
|
if [ "${where}" != "${item}" ]; then
|
|
|
|
where="$( readlink -e "${where}" )"
|
|
|
|
status=yes
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
printf "no\n"
|
|
|
|
done
|
2009-05-01 16:16:53 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-05-02 18:23:58 +00:00
|
|
|
if [ -z "${status}" ]; then
|
|
|
|
printf "\n${err:-${prog}${inc}${lib}: none found}\n\n"
|
|
|
|
printf "Either you are missing entirely the needed tool,\n"
|
|
|
|
printf "or the version you have is too old.\n"
|
|
|
|
if [ -n "${var}" ]; then
|
|
|
|
printf "You can give the path to this tool using: --with-${var}=PATH\n"
|
|
|
|
fi
|
|
|
|
# FORCE can be set in the environment
|
|
|
|
[ -z "${FORCE}" ] && do_error "Bailing out..."
|
|
|
|
printf "\n"
|
|
|
|
printf "<* *>\n"
|
|
|
|
printf "<* FORCE in action: *>\n"
|
|
|
|
printf "<* Continuing despite missing pre-requisite *>\n"
|
|
|
|
printf "<* Prepare for breakage *>\n"
|
|
|
|
printf "<* *>\n"
|
|
|
|
printf "\n"
|
|
|
|
else
|
|
|
|
printf "${status}"
|
|
|
|
if [ -n "${var}" ]; then
|
|
|
|
eval ${var}='"'"${where}"'"'
|
|
|
|
add_to_var_list "${var}"
|
|
|
|
fi
|
|
|
|
printf "\n"
|
|
|
|
fi
|
2009-05-01 16:16:53 +00:00
|
|
|
}
|
|
|
|
|
2007-07-01 20:52:34 +00:00
|
|
|
do_help() {
|
|
|
|
cat <<__EOF__
|
2009-01-18 15:08:28 +00:00
|
|
|
\`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
|
2007-07-01 20:52:34 +00:00
|
|
|
|
|
|
|
USAGE: ./configure [OPTION]...
|
|
|
|
|
|
|
|
Defaults for the options are specified in brackets.
|
|
|
|
|
|
|
|
Configuration:
|
2008-12-22 18:21:51 +00:00
|
|
|
-h, --help display this help and exit
|
2009-05-01 16:16:53 +00:00
|
|
|
--force force configure to continue, even in case
|
|
|
|
some pre-requisites are missing
|
2008-06-25 08:38:51 +00:00
|
|
|
|
|
|
|
Installation directories:
|
2007-07-01 21:21:11 +00:00
|
|
|
--prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
|
2007-07-22 17:44:27 +00:00
|
|
|
--local don't install, and use current directory
|
2007-07-01 20:52:34 +00:00
|
|
|
|
|
|
|
By default, \`make install' will install all the files in
|
|
|
|
\`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
|
|
|
|
an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
|
|
|
|
for instance \`--prefix=\${HOME}'.
|
|
|
|
|
|
|
|
For better control, use the options below.
|
|
|
|
|
|
|
|
Fine tuning of the installation directories:
|
2008-07-18 21:03:04 +00:00
|
|
|
--bindir=DIR user executables [PREFIX/bin]
|
|
|
|
--libdir=DIR object code libraries [PREFIX/lib]
|
|
|
|
--docdir=DIR info documentation [PREFIX/share/doc]
|
|
|
|
--mandir=DIR man documentation [PREFIX/share/man]
|
2008-06-25 08:34:47 +00:00
|
|
|
|
|
|
|
Optional Features:
|
2009-01-18 15:08:28 +00:00
|
|
|
--with-install=PATH Specify the full PATH to GNU install
|
2009-05-01 16:16:53 +00:00
|
|
|
--with-make=PATH Specify the full PATH to GNU make >= 3.80
|
2009-01-18 15:08:28 +00:00
|
|
|
--with-grep=PATH Specify the full PATH to GNU grep
|
|
|
|
--with-sed=PATH Specify the full PATH to GNU sed
|
|
|
|
--with-bash=PATH Specify the full PATH to bash >= 3.0
|
2007-07-01 20:52:34 +00:00
|
|
|
__EOF__
|
|
|
|
}
|
|
|
|
|
2007-09-12 20:44:15 +00:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Set user's options
|
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
case "$1" in
|
2009-04-20 19:57:16 +00:00
|
|
|
--local) LOCAL_set="y"; shift;;
|
2007-07-01 19:04:20 +00:00
|
|
|
--prefix*) set_prefix "$1" "$2" && shift || shift 2;;
|
|
|
|
--bindir*) set_bindir "$1" "$2" && shift || shift 2;;
|
|
|
|
--libdir*) set_libdir "$1" "$2" && shift || shift 2;;
|
|
|
|
--docdir*) set_docdir "$1" "$2" && shift || shift 2;;
|
|
|
|
--mandir*) set_mandir "$1" "$2" && shift || shift 2;;
|
2009-01-18 15:08:28 +00:00
|
|
|
--with-*) set_tool "$1" "$2" && shift || shift 2;;
|
2009-05-01 16:16:53 +00:00
|
|
|
--force) FORCE=1; shift;;
|
2007-07-01 20:52:34 +00:00
|
|
|
--help|-h) do_help; exit 0;;
|
2009-05-11 20:44:47 +00:00
|
|
|
*) printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
|
2007-07-01 19:04:20 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2008-07-07 21:22:25 +00:00
|
|
|
# Use defaults
|
2007-07-01 21:21:11 +00:00
|
|
|
[ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
|
2008-07-07 21:22:25 +00:00
|
|
|
|
|
|
|
# Special case when installing locally
|
2009-04-20 19:57:16 +00:00
|
|
|
if [ "${LOCAL_set}" = "y" ]; then
|
2008-12-22 18:21:51 +00:00
|
|
|
set_prefix "" "$( pwd )"
|
|
|
|
set_bindir "" "$( pwd )"
|
|
|
|
set_libdir "" "$( pwd )"
|
|
|
|
set_docdir "" "$( pwd )/docs"
|
|
|
|
set_mandir "" "$( pwd )/docs"
|
2007-07-22 17:44:27 +00:00
|
|
|
fi
|
2007-07-01 20:52:34 +00:00
|
|
|
|
2007-09-12 20:44:15 +00:00
|
|
|
#---------------------------------------------------------------------
|
2009-01-18 15:08:28 +00:00
|
|
|
# Some sanity checks, now
|
|
|
|
|
|
|
|
# We check for grep and sed manually, because they are used in has_or_abort
|
|
|
|
printf "Checking for 'grep'... "
|
|
|
|
if [ -n "${grep}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${grep} (cached)\n"
|
2009-01-18 15:08:28 +00:00
|
|
|
else
|
|
|
|
grep="$( which grep 2>/dev/null )"
|
2009-02-01 18:40:16 +00:00
|
|
|
if [ -z "${grep}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "not found\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
else
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${grep}\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
printf "Checking whether '${grep}' supports -E... "
|
|
|
|
if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "yes\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
else
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "no\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
grep=
|
|
|
|
fi
|
|
|
|
fi
|
2009-01-18 15:08:28 +00:00
|
|
|
fi
|
2009-02-01 18:40:16 +00:00
|
|
|
if [ -z "${grep}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "Either you are missing entirely the needed tool,\n"
|
|
|
|
printf "or the version you have is too old.\n"
|
|
|
|
printf "You can give the path to this tool using: --with-grep=PATH\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
do_error "Bailing out..."
|
2008-12-23 22:20:25 +00:00
|
|
|
fi
|
2009-05-01 16:16:53 +00:00
|
|
|
add_to_var_list grep
|
2008-12-23 22:20:25 +00:00
|
|
|
|
2009-01-18 15:08:28 +00:00
|
|
|
printf "Checking for 'sed'... "
|
|
|
|
if [ -n "${sed}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${sed} (cached)\n"
|
2009-01-18 15:08:28 +00:00
|
|
|
else
|
|
|
|
sed="$( which sed 2>/dev/null )"
|
2009-02-01 18:40:16 +00:00
|
|
|
if [ -z "${sed}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "not found\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
else
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "${sed}\n"
|
2009-04-02 22:28:10 +00:00
|
|
|
printf "Checking whether '${sed}' supports -i and -e... "
|
2009-02-01 18:40:16 +00:00
|
|
|
touch .ct-ng.sed.test
|
|
|
|
if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "yes\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
else
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "no\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
sed=
|
|
|
|
fi
|
|
|
|
rm -f .ct-ng.sed.test
|
|
|
|
fi
|
2009-01-18 15:08:28 +00:00
|
|
|
fi
|
2009-02-01 18:40:16 +00:00
|
|
|
if [ -z "${sed}" ]; then
|
2009-05-11 20:44:47 +00:00
|
|
|
printf "Either you are missing entirely the needed tool,\n"
|
|
|
|
printf "or the version you have is too old.\n"
|
|
|
|
printf "You can give the path to this tool using: --with-sed=PATH\n"
|
2009-02-01 18:40:16 +00:00
|
|
|
do_error "Bailing out..."
|
2009-01-18 15:08:28 +00:00
|
|
|
fi
|
2009-05-01 16:16:53 +00:00
|
|
|
add_to_var_list sed
|
|
|
|
|
|
|
|
# The regular list of tools we can now easily check for
|
|
|
|
has_or_abort prog=bash \
|
|
|
|
var=bash \
|
2009-08-19 17:41:24 +00:00
|
|
|
ver='^GNU bash, version (3\.[1-9]|4)' \
|
|
|
|
err="'bash' 3.1 or above was not found"
|
2009-05-01 16:16:53 +00:00
|
|
|
has_or_abort prog=cut
|
|
|
|
has_or_abort prog=install var=install
|
|
|
|
has_or_abort prog=make \
|
|
|
|
var=make \
|
|
|
|
ver='^GNU Make (3.[89][[:digit:]]|[4-9])' \
|
|
|
|
err="GNU 'make' 3.80 or above was not found"
|
|
|
|
has_or_abort prog=gcc
|
2009-07-22 18:42:23 +00:00
|
|
|
has_or_abort prog="awk gawk" ver='^GNU Awk' err="GNU 'awk' was not found"
|
2009-05-01 16:16:53 +00:00
|
|
|
has_or_abort prog=bison
|
|
|
|
has_or_abort prog=flex
|
|
|
|
has_or_abort prog=makeinfo
|
|
|
|
has_or_abort prog=automake \
|
2009-08-01 17:18:12 +00:00
|
|
|
ver='\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)' \
|
2009-05-01 16:16:53 +00:00
|
|
|
err="'automake' 1.10 or above was not found"
|
|
|
|
has_or_abort prog=libtool \
|
|
|
|
ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \
|
|
|
|
err="'libtool' 1.5.26 or above was not found"
|
2009-06-02 21:01:19 +00:00
|
|
|
has_or_abort prog=stat ver='GNU coreutils'
|
2009-05-01 16:16:53 +00:00
|
|
|
has_or_abort prog="curl wget"
|
2009-05-20 20:20:51 +00:00
|
|
|
has_or_abort prog=cvs
|
2009-05-01 16:16:53 +00:00
|
|
|
has_or_abort prog=patch
|
|
|
|
has_or_abort prog=tar
|
|
|
|
has_or_abort prog=gzip
|
|
|
|
has_or_abort prog=bzip2
|
|
|
|
has_or_abort prog=lzma
|
2009-05-02 21:50:09 +00:00
|
|
|
has_or_abort prog=readlink
|
2009-05-01 16:16:53 +00:00
|
|
|
|
2009-05-02 18:23:58 +00:00
|
|
|
has_or_abort inc="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h" \
|
|
|
|
err="'ncurses' headers files were not found"
|
2009-05-02 21:50:09 +00:00
|
|
|
|
2009-05-11 20:24:29 +00:00
|
|
|
ncurses_libs="$( for l in ncursesw ncurses curses; do \
|
|
|
|
for x in so a dylib; do \
|
|
|
|
printf "lib$l.$x "; \
|
|
|
|
done; \
|
|
|
|
done \
|
|
|
|
)"
|
|
|
|
has_or_abort lib="${ncurses_libs}" \
|
2009-05-02 21:50:09 +00:00
|
|
|
err="'ncurses' library was not found"
|
2009-01-18 15:08:28 +00:00
|
|
|
|
2008-12-23 22:20:25 +00:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Compute the version string
|
2007-09-12 20:44:15 +00:00
|
|
|
|
2008-02-17 22:58:57 +00:00
|
|
|
# If this version is a svn snapshot, try to get the revision number
|
|
|
|
# If we can't get the revision number, use date
|
|
|
|
case "${VERSION}" in
|
2009-06-17 08:46:28 +00:00
|
|
|
*+hg|hg)
|
|
|
|
has_or_abort prog=hg
|
2009-05-01 16:16:53 +00:00
|
|
|
printf "Computing version string... "
|
2009-06-17 08:46:28 +00:00
|
|
|
REVISION="$( hg id -n 2>/dev/null )"
|
2008-12-22 18:21:51 +00:00
|
|
|
case "${REVISION}" in
|
2009-06-17 08:46:28 +00:00
|
|
|
"")
|
2008-12-22 18:21:51 +00:00
|
|
|
VERSION="${VERSION}_unknown@$( date +%Y%m%d.%H%M%S )";;
|
|
|
|
*)
|
2009-07-15 07:22:47 +00:00
|
|
|
VERSION="${VERSION}_$( hg id -b )@${REVISION%%+}_$( hg id -i )"
|
2008-12-22 18:21:51 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
# Arrange to have no / in the directory name, no need to create an
|
|
|
|
# arbitrarily deep directory structure
|
2009-05-11 20:44:47 +00:00
|
|
|
VERSION="$( printf "${VERSION}\n" |"${sed}" -r -e 's|/+|_|g;' )"
|
2008-04-17 19:21:32 +00:00
|
|
|
;;
|
2008-02-17 22:58:57 +00:00
|
|
|
esac
|
2008-06-11 20:40:38 +00:00
|
|
|
echo "${VERSION}"
|
2008-02-17 22:58:57 +00:00
|
|
|
|
2008-12-23 22:20:25 +00:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# Compute and check install paths
|
|
|
|
|
2008-06-25 08:34:47 +00:00
|
|
|
# Now we have the version string, we can build up the paths
|
2008-06-11 21:45:57 +00:00
|
|
|
[ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
|
|
|
|
[ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
|
|
|
|
[ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
|
|
|
|
[ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
|
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
# Check that install PATHs are absolute
|
|
|
|
for p in BIN LIB DOC MAN; do
|
2008-12-22 18:21:51 +00:00
|
|
|
var="${p}DIR"
|
|
|
|
eval v='"${'"${var}"'}"'
|
|
|
|
case "${v}" in
|
|
|
|
/*) ;;
|
|
|
|
*) do_error "'${var}' is not an absolute path: '${v}'"
|
|
|
|
esac
|
2008-11-16 21:55:46 +00:00
|
|
|
done
|
|
|
|
|
2008-12-23 22:20:25 +00:00
|
|
|
#---------------------------------------------------------------------
|
|
|
|
# That's all, folks!
|
2008-06-25 08:34:47 +00:00
|
|
|
|
2008-07-07 21:22:25 +00:00
|
|
|
printf "Building up Makefile... "
|
2009-01-18 15:08:28 +00:00
|
|
|
var_sed="$( for var_name in ${var_list}; do
|
|
|
|
eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
|
|
|
|
done
|
|
|
|
)"
|
2008-12-23 22:20:25 +00:00
|
|
|
"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g
|
|
|
|
s,@@LIBDIR@@,${LIBDIR},g
|
|
|
|
s,@@DOCDIR@@,${DOCDIR},g
|
|
|
|
s,@@MANDIR@@,${MANDIR},g
|
|
|
|
s,@@VERSION@@,${VERSION},g
|
|
|
|
s,@@DATE@@,${DATE},g
|
2009-01-18 15:08:28 +00:00
|
|
|
${var_sed}
|
2008-12-23 22:20:25 +00:00
|
|
|
s,@@LOCAL@@,${LOCAL_set},g" Makefile.in >Makefile
|
2008-07-16 21:59:49 +00:00
|
|
|
echo "done"
|
2007-07-01 21:21:11 +00:00
|
|
|
|
|
|
|
cat <<__EOF__
|
2008-07-16 21:59:49 +00:00
|
|
|
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG configured as follows:
|
2008-06-11 21:45:57 +00:00
|
|
|
PREFIX='${PREFIX}'
|
|
|
|
BINDIR='${BINDIR}'
|
|
|
|
LIBDIR='${LIBDIR}'
|
|
|
|
DOCDIR='${DOCDIR}'
|
|
|
|
MANDIR='${MANDIR}'
|
2008-12-23 22:20:25 +00:00
|
|
|
|
|
|
|
Now run:
|
|
|
|
make
|
2007-07-01 21:21:11 +00:00
|
|
|
__EOF__
|
2009-04-20 20:14:53 +00:00
|
|
|
if [ "${LOCAL_set}" != "y" ]; then
|
2009-04-20 19:57:16 +00:00
|
|
|
printf " make install\n"
|
|
|
|
fi
|