enable darwin support
[deb_libcec.git] / configure.ac
index 2034c08dd0320fbb16fbdf6e274247b11484d1d9..c3a5a08d7f4efdc239c5dfd9fd039a4a095ae9a5 100644 (file)
@@ -4,11 +4,21 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AC_PROG_CXX
 AC_PROG_LIBTOOL
 
-AC_CHECK_LIB([rt], [main],, AC_MSG_ERROR("required library 'rt' is missing"))
+case "${host}" in
+  *-*-linux*)
+    AC_CHECK_LIB([rt], [main],, AC_MSG_ERROR("required library 'rt' is missing"))
+    AC_CHECK_LIB([udev], [main],, AC_MSG_ERROR("required library 'udev' is missing"))
+    REQUIRES="udev"
+    ;;
+  *-apple-darwin*)
+    LIBS+="-framework CoreVideo -framework IOKit"
+    ;;
+esac
+
 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"))
 
 CXXFLAGS="-fPIC -Wall -Wextra $CXXFLAGS"
 
+AC_SUBST(REQUIRES)
 AC_CONFIG_FILES([src/lib/libcec.pc])
 AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile])