cec: make libudev optional. if libudev is not available on linux, adapter autodetecti...
[deb_libcec.git] / configure.ac
index e961c1b2e6e1837a92d929d74749a8d04b91dd2b..22b634309a0d7245de0567270525cef79f49436d 100644 (file)
@@ -4,16 +4,23 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AC_PROG_CXX
 AC_PROG_LIBTOOL
 
+has_libudev="yes"
 case "${host}" in
   *-*-linux*)
-    AC_SEARCH_LIBS([udev_new], [udev],, AC_MSG_ERROR("required library 'udev' is missing"))
-    REQUIRES="udev"
+    PKG_CHECK_MODULES([UDEV],[libudev],,[has_libudev="no";AC_MSG_WARN("library 'udev' is missing - adapter detection will not be available")])
     ;;
   *-apple-darwin*)
+    has_libudev="no";
     LIBS+="-framework CoreVideo -framework IOKit"
     ;;
 esac
 
+if test "x$has_libudev" != "xno"; then
+  INCLUDES="$INCLUDES $UDEV_CFLAGS";LIBS="$LIBS $UDEV_LIBS"
+  AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"])
+  REQUIRES="udev"
+fi
+
 AC_SEARCH_LIBS([pthread_create],[pthread],, AC_MSG_ERROR("required library 'pthread' is missing"))
 
 libs_pre_dl=$LIBS