blob: e1a0e3d88a613cfecff6450e86bcb0770f6101a9 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/CMakeLists.txt
2+++ b/CMakeLists.txt
3@@ -64,31 +64,35 @@ else()
4 add_definitions(-DL_ENDIAN)
5 endif()
6
7-check_c_source_runs("
8- #ifdef _MSC_VER
9- # include <intrin.h>
10- #else
11- # include <x86intrin.h>
12- #endif
13- int main(void) {
14- unsigned long long x = -1, y = 1, r;
15- unsigned char cf;
16- cf = _addcarry_u64(1, x, y, &r);
17- return !(cf == 1 && r == 1);
18- }
19- " ADDCARRY_U64)
20+if(NOT CMAKE_CROSSCOMPILING)
21+ check_c_source_runs("
22+ #ifdef _MSC_VER
23+ # include <intrin.h>
24+ #else
25+ # include <x86intrin.h>
26+ #endif
27+ int main(void) {
28+ unsigned long long x = -1, y = 1, r;
29+ unsigned char cf;
30+ cf = _addcarry_u64(1, x, y, &r);
31+ return !(cf == 1 && r == 1);
32+ }
33+ " ADDCARRY_U64)
34+
35+ check_c_source_runs("
36+ int main(void) {
37+ char buf[16] = { 0, 1, 2 };
38+ int *p = (int *)(buf + 1);
39+ int *q = (int *)(buf + 2);
40+ return (*p == *q);
41+ }
42+ " RELAXED_ALIGNMENT)
43+endif()
44+
45 if (ADDCARRY_U64)
46 add_definitions(-DHAVE_ADDCARRY_U64)
47 endif()
48
49-check_c_source_runs("
50- int main(void) {
51- char buf[16] = { 0, 1, 2 };
52- int *p = (int *)(buf + 1);
53- int *q = (int *)(buf + 2);
54- return (*p == *q);
55- }
56- " RELAXED_ALIGNMENT)
57 if (NOT RELAXED_ALIGNMENT)
58 add_definitions(-DSTRICT_ALIGNMENT)
59 endif()