From: Lars Op den Kamp Date: Thu, 6 Dec 2012 23:04:54 +0000 (+0100) Subject: Merge branch 'master' into release X-Git-Tag: upstream/2.2.0~1^2~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d4a56bb9a13f82653a9d56a448671d0e8b5c8c42;hp=458f38eb0236dcd411a1da4f5a995b06430fb059;p=deb_libcec.git Merge branch 'master' into release --- diff --git a/configure.ac b/configure.ac index c7b7b1b..b179677 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ msg_pthread_missing="required library 'pthread' is missing" msg_dl_missing="required library 'dl' is missing" msg_udev_missing="library 'udev' is missing - adapter detection will not be available" msg_dirent_missing="dirent.h header is missing - adapter detection will not be available" -msg_lockdev_missing="required library 'liblockdev' is missing" +msg_lockdev_missing="library 'liblockdev' is missing" msg_rpi_api_missing="Raspberry Pi API not found or incompatible with libCEC" msg_rpi_will_check="will check for RPi support" msg_rpi_unsupported_target="will not check for RPi support (unsupported cpu: ${host_cpu})" @@ -116,7 +116,7 @@ AC_CHECK_FUNCS([dlopen dlclose dlsym]) case "${host}" in *-*-linux*) # for timeutils - LIBS="$LIBS -lrt" + AC_SEARCH_LIBS([clock_gettime], [rt]) ;; *-apple-darwin*) LIBS="$LIBS -framework CoreVideo -framework IOKit" @@ -129,6 +129,7 @@ libs_client="$LIBS" ## search for udev, lockdev and the RPi API, only required by libCEC use_udev="no" use_adapter_detection="yes" +use_lockdev="no" case "${host}" in *-*-linux*) ## search for udev if pkg-config was found @@ -146,8 +147,9 @@ case "${host}" in fi ## search for lockdev - AC_CHECK_HEADER(lockdev.h,,AC_MSG_ERROR($msg_lockdev_missing)) - AC_CHECK_LIB(lockdev,dev_unlock,,AC_MSG_ERROR($msg_lockdev_missing)) + use_lockdev="yes" + AC_CHECK_HEADER(lockdev.h,,[use_lockdev="no";AC_MSG_WARN($msg_lockdev_missing)]) + AC_CHECK_LIB(lockdev,dev_unlock,,[use_lockdev="no";AC_MSG_WARN($msg_lockdev_missing)]) AC_CHECK_HEADER(time.h,,AC_MSG_ERROR($msg_required_header_missing)) AC_CHECK_HEADER(sys/prctl.h,,AC_MSG_ERROR($msg_required_header_missing)) @@ -219,6 +221,10 @@ LIB_INFO="$LIB_INFO 'P8 USB'" AC_DEFINE([HAVE_P8_USB],[1],[Define to 1 to include support for the Pulse-Eight USB-CEC Adapter]) AM_CONDITIONAL(USE_P8_USB, true) +if test "x$use_lockdev" = "xyes"; then + AC_DEFINE([HAVE_LOCKDEV],[1],[Define to 1 if liblockdev is installed]) +fi + ## mark adapter detection as available if the required deps were found if test "x$use_adapter_detection" = "xyes"; then ## mark udev as available if it was found diff --git a/src/lib/platform/posix/serialport.cpp b/src/lib/platform/posix/serialport.cpp index 0089521..f067ac4 100644 --- a/src/lib/platform/posix/serialport.cpp +++ b/src/lib/platform/posix/serialport.cpp @@ -48,15 +48,17 @@ #define IUCLC 0 #endif #else +#ifdef HAVE_LOCKDEV #include #endif +#endif using namespace std; using namespace PLATFORM; inline bool RemoveLock(const char *strDeviceName) { - #if !defined(__APPLE__) && !defined(__FreeBSD__) + #if !defined(__APPLE__) && !defined(__FreeBSD__) && defined(HAVE_LOCKDEV) return dev_unlock(strDeviceName, 0) == 0; #else void *tmp = (void*)strDeviceName; // silence unused warning @@ -125,7 +127,7 @@ bool CSerialSocket::Open(uint64_t iTimeoutMs /* = 0 */) return false; } - #if !defined(__APPLE__) && !defined(__FreeBSD__) + #if !defined(__APPLE__) && !defined(__FreeBSD__) && defined(HAVE_LOCKDEV) if (dev_lock(m_strName.c_str()) != 0) { m_strError = "Couldn't lock the serial port";