From d61e5e42ca58b693fc4fe74bc75b7f00ab990ff4 Mon Sep 17 00:00:00 2001 From: hax0kartik Date: Thu, 26 Mar 2020 00:08:00 -0700 Subject: [PATCH] Use preprocessors to ensure libvnc monitor is only built when libvnc is found --- src/zm_libvnc_camera.cpp | 5 ++++- src/zm_libvnc_camera.h | 3 ++- src/zm_monitor.cpp | 6 ++++++ zoneminder-config.cmake | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/zm_libvnc_camera.cpp b/src/zm_libvnc_camera.cpp index efd2954cd..c72b0b340 100644 --- a/src/zm_libvnc_camera.cpp +++ b/src/zm_libvnc_camera.cpp @@ -2,6 +2,8 @@ #include "zm_signal.h" #include "zm_libvnc_camera.h" +#if HAVE_LIBVNC + static int TAG_0; static int TAG_1; static int TAG_2; @@ -125,4 +127,5 @@ int VncCamera::CaptureAndRecord(Image &image, timeval recording, char* event_dir int VncCamera::Close() { rfbClientCleanup(mRfb); return 0; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/zm_libvnc_camera.h b/src/zm_libvnc_camera.h index 667111bc5..6d9285114 100644 --- a/src/zm_libvnc_camera.h +++ b/src/zm_libvnc_camera.h @@ -6,6 +6,7 @@ #include "zm_camera.h" #include "zm_thread.h" +#if HAVE_LIBVNC #include // Used by vnc callbacks @@ -61,4 +62,4 @@ public: int Close(); }; -#endif \ No newline at end of file +#endif // HAVE_LIBVNC diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 291fe039d..1186c75f7 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -51,7 +51,9 @@ #if HAVE_LIBCURL #include "zm_curl_camera.h" #endif // HAVE_LIBCURL +#if HAVE_LIBVNC #include "zm_libvnc_camera.h" +#endif // HAVE_LIBVNC #if ZM_MEM_MAPPED #include @@ -2335,6 +2337,7 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) { Fatal("You must have libcurl installed to use ffmpeg cameras for monitor %d", id); #endif // HAVE_LIBCURL } else if ( type == "VNC" ) { +#if HAVE_LIBVNC camera = new VncCamera( id, host.c_str(), @@ -2351,6 +2354,9 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) { purpose==CAPTURE, record_audio ); +#else // HAVE_LIBVNC + Fatal("You must have libvnc installed to use VNC cameras for monitor id %d", id); +#endif // HAVE_LIBVNC } else { Fatal("Bogus monitor type '%s' for monitor %d", type.c_str(), id); } // end if type diff --git a/zoneminder-config.cmake b/zoneminder-config.cmake index 320620aa0..edcb42ff6 100644 --- a/zoneminder-config.cmake +++ b/zoneminder-config.cmake @@ -59,6 +59,8 @@ #cmakedefine HAVE_LIBAVRESAMPLE_AVRESAMPLE_H 1 #cmakedefine HAVE_LIBVLC 1 #cmakedefine HAVE_VLC_VLC_H 1 +#cmakedefine HAVE_LIBVNC 1 +#cmakedefine HAVE_RFB_RFB_H 1 #cmakedefine HAVE_LIBX264 1 #cmakedefine HAVE_X264_H 1 #cmakedefine HAVE_LIBMP4V2 1