polytreewm/configure

129 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
set -e
help() {
cat <<HELP
This script tries to be similar to autotools' \`configure', but is different.
Usage: ./configure [OPTION]...
Defaults for the options are specified in brackets.
Configuration:
-h, --help Display this help and exit
Installation directories:
--prefix PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`/usr/local/bin', \`/usr/local/lib' etc. You can specify
an installation prefix other than \`/usr/local' using \`--prefix',
for instance \`--prefix \$HOME'.
For better control, use the options below.
File tuning of the installation directories:
--bindir DIR user executables [EPREFIX/bin]
--datarootdir DIR read-only arch.-independent data root [PREFIX/share]
--mandir DIR man documentation [DATAROOTDIR/man]
Optional Features:
--enable-gnome-terminal use GNOME Terminal instead of ptterm
--disable-xinerama disable Xinerama
HELP
}
prefix='/usr/local'
eprefix=''
bindir=''
datarootdir=''
mandir=''
enable_gnome_terminal='no'
enable_xinerama='yes'
while [ $# -gt 0 ]; do
case "$1" in
-h | -? | --help | -help | help)
help
exit
;;
--prefix)
shift
prefix="$1"
;;
--exec-prefix)
shift
eprefix="$1"
;;
--bindir)
shift
bindir="$1"
;;
--datarootdir)
shift
datarootdir="$1"
;;
--mandir)
shift
mandir="$1"
;;
--enable-gnome-terminal)
enable_gnome_terminal='yes'
;;
--disable-xinerama)
enable_xinerama='no'
;;
*)
help
exit
;;
esac
shift
done
if [ "$eprefix" = '' ]; then
eprefix="$prefix"
fi
if [ "$bindir" = '' ]; then
bindir="$eprefix/bin"
fi
if [ "$datarootdir" = '' ]; then
datarootdir="$prefix/share"
fi
if [ "$mandir" = '' ]; then
mandir="$datarootdir/man"
fi
echo "PREFIX = $prefix"
echo "EPREFIX = $eprefix"
echo "BINDIR = $bindir"
echo "DATAROOTDIR = $datarootdir"
echo "MANDIR = $mandir"
echo "ENABLE_GNOME_TERMINAL = $enable_gnome_terminal"
echo "ENABLE_XINERAMA = $enable_xinerama"
cat > 'config/1-generated.mk' << MAKE
PREFIX = $prefix
EPREFIX = $eprefix
BINDIR = $bindir
DATAROOTDIR = $datarootdir
MANDIR = $mandir
ENABLE_GNOME_TERMINAL = $enable_gnome_terminal
ENABLE_XINERAMA = $enable_xinerama
MAKE
make_help_result="$(make --help 2>&1 || true)"
if [ "$(echo "$make_help_result" | grep 'gnu.org')" = '' ]; then
ln -sf '2-conditionals-bsd.mk' 'config/2-conditionals.mk'
else
ln -sf '2-conditionals-gnu.mk' 'config/2-conditionals.mk'
fi