cec: only link cec-client against ld. use AC_SEARCH_LIBS instead of AC_CHECK_LIB
[deb_libcec.git] / configure.ac
index 69c15ec4a60f827a1fa39db10362e11f486abf6d..fd1eb01a2e6e807ea1611dd3694aa2769d4bd540 100644 (file)
@@ -6,7 +6,7 @@ AC_PROG_LIBTOOL
 
 case "${host}" in
   *-*-linux*)
-    AC_CHECK_LIB([udev], [main],, AC_MSG_ERROR("required library 'udev' is missing"))
+    AC_SEARCH_LIBS([udev_new], [udev],, AC_MSG_ERROR("required library 'udev' is missing"))
     REQUIRES="udev"
     ;;
   *-apple-darwin*)
@@ -14,8 +14,14 @@ case "${host}" in
     ;;
 esac
 
-AC_CHECK_LIB([pthread], [main],, AC_MSG_ERROR("required library 'pthread' is missing"))
-AC_CHECK_LIB([dl], [main],, AC_MSG_ERROR("required library 'dl' is missing"))
+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"