diff options
author | Nathan Hjelm <hjelmn@me.com> | 2012-11-29 16:14:03 -0700 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-05-15 20:43:32 +0200 |
commit | 6853291ed0c7a783d01be3f8813988fc6e5c5ac3 (patch) | |
tree | a5e202ed02b4292180e8c7649d78b6f0c8bd7cca /configure.ac | |
parent | 9b76386f3e91dbc02a3dc7d744265cf1f370b1f1 (diff) | |
download | libusb-6853291ed0c7a783d01be3f8813988fc6e5c5ac3.tar.gz |
Add hotplug support to the Linux backend.
There are two ways to configure hotplug support for Linux: udev, and netlink. It
is strongly recommened that udev support is used on systems that utilize udev.
We reenforce this recommendation by defaulting to --with-udev=yes at configure
time. To enable netlink support run configure with --with-udev=no. If udev
support is enabled all device enumeration is done with udev.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index ec07937..0fa92ec 100644 --- a/configure.ac +++ b/configure.ac @@ -88,6 +88,18 @@ linux) AC_DEFINE(OS_LINUX, 1, [Linux backend]) AC_SUBST(OS_LINUX) AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread) + AC_ARG_ENABLE([udev], + [AC_HELP_STRING([--with-udev], [use udev for device enumeration and hotplug support (recommended, default: yes)])], + [], [enable_udev="yes"]) + if test "x$enable_udev" = "xyes" ; then + # system has udev. use it or fail! + AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])]) + AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])]) + AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug]) + else + AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])]) + fi + AC_SUBST(USE_UDEV) THREAD_CFLAGS="-pthread" LIBS="${LIBS} -pthread" AC_CHECK_HEADERS([poll.h]) @@ -128,7 +140,8 @@ AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin) AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd) AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows) AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix) -AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes") +AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes") +AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes) if test "$threads" = posix; then AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads]) fi |