]> sigrok.org Git - libserialport.git/commitdiff
Make libudev optional.
authorMartin Ling <redacted>
Thu, 5 Dec 2013 20:18:32 +0000 (20:18 +0000)
committerMartin Ling <redacted>
Thu, 5 Dec 2013 20:21:39 +0000 (20:21 +0000)
configure.ac
serialport.c

index 50f8de43fc9ba14458d0e8baa9e10d3e33ca014b..b1e98b478be78343abbe56526a38d27bab533589 100644 (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"
index 0276567a4008008064e871ac24e7e63d8dd5e9fa..497ce7fead5ecf3b1259f343f3309885ffe2fccd 100644 (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;