2021-11-16 17:02:06 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-11-18 08:09:40 -05:00
|
|
|
usage() {
|
|
|
|
cat <<USAGE
|
|
|
|
There is an error in your command.
|
|
|
|
More information: ./configure --help
|
|
|
|
USAGE
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2021-11-16 17:02:06 -05:00
|
|
|
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:
|
|
|
|
--disable-xinerama disable Xinerama
|
2021-11-18 08:09:40 -05:00
|
|
|
|
|
|
|
Optional Packages:
|
|
|
|
--with-PACKAGE[ ARG] use PACKAGE [ARG=yes]
|
|
|
|
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE no)
|
2021-11-18 08:57:41 -05:00
|
|
|
--with-terminal [alacritty|gnome|st|xterm]
|
|
|
|
use ARG as terminal [alacritty]
|
2021-11-18 08:09:40 -05:00
|
|
|
--without-terminal do not use terminal at all
|
2021-11-16 17:02:06 -05:00
|
|
|
HELP
|
2021-11-18 08:09:40 -05:00
|
|
|
exit
|
2021-11-16 17:02:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
prefix='/usr/local'
|
|
|
|
eprefix=''
|
|
|
|
bindir=''
|
|
|
|
datarootdir=''
|
|
|
|
mandir=''
|
2021-11-18 08:09:40 -05:00
|
|
|
enable_xinerama=''
|
|
|
|
with_terminal=''
|
2021-11-16 17:02:06 -05:00
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
2021-11-18 08:09:40 -05:00
|
|
|
do_shift='yes'
|
|
|
|
|
2021-11-16 17:02:06 -05:00
|
|
|
case "$1" in
|
|
|
|
-h | -? | --help | -help | help)
|
|
|
|
help
|
|
|
|
;;
|
|
|
|
--prefix)
|
|
|
|
shift
|
|
|
|
prefix="$1"
|
|
|
|
;;
|
|
|
|
--exec-prefix)
|
|
|
|
shift
|
|
|
|
eprefix="$1"
|
|
|
|
;;
|
|
|
|
--bindir)
|
|
|
|
shift
|
|
|
|
bindir="$1"
|
|
|
|
;;
|
|
|
|
--datarootdir)
|
|
|
|
shift
|
|
|
|
datarootdir="$1"
|
|
|
|
;;
|
|
|
|
--mandir)
|
|
|
|
shift
|
|
|
|
mandir="$1"
|
|
|
|
;;
|
|
|
|
--disable-xinerama)
|
|
|
|
enable_xinerama='no'
|
|
|
|
;;
|
2021-11-18 08:09:40 -05:00
|
|
|
--without-terminal)
|
|
|
|
if [ "$with_terminal" = '' ]; then
|
|
|
|
with_terminal='no'
|
|
|
|
elif [ "$with_terminal" != 'no' ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--with-terminal)
|
|
|
|
shift
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
yes)
|
|
|
|
if [ "$with_terminal" = '' ]; then
|
|
|
|
with_terminal='yes'
|
|
|
|
elif [ "$with_terminal" != 'yes' ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
if [ "$with_terminal" = '' ]; then
|
|
|
|
with_terminal='no'
|
|
|
|
elif [ "$with_terminal" != 'no' ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
2021-11-18 08:57:41 -05:00
|
|
|
alacritty)
|
2021-11-18 08:09:40 -05:00
|
|
|
if [ "$with_terminal" = '' ]; then
|
2021-11-18 08:57:41 -05:00
|
|
|
with_terminal='alacritty'
|
|
|
|
elif [ "$with_terminal" != 'alacritty' ]; then
|
2021-11-18 08:09:40 -05:00
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
2021-11-18 08:57:41 -05:00
|
|
|
gnome)
|
2021-11-18 08:09:40 -05:00
|
|
|
if [ "$with_terminal" = '' ]; then
|
2021-11-18 08:57:41 -05:00
|
|
|
with_terminal='gnome'
|
|
|
|
elif [ "$with_terminal" != 'gnome' ]; then
|
2021-11-18 08:09:40 -05:00
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
2021-11-18 08:57:41 -05:00
|
|
|
st)
|
2021-11-18 08:09:40 -05:00
|
|
|
if [ "$with_terminal" = '' ]; then
|
2021-11-18 08:57:41 -05:00
|
|
|
with_terminal='st'
|
|
|
|
elif [ "$with_terminal" != 'st' ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
xterm)
|
|
|
|
if [ "$with_terminal" = '' ]; then
|
|
|
|
with_terminal='xterm'
|
|
|
|
elif [ "$with_terminal" != 'xterm' ]; then
|
2021-11-18 08:09:40 -05:00
|
|
|
usage
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
do_shift='no'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2021-11-16 17:02:06 -05:00
|
|
|
*)
|
2021-11-18 08:09:40 -05:00
|
|
|
usage
|
2021-11-16 17:02:06 -05:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-11-18 08:09:40 -05:00
|
|
|
if [ "$do_shift" = 'yes' ]; then shift; fi
|
2021-11-16 17:02:06 -05:00
|
|
|
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
|
|
|
|
|
2021-11-18 08:09:40 -05:00
|
|
|
if [ "$enable_xinerama" = '' ]; then
|
|
|
|
enable_xinerama='yes'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$with_terminal" = '' -o "$with_terminal" = 'yes' ]; then
|
2021-11-18 08:57:41 -05:00
|
|
|
with_terminal='alacritty'
|
2021-11-18 08:09:40 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "PREFIX = $prefix"
|
|
|
|
echo "EPREFIX = $eprefix"
|
|
|
|
echo "BINDIR = $bindir"
|
|
|
|
echo "DATAROOTDIR = $datarootdir"
|
|
|
|
echo "MANDIR = $mandir"
|
|
|
|
echo "ENABLE_XINERAMA = $enable_xinerama"
|
|
|
|
echo "WITH_TERMINAL = $with_terminal"
|
2021-11-16 17:02:06 -05:00
|
|
|
|
2021-11-16 18:05:40 -05:00
|
|
|
cat > 'config/1-generated.mk' << MAKE
|
2021-11-18 08:09:40 -05:00
|
|
|
PREFIX = $prefix
|
|
|
|
EPREFIX = $eprefix
|
|
|
|
BINDIR = $bindir
|
|
|
|
DATAROOTDIR = $datarootdir
|
|
|
|
MANDIR = $mandir
|
|
|
|
ENABLE_XINERAMA = $enable_xinerama
|
|
|
|
WITH_TERMINAL = $with_terminal
|
2021-11-16 17:35:52 -05:00
|
|
|
MAKE
|
|
|
|
|
2021-11-16 17:47:45 -05:00
|
|
|
make_help_result="$(make --help 2>&1 || true)"
|
2021-11-16 17:35:52 -05:00
|
|
|
if [ "$(echo "$make_help_result" | grep 'gnu.org')" = '' ]; then
|
2021-11-16 18:07:04 -05:00
|
|
|
ln -sf '2-conditionals-bsd.mk' 'config/2-conditionals.mk'
|
2021-11-16 17:35:52 -05:00
|
|
|
else
|
2021-11-16 18:07:04 -05:00
|
|
|
ln -sf '2-conditionals-gnu.mk' 'config/2-conditionals.mk'
|
2021-11-16 17:35:52 -05:00
|
|
|
fi
|