-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"))
+case "${host}" in
+ *-*-linux*)
+ AC_SEARCH_LIBS([udev_new], [udev],, AC_MSG_ERROR("required library 'udev' is missing"))
+ REQUIRES="udev"
+ ;;
+ *-apple-darwin*)
+ LIBS+="-framework CoreVideo -framework IOKit"
+ ;;
+esac
+
+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
+
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADERS([boost/shared_ptr.hpp], [],
+ [AC_MSG_ERROR(You need the Boost libraries.)])
+AC_CHECK_HEADERS([boost/enable_shared_from_this.hpp], [],
+ [AC_MSG_ERROR(You need the Boost libraries.)])
+AC_LANG_POP([C++])