$NetBSD$

Don't have a file called "version", to avoid conflict with C++20 <version>.

CMake will detect the MacOS 6-argument sendfile() support and configure
HAVE_SENDFILE, but the code itself doesn't support this interface.  So don't
probe for HAVE_SENDFILE if we HAVE_SENDFILE6_SUPPORT.

Just because librt doesn't exist does not mean that clock_gettime() doesn't
exist, so don't insist on librt being present.  Fixes the build on MacOS.

Let Pkgsrc be responsible for zm.conf into examples, rather than overwriting
the existing configuration file.

--- CMakeLists.txt.orig	2018-12-08 14:22:36.000000000 +0000
+++ CMakeLists.txt
@@ -4,7 +4,7 @@
 #
 cmake_minimum_required (VERSION 2.8.7)
 project (zoneminder)
-file (STRINGS "version" zoneminder_VERSION)
+file (STRINGS "version.txt" zoneminder_VERSION)
 # make API version a minor of ZM version
 set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")
 
@@ -282,7 +282,9 @@ check_include_file("ucontext.h" HAVE_UCO
 check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H)
 check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
 check_function_exists("syscall" HAVE_SYSCALL)
+if(NOT HAVE_SENDFILE6_SUPPORT)
 check_function_exists("sendfile" HAVE_SENDFILE)
+endif(NOT HAVE_SENDFILE6_SUPPORT)
 check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN)
 check_type_size("siginfo_t" HAVE_SIGINFO_T)
 check_type_size("ucontext_t" HAVE_UCONTEXT_T)
@@ -293,7 +295,7 @@ if (UNIX)
     include (CheckLibraryExists)
     CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
     if(NOT HAVE_CLOCK_GETTIME)
-        message(FATAL_ERROR "clock_gettime not found")
+        #message(FATAL_ERROR "clock_gettime not found")
     else(NOT HAVE_CLOCK_GETTIME)
         list(APPEND ZM_BIN_LIBS "-lrt")
     endif(NOT HAVE_CLOCK_GETTIME)
@@ -891,8 +893,8 @@ else(zmconfgen_result EQUAL 0)
 endif(zmconfgen_result EQUAL 0)
 
 # Install zm.conf
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
-install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE)
+#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
+#install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE)
 
 # Uninstall target
 configure_file(
