-AC_CHECK_LIB([rt], [main],, AC_MSG_ERROR("required library 'rt' is missing"))
-AC_CHECK_LIB([pthread], [main],, AC_MSG_ERROR("required library 'pthread' is missing"))
-AC_CHECK_LIB([udev], [main],, AC_MSG_ERROR("required library 'udev' is missing"))
+has_libudev="yes"
+case "${host}" in
+ *-*-linux*)
+ 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
+ AC_SEARCH_LIBS(dlopen, [dl],
+ [test "$ac_cv_search_dlopen" = "none required" || LIBS_DL=$ac_cv_search_dlopen],
+ AC_MSG_ERROR("required library 'dl' is missing"))
+ AC_SUBST([LIBS_DL])
+LIBS=$libs_pre_dl