Skip to content

Commit

Permalink
Add new set of checks: little-endian, amd64/x86 or Aarch64 @ 64-bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Feb 13, 2016
1 parent ff72e9c commit 15803b8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)

include(CheckCCompilerFlag)
include(TestBigEndian)

# Check if this is source package build
if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
Expand Down Expand Up @@ -52,6 +53,15 @@ endif()

MESSAGE(STATUS "Building SSE2-optimized codepaths: ${BUILD_SSE2_CODEPATHS}")

test_big_endian(BIGENDIAN)
if(${BIGENDIAN})
# we do not really want those.
# besides, no one probably tried darktable on such systems
MESSAGE(FATAL_ERROR "Found big endian system. Bad.")
else()
MESSAGE(STATUS "Found little endian system. Good.")
endif(${BIGENDIAN})

if(APPLE)
option(USE_MAC_INTEGRATION "Enable OS X integration" ON)
else(APPLE)
Expand Down
22 changes: 22 additions & 0 deletions src/common/darktable.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,28 @@ int dt_init(int argc, char *argv[], const int init_gui, lua_State *L)
_dt_sigsegv_old_handler = signal(SIGSEGV, &_dt_sigsegv_handler);
#endif

#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
#error "Unfortunately we only work on litte-endian systems."
#endif

#if !defined(__amd64__) && !defined(__amd64) && !defined(__x86_64__) && !defined(__x86_64) \
&& !defined(__i386__) && !defined(__i386) \
&& !(defined(__aarch64__) && defined(__ARM_64BIT_STATE) && defined(__ARM_ARCH) && defined(__ARM_ARCH_8A))
#error "Unfortunately we only work on amd64/x86 (64-bit and maybe 32-bit) and ARMv8-A (64-bit only)."
#endif

#if defined(__aarch64__) && defined(__ARM_64BIT_STATE) && defined(__ARM_ARCH) && defined(__ARM_ARCH_8A)
#if !defined(__SIZEOF_POINTER__) || __SIZEOF_POINTER__ < 8
#error "On ARMv8-A, we only support 64-bit."
#else
if(sizeof(void *) < 8)
{
fprintf(stderr, "[dt_init] On ARMv8-A, we only support 64-bit.\n");
return 1;
}
#endif
#endif

#ifndef __SSE2__
#pragma message "Building without SSE2 is highly experimental."
#pragma message "Expect a LOT of functionality to be broken. You have been warned."
Expand Down

0 comments on commit 15803b8

Please sign in to comment.