Commit 55b9c037 authored by Stuart Cunningham's avatar Stuart Cunningham

Fix cmake detection of build platform endianness

Improve comments to indicate actual usage of WORDS_BIGENDIAN where
it is tested with #ifdef rather than #if
parent 5d43d3ca
...@@ -6,7 +6,6 @@ project(${TIFF_LIBRARY}) ...@@ -6,7 +6,6 @@ project(${TIFF_LIBRARY})
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFile) include(CheckIncludeFile)
include(TestBigEndian)
check_include_file(assert.h HAVE_ASSERT_H) check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(fcntl.h HAVE_FCNTL_H) check_include_file(fcntl.h HAVE_FCNTL_H)
...@@ -17,7 +16,6 @@ check_include_file(search.h HAVE_SEARCH_H) ...@@ -17,7 +16,6 @@ check_include_file(search.h HAVE_SEARCH_H)
check_include_file(string.h HAVE_STRING_H) check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(unistd.h HAVE_UNISTD_H)
test_big_endian(HOST_BIGENDIAN)
if(WIN32 AND NOT HAVE_WINRT) if(WIN32 AND NOT HAVE_WINRT)
set(USE_WIN32_FILEIO 1) set(USE_WIN32_FILEIO 1)
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */ (Intel) */
#define HOST_BIGENDIAN @HOST_BIGENDIAN@ #define HOST_BIGENDIAN @WORDS_BIGENDIAN@
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB #define HOST_FILLORDER FILLORDER_LSB2MSB
...@@ -154,17 +154,9 @@ ...@@ -154,17 +154,9 @@
/* define to use win32 IO system */ /* define to use win32 IO system */
#cmakedefine USE_WIN32_FILEIO #cmakedefine USE_WIN32_FILEIO
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most /* Define WORDS_BIGENDIAN if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */ significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD #cmakedefine WORDS_BIGENDIAN
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Support Deflate compression */ /* Support Deflate compression */
#define ZIP_SUPPORT 1 #define ZIP_SUPPORT 1
...@@ -444,6 +444,12 @@ endif() ...@@ -444,6 +444,12 @@ endif()
include(cmake/OpenCVPCHSupport.cmake) include(cmake/OpenCVPCHSupport.cmake)
include(cmake/OpenCVModule.cmake) include(cmake/OpenCVModule.cmake)
# ----------------------------------------------------------------------------
# Detect endianness of build platform
# ----------------------------------------------------------------------------
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Detect 3rd-party libraries # Detect 3rd-party libraries
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -161,6 +161,6 @@ ...@@ -161,6 +161,6 @@
/* Xine video library */ /* Xine video library */
#cmakedefine HAVE_XINE #cmakedefine HAVE_XINE
/* Define to 1 if your processor stores words with the most significant byte /* Define if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */ first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN #cmakedefine WORDS_BIGENDIAN
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment