From 6ea2515b8424d03dbf1b951effc729c3f71415a9 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 21 Jun 2012 15:39:08 +0200 Subject: [PATCH] Makefile cleanups. don't link cec-client and cec-config against libudev and liblockdev --- configure.ac | 52 ++++++++++++++++++++++++++++---------- src/cec-config/Makefile.am | 2 +- src/lib/Makefile.am | 2 +- src/testclient/Makefile.am | 2 +- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index ba40f03..3098d00 100644 --- a/configure.ac +++ b/configure.ac @@ -1,15 +1,44 @@ -AC_INIT([libcec], 1:7:0) +AC_PREREQ(2.59) +AC_INIT([libcec], [1:7:0], [http://libcec.pulse-eight.com/]) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AC_PROG_CXX AC_PROG_LIBTOOL +# search for pthread, required by all targets +AC_SEARCH_LIBS([pthread_create],[pthread],, + AC_MSG_ERROR("required library 'pthread' is missing")) + +# search for dlopen, required by all targets +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")) + + +# platform specific libs, required by all targets +case "${host}" in + *-*-linux*) + LIBS+=" -lrt" + ;; + *-apple-darwin*) + ;; + *-freebsd*) + ;; +esac + +libs_client=$LIBS + +# search for udev and lockdev, only required by libCEC has_libudev="yes" case "${host}" in *-*-linux*) - PKG_CHECK_MODULES([UDEV],[libudev],,[has_libudev="no"]; AC_MSG_WARN("library 'udev' is missing - adapter detection will not be available")) - AC_CHECK_HEADER(lockdev.h,, AC_MSG_ERROR("required library 'liblockdev' is missing")) - LIBS+=" -lrt -llockdev" + PKG_CHECK_MODULES([UDEV],[libudev],, + [has_libudev="no"]; AC_MSG_WARN("library 'udev' is missing - adapter detection will not be available")) + + AC_CHECK_HEADER(lockdev.h,, + AC_MSG_ERROR("required library 'liblockdev' is missing")) + + LIBS+=" -llockdev" ;; *-apple-darwin*) has_libudev="no"; @@ -20,23 +49,20 @@ case "${host}" in ;; esac +# mark udev as available if it was found, so we can include adapter autodetection code if test "x$has_libudev" != "xno"; then INCLUDES="$INCLUDES $UDEV_CFLAGS";LIBS="$LIBS $UDEV_LIBS" AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]) REQUIRES="udev" fi -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 +LIBS_LIBCEC=$LIBS +LIBS=$libs_client CXXFLAGS="-fPIC -Wall -Wextra -Wno-missing-field-initializers $CXXFLAGS" -AC_SUBST(REQUIRES) +AC_SUBST([REQUIRES]) +AC_SUBST([LIBS]) +AC_SUBST([LIBS_LIBCEC]) AC_CONFIG_FILES([src/lib/libcec.pc]) AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile src/cec-config/Makefile]) diff --git a/src/cec-config/Makefile.am b/src/cec-config/Makefile.am index a6c6c39..da7b89b 100644 --- a/src/cec-config/Makefile.am +++ b/src/cec-config/Makefile.am @@ -2,4 +2,4 @@ bin_PROGRAMS = cec-config cec_config_SOURCES = cec-config.cpp cec_config_CPPFLAGS = -I@abs_top_srcdir@/include -cec_config_LDFLAGS = @LIBS_DL@ \ No newline at end of file +cec_config_LDFLAGS = @LIBS@ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 30637f2..3d34f83 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -35,5 +35,5 @@ libcec_la_SOURCES = CECProcessor.cpp \ platform/adl/adl-edid.cpp \ platform/nvidia/nv-edid.cpp -libcec_la_LDFLAGS = @LIBS@ -version-info @VERSION@ +libcec_la_LDFLAGS = @LIBS_LIBCEC@ -version-info @VERSION@ libcec_la_CPPFLAGS = -I@abs_top_srcdir@/include diff --git a/src/testclient/Makefile.am b/src/testclient/Makefile.am index 726cf62..d613d6d 100644 --- a/src/testclient/Makefile.am +++ b/src/testclient/Makefile.am @@ -2,4 +2,4 @@ bin_PROGRAMS = cec-client cec_client_SOURCES = main.cpp cec_client_CPPFLAGS = -I@abs_top_srcdir@/include -cec_client_LDFLAGS = @LIBS_DL@ \ No newline at end of file +cec_client_LDFLAGS = @LIBS@ -- 2.34.1