cec: only link cec-client against ld. use AC_SEARCH_LIBS instead of AC_CHECK_LIB
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 13 Oct 2011 21:11:33 +0000 (23:11 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 13 Oct 2011 21:11:59 +0000 (23:11 +0200)
configure.ac
src/testclient/Makefile.am

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"
 
index aa23d92b5222bfb946ad99905d0b007d2c35a683..34af79bcd62478162de6603aae250fb770b7f232 100644 (file)
@@ -2,4 +2,5 @@ bin_PROGRAMS = cec-client
 cec_client_SOURCES = main.cpp \
                      ../lib/platform/threads.cpp
 
-cec_client_CPPFLAGS = -I@abs_top_srcdir@/include
\ No newline at end of file
+cec_client_CPPFLAGS = -I@abs_top_srcdir@/include
+cec_client_LDFLAGS = @LIBS_DL@
\ No newline at end of file