Make libudev optional.

This commit is contained in:
Martin Ling 2013-12-05 20:18:32 +00:00
parent 6c8716e9da
commit 397d89de3a
2 changed files with 10 additions and 3 deletions

View File

@ -86,10 +86,15 @@ SP_PKGLIBS=""
case $target_os in
*linux*)
# On Linux libudev is currently a hard requirement.
# On Linux libudev is currently required for enumeration.
AC_ARG_WITH([libudev],
[AS_HELP_STRING([--with-libudev],
[use libudev for serial port enumeration @<:@default=check@:>@])],
[], [with_libudev=check])
AS_IF([test "x$with_libudev" != xno], [
PKG_CHECK_MODULES([libudev], [libudev >= 0],
[CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
SP_PKGLIBS="$SP_PKGLIBS libudev"])
SP_PKGLIBS="$SP_PKGLIBS libudev"; AC_DEFINE(HAVE_LIBUDEV)])], [])
;;
*darwin*)
LDFLAGS="$LDFLAGS -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation"

View File

@ -47,7 +47,9 @@
#include <sys/syslimits.h>
#endif
#ifdef __linux__
#ifdef HAVE_LIBUDEV
#include "libudev.h"
#endif
#include "linux/serial.h"
#include "linux_termios.h"
@ -460,7 +462,7 @@ out_release:
IOObjectRelease(iter);
out_done:
#endif
#ifdef __linux__
#if defined(__linux__) && defined(HAVE_LIBUDEV)
struct udev *ud;
struct udev_enumerate *ud_enumerate;
struct udev_list_entry *ud_list;