summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-09-09 16:14:06 +0000
committerRoy Marples <roy@marples.name>2013-09-09 16:14:06 +0000
commit12bbc8cb5c7507be15a7e0af4140c3d81125c46c (patch)
treed67441d8173625751722350e192672a28a056224 /configure
parent7cece083bdc00e50c54af0c487adf34d7ed97eef (diff)
downloaddhcpcd-12bbc8cb5c7507be15a7e0af4140c3d81125c46c.tar.xz
Add udev support for interface arrival and departure.
This is because udev likes to rename the interface, which it can't do if dhcpcd grabs it first.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure40
1 files changed, 39 insertions, 1 deletions
diff --git a/configure b/configure
index 69a5ad80..7b091f17 100755
--- a/configure
+++ b/configure
@@ -9,6 +9,7 @@ ARC4RANDOM=
CLOSEFROM=
GETLINE=
STRLCPY=
+UDEV=
OS=
BUILD=
HOST=
@@ -57,8 +58,9 @@ for x do
--without-getline) GETLINE=no;;
--without-strlcpy) STRLCPY=no;;
--without-posix_spawn) POSIX_SPAWN=no;;
- --without-pollts) POLLTS=xno;;
+ --without-pollts) POLLTS=no;;
--with-pollts) POLLTS=$var;;
+ --without-udev) UDEV=no;;
--serviceexists) SERVICEEXISTS=$var;;
--servicecmd) SERVICECMD=$var;;
--servicestatus) SERVICESTATUS=$var;;
@@ -599,6 +601,42 @@ pselect)
;;
esac
+if [ "$UDEV" != no ]; then
+ printf "Checking for libudev ... "
+ LIBUDEV_CFLAGS=$(pkg-config --cflags libudev 2>/dev/null)
+ LIBUDEV_LIBS=$(pkg-config --libs libudev 2>/dev/null)
+fi
+if [ "$UDEV" != no -a -n "$LIBUDEV_LIBS" ]; then
+ echo "yes"
+ echo "SRCS+= dev/udev.c" >>$CONFIG_MK
+ if [ -n "$LIBUDEV_CFLAGS" ]; then
+ echo "CFLAGS+= $LIBUDEV_CFLAGS" >>$CONFIG_MK
+ fi
+ echo "CPPFLAGS+= -DLIBUDEV" >>$CONFIG_MK
+ echo "LDADD+= $LIBUDEV_LIBS" >>$CONFIG_MK
+
+ printf "Checking udev_monitor_filter_add_match_subsystem_devtype ..."
+ cat <<EOF >_udev.c
+#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
+#include <libudev.h>
+#include <stdlib.h>
+int main(void) {
+ udev_monitor_filter_add_match_subsystem_devtype(NULL, NULL, NULL);
+ return 0;
+}
+EOF
+ if $XCC $LIBUDEV_CFLAGS _udev.c -o _udev $LIBUDEV_LIBS2 2>/dev/null
+ then
+ echo "CPPFLAGS+= -DLIBUDEV_FILTER" >>$CONFIG_MK
+ echo " yes"
+ else
+ echo " no"
+ fi
+ rm -f _udev.c _udev
+elif [ "$UDEV" != no ]; then
+ echo "no"
+fi
+
if [ -z "$SERVICECMD" ]; then
printf "Checking for OpenRC ... "
if [ -x /sbin/rc-service ]; then