2011-03-18 10:35:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Try and be like autotools configure, but without autotools
|
|
|
|
|
|
|
|
# Ensure that we do not inherit these from env
|
|
|
|
OS=
|
|
|
|
BUILD=
|
|
|
|
HOST=
|
|
|
|
TARGET=
|
|
|
|
RESTARTCMD=
|
|
|
|
RCDIR=
|
2016-07-20 03:52:04 +00:00
|
|
|
STATUSARG=
|
2011-03-18 10:35:54 +00:00
|
|
|
|
2011-09-13 02:41:09 +00:00
|
|
|
for x do
|
2011-03-18 10:35:54 +00:00
|
|
|
opt=${x%%=*}
|
|
|
|
var=${x#*=}
|
|
|
|
case "$opt" in
|
|
|
|
--os|OS) OS=$var;;
|
|
|
|
--with-cc|CC) CC=$var;;
|
|
|
|
--debug) DEBUG=$var;;
|
|
|
|
--disable-debug) DEBUG=no;;
|
|
|
|
--enable-debug) DEBUG=yes;;
|
2015-05-04 20:51:27 +00:00
|
|
|
--prefix) PREFIX=$var;;
|
2011-03-18 10:35:54 +00:00
|
|
|
--sysconfdir) SYSCONFDIR=$var;;
|
|
|
|
--bindir|--sbindir) SBINDIR=$var;;
|
|
|
|
--libexecdir) LIBEXECDIR=$var;;
|
|
|
|
--statedir|--localstatedir) STATEDIR=$var;;
|
|
|
|
--dbdir) DBDIR=$var;;
|
|
|
|
--rundir) RUNDIR=$var;;
|
|
|
|
--mandir) MANDIR=$var;;
|
|
|
|
--with-ccopts|CFLAGS) CFLAGS=$var;;
|
|
|
|
CPPFLAGS) CPPFLAGS=$var;;
|
|
|
|
--build) BUILD=$var;;
|
|
|
|
--host) HOST=$var;;
|
|
|
|
--target) TARGET=$var;;
|
|
|
|
--libdir) LIBDIR=$var;;
|
|
|
|
--restartcmd) RESTARTCMD=$var;;
|
2016-07-20 03:52:04 +00:00
|
|
|
--rcdir) RCDIR=$var;;
|
|
|
|
--statusarg) STATUSARG=$var;;
|
2011-03-18 10:35:54 +00:00
|
|
|
--includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
|
|
|
|
--datadir|--infodir) ;; # ignore autotools
|
|
|
|
--disable-maintainer-mode|--disable-dependency-tracking) ;;
|
|
|
|
--help) echo "See the README file for available options"; exit 0;;
|
|
|
|
*) echo "$0: WARNING: unknown option $opt" >&2;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-05-04 20:51:27 +00:00
|
|
|
if [ -z "$LIBEXECDIR" ]; then
|
|
|
|
printf "Checking for directory /libexec ... "
|
|
|
|
if [ -d /libexec ]; then
|
|
|
|
echo "yes"
|
|
|
|
LIBEXECDIR=$PREFIX/libexec/resolvconf
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
LIBEXECDIR=$PREFIX/lib/resolvconf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$RUNDIR" ]; then
|
|
|
|
printf "Checking for directory /run ... "
|
|
|
|
if [ -d /run ]; then
|
|
|
|
echo "yes"
|
|
|
|
RUNDIR=/run
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
RUNDIR=/var/run
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-03-18 10:35:54 +00:00
|
|
|
: ${SED:=sed}
|
|
|
|
|
|
|
|
: ${SYSCONFDIR:=$PREFIX/etc}
|
|
|
|
: ${SBINDIR:=$PREFIX/sbin}
|
2015-05-04 20:51:27 +00:00
|
|
|
: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf}
|
2011-03-18 10:35:54 +00:00
|
|
|
: ${STATEDIR:=/var}
|
|
|
|
: ${RUNDIR:=$STATEDIR/run}
|
|
|
|
: ${MANDIR:=${PREFIX:-/usr}/share/man}
|
|
|
|
|
|
|
|
eval SYSCONFDIR="$SYSCONFDIR"
|
|
|
|
eval SBINDIR="$SBINDIR"
|
2015-05-04 20:51:27 +00:00
|
|
|
eval LIBEXECDIR="$LIBEXECDIR"
|
2011-03-18 10:35:54 +00:00
|
|
|
eval VARDIR="$RUNDIR/resolvconf"
|
|
|
|
eval MANDIR="$MANDIR"
|
|
|
|
|
|
|
|
CONFIG_MK=config.mk
|
|
|
|
|
|
|
|
if [ -z "$BUILD" ]; then
|
2015-05-04 20:51:27 +00:00
|
|
|
# autoconf target triplet: cpu-vendor-os
|
|
|
|
BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
|
2011-03-18 10:35:54 +00:00
|
|
|
fi
|
2015-05-04 20:51:27 +00:00
|
|
|
: ${HOST:=$BUILD}
|
2011-03-18 10:35:54 +00:00
|
|
|
|
|
|
|
if [ -z "$OS" ]; then
|
2015-05-04 20:51:27 +00:00
|
|
|
echo "Deriving operating system from ... $HOST"
|
|
|
|
# Derive OS from cpu-vendor-[kernel-]os
|
|
|
|
CPU=${HOST%%-*}
|
|
|
|
REST=${HOST#*-}
|
2011-03-18 10:35:54 +00:00
|
|
|
if [ "$CPU" != "$REST" ]; then
|
2015-05-04 20:51:27 +00:00
|
|
|
VENDOR=${REST%%-*}
|
2011-03-18 10:35:54 +00:00
|
|
|
REST=${REST#*-}
|
2015-05-04 20:51:27 +00:00
|
|
|
if [ "$VENDOR" != "$REST" ]; then
|
|
|
|
# Use kernel if given, otherwise os
|
2011-03-18 10:35:54 +00:00
|
|
|
OS=${REST%%-*}
|
|
|
|
else
|
|
|
|
# 2 tupple
|
2015-05-04 20:51:27 +00:00
|
|
|
OS=$VENDOR
|
|
|
|
VENDOR=
|
2011-03-18 10:35:54 +00:00
|
|
|
fi
|
|
|
|
fi
|
2015-05-04 20:51:27 +00:00
|
|
|
|
|
|
|
# Work with cpu-kernel-os, ie Debian
|
|
|
|
case "$VENDOR" in
|
|
|
|
linux*|kfreebsd*) OS=$VENDOR; VENDOR= ;;
|
|
|
|
esac
|
|
|
|
# Special case
|
|
|
|
case "$OS" in
|
|
|
|
gnu*) OS=hurd;; # No HURD support as yet
|
|
|
|
esac
|
2011-03-18 10:35:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Configuring openresolv for ... $OS"
|
|
|
|
rm -rf $CONFIG_MK
|
|
|
|
echo "# $OS" >$CONFIG_MK
|
|
|
|
|
2016-07-20 03:52:04 +00:00
|
|
|
# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
|
|
|
|
# regardless of if it's not running.
|
|
|
|
# So we force onestatus to work around this silly bug.
|
|
|
|
if [ -z "$STATUSARG" ]; then
|
|
|
|
case "$OS" in
|
|
|
|
freebsd*) STATUSARG="onestatus";;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
|
|
|
|
do
|
2011-03-18 10:35:54 +00:00
|
|
|
eval v=\$$x
|
|
|
|
# Make files look nice for import
|
|
|
|
l=$((10 - ${#x}))
|
|
|
|
unset t
|
|
|
|
[ $l -gt 3 ] && t=" "
|
|
|
|
echo "$x=$t $v" >>$CONFIG_MK
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo " SYSCONFDIR = $SYSCONFDIR"
|
|
|
|
echo " SBINDIR = $SBINDIR"
|
|
|
|
echo " LIBEXECDIR = $LIBEXECDIR"
|
|
|
|
echo " VARDIR = $RUNDIR"
|
|
|
|
echo " MANDIR = $MANDIR"
|
|
|
|
echo
|
2016-07-20 03:52:04 +00:00
|
|
|
echo " RESTARTCMD = $RESTARTCMD"
|
|
|
|
echo " RCDIR = $RCDIR"
|
|
|
|
echo " STATUSARG = $STATUSARG"
|
|
|
|
echo
|