2009-07-14 21:59:30 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# Try and be like autotools configure, but without autotools
|
|
|
|
|
2014-03-07 21:35:10 +08:00
|
|
|
echo "configure args: $*"
|
|
|
|
|
2010-01-26 04:06:15 +08:00
|
|
|
# Ensure that we do not inherit these from env
|
2009-10-17 05:36:51 +08:00
|
|
|
HOOKSET=false
|
2013-02-04 21:30:35 +08:00
|
|
|
INET=
|
|
|
|
INET6=
|
2009-11-20 20:20:10 +08:00
|
|
|
ARC4RANDOM=
|
|
|
|
CLOSEFROM=
|
|
|
|
GETLINE=
|
|
|
|
STRLCPY=
|
2013-09-10 00:14:06 +08:00
|
|
|
UDEV=
|
2010-01-26 04:06:15 +08:00
|
|
|
OS=
|
2014-03-25 02:41:34 +08:00
|
|
|
BUILD=
|
2014-03-25 02:40:45 +08:00
|
|
|
BUILDCC=
|
2010-01-26 04:06:15 +08:00
|
|
|
HOST=
|
|
|
|
TARGET=
|
|
|
|
DEBUG=
|
|
|
|
FORK=
|
2012-07-06 00:37:41 +08:00
|
|
|
STATIC=
|
2010-06-09 23:32:03 +08:00
|
|
|
INCLUDEDIR=
|
2013-09-12 23:43:20 +08:00
|
|
|
DEVS=
|
2013-11-29 19:15:03 +08:00
|
|
|
EMBEDDED=
|
2009-10-17 05:36:51 +08:00
|
|
|
|
2011-06-01 14:28:41 +08:00
|
|
|
for x do
|
2009-07-14 21:59:30 +08:00
|
|
|
opt=${x%%=*}
|
|
|
|
var=${x#*=}
|
|
|
|
case "$opt" in
|
2009-07-27 03:29:37 +08:00
|
|
|
--os|OS) OS=$var;;
|
2009-07-14 21:59:30 +08:00
|
|
|
--debug) DEBUG=$var;;
|
|
|
|
--disable-debug) DEBUG=no;;
|
|
|
|
--enable-debug) DEBUG=yes;;
|
|
|
|
--fork) FORK=$var;;
|
|
|
|
--disable-fork) FORK=no;;
|
|
|
|
--enable-fork) FORK=yes;;
|
2012-07-06 00:37:41 +08:00
|
|
|
--disable-static) STATIC=no;;
|
|
|
|
--enable-static) STATIC=yes;;
|
2013-02-04 21:30:35 +08:00
|
|
|
--disable-ipv4) INET=no;;
|
|
|
|
--enable-ipv4) INET=yes;;
|
|
|
|
--disable-ipv6) INET6=no;;
|
|
|
|
--enable-ipv6) INET6=yes;;
|
2013-11-29 19:15:03 +08:00
|
|
|
--disable-embedded) EMBEDDED=no;;
|
2014-04-25 16:16:02 +08:00
|
|
|
--enable-embedded) EMBEDDED=yes;;
|
2013-06-06 08:31:00 +08:00
|
|
|
--prefix) PREFIX=$var;;
|
2009-07-14 21:59:30 +08:00
|
|
|
--sysconfdir) SYSCONFDIR=$var;;
|
2009-09-03 20:18:03 +08:00
|
|
|
--bindir|--sbindir) SBINDIR=$var;;
|
2009-07-14 21:59:30 +08:00
|
|
|
--libexecdir) LIBEXECDIR=$var;;
|
2009-07-27 01:26:18 +08:00
|
|
|
--statedir|--localstatedir) STATEDIR=$var;;
|
2009-07-14 21:59:30 +08:00
|
|
|
--dbdir) DBDIR=$var;;
|
|
|
|
--rundir) RUNDIR=$var;;
|
|
|
|
--mandir) MANDIR=$var;;
|
|
|
|
--with-ccopts|CFLAGS) CFLAGS=$var;;
|
2014-03-24 19:07:19 +08:00
|
|
|
CC) CC=$var;;
|
2009-07-14 21:59:30 +08:00
|
|
|
CPPFLAGS) CPPFLAGS=$var;;
|
2009-07-27 03:37:46 +08:00
|
|
|
--with-hook) HOOKSCRIPTS="$HOOKSCRIPTS${HOOKSCRIPTS:+ }$var";;
|
2009-10-17 05:36:51 +08:00
|
|
|
--with-hooks|HOOKSCRIPTS) HOOKSCRIPTS=$var; HOOKSET=true;;
|
2009-07-27 03:29:37 +08:00
|
|
|
--build) BUILD=$var;;
|
2014-03-25 02:40:45 +08:00
|
|
|
--host) HOST=$var; HOSTCC=$var-;;
|
2009-07-27 03:29:37 +08:00
|
|
|
--target) TARGET=$var;;
|
|
|
|
--libdir) LIBDIR=$var;;
|
2009-11-20 20:20:10 +08:00
|
|
|
--without-arc4random) ARC4RANDOM=no;;
|
|
|
|
--without-closefrom) CLOSEFROM=no;;
|
|
|
|
--without-getline) GETLINE=no;;
|
|
|
|
--without-strlcpy) STRLCPY=no;;
|
2012-11-11 00:38:53 +08:00
|
|
|
--without-posix_spawn) POSIX_SPAWN=no;;
|
2013-09-10 00:14:06 +08:00
|
|
|
--without-pollts) POLLTS=no;;
|
2013-02-19 05:25:07 +08:00
|
|
|
--with-pollts) POLLTS=$var;;
|
2014-01-25 09:35:53 +08:00
|
|
|
--without-md5) MD5=no;;
|
2014-06-02 22:48:33 +08:00
|
|
|
--without-sha2) SHA2=no;;
|
|
|
|
--without-sha256) SHA2=no;;
|
2013-09-12 23:43:20 +08:00
|
|
|
--without-dev) DEV=no;;
|
2013-09-10 00:14:06 +08:00
|
|
|
--without-udev) UDEV=no;;
|
2010-09-09 22:40:27 +08:00
|
|
|
--serviceexists) SERVICEEXISTS=$var;;
|
|
|
|
--servicecmd) SERVICECMD=$var;;
|
|
|
|
--servicestatus) SERVICESTATUS=$var;;
|
2010-06-09 23:32:03 +08:00
|
|
|
--includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
|
2009-07-27 03:29:37 +08:00
|
|
|
--datadir|--infodir) ;; # ignore autotools
|
2010-06-09 23:32:03 +08:00
|
|
|
--disable-maintainer-mode|--disable-dependency-tracking) ;;
|
2014-03-07 21:35:10 +08:00
|
|
|
--disable-silent-rules) ;;
|
2013-02-16 04:07:26 +08:00
|
|
|
-V|--version)
|
|
|
|
v=$(sed -ne 's/.*VERSION[[:space:]]*"\([^"]*\).*/\1/p' defs.h);
|
|
|
|
c=$(sed -ne 's/^.*copyright\[\] = "\([^"]*\).*/\1/p' dhcpcd.c);
|
|
|
|
echo "dhcpcd-$v $c";
|
|
|
|
exit 0;;
|
|
|
|
-h|--help) cat <<EOF
|
|
|
|
\`configure' configures this package to adapt to many kinds of systems.
|
|
|
|
|
|
|
|
Usage: configure [OPTION]... [VAR=VALUE]...
|
|
|
|
|
|
|
|
To assign environment variables (e.g., CC, CFLAGS...), specify them as
|
|
|
|
VAR=VALUE. See below for descriptions of some of the useful variables.
|
|
|
|
|
|
|
|
Defaults for the options are specified in brackets.
|
|
|
|
|
|
|
|
Configuration:
|
|
|
|
-h, --help display this help and exit
|
|
|
|
--help=short display options specific to this package
|
|
|
|
-V, --version display version information and exit
|
|
|
|
|
|
|
|
Installation directories:
|
|
|
|
--prefix=PREFIX install architecture-independent files in PREFIX [/]
|
|
|
|
|
|
|
|
By default, \`make install' will install all the files in \'/sbin',
|
|
|
|
\`/libexec', etc. You can specify
|
|
|
|
an installation prefix other than \`/' 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]
|
|
|
|
--sbindir=DIR system admin executables [PREFIX/sbin]
|
|
|
|
--libexecdir=DIR program executables [PREFIX/libexec]
|
|
|
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
|
|
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
|
|
|
--libdir=DIR object code libraries [PREFIX/lib]
|
|
|
|
--includedir=DIR C header files [PREFIX/include]
|
|
|
|
--mandir=DIR man documentation [PREFIX/man]
|
|
|
|
|
|
|
|
System types:
|
|
|
|
--build=BUILD configure for building on BUILD [guessed]
|
|
|
|
--host=HOST build programs to run on HOST [BUILD]
|
|
|
|
--target=TARGET configure for building compilers for TARGET [HOST]
|
|
|
|
|
|
|
|
Optional Features:
|
|
|
|
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
|
|
|
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
|
|
|
|
|
|
|
Some influential environment variables:
|
|
|
|
CC C compiler command
|
|
|
|
CFLAGS C compiler flags
|
|
|
|
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
|
|
|
nonstandard directory <lib dir>
|
|
|
|
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
|
|
|
|
headers in a nonstandard directory <include dir>
|
|
|
|
CPP C preprocessor
|
|
|
|
|
|
|
|
Use these variables to override the choices made by \`configure' or to help
|
|
|
|
it to find libraries and programs with nonstandard names/locations.
|
|
|
|
EOF
|
|
|
|
exit 0
|
|
|
|
;;
|
2009-07-27 00:40:47 +08:00
|
|
|
*) echo "$0: WARNING: unknown option $opt" >&2;;
|
2009-07-14 21:59:30 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2009-09-03 18:10:51 +08:00
|
|
|
: ${SED:=sed}
|
2013-11-29 19:15:03 +08:00
|
|
|
: ${GREP:=grep}
|
|
|
|
: ${WC:=wc}
|
2009-09-03 18:10:51 +08:00
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
: ${FORK:=yes}
|
|
|
|
: ${SYSCONFDIR:=$PREFIX/etc}
|
|
|
|
: ${SBINDIR:=$PREFIX/sbin}
|
2009-07-27 03:29:37 +08:00
|
|
|
: ${LIBDIR:=$PREFIX/lib}
|
2009-07-14 21:59:30 +08:00
|
|
|
: ${LIBEXECDIR:=$PREFIX/libexec}
|
|
|
|
: ${STATEDIR:=/var}
|
|
|
|
: ${DBDIR:=$STATEDIR/db}
|
|
|
|
: ${RUNDIR:=$STATEDIR/run}
|
|
|
|
: ${MANDIR:=${PREFIX:-/usr}/share/man}
|
|
|
|
|
2010-06-09 23:32:03 +08:00
|
|
|
eval SYSCONFDIR="$SYSCONFDIR"
|
|
|
|
eval LIBDIR="$LIBDIR"
|
|
|
|
eval LIBEXECDIR="$LIBEXECDIR"
|
|
|
|
eval STATEDIR="$STATEDIR"
|
|
|
|
eval DBDIR="$DBDIR"
|
|
|
|
eval RUNDIR="$RUNDIR"
|
|
|
|
eval MANDIR="$MANDIR"
|
|
|
|
|
2009-10-09 21:12:20 +08:00
|
|
|
_which()
|
|
|
|
{
|
|
|
|
x="$(which "$1" 2>/dev/null)"
|
|
|
|
if [ -n "$x" ]; then
|
|
|
|
echo "$x"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
for x in /sbin/"$1" /usr/sbin/"$1" \
|
|
|
|
/usr/pkg/sbin/"$1" /usr/local/sbin/"$1"
|
|
|
|
do
|
|
|
|
if [ -e "$x" ]; then
|
|
|
|
echo "$x"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
CONFIG_H=config.h
|
|
|
|
CONFIG_MK=config.mk
|
|
|
|
|
2009-07-27 03:29:37 +08:00
|
|
|
if [ -z "$BUILD" ]; then
|
2014-03-02 16:36:19 +08:00
|
|
|
# autoconf target triplet: cpu-vendor-os
|
|
|
|
BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
|
2009-07-27 03:29:37 +08:00
|
|
|
fi
|
2014-03-25 02:40:45 +08:00
|
|
|
: ${HOST:=$BUILD}
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2009-07-27 03:29:37 +08:00
|
|
|
if [ -z "$OS" ]; then
|
2014-03-25 02:40:45 +08:00
|
|
|
echo "Deriving operating system from ... $HOST"
|
2014-03-03 23:48:07 +08:00
|
|
|
# Derive OS from cpu-vendor-[kernel-]os
|
2014-03-25 02:40:45 +08:00
|
|
|
CPU=${HOST%%-*}
|
|
|
|
REST=${HOST#*-}
|
2010-06-09 23:32:03 +08:00
|
|
|
if [ "$CPU" != "$REST" ]; then
|
2014-03-02 16:36:19 +08:00
|
|
|
VENDOR=${REST%%-*}
|
2010-06-09 23:32:03 +08:00
|
|
|
REST=${REST#*-}
|
2014-03-02 16:36:19 +08:00
|
|
|
if [ "$VENDOR" != "$REST" ]; then
|
2014-03-04 01:25:28 +08:00
|
|
|
# Use kernel if given, otherwise os
|
|
|
|
OS=${REST%%-*}
|
2010-06-09 23:32:03 +08:00
|
|
|
else
|
|
|
|
# 2 tupple
|
2014-03-02 16:36:19 +08:00
|
|
|
OS=$VENDOR
|
|
|
|
VENDOR=
|
2010-06-09 23:32:03 +08:00
|
|
|
fi
|
|
|
|
fi
|
2014-03-03 23:48:07 +08:00
|
|
|
|
|
|
|
# Work with cpu-kernel-os, ie Debian
|
2014-03-04 01:25:28 +08:00
|
|
|
case "$VENDOR" in
|
2014-03-07 03:11:55 +08:00
|
|
|
linux*|kfreebsd*) OS=$VENDOR; VENDOR= ;;
|
2014-03-04 01:25:28 +08:00
|
|
|
esac
|
|
|
|
# Special case
|
|
|
|
case "$OS" in
|
2014-03-07 03:11:55 +08:00
|
|
|
gnu*) OS=hurd;; # No HURD support as yet
|
2014-03-04 01:25:28 +08:00
|
|
|
esac
|
2009-07-27 03:29:37 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Configuring dhcpcd for ... $OS"
|
|
|
|
rm -f $CONFIG_H $CONFIG_MK
|
|
|
|
echo "# $OS" >$CONFIG_MK
|
|
|
|
echo "/* $OS */" >$CONFIG_H
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2013-09-12 23:43:20 +08:00
|
|
|
for x in SYSCONFDIR SBINDIR LIBDIR LIBEXECDIR DBDIR RUNDIR; do
|
2009-10-03 03:08:59 +08:00
|
|
|
eval v=\$$x
|
2009-07-15 17:36:43 +08:00
|
|
|
# Make files look nice for import
|
|
|
|
l=$((10 - ${#x}))
|
2009-10-03 03:08:59 +08:00
|
|
|
unset t
|
|
|
|
[ $l -gt 3 ] && t=" "
|
2009-07-15 17:36:43 +08:00
|
|
|
echo "$x=$t $v" >>$CONFIG_MK
|
2009-10-03 03:08:59 +08:00
|
|
|
unset t
|
|
|
|
[ $l -gt 2 ] && t=" "
|
2009-07-15 17:36:43 +08:00
|
|
|
echo "#define $x$t \"$v\"" >>$CONFIG_H
|
2009-07-14 21:59:30 +08:00
|
|
|
done
|
2009-07-27 03:29:37 +08:00
|
|
|
echo "LIBDIR= $LIBDIR" >>$CONFIG_MK
|
2009-07-15 17:36:43 +08:00
|
|
|
echo "MANDIR= $MANDIR" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2014-03-24 19:07:19 +08:00
|
|
|
# Always obey CC.
|
|
|
|
# However, if CC is not specified and we are given GNU style
|
|
|
|
# --host or --build targets the expectation is we try and match that
|
|
|
|
# to a compiler.
|
|
|
|
if [ -n "$CC" ]; then
|
2014-03-25 02:40:45 +08:00
|
|
|
HOSTCC=
|
2014-03-24 19:07:19 +08:00
|
|
|
else
|
|
|
|
CC=cc
|
|
|
|
_COMPILERS="cc clang gcc pcc icc"
|
|
|
|
fi
|
2014-03-25 02:40:45 +08:00
|
|
|
if [ -n "$HOSTCC" ]; then
|
2014-03-24 19:07:19 +08:00
|
|
|
for _CC in $_COMPILERS; do
|
2014-03-25 02:40:45 +08:00
|
|
|
_CC=$(_which "$HOSTCC$_CC")
|
2014-03-24 19:07:19 +08:00
|
|
|
if [ -x "$_CC" ]; then
|
|
|
|
CC=$_CC
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2014-03-13 08:42:16 +08:00
|
|
|
if ! type "$CC" >/dev/null 2>&1; then
|
2014-03-24 19:07:19 +08:00
|
|
|
for _CC in $_COMPILERS; do
|
2014-03-13 08:42:16 +08:00
|
|
|
_CC=$(_which "$_CC")
|
|
|
|
if [ -x "$_CC" ]; then
|
|
|
|
CC=$_CC
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Using compiler .. $CC"
|
2014-06-30 17:44:07 +08:00
|
|
|
cat <<EOF >_test.c
|
|
|
|
int main(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
_CC=false
|
|
|
|
if $CC _test.c -o _test >/dev/null 2>&1; then
|
|
|
|
[ -x _test ] && _CC=true
|
|
|
|
fi
|
|
|
|
rm -f _test.c _test
|
|
|
|
if ! $_CC; then
|
2014-06-21 23:46:31 +08:00
|
|
|
echo "$CC does not create executables"
|
2014-03-13 08:42:16 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
[ "$CC" != cc ] && echo "CC= $CC" >>$CONFIG_MK
|
2012-01-24 19:26:20 +08:00
|
|
|
$CC --version | $SED -e '1!d'
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2013-11-10 19:17:40 +08:00
|
|
|
# Set to blank, then append user config
|
|
|
|
# We do this so our SED call to append to XCC remains portable
|
2009-07-14 21:59:30 +08:00
|
|
|
if [ -n "$CFLAGS" ]; then
|
2013-11-28 05:14:19 +08:00
|
|
|
echo "CFLAGS=" >>$CONFIG_MK
|
2013-11-10 19:17:40 +08:00
|
|
|
echo "CFLAGS+= $CFLAGS" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
fi
|
2013-06-25 17:04:10 +08:00
|
|
|
if [ -n "$CPPFLAGS" ]; then
|
2013-11-28 05:14:19 +08:00
|
|
|
echo "CPPFLAGS=" >>$CONFIG_MK
|
2013-11-10 19:17:40 +08:00
|
|
|
echo "CPPFLAGS+= $CPPFLAGS" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
fi
|
2012-07-06 00:37:41 +08:00
|
|
|
if [ -n "$LDFLAGS" ]; then
|
2013-11-28 05:14:19 +08:00
|
|
|
echo "LDFLAGS=" >>$CONFIG_MK
|
2013-11-10 19:17:40 +08:00
|
|
|
echo "LDFLAGS+= $LDFLAGS" >>$CONFIG_MK
|
2012-07-06 00:37:41 +08:00
|
|
|
fi
|
2013-11-10 19:17:40 +08:00
|
|
|
|
2014-03-26 19:16:02 +08:00
|
|
|
# NetBSD: Even if we build for $PREFIX, the clueless user might move us to /
|
|
|
|
LDELF=/libexec/ld.elf_so
|
|
|
|
if [ -e "$LDELF" ]; then
|
|
|
|
echo "Linking against $LDELF"
|
|
|
|
echo "LDFLAGS+= -Wl,-dynamic-linker=$LDELF" >>$CONFIG_MK
|
|
|
|
echo "LDFLAGS+= -Wl,-rpath=${LIBDIR}" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2014-06-06 01:42:21 +08:00
|
|
|
if [ -z "$PREFIX" -o "$PREFIX" = / ]; then
|
|
|
|
ALLOW_USR_LIBS=false
|
|
|
|
else
|
|
|
|
ALLOW_USR_LIBS=true
|
|
|
|
fi
|
2014-03-08 00:03:52 +08:00
|
|
|
case "$OS" in
|
2014-05-22 07:07:52 +08:00
|
|
|
linux*|sunos*) ;;
|
2014-03-26 19:16:02 +08:00
|
|
|
*)
|
|
|
|
if ! [ -x "$LDELF" -o -x /libexec/ld-elf.so.[0-9]* ] && \
|
|
|
|
[ -z "$PREFIX" -o "$PREFIX" = "/" ]
|
|
|
|
then
|
|
|
|
echo "Forcing a static build for $OS and \$PREFIX of /"
|
2014-03-08 00:03:52 +08:00
|
|
|
STATIC=yes
|
2014-06-06 01:42:21 +08:00
|
|
|
ALLOW_USR_LIBS=true
|
2014-03-08 00:03:52 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2012-07-06 00:37:41 +08:00
|
|
|
if [ "$STATIC" = yes ]; then
|
|
|
|
echo "LDFLAGS+= -static" >>$CONFIG_MK
|
|
|
|
fi
|
2010-06-09 23:32:03 +08:00
|
|
|
for x in $INCLUDEDIR; do
|
|
|
|
echo "CPPFLAGS+= -I$x" >>$CONFIG_MK
|
|
|
|
done
|
2009-07-14 21:59:30 +08:00
|
|
|
|
2014-02-04 22:39:26 +08:00
|
|
|
if [ -z "$DEBUG" -a -f .fslckout ]; then
|
2014-01-04 01:16:12 +08:00
|
|
|
printf "Found fossil checkout ... "
|
2009-09-05 07:27:53 +08:00
|
|
|
DEBUG=yes
|
2009-08-06 04:36:31 +08:00
|
|
|
else
|
|
|
|
DEBUG=no
|
2009-07-15 05:01:59 +08:00
|
|
|
fi
|
2009-08-06 04:36:31 +08:00
|
|
|
if [ "$DEBUG" != no -a "$DEBUG" != false ]; then
|
2009-07-14 21:59:30 +08:00
|
|
|
echo "Adding debugging CFLAGS"
|
|
|
|
cat <<EOF >>$CONFIG_MK
|
2014-03-04 21:12:07 +08:00
|
|
|
CFLAGS+= -g -Wall -Wextra -Wshadow -Wformat=2
|
2009-07-14 21:59:30 +08:00
|
|
|
CFLAGS+= -Wmissing-prototypes -Wmissing-declarations
|
|
|
|
CFLAGS+= -Wmissing-noreturn -Wmissing-format-attribute
|
2014-03-06 02:11:22 +08:00
|
|
|
CFLAGS+= -Wnested-externs
|
2009-07-14 21:59:30 +08:00
|
|
|
CFLAGS+= -Winline -Wwrite-strings -Wcast-align -Wcast-qual
|
2014-05-22 07:07:52 +08:00
|
|
|
CFLAGS+= -Wpointer-arith
|
2014-03-04 21:12:07 +08:00
|
|
|
CFLAGS+= -Wdeclaration-after-statement
|
2014-03-28 06:14:52 +08:00
|
|
|
CFLAGS+= -Wconversion
|
2009-07-14 21:59:30 +08:00
|
|
|
EOF
|
2014-03-06 02:11:22 +08:00
|
|
|
case "$OS" in
|
2014-03-28 06:14:52 +08:00
|
|
|
mirbsd*|openbsd*);; # OpenBSD has many redundant decs in system headers
|
2014-03-06 02:11:22 +08:00
|
|
|
*) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK;;
|
|
|
|
esac
|
2014-05-22 07:07:52 +08:00
|
|
|
|
|
|
|
case "$OS" in
|
|
|
|
sunos*);;
|
2014-05-31 06:02:16 +08:00
|
|
|
*) echo "CFLAGS+= -Wstrict-overflow" >>$CONFIG_MK;;
|
2014-05-22 07:07:52 +08:00
|
|
|
esac
|
2009-07-14 21:59:30 +08:00
|
|
|
fi
|
|
|
|
|
2013-11-29 19:15:03 +08:00
|
|
|
if [ -z "$EMBEDDED" -o "$EMBEDDED" = yes ]; then
|
2013-12-03 00:42:09 +08:00
|
|
|
echo "dhcpcd-definitions.conf will be embedded in dhcpcd itself"
|
2014-01-25 09:35:53 +08:00
|
|
|
echo "DHCPCD_SRCS+= dhcpcd-embedded.c" >>$CONFIG_MK
|
2013-11-29 19:15:03 +08:00
|
|
|
else
|
2013-12-03 00:42:09 +08:00
|
|
|
echo "dhcpcd-definitions.conf will be installed to $LIBEXECDIR"
|
|
|
|
echo "CFLAGS+= -DEMBEDDED_CONFIG=\\\"$LIBEXECDIR/dhcpcd-definitions.conf\\\"" >>$CONFIG_MK
|
2013-11-29 19:15:03 +08:00
|
|
|
echo "EMBEDDEDINSTALL= _embeddedinstall" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2009-07-14 21:59:30 +08:00
|
|
|
if [ -n "$FORK" -a "$FORK" != yes -a "$FORK" != true ]; then
|
|
|
|
echo "There is no fork"
|
|
|
|
echo "CPPFLAGS+= -DTHERE_IS_NO_FORK" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2009-07-27 03:29:37 +08:00
|
|
|
case "$OS" in
|
2014-03-07 03:11:55 +08:00
|
|
|
linux*)
|
2012-11-11 20:19:19 +08:00
|
|
|
echo "CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700" >>$CONFIG_MK
|
2014-09-10 09:46:58 +08:00
|
|
|
echo "DHCPCD_SRCS+= if-linux.c" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
;;
|
2014-03-07 03:11:55 +08:00
|
|
|
kfreebsd*)
|
2010-10-27 22:17:21 +08:00
|
|
|
echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK
|
2014-04-24 04:09:20 +08:00
|
|
|
echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK
|
2013-06-19 17:17:15 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/linkaddr.c" >>$CONFIG_MK
|
2010-10-20 19:27:32 +08:00
|
|
|
;;
|
2014-05-22 07:07:52 +08:00
|
|
|
sunos*)
|
2014-05-24 21:08:29 +08:00
|
|
|
echo "WARNING!!! Solaris support is at early development stage!" >&2
|
|
|
|
echo "so don't expect it to work just yet, patches welcome" >&2
|
2014-05-22 07:07:52 +08:00
|
|
|
echo "CPPFLAGS+= -D_XPG4_2 -D__EXTENSIONS__ -DBSD_COMP" \
|
|
|
|
>>$CONFIG_MK
|
2014-05-24 21:08:29 +08:00
|
|
|
echo "DHCPCD_SRCS+= if-sun.c" >>$CONFIG_MK
|
|
|
|
|
|
|
|
# IPv6 won't work, but it will at least compile.
|
|
|
|
echo "CPPFLAGS+= -DIN6_IFF_DETACHED=0" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS+= -DIN6_IFF_TENTATIVE=0" >>$CONFIG_MK
|
|
|
|
echo "CPPFLAGS+= -DIN6_IFF_DUPLICATED=0" >>$CONFIG_MK
|
2014-05-22 07:07:52 +08:00
|
|
|
;;
|
2009-07-14 21:59:30 +08:00
|
|
|
*)
|
2014-04-24 04:09:20 +08:00
|
|
|
echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-02-04 21:30:35 +08:00
|
|
|
if [ -z "$INET" -o "$INET" = yes ]; then
|
|
|
|
echo "CPPFLAGS+= -DINET" >>$CONFIG_MK
|
2014-01-25 09:35:53 +08:00
|
|
|
echo "DHCPCD_SRCS+= arp.c dhcp.c ipv4.c ipv4ll.c" >>$CONFIG_MK
|
2013-02-04 21:30:35 +08:00
|
|
|
fi
|
|
|
|
if [ -z "$INET6" -o "$INET6" = yes ]; then
|
|
|
|
echo "CPPFLAGS+= -DINET6" >>$CONFIG_MK
|
2014-01-25 09:35:53 +08:00
|
|
|
echo "DHCPCD_SRCS+= ipv6.c ipv6nd.c dhcp6.c" >>$CONFIG_MK
|
2013-02-04 21:30:35 +08:00
|
|
|
fi
|
|
|
|
|
2009-09-03 18:10:51 +08:00
|
|
|
# Add CPPFLAGS and CFLAGS to CC for testing features
|
2013-11-10 18:32:01 +08:00
|
|
|
XCC="$CC `$SED -n -e 's/CPPFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
2009-09-03 18:10:51 +08:00
|
|
|
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
|
|
|
|
2014-09-10 10:22:18 +08:00
|
|
|
if [ "$OS" = linux ]; then
|
|
|
|
printf "Testing for nl80211 ... "
|
|
|
|
cat <<EOF >_nl80211.c
|
2014-09-10 16:40:06 +08:00
|
|
|
#include <linux/nl80211.h>
|
2014-09-10 10:22:18 +08:00
|
|
|
int main(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _nl80211.c -o _nl80211 2>/dev/null; then
|
|
|
|
echo "yes"
|
|
|
|
echo "#define HAVE_NL80211_H" >>$CONFIG_H
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo "DHCPCD_SRCS+= if-linux-wext.c" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
rm -f _nl80211.c _nl80211
|
|
|
|
fi
|
|
|
|
|
2009-07-22 04:07:13 +08:00
|
|
|
abort=false
|
2009-07-18 19:31:56 +08:00
|
|
|
# We require the libc to support non standard functions, like getifaddrs
|
2009-07-27 05:56:43 +08:00
|
|
|
printf "Testing for getifaddrs ... "
|
2009-07-18 19:31:56 +08:00
|
|
|
cat <<EOF >_getifaddrs.c
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <ifaddrs.h>
|
|
|
|
int main(void) {
|
|
|
|
struct ifaddrs *ifap;
|
|
|
|
return getifaddrs(&ifap);
|
|
|
|
}
|
|
|
|
EOF
|
2009-09-03 18:10:51 +08:00
|
|
|
if $XCC _getifaddrs.c -o _getifaddrs 2>/dev/null; then
|
2009-07-18 19:31:56 +08:00
|
|
|
echo "yes"
|
2014-07-05 23:40:01 +08:00
|
|
|
elif $XCC _getifaddrs.c -o _getifaddrs -lsocket 2>/dev/null; then
|
2014-05-22 07:07:52 +08:00
|
|
|
echo "yes (-lsocket)"
|
|
|
|
echo "LDADD+= -lsocket" >>$CONFIG_MK
|
2009-07-18 19:31:56 +08:00
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo "libc support for getifaddrs is required - aborting" >&2
|
2009-07-22 04:07:13 +08:00
|
|
|
abort=true
|
2009-07-18 19:31:56 +08:00
|
|
|
fi
|
2009-07-22 04:07:13 +08:00
|
|
|
rm -f _getifaddrs.c _getifaddrs
|
|
|
|
$abort && exit 1
|
2009-07-18 19:31:56 +08:00
|
|
|
|
2014-03-23 21:38:09 +08:00
|
|
|
printf "Testing for clock_gettime ... "
|
|
|
|
cat <<EOF >_clock_gettime.c
|
|
|
|
#include <time.h>
|
|
|
|
int main(void) {
|
|
|
|
struct timespec ts;
|
|
|
|
return clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _clock_gettime.c -o _clock_gettime 2>/dev/null; then
|
|
|
|
echo "yes"
|
|
|
|
elif $XCC _clock_gettime.c -lrt -o _clock_gettime 2>/dev/null; then
|
|
|
|
echo "yes (-lrt)"
|
|
|
|
echo "LDADD+= -lrt" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo "libc support for clock_getttime is required - aborting" >&2
|
|
|
|
abort=true
|
|
|
|
fi
|
2014-03-24 19:07:19 +08:00
|
|
|
rm -f _clock_gettime.c _clock_gettime
|
2014-03-23 21:38:09 +08:00
|
|
|
$abort && exit 1
|
|
|
|
|
2014-05-22 07:07:52 +08:00
|
|
|
printf "Testing for inet_ntoa ... "
|
|
|
|
cat <<EOF >_inet_ntoa.c
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
int main(void) {
|
|
|
|
struct in_addr in;
|
|
|
|
inet_ntoa(in);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _inet_ntoa.c -o _inet_ntoa 2>/dev/null; then
|
|
|
|
echo "yes"
|
|
|
|
elif $XCC _inet_ntoa.c -lnsl -o _inet_ntoa 2>/dev/null; then
|
|
|
|
echo "yes (-lnsl)"
|
|
|
|
echo "LDADD+= -lnsl" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo "libc support for inet_ntoa is required - aborting" >&2
|
|
|
|
abort=true
|
|
|
|
fi
|
|
|
|
rm -f _inet_ntoa.c _inet_ntoa
|
|
|
|
$abort && exit 1
|
|
|
|
|
2009-11-20 20:20:10 +08:00
|
|
|
if [ -z "$ARC4RANDOM" ]; then
|
|
|
|
printf "Testing for arc4random ... "
|
|
|
|
cat <<EOF >_arc4random.c
|
2009-07-14 21:59:30 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
2012-02-04 22:25:11 +08:00
|
|
|
arc4random();
|
2009-07-14 21:59:30 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2009-11-20 20:20:10 +08:00
|
|
|
if $XCC _arc4random.c -o _arc4random 2>/dev/null; then
|
|
|
|
ARC4RANDOM=yes
|
|
|
|
else
|
|
|
|
ARC4RANDOM=no
|
|
|
|
fi
|
|
|
|
echo "$ARC4RANDOM"
|
|
|
|
rm -f _arc4random.c _arc4random
|
|
|
|
fi
|
|
|
|
if [ "$ARC4RANDOM" = no ]; then
|
2009-10-09 04:21:23 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/arc4random.c" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
echo "#include \"compat/arc4random.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2014-09-08 01:24:07 +08:00
|
|
|
if [ -z "$ARC4RANDOM_UNIFORM" ]; then
|
|
|
|
printf "Testing for arc4random_uniform ... "
|
|
|
|
cat <<EOF >_arc4random_uniform.c
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
arc4random_uniform(100);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _arc4random_uniform.c -o _arc4random_uniform 2>/dev/null; then
|
|
|
|
ARC4RANDOM_UNIFORM=yes
|
|
|
|
else
|
|
|
|
ARC4RANDOM_UNIFORM=no
|
|
|
|
fi
|
|
|
|
echo "$ARC4RANDOM"
|
2014-09-10 10:22:18 +08:00
|
|
|
rm -f _arc4random_uniform.c _arc4random_uniform
|
2014-09-08 01:24:07 +08:00
|
|
|
fi
|
|
|
|
if [ "$ARC4RANDOM_UNIFORM" = no ]; then
|
|
|
|
echo "COMPAT_SRCS+= compat/arc4random_uniform.c" >>$CONFIG_MK
|
|
|
|
echo "#include \"compat/arc4random_uniform.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2009-11-20 20:20:10 +08:00
|
|
|
if [ -z "$CLOSEFROM" ]; then
|
|
|
|
printf "Testing for closefrom ... "
|
|
|
|
cat <<EOF >_closefrom.c
|
2009-07-14 21:59:30 +08:00
|
|
|
#include <unistd.h>
|
|
|
|
int main(void) {
|
2010-04-13 20:10:16 +08:00
|
|
|
closefrom(3);
|
2009-07-14 21:59:30 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2009-11-20 20:20:10 +08:00
|
|
|
if $XCC _closefrom.c -o _closefrom 2>/dev/null; then
|
|
|
|
CLOSEFROM=yes
|
|
|
|
else
|
|
|
|
CLOSEFROM=no
|
|
|
|
fi
|
|
|
|
echo "$CLOSEFROM"
|
|
|
|
rm -f _closefrom.c _closefrom
|
|
|
|
fi
|
|
|
|
if [ "$CLOSEFROM" = no ]; then
|
2009-10-09 04:21:23 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/closefrom.c" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
echo "#include \"compat/closefrom.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2009-11-20 20:20:10 +08:00
|
|
|
if [ -z "$GETLINE" ]; then
|
|
|
|
printf "Testing for getline ... "
|
|
|
|
cat <<EOF >_getline.c
|
2009-07-14 21:59:30 +08:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
|
|
char *buf = NULL;
|
|
|
|
size_t n = 0;
|
|
|
|
getline(&buf, &n, stdin);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2009-11-20 20:20:10 +08:00
|
|
|
if $XCC _getline.c -o _getline 2>/dev/null; then
|
|
|
|
GETLINE=yes
|
|
|
|
else
|
|
|
|
GETLINE=no
|
|
|
|
fi
|
|
|
|
echo "$GETLINE"
|
|
|
|
rm -f _getline.c _getline
|
|
|
|
fi
|
|
|
|
if [ "$GETLINE" = no ]; then
|
2009-10-09 04:21:23 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/getline.c" >>$CONFIG_MK
|
2009-07-14 21:59:30 +08:00
|
|
|
echo "#include \"compat/getline.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2009-11-20 20:20:10 +08:00
|
|
|
if [ -z "$STRLCPY" ]; then
|
|
|
|
printf "Testing for strlcpy ... "
|
|
|
|
cat <<EOF >_strlcpy.c
|
2009-07-14 21:59:30 +08:00
|
|
|
#include <string.h>
|
|
|
|
int main(void) {
|
|
|
|
const char s1[] = "foo";
|
|
|
|
char s2[10];
|
|
|
|
strlcpy(s2, s1, sizeof(s2));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2009-11-20 20:20:10 +08:00
|
|
|
if $XCC _strlcpy.c -o _strlcpy 2>/dev/null; then
|
|
|
|
STRLCPY=yes
|
|
|
|
else
|
|
|
|
STRLCPY=no
|
|
|
|
fi
|
|
|
|
echo "$STRLCPY"
|
|
|
|
rm -f _strlcpy.c _strlcpy
|
|
|
|
fi
|
|
|
|
if [ "$STRLCPY" = no ]; then
|
2009-10-09 04:21:23 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/strlcpy.c" >>$CONFIG_MK
|
2014-04-23 17:43:30 +08:00
|
|
|
echo "#include \"compat/strlcpy.h\"" >>$CONFIG_H
|
2009-07-14 21:59:30 +08:00
|
|
|
fi
|
2009-07-15 05:01:59 +08:00
|
|
|
|
2014-05-22 07:07:52 +08:00
|
|
|
if [ -z "$DPRINTF" ]; then
|
|
|
|
printf "Testing for dprintf ... "
|
|
|
|
cat <<EOF >_dprintf.c
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
|
|
return dprintf(0, "%d", 0);
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _dprintf.c -o _dprintf 2>/dev/null; then
|
|
|
|
DPRINTF=yes
|
|
|
|
else
|
|
|
|
DPRINTF=no
|
|
|
|
fi
|
|
|
|
echo "$DPRINTF"
|
|
|
|
rm -f _dprintf.c _dprintf
|
|
|
|
fi
|
|
|
|
if [ "$DPRINTF" = no ]; then
|
|
|
|
echo "COMPAT_SRCS+= compat/dprintf.c" >>$CONFIG_MK
|
|
|
|
echo "#include \"compat/dprintf.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2012-07-06 00:37:41 +08:00
|
|
|
if [ -z "$TAILQ_FOREACH_SAFE" ]; then
|
|
|
|
printf "Testing for TAILQ_FOREACH_SAFE ... "
|
|
|
|
cat <<EOF >_queue.c
|
|
|
|
#include <sys/queue.h>
|
|
|
|
int main(void) {
|
|
|
|
#ifndef TAILQ_FOREACH_SAFE
|
|
|
|
#error TAILQ_FOREACH_SAFE
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _queue.c -o _queue 2>/dev/null; then
|
|
|
|
TAILQ_FOREACH_SAFE=yes
|
|
|
|
else
|
|
|
|
TAILQ_FOREACH_SAFE=no
|
|
|
|
fi
|
|
|
|
echo "$TAILQ_FOREACH_SAFE"
|
|
|
|
rm -f _queue.c _queue
|
|
|
|
fi
|
2014-03-06 02:11:22 +08:00
|
|
|
if [ -z "$TAILQ_CONCAT" ]; then
|
|
|
|
printf "Testing for TAILQ_CONCAT ..."
|
|
|
|
cat <<EOF >_queue.c
|
|
|
|
#include <sys/queue.h>
|
|
|
|
int main(void) {
|
|
|
|
#ifndef TAILQ_CONCAT
|
|
|
|
#error TAILQ_CONCAT
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _queue.c -o _queue 2>/dev/null; then
|
|
|
|
TAILQ_CONCAT=yes
|
|
|
|
else
|
|
|
|
TAILQ_CONCAT=no
|
|
|
|
fi
|
|
|
|
echo "$TAILQ_CONCAT"
|
|
|
|
rm -f _queue.c _queue
|
|
|
|
fi
|
2014-04-23 17:34:42 +08:00
|
|
|
if [ "$TAILQ_FOREACH_SAFE" = no -o "$TAILQ_CONCAT" = no ]; then
|
|
|
|
echo "#include \"compat/queue.h\"">>$CONFIG_H
|
2014-03-06 02:11:22 +08:00
|
|
|
fi
|
|
|
|
|
2012-11-11 00:38:52 +08:00
|
|
|
if [ -z "$POSIX_SPAWN" ]; then
|
|
|
|
printf "Testing for posix_spawn ... "
|
|
|
|
cat <<EOF >_posix_spawn.c
|
|
|
|
#include <spawn.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
posix_spawn(NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _posix_spawn.c -o _posix_spawn 2>/dev/null; then
|
2014-03-06 02:11:22 +08:00
|
|
|
case "$OS" in
|
2014-03-07 03:11:55 +08:00
|
|
|
openbsd*) printf "broken OpenBSD ... "; POSIX_SPAWN=no;;
|
2014-03-06 02:11:22 +08:00
|
|
|
*) POSIX_SPAWN=yes;;
|
|
|
|
esac
|
2012-11-11 00:38:52 +08:00
|
|
|
else
|
|
|
|
POSIX_SPAWN=no
|
|
|
|
fi
|
|
|
|
echo "$POSIX_SPAWN"
|
|
|
|
rm -f _posix_spawn.c _posix_spawn
|
|
|
|
fi
|
|
|
|
if [ "$POSIX_SPAWN" = no ]; then
|
|
|
|
echo "COMPAT_SRCS+= compat/posix_spawn.c" >>$CONFIG_MK
|
|
|
|
else
|
2014-04-23 17:43:30 +08:00
|
|
|
echo "#define HAVE_SPAWN_H" >>$CONFIG_H
|
2012-11-11 00:38:52 +08:00
|
|
|
fi
|
|
|
|
|
2013-02-19 05:25:07 +08:00
|
|
|
if [ -z "$POLLTS" ]; then
|
|
|
|
printf "Testing for pollts ... "
|
|
|
|
cat <<EOF >_pollts.c
|
2013-02-19 04:56:55 +08:00
|
|
|
#include <poll.h>
|
2013-02-19 05:25:07 +08:00
|
|
|
#include <signal.h>
|
2013-02-19 04:56:55 +08:00
|
|
|
#include <stdlib.h>
|
2013-02-19 05:25:07 +08:00
|
|
|
#include <time.h>
|
2013-02-19 04:56:55 +08:00
|
|
|
int main(void) {
|
2013-02-19 05:25:07 +08:00
|
|
|
pollts(NULL, 0, NULL, NULL);
|
2013-02-19 04:56:55 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2013-02-19 05:25:07 +08:00
|
|
|
if $XCC _pollts.c -o _pollts 2>/dev/null; then
|
|
|
|
POLLTS=yes
|
2013-02-19 04:56:55 +08:00
|
|
|
else
|
2013-02-19 05:25:07 +08:00
|
|
|
POLLTS=no
|
2013-02-19 04:56:55 +08:00
|
|
|
fi
|
2013-02-19 05:25:07 +08:00
|
|
|
echo "$POLLTS"
|
|
|
|
rm -f _pollts.c _pollts
|
2013-02-19 04:56:55 +08:00
|
|
|
fi
|
2013-02-19 05:25:07 +08:00
|
|
|
if [ "$POLLTS" = no ]; then
|
|
|
|
printf "Testing for ppoll ... "
|
|
|
|
cat <<EOF >_ppoll.c
|
2013-02-19 04:56:55 +08:00
|
|
|
#include <poll.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
2013-02-19 05:25:07 +08:00
|
|
|
ppoll(NULL, 0, NULL, NULL);
|
2013-02-19 04:56:55 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2013-02-19 05:25:07 +08:00
|
|
|
if $XCC _ppoll.c -o _ppoll 2>/dev/null; then
|
|
|
|
POLLTS=ppoll
|
2013-02-19 04:56:55 +08:00
|
|
|
echo "yes"
|
|
|
|
else
|
2013-02-19 05:25:07 +08:00
|
|
|
POLLTS=no
|
2013-02-19 04:56:55 +08:00
|
|
|
echo "no"
|
|
|
|
fi
|
2013-02-19 05:25:07 +08:00
|
|
|
rm -f _ppoll.c _ppoll
|
2013-02-19 04:56:55 +08:00
|
|
|
fi
|
2013-02-19 05:25:07 +08:00
|
|
|
if [ "$POLLTS" = no ]; then
|
2012-11-11 00:38:53 +08:00
|
|
|
printf "Testing for pselect ... "
|
|
|
|
cat <<EOF >_pselect.c
|
|
|
|
#include <sys/select.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
pselect(0, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _pselect.c -o _pselect 2>/dev/null; then
|
2013-02-19 05:25:07 +08:00
|
|
|
POLLTS=pselect
|
2013-02-19 04:56:55 +08:00
|
|
|
echo "yes"
|
2012-11-11 00:38:53 +08:00
|
|
|
else
|
2013-02-19 05:25:07 +08:00
|
|
|
POLLTS=no
|
2013-02-19 04:56:55 +08:00
|
|
|
echo "no"
|
2012-11-11 00:38:53 +08:00
|
|
|
fi
|
|
|
|
rm -f _pselect.c _pselect
|
|
|
|
fi
|
2013-02-19 05:25:07 +08:00
|
|
|
case "$POLLTS" in
|
|
|
|
yes)
|
|
|
|
;;
|
|
|
|
ppoll)
|
2014-06-05 21:53:20 +08:00
|
|
|
echo "#define pollts ppoll" >>$CONFIG_H
|
2013-02-19 04:56:55 +08:00
|
|
|
;;
|
|
|
|
pselect)
|
2012-11-11 00:38:53 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/pselect.c" >>$CONFIG_MK
|
2014-04-23 17:43:30 +08:00
|
|
|
echo "#include \"compat/pollts.h\"" >>$CONFIG_H
|
2013-02-19 04:56:55 +08:00
|
|
|
;;
|
|
|
|
*)
|
2013-02-19 05:35:24 +08:00
|
|
|
echo "COMPAT_SRCS+= compat/pollts.c" >>$CONFIG_MK
|
2014-04-23 17:43:30 +08:00
|
|
|
echo "#include \"compat/pollts.h\"" >>$CONFIG_H
|
2013-02-19 04:56:55 +08:00
|
|
|
;;
|
|
|
|
esac
|
2012-11-11 00:38:53 +08:00
|
|
|
|
2014-05-24 21:08:29 +08:00
|
|
|
if [ -z "$LOG_PERROR" ]; then
|
|
|
|
printf "Testing for LOG_PERROR ... "
|
|
|
|
cat <<EOF >_log_perror.c
|
|
|
|
#include <syslog.h>
|
|
|
|
int main(void) {
|
|
|
|
openlog("test", LOG_PERROR, LOG_DAEMON);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _log_perror.c -o _log_perror 2>/dev/null; then
|
|
|
|
LOG_PERROR=yes
|
|
|
|
else
|
|
|
|
LOG_PERROR=no
|
|
|
|
fi
|
|
|
|
echo "$LOG_PERROR"
|
|
|
|
rm -f _log_perror.c _log_perror
|
|
|
|
fi
|
|
|
|
if [ "$LOG_PERROR" = no ]; then
|
|
|
|
echo "COMPAT_SRCS+= compat/psyslog.c" >>$CONFIG_MK
|
|
|
|
echo "#include \"compat/psyslog.h\"" >>$CONFIG_H
|
|
|
|
echo "#define syslog psyslog" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2014-06-05 21:53:20 +08:00
|
|
|
if [ -z "$BE64ENC" ]; then
|
|
|
|
printf "Testing for be64enc ... "
|
|
|
|
cat <<EOF >_be64enc.c
|
|
|
|
#include <sys/endian.h>
|
2014-06-05 21:56:16 +08:00
|
|
|
#include <stdlib.h>
|
2014-06-05 21:53:20 +08:00
|
|
|
int main(void) {
|
|
|
|
be64enc(NULL, 0);
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _be64enc.c -o _be64enc 2>/dev/null; then
|
|
|
|
BE64ENC=yes
|
|
|
|
else
|
|
|
|
BE64ENC=no
|
|
|
|
fi
|
|
|
|
echo "$BE64ENC"
|
2014-06-05 22:21:27 +08:00
|
|
|
rm -f _be64enc.c _be64enc
|
2014-06-05 21:53:20 +08:00
|
|
|
fi
|
2014-06-05 21:54:38 +08:00
|
|
|
if [ "$BE64ENC" = no ]; then
|
2014-06-05 21:53:20 +08:00
|
|
|
echo "#include \"compat/endian.h\"" >>$CONFIG_H
|
|
|
|
fi
|
|
|
|
|
2014-01-25 09:35:53 +08:00
|
|
|
if [ -z "$MD5" ]; then
|
2014-02-03 21:09:13 +08:00
|
|
|
MD5_LIB=
|
2014-01-25 09:35:53 +08:00
|
|
|
printf "Testing for MD5Init ... "
|
|
|
|
cat <<EOF >_md5.c
|
2014-02-03 21:09:13 +08:00
|
|
|
#include <sys/types.h>
|
2014-01-25 09:35:53 +08:00
|
|
|
#include <md5.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
MD5_CTX context;
|
|
|
|
MD5Init(&context);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2014-02-03 21:24:04 +08:00
|
|
|
# We only want to link to libmd if it exists in /lib
|
2014-06-06 01:42:21 +08:00
|
|
|
if $ALLOW_USR_LIBS; then
|
|
|
|
set -- /
|
|
|
|
else
|
|
|
|
set -- $(ls /lib/libmd.so.* 2>/dev/null)
|
|
|
|
fi
|
2014-01-25 09:35:53 +08:00
|
|
|
if $XCC _md5.c -o _md5 2>/dev/null; then
|
|
|
|
MD5=yes
|
2014-02-03 21:24:04 +08:00
|
|
|
elif [ -e "$1" ] && $XCC _md5.c -lmd -o _md5 2>/dev/null; then
|
2014-02-03 21:09:13 +08:00
|
|
|
MD5="yes (-lmd)"
|
|
|
|
MD5_LIB=-lmd
|
2014-01-25 09:35:53 +08:00
|
|
|
else
|
|
|
|
MD5=no
|
|
|
|
fi
|
|
|
|
echo "$MD5"
|
|
|
|
rm -f _md5.c _md5
|
|
|
|
fi
|
|
|
|
if [ "$MD5" = no ]; then
|
2014-07-30 17:46:33 +08:00
|
|
|
echo "MD5_SRC= crypt/md5.c" >>$CONFIG_MK
|
2014-01-25 09:35:53 +08:00
|
|
|
else
|
|
|
|
echo "MD5_SRC=" >>$CONFIG_MK
|
2014-03-20 00:51:57 +08:00
|
|
|
echo "#define HAVE_MD5_H" >>$CONFIG_H
|
2014-03-04 21:12:07 +08:00
|
|
|
[ -n "$MD5_LIB" ] && echo "LDADD+= $MD5_LIB" >>$CONFIG_MK
|
2014-01-25 09:35:53 +08:00
|
|
|
fi
|
|
|
|
|
2014-06-02 22:48:33 +08:00
|
|
|
if [ -z "$SHA2_H" -a -z "$SHA2" -o "$SHA2" != no ]; then
|
|
|
|
printf "Testing for sha2.h ... "
|
|
|
|
if [ -e /usr/include/sha2.h ]; then
|
|
|
|
SHA2_H=sha2.h
|
2014-06-02 23:00:24 +08:00
|
|
|
elif [ -e /usr/include/sha256.h ]; then
|
2014-06-02 22:48:33 +08:00
|
|
|
SHA2_H=sha256.h
|
|
|
|
fi
|
|
|
|
if [ -n "$SHA2_H" ]; then
|
|
|
|
echo "$SHA2_H"
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$SHA2" ]; then
|
|
|
|
SHA2_LIB=
|
2014-06-03 00:31:37 +08:00
|
|
|
SHA2_RENAMED=
|
2014-06-02 22:48:33 +08:00
|
|
|
printf "Testing for SHA256_Init ... "
|
|
|
|
cat <<EOF >_sha256.c
|
|
|
|
#include <sys/types.h>
|
|
|
|
EOF
|
|
|
|
[ -n "$SHA2_H" ] && echo "#include <$SHA2_H>">>_sha256.c
|
|
|
|
cat <<EOF >>_sha256.c
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
SHA256_CTX context;
|
|
|
|
SHA256_Init(&context);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
# We only want to link to libmd if it exists in /lib
|
2014-06-06 01:42:21 +08:00
|
|
|
if $ALLOW_USR_LIBS; then
|
|
|
|
set -- /
|
|
|
|
else
|
|
|
|
set -- $(ls /lib/libmd.so.* 2>/dev/null)
|
|
|
|
fi
|
2014-06-02 22:48:33 +08:00
|
|
|
if $XCC _sha256.c -o _sha256 2>/dev/null; then
|
|
|
|
SHA2=yes
|
|
|
|
elif [ -e "$1" ] && $XCC _sha256.c -lmd -o _sha256 2>/dev/null; then
|
|
|
|
SHA2="yes (-lmd)"
|
|
|
|
SHA2_LIB=-lmd
|
|
|
|
else
|
2014-06-02 23:00:24 +08:00
|
|
|
SHA2=no
|
2014-06-02 22:48:33 +08:00
|
|
|
fi
|
|
|
|
echo "$SHA2"
|
|
|
|
rm -f _sha256.c _sha256
|
2014-06-03 00:31:37 +08:00
|
|
|
if [ "$SHA2" = no ]; then
|
|
|
|
# Did OpenBSD really change this? grrrr
|
|
|
|
printf "Testing for SHA256Init ... "
|
|
|
|
cat <<EOF >_sha256.c
|
|
|
|
#include <sys/types.h>
|
|
|
|
EOF
|
|
|
|
[ -n "$SHA2_H" ] && echo "#include <$SHA2_H>">>_sha256.c
|
|
|
|
cat <<EOF >>_sha256.c
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
SHA2_CTX context;
|
|
|
|
SHA256Init(&context);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
# We only want to link to libmd if it exists in /lib
|
2014-06-06 01:42:21 +08:00
|
|
|
if $ALLOW_USR_LIBS; then
|
|
|
|
set -- /
|
|
|
|
else
|
|
|
|
set -- $(ls /lib/libmd.so.* 2>/dev/null)
|
|
|
|
fi
|
2014-06-03 01:10:13 +08:00
|
|
|
if $XCC _sha256.c -o _sha256 2>/dev/null; then
|
2014-06-03 00:31:37 +08:00
|
|
|
SHA2=yes
|
|
|
|
SHA2_RENAMED=yes
|
|
|
|
elif [ -e "$1" ] && $XCC _sha256.c -lmd -o _sha256 2>/dev/null
|
|
|
|
then
|
|
|
|
SHA2="yes (-lmd)"
|
|
|
|
SHA2_LIB=-lmd
|
|
|
|
SHA2_RENAMED=yes
|
|
|
|
else
|
|
|
|
SHA2=no
|
|
|
|
fi
|
|
|
|
echo "$SHA2"
|
|
|
|
rm -f _sha256.c _sha256
|
|
|
|
fi
|
2014-06-02 22:48:33 +08:00
|
|
|
fi
|
|
|
|
if [ "$SHA2" = no ]; then
|
2014-07-30 17:46:33 +08:00
|
|
|
echo "SHA256_SRC= crypt/sha256.c" >>$CONFIG_MK
|
2014-06-02 22:48:33 +08:00
|
|
|
else
|
|
|
|
echo "SHA256_SRC=" >>$CONFIG_MK
|
|
|
|
echo "#define SHA2_H <$SHA2_H>" >>$CONFIG_H
|
2014-06-03 00:31:37 +08:00
|
|
|
if [ "$SHA2_RENAMED" = yes ]; then
|
|
|
|
echo "#define SHA256_CTX SHA2_CTX" >>$CONFIG_H
|
|
|
|
echo "#define SHA256_Init SHA256Init" >>$CONFIG_H
|
|
|
|
echo "#define SHA256_Update SHA256Update" >>$CONFIG_H
|
|
|
|
echo "#define SHA256_Final SHA256Final" >>$CONFIG_H
|
|
|
|
fi
|
2014-06-02 22:48:33 +08:00
|
|
|
[ -n "$SHA2_LIB" ] && echo "LDADD+= $SHA2_LIB" >>$CONFIG_MK
|
|
|
|
fi
|
|
|
|
|
2013-09-12 23:43:20 +08:00
|
|
|
if [ "$DEV" != no -a "$UDEV" != no ]; then
|
2013-09-10 00:14:06 +08:00
|
|
|
printf "Checking for libudev ... "
|
|
|
|
LIBUDEV_CFLAGS=$(pkg-config --cflags libudev 2>/dev/null)
|
|
|
|
LIBUDEV_LIBS=$(pkg-config --libs libudev 2>/dev/null)
|
|
|
|
fi
|
2013-09-12 23:43:20 +08:00
|
|
|
if [ "$DEV" != no -a "$UDEV" != no -a -n "$LIBUDEV_LIBS" ]; then
|
2013-09-13 01:16:51 +08:00
|
|
|
echo "yes"
|
2013-09-13 01:08:34 +08:00
|
|
|
[ -z "$DEV" ] && DEV=yes
|
2013-09-12 23:43:20 +08:00
|
|
|
echo "DEV_PLUGINS+= udev" >>$CONFIG_MK
|
2013-09-10 00:14:06 +08:00
|
|
|
if [ -n "$LIBUDEV_CFLAGS" ]; then
|
2013-09-12 23:43:20 +08:00
|
|
|
echo "LIBUDEV_CFLAGS= $LIBUDEV_CFLAGS" >>$CONFIG_MK
|
2013-09-10 00:14:06 +08:00
|
|
|
fi
|
2013-11-30 02:41:02 +08:00
|
|
|
echo "LIBUDEV_LIBS= $LIBUDEV_LIBS" >>$CONFIG_MK
|
2013-09-10 00:14:06 +08:00
|
|
|
|
2013-09-13 00:46:41 +08:00
|
|
|
printf "Checking udev_monitor_filter_add_match_subsystem_devtype ... "
|
2013-09-10 00:14:06 +08:00
|
|
|
cat <<EOF >_udev.c
|
|
|
|
#include <libudev.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
udev_monitor_filter_add_match_subsystem_devtype(NULL, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
2013-09-10 00:28:05 +08:00
|
|
|
if $XCC $LIBUDEV_CFLAGS _udev.c -o _udev $LIBUDEV_LIBS 2>/dev/null
|
2013-09-10 00:14:06 +08:00
|
|
|
then
|
2013-09-13 00:46:41 +08:00
|
|
|
echo "yes"
|
2013-09-10 00:14:06 +08:00
|
|
|
else
|
2013-09-13 00:46:41 +08:00
|
|
|
echo "LIBUDEV_CPPFLAGS+= -DLIBUDEV_NOFILTER" >>$CONFIG_MK
|
|
|
|
echo "no"
|
2013-09-10 00:14:06 +08:00
|
|
|
fi
|
|
|
|
rm -f _udev.c _udev
|
2013-09-13 05:43:17 +08:00
|
|
|
|
|
|
|
printf "Checking udev_device_get_is_initialized ... "
|
|
|
|
cat <<EOF >_udev.c
|
|
|
|
#include <libudev.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
udev_device_get_is_initialized(NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC $LIBUDEV_CFLAGS _udev.c -o _udev $LIBUDEV_LIBS 2>/dev/null
|
|
|
|
then
|
|
|
|
echo "yes"
|
|
|
|
else
|
|
|
|
echo "LIBUDEV_CPPFLAGS+= -DLIBUDEV_NOINIT" >>$CONFIG_MK
|
|
|
|
echo "no"
|
|
|
|
fi
|
|
|
|
rm -f _udev.c _udev
|
2013-09-12 23:43:20 +08:00
|
|
|
elif [ "$DEV" != no -a "$UDEV" != no ]; then
|
2013-09-10 00:14:06 +08:00
|
|
|
echo "no"
|
|
|
|
fi
|
|
|
|
|
2013-09-12 23:43:20 +08:00
|
|
|
if [ "$DEV" = yes ]; then
|
2014-01-25 09:35:53 +08:00
|
|
|
echo "DHCPCD_SRCS+= dev.c" >>$CONFIG_MK
|
2013-09-12 23:43:20 +08:00
|
|
|
echo "CPPFLAGS+= -DPLUGIN_DEV" >>$CONFIG_MK
|
2013-11-30 02:41:02 +08:00
|
|
|
echo "MKDIRS+= dev" >>$CONFIG_MK
|
2014-03-23 21:38:09 +08:00
|
|
|
|
|
|
|
printf "Testing for dlopen ... "
|
|
|
|
cat <<EOF >_dlopen.c
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
|
|
dlopen(NULL, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
if $XCC _dlopen.c -o _dlopen 2>/dev/null; then
|
|
|
|
echo "yes"
|
|
|
|
elif $XCC _dlopen.c -ldl -o _dlopen 2>/dev/null; then
|
|
|
|
echo "yes (-ldl)"
|
|
|
|
echo "LDADD+= -ldl" >>$CONFIG_MK
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo "libc for dlopen is required - aborting"
|
|
|
|
fi
|
|
|
|
rm -f _dlopen.c _dlopen
|
|
|
|
$abort && exit 1
|
2013-09-12 23:43:20 +08:00
|
|
|
fi
|
|
|
|
|
2010-09-09 22:40:27 +08:00
|
|
|
# Transform for a make file
|
2010-11-04 17:12:14 +08:00
|
|
|
SERVICEEXISTS=$(echo "$SERVICEEXISTS" | $SED \
|
2010-09-09 22:40:27 +08:00
|
|
|
-e 's:\\:\\\\:g' \
|
|
|
|
-e 's:\&:\\\&:g' \
|
2014-01-08 19:34:51 +08:00
|
|
|
-e 's:\$:\\\\\$\$:g' \
|
2010-09-09 22:40:27 +08:00
|
|
|
)
|
|
|
|
echo "SERVICEEXISTS= $SERVICEEXISTS" >>config.mk
|
2010-11-04 17:12:14 +08:00
|
|
|
SERVICECMD=$(echo "$SERVICECMD" | $SED \
|
2010-09-09 22:40:27 +08:00
|
|
|
-e 's:\\:\\\\:g' \
|
|
|
|
-e 's:\&:\\\&:g' \
|
2014-01-08 19:34:51 +08:00
|
|
|
-e 's:\$:\\\\\$\$:g' \
|
2010-09-09 22:40:27 +08:00
|
|
|
)
|
|
|
|
echo "SERVICECMD= $SERVICECMD" >>config.mk
|
2010-11-04 17:12:14 +08:00
|
|
|
SERVICESTATUS=$(echo "$SERVICESTATUS" | $SED \
|
2010-09-09 22:40:27 +08:00
|
|
|
-e 's:\\:\\\\:g' \
|
|
|
|
-e 's:\&:\\\&:g' \
|
2014-01-08 19:34:51 +08:00
|
|
|
-e 's:\$:\\\\\$\$:g' \
|
2010-09-09 22:40:27 +08:00
|
|
|
)
|
|
|
|
echo "SERVICESTATUS= $SERVICESTATUS" >>config.mk
|
|
|
|
|
2009-07-15 05:01:59 +08:00
|
|
|
HOOKS=
|
2009-10-17 05:36:51 +08:00
|
|
|
if ! $HOOKSET; then
|
|
|
|
printf "Checking for ntpd ... "
|
|
|
|
NTPD=$(_which ntpd)
|
|
|
|
if [ -n "$NTPD" ]; then
|
|
|
|
echo "$NTPD (50-ntp.conf)"
|
|
|
|
HOOKS="$HOOKS${HOOKS:+ }50-ntp.conf"
|
|
|
|
else
|
|
|
|
echo "not found"
|
|
|
|
fi
|
2009-10-09 21:12:20 +08:00
|
|
|
|
2014-03-20 00:51:57 +08:00
|
|
|
printf "Checking for ypbind ... "
|
2009-10-17 05:36:51 +08:00
|
|
|
YPBIND=$(_which ypbind)
|
|
|
|
if [ -n "$YPBIND" ]; then
|
2014-03-20 00:51:57 +08:00
|
|
|
YPHOOK="50-ypbind"
|
2014-03-19 23:02:30 +08:00
|
|
|
if strings "$YPBIND" | $GREP -q yp\\.conf; then
|
2009-10-17 05:36:51 +08:00
|
|
|
YPHOOK="50-yp.conf"
|
2014-03-20 00:51:57 +08:00
|
|
|
YPOS="Linux"
|
2014-03-19 23:02:30 +08:00
|
|
|
elif strings "$YPBIND" | $GREP -q \\.ypservers; then
|
2014-03-20 00:51:57 +08:00
|
|
|
YPOS="NetBSD"
|
2014-03-19 23:02:30 +08:00
|
|
|
echo "YPDOMAIN_DIR= /var/yp" >>$CONFIG_MK
|
|
|
|
echo "YPDOMAIN_SUFFIX=.ypservers" >>$CONFIG_MK
|
|
|
|
elif strings "$YPBIND" | $GREP -q /etc/yp; then
|
2014-03-20 00:51:57 +08:00
|
|
|
YPOS="OpenBSD"
|
2014-03-19 23:02:30 +08:00
|
|
|
echo "YPDOMAIN_DIR= /etc/yp" >>$CONFIG_MK
|
|
|
|
echo "YPDOMAIN_SUFFIX=" >>$CONFIG_MK
|
|
|
|
else
|
2014-03-20 00:51:57 +08:00
|
|
|
YPOS="FreeBSD"
|
|
|
|
echo "YPDOMAIN_DIR=" >>$CONFIG_MK
|
|
|
|
echo "YPDOMAIN_SUFFIX=" >>$CONFIG_MK
|
2009-10-17 05:36:51 +08:00
|
|
|
fi
|
2014-03-20 00:51:57 +08:00
|
|
|
echo "$YPBIND ($YPHOOK${YPOS:+ }$YPOS)"
|
|
|
|
HOOKS="$HOOKS${HOOKS:+ }$YPHOOK"
|
2009-10-09 21:12:20 +08:00
|
|
|
else
|
2009-10-17 05:36:51 +08:00
|
|
|
echo "not found"
|
2009-10-09 21:12:20 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-03-20 00:51:57 +08:00
|
|
|
if cd dhcpcd-hooks; then
|
|
|
|
for x in $HOOKSCRIPTS; do
|
|
|
|
printf "Finding hook $x ... "
|
|
|
|
for h in [0-9][0-9]"-$x" \
|
|
|
|
[0-9][0-9]"-$x.sh" \
|
|
|
|
[0-9][0-9]"-$x.conf"
|
|
|
|
do
|
|
|
|
[ -e "$h" ] && break
|
|
|
|
done
|
|
|
|
if [ ! -e "$h" ]; then
|
|
|
|
echo "no"
|
|
|
|
else
|
|
|
|
echo "$h"
|
|
|
|
case " $HOOKS " in
|
|
|
|
*" $h "*) ;;
|
|
|
|
*) HOOKS="$HOOKS${HOOKS:+ }$h";;
|
|
|
|
esac
|
|
|
|
fi
|
2009-07-15 05:01:59 +08:00
|
|
|
done
|
2014-03-20 00:51:57 +08:00
|
|
|
cd ..
|
|
|
|
fi
|
2009-07-15 05:01:59 +08:00
|
|
|
echo "HOOKSCRIPTS= $HOOKS" >>$CONFIG_MK
|
|
|
|
|
2013-06-20 18:35:16 +08:00
|
|
|
# Define any RCSIDs for import into 3rd party systems
|
|
|
|
case "$OS" in
|
|
|
|
netbsd)
|
|
|
|
echo "IMPORT_RCSID= \#include <sys/cdefs.h>\\n" >>$CONFIG_MK
|
|
|
|
echo "IMPORT_RCSID+= __RCSID(\\\"\\\$\$NetBSD: \\\$\$\\\");" >> \
|
|
|
|
$CONFIG_MK
|
|
|
|
echo "IMPORT_HID+= /* \\\$\$NetBSD: \\\$\$ */" >> \
|
|
|
|
$CONFIG_MK
|
|
|
|
echo "IMPORT_MANID= .\\\\\\\\\\\" \\\$\$NetBSD: \$\$ " >> \
|
|
|
|
$CONFIG_MK
|
|
|
|
echo "IMPORT_SHID= \# \\\$\$NetBSD: \$\$ " >>$CONFIG_MK
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-07-15 05:01:59 +08:00
|
|
|
echo
|
|
|
|
echo " SYSCONFDIR = $SYSCONFDIR"
|
|
|
|
echo " SBINDIR = $SBINDIR"
|
2009-07-27 03:29:37 +08:00
|
|
|
echo " LIBDIR = $LIBDIR"
|
2009-07-15 05:01:59 +08:00
|
|
|
echo " LIBEXECDIR = $LIBEXECDIR"
|
|
|
|
echo " DBDIR = $DBDIR"
|
|
|
|
echo " RUNDIR = $RUNDIR"
|
|
|
|
echo " MANDIR = $MANDIR"
|
2009-10-09 21:12:20 +08:00
|
|
|
echo " HOOKSCRIPTS = $HOOKS"
|
2009-07-15 05:01:59 +08:00
|
|
|
echo
|
2014-01-25 09:35:53 +08:00
|
|
|
|
|
|
|
rm -f dhcpcd tests/test
|