summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-11-29 11:15:03 +0000
committerRoy Marples <roy@marples.name>2013-11-29 11:15:03 +0000
commit1cd05a96d5490f317e38001418b61a414142b514 (patch)
tree4ab7ea98b95a754432eaafcf79f9291407c78688 /configure
parent26add2b59fbb3a4a9af63d094cb8a835c61bc528 (diff)
downloaddhcpcd-1cd05a96d5490f317e38001418b61a414142b514.tar.xz
Read the embedded config into global values rather than each time
per interface. Add config toggles to build dhcpcd-embedded.conf into dhcpcd or to read it at runtime. The build process will now build .c and .h files based on dhcpcd-embedded.conf and provide defines to reduce the number or re-allocs if it grows (ie has the full DHCP option list).
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure24
1 files changed, 23 insertions, 1 deletions
diff --git a/configure b/configure
index c14c6ff7..97e9330e 100755
--- a/configure
+++ b/configure
@@ -19,6 +19,7 @@ FORK=
STATIC=
INCLUDEDIR=
DEVS=
+EMBEDDED=
for x do
opt=${x%%=*}
@@ -38,6 +39,8 @@ for x do
--enable-ipv4) INET=yes;;
--disable-ipv6) INET6=no;;
--enable-ipv6) INET6=yes;;
+ --disable-embedded) EMBEDDED=no;;
+ --enable-embedded) EMBEDDED=no;;
--prefix) PREFIX=$var;;
--sysconfdir) SYSCONFDIR=$var;;
--bindir|--sbindir) SBINDIR=$var;;
@@ -137,6 +140,8 @@ exit 0
done
: ${SED:=sed}
+: ${GREP:=grep}
+: ${WC:=wc}
: ${FORK:=yes}
: ${SYSCONFDIR:=$PREFIX/etc}
@@ -312,6 +317,23 @@ CFLAGS+= -fno-common
EOF
fi
+if [ -z "$EMBEDDED" -o "$EMBEDDED" = yes ]; then
+ echo "dhcpcd-embedded.conf will be embedded in dhcpcd itself"
+ echo "SRCS+= dhcpcd-embedded.c" >>$CONFIG_MK
+else
+ echo "dhcpcd-embedded.conf will be installed to $LIBEXECDIR"
+ echo "CFLAGS+= -DEMBEDDED_CONFIG=\\\"$LIBEXECDIR/dhcpcd-embedded.conf\\\"" >>$CONFIG_MK
+ echo "EMBEDDEDINSTALL= _embeddedinstall" >>$CONFIG_MK
+fi
+printf %s "Estimating initial embedded defines ... "
+INITDEFINES=$($GREP "^define " dhcpcd-embedded.conf | $WC -l)
+echo $INITDEFINES
+echo "#define INITDEFINES $INITDEFINES" >>$CONFIG_H
+printf %s "Estimating initial embedded define6s ... "
+INITDEFINE6S=$($GREP "^define6 " dhcpcd-embedded.conf | $WC -l)
+echo $INITDEFINE6S
+echo "#define INITDEFINE6S $INITDEFINE6S" >>$CONFIG_H
+
if [ -n "$FORK" -a "$FORK" != yes -a "$FORK" != true ]; then
echo "There is no fork"
echo "CPPFLAGS+= -DTHERE_IS_NO_FORK" >>$CONFIG_MK
@@ -770,7 +792,7 @@ if ! $HOOKSET; then
printf "Checking for ypind ... "
YPBIND=$(_which ypbind)
if [ -n "$YPBIND" ]; then
- if strings "$YPBIND" | grep -q yp.conf; then
+ if strings "$YPBIND" | $GREP -q yp.conf; then
YPHOOK="50-yp.conf"
else
YPHOOK="50-ypbind"