cec: removed 'retries' from cec_command, to avoid stack smashing when upgrading the...
[deb_libcec.git] / configure.ac
index 883d414ac3e2172f527dfeea734c62166ae08d09..e961c1b2e6e1837a92d929d74749a8d04b91dd2b 100644 (file)
@@ -1,12 +1,30 @@
-AC_INIT([libcec], 0:2:0)
+AC_INIT([libcec], 1:2:0)
 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"))
-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
+
+CXXFLAGS="-fPIC -Wall -Wextra $CXXFLAGS"
+
+AC_SUBST(REQUIRES)
 AC_CONFIG_FILES([src/lib/libcec.pc])
 AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile])