2007-07-01 19:04:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-08-15 15:39:44 +00:00
|
|
|
VERSION=$(cat .version)
|
2007-07-01 19:04:20 +00:00
|
|
|
DATE=$(date +%Y%m%d)
|
|
|
|
|
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=
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
get_optval(){
|
|
|
|
local ret
|
|
|
|
case "$1" in
|
|
|
|
--*=?*)
|
2007-07-02 17:47:55 +00:00
|
|
|
echo "${1}" |cut -d '=' -f 2-
|
2007-07-01 19:04:20 +00:00
|
|
|
ret=0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "${2}"
|
|
|
|
ret=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_prefix() {
|
|
|
|
local ret
|
|
|
|
PREFIX=$(get_optval "$1" "$2")
|
|
|
|
ret=$?
|
|
|
|
[ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
|
2007-07-01 21:21:11 +00:00
|
|
|
[ -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"
|
2007-07-01 19:04:20 +00:00
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_bindir() {
|
|
|
|
local ret
|
|
|
|
BINDIR=$(get_optval "$1" "$2")
|
|
|
|
ret=$?
|
|
|
|
BINDIR_set=1
|
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_libdir() {
|
|
|
|
local ret
|
|
|
|
LIBDIR=$(get_optval "$1" "$2")
|
|
|
|
ret=$?
|
|
|
|
LIBDIR_set=1
|
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_docdir() {
|
|
|
|
local ret
|
|
|
|
DOCDIR=$(get_optval "$1" "$2")
|
|
|
|
ret=$?
|
|
|
|
DOCDIR_set=1
|
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_mandir() {
|
|
|
|
local ret
|
|
|
|
MANDIR=$(get_optval "$1" "$2")
|
|
|
|
ret=$?
|
|
|
|
MANDIR_set=1
|
|
|
|
return ${ret}
|
|
|
|
}
|
|
|
|
|
2007-07-01 20:52:34 +00:00
|
|
|
do_help() {
|
|
|
|
cat <<__EOF__
|
2007-07-02 19:40:54 +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:
|
|
|
|
-h, --help display this help and exit
|
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:
|
|
|
|
--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]
|
|
|
|
__EOF__
|
|
|
|
}
|
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
--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;;
|
2007-07-22 17:44:27 +00:00
|
|
|
--local) LOCAL_set=1; shift;;
|
2007-07-01 20:52:34 +00:00
|
|
|
--help|-h) do_help; exit 0;;
|
|
|
|
*) do_help; exit 1;;
|
2007-07-01 19:04:20 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2007-07-01 21:21:11 +00:00
|
|
|
[ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
|
2007-07-22 17:44:27 +00:00
|
|
|
if [ "${LOCAL_set}" = "1" ]; then
|
|
|
|
set_prefix "" $(pwd)
|
|
|
|
set_bindir "" $(pwd)
|
|
|
|
set_libdir "" $(pwd)
|
|
|
|
set_docdir "" $(pwd)/docs
|
|
|
|
set_mandir "" $(pwd)/docs
|
|
|
|
fi
|
2007-07-01 20:52:34 +00:00
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
|
|
|
|
-e "s,@@LIBDIR@@,${LIBDIR},g;" \
|
|
|
|
-e "s,@@DOCDIR@@,${DOCDIR},g;" \
|
|
|
|
-e "s,@@MANDIR@@,${MANDIR},g;" \
|
|
|
|
-e "s,@@VERSION@@,${VERSION},g;" \
|
|
|
|
-e "s,@@DATE@@,${DATE},g;" \
|
2007-07-22 17:44:27 +00:00
|
|
|
-e "s,@@LOCAL@@,${LOCAL_set},g;" \
|
2007-07-01 21:21:11 +00:00
|
|
|
Makefile.in >Makefile
|
|
|
|
|
|
|
|
cat <<__EOF__
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG configured as follows:
|
2007-07-01 21:21:11 +00:00
|
|
|
PREFIX="${PREFIX}"
|
|
|
|
BINDIR="${BINDIR}"
|
|
|
|
LIBDIR="${LIBDIR}"
|
|
|
|
DOCDIR="${DOCDIR}"
|
|
|
|
MANDIR="${MANDIR}"
|
|
|
|
__EOF__
|