From: Uwe Hermann Date: Tue, 8 Jan 2019 21:32:35 +0000 (+0100) Subject: Check for the (optional) libsigrokdecode dependency. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=45e6e688b16d4653e8b8f2707f1e2c1e041b7261;p=libsigrokflow.git Check for the (optional) libsigrokdecode dependency. --- diff --git a/configure.ac b/configure.ac index bafb3ba..687e144 100644 --- a/configure.ac +++ b/configure.ac @@ -71,6 +71,7 @@ SR_PKG_CHECK_SUMMARY([srf_pkglibs_summary]) SR_VAR_OPT_PKG([SRF_PKGLIBS], [srf_deps_avail]) SR_ARG_OPT_PKG([libsigrokcxx], [LIBSIGROKCXX], , [libsigrokcxx >= 0.5.1]) +SR_ARG_OPT_PKG([libsigrokdecode], [LIBSIGROKDECODE], , [libsigrokdecode >= 0.5.1]) AC_LANG([C++]) SR_ARG_ENABLE_WARNINGS([SRF_WXXFLAGS], [-Wall], [-Wall -Wextra]) diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index ee71487..31cbd01 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -27,7 +27,9 @@ #ifdef HAVE_LIBSIGROKCXX #include #endif +#ifdef HAVE_LIBSIGROKDECODE #include +#endif namespace Srf { @@ -173,6 +175,7 @@ private: }; #endif +#ifdef HAVE_LIBSIGROKDECODE class LegacyDecoder : public Sink { @@ -205,6 +208,7 @@ private: uint64_t _abs_ss; uint64_t _unitsize; }; +#endif } #endif diff --git a/src/main.cpp b/src/main.cpp index 080ef64..ab9435b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,11 +19,8 @@ */ #include -#include - -#include - #include +#include namespace Srf { @@ -50,11 +47,13 @@ void init() sigc::ptr_fun(&LegacyOutput::register_element), "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org"); #endif +#ifdef HAVE_LIBSIGROKDECODE Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "sigrok_legacy_decoder", "Wrapper for protocol decoders using legacy libsigrokdecode APIs", sigc::ptr_fun(&LegacyDecoder::register_element), "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org"); +#endif } Sink::Sink(GstBaseSink *gobj) : @@ -350,6 +349,7 @@ bool LegacyOutput::stop_vfunc() } #endif +#ifdef HAVE_LIBSIGROKDECODE void LegacyDecoder::class_init(Gst::ElementClass *klass) { klass->set_metadata("sigrok legacy decoder", @@ -418,5 +418,6 @@ bool LegacyDecoder::stop_vfunc() srd_session_terminate_reset(_session); return true; } +#endif }