Skip to content

Commit 35dc7d4

Browse files
author
Ivan Zhakov
committed
cmake: Set APR_IS_BIGENDIAN based on CMAKE_C_BYTE_ORDER.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1934390 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0f46439 commit 35dc7d4

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ if(APR_HAS_LDAP)
120120
set(LDAP_LIBRARIES wldap32)
121121
endif()
122122

123+
if (CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN")
124+
set(APR_IS_BIGENDIAN 1)
125+
elseif (CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")
126+
set(APR_IS_BIGENDIAN 0)
127+
else ()
128+
message(FATAL_ERROR "Endianness could not be determined.")
129+
endif ()
130+
123131
if(APR_POOL_DEBUG)
124132
add_compile_definitions(APR_POOL_DEBUG=1)
125133
endif()

include/apr.hwc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ typedef apr_uint32_t apr_uintptr_t;
393393
typedef apr_int32_t apr_intptr_t;
394394
#endif
395395

396-
/* Are we big endian? */
397-
/* XXX: Fatal assumption on Alpha platforms */
398-
#define APR_IS_BIGENDIAN 0
396+
#cmakedefine01 APR_IS_BIGENDIAN
399397

400398
/* Mechanisms to properly type numeric literals */
401399

0 commit comments

Comments
 (0)