From f7f24d1470d9553fdedcc0c687f0d9bd263b4903 Mon Sep 17 00:00:00 2001
From: Pavel Puchkin <i@neoascetic.me>
Date: Sat, 22 Nov 2014 00:31:12 +0200
Subject: [PATCH] Fix compiling if no endian.h found

f7d6509 introduces error when no endian.h found in the system.

Since "CHECK_INCLUDE_FILE" returns empty string instead of "0", when
"cmake_config.h" is generated it has "#define CMAKE_HAVE_ENDIAN_H " line.
Later we have "#define HAVE_ENDIAN_H CMAKE_HAVE_ENDIAN_H" in the
"config.h", an thus "HAVE_ENDIAN_H" is also empty sting. Because of
this, "#if HAVE_ENDIAN_H" is incorrect preprocessor directive.

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
---
 src/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ec6c7fbac..1a84c3714 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -315,6 +315,9 @@ if(ENABLE_REDIS)
 endif(ENABLE_REDIS)
 
 CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
+if(NOT HAVE_ENDIAN_H)
+  set(HAVE_ENDIAN_H 0)
+endif(NOT HAVE_ENDIAN_H)
 
 configure_file(
 	"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
-- 
GitLab