Source: netcdf
Version: 1:4.5.0-1
Tags: patch upstream
User: [email protected]
Usertags: rebootstrap
netcdf fails to cross build from source, because it uses
CHECK_C_SOURCE_RUNS. Fortunately, the only relevant check can easily be
turned into CHECK_C_SOURCE_COMPILES (by exploiting that arrays of
negative length cause a compile error). After doing so, netcdf cross
builds successfully. Please consider applying the attached patch.
Helmut
Index: netcdf-4.5.0/CMakeLists.txt
===================================================================
--- netcdf-4.5.0.orig/CMakeLists.txt
+++ netcdf-4.5.0/CMakeLists.txt
@@ -93,7 +93,6 @@
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceRuns.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)
@@ -1194,14 +1193,12 @@
SET(SIGNED_TEST_SOURCE "\n
#include <stdlib.h>\n
int main(void) {\n
- char is_signed = (char) - 1;\n
- if(is_signed < 0)\n
- return 1;\n
- else\n
- return 0;\n
+ char error_if_char_is_signed[((char)-1) < 0 ? -1 : 1];\n
+ error_if_char_is_signed[0] = 0;
+ return 0;\n
}\n")
-CHECK_C_SOURCE_RUNS("${SIGNED_TEST_SOURCE}" __CHAR_UNSIGNED__)
+CHECK_C_SOURCE_COMPILES("${SIGNED_TEST_SOURCE}" __CHAR_UNSIGNED__)
# Library include checks
CHECK_INCLUDE_FILE("math.h" HAVE_MATH_H)