From f38f8806dec5eb558f77476ebb455eae802f2073 Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Tue, 6 Jun 2017 17:48:25 +0100 Subject: [PATCH] Check for cdio/paranoia.h in cdio/paranoia/paranoia.h Issue #1022 --- cmake/FindCdioparanoia.cmake | 16 ++++++++++++++++ config.h.cmake | 6 ++++++ devices/cdparanoia.h | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/cmake/FindCdioparanoia.cmake b/cmake/FindCdioparanoia.cmake index 33aecb879..e652e105c 100644 --- a/cmake/FindCdioparanoia.cmake +++ b/cmake/FindCdioparanoia.cmake @@ -6,12 +6,28 @@ # CDIOPARANOIA_LIBRARIES - The libcdio_paranoia libraries include(FindPkgConfig) +include(CheckIncludeFiles) if(PKG_CONFIG_FOUND) pkg_check_modules (CDIOPARANOIA libcdio_paranoia) list(APPEND CDIOPARANOIA_INCLUDE_DIRS ${CDIOPARANOIA_INCLUDEDIR}) endif() +if (CDIOPARANOIA_FOUND) + check_include_files(cdio/paranoia.h HAVE_CDIO_PARANOIA_H) + check_include_files(cdio/cdda.h HAVE_CDIO_CDDA_H) + # Issue 1022 - sometimes its cdio/paranoia/paranoia.h + if (NOT HAVE_CDIO_PARANOIA_H) + check_include_files(cdio/paranoia/paranoia.h HAVE_CDIO_PARANOIA_PARANOIA_H) + endif() + if (NOT HAVE_CDIO_CDDA_H) + check_include_files(cdio/paranoia/cdda.h HAVE_CDIO_PARANOIA_CDDA_H) + endif() + if (NOT HAVE_CDIO_PARANOIA_H AND NOT HAVE_CDIO_PARANOIA_PARANOIA_H AND NOT HAVE_CDIO_CDDA_H AND NOT HAVE_CDIO_PARANOIA_CDDA_H) + set(CDIOPARANOIA_FOUND OFF) + message("Failed to determine cdio/paranoia header file location") + endif() +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CDIOPARANOIA DEFAULT_MSG CDIOPARANOIA_INCLUDE_DIRS CDIOPARANOIA_LIBRARIES) diff --git a/config.h.cmake b/config.h.cmake index 36ebd5948..0355800c5 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -41,6 +41,12 @@ #cmakedefine UNITY_MENU_HACK 1 #cmakedefine ENABLE_SIMPLE_MPD_SUPPORT 1 +#cmakedefine HAVE_CDIO_PARANOIA_H 1 +#cmakedefine HAVE_CDIO_PARANOIA_PARANOIA_H 1 +#cmakedefine HAVE_CDIO_CDDA_H 1 +#cmakedefine HAVE_CDIO_PARANOIA_CDDA_H 1 + + #ifdef ENABLE_UBUNTU #define CANTATA_REV_URL "com.ubuntu.developer.nikwen.cantata-touch-reboot" //Sadly, it requires the com.ubuntu.developer.nikwen prefix to be published to the click store #else diff --git a/devices/cdparanoia.h b/devices/cdparanoia.h index 2217e4b2c..65f650829 100644 --- a/devices/cdparanoia.h +++ b/devices/cdparanoia.h @@ -29,8 +29,19 @@ extern "C" { #ifdef CDIOPARANOIA_FOUND + +#ifdef HAVE_CDIO_PARANOIA_H #include +#elif defined HAVE_CDIO_PARANOIA_PARANOIA_H +#include +#endif + +#ifdef HAVE_CDIO_CDDA_H #include +#elif defined HAVE_CDIO_PARANOIA_CDDA_H +#include +#endif + #else #include #include