|
1 | 1 | #[=============================================================================[ |
2 | | -Check if 'fopencookie()' works as expected. |
| 2 | +Check if fopencookie() works as expected. |
3 | 3 |
|
4 | | -Module first checks if 'fopencookie()' and type 'cookie_io_functions_t' are |
5 | | -available. Then it checks whether the 'fopencookie' seeker uses type 'off64_t'. |
6 | | -Since 'off64_t' is non-standard and obsolescent, the standard 'off_t' type can |
7 | | -be used on both 64-bit and 32-bit systems, where the '_FILE_OFFSET_BITS=64' can |
8 | | -make it behave like 'off64_t' on 32-bit. Since code is in the transition process |
9 | | -to use 'off_t' only, check is left here when using glibc. |
| 4 | +First, the fopencookie() and type cookie_io_functions_t are checked if they are |
| 5 | +available. Then check is done whether the 'fopencookie' seeker uses type |
| 6 | +off64_t. Since off64_t is non-standard and obsolescent, the standard off_t type |
| 7 | +can be used on both 64-bit and 32-bit systems, where the _FILE_OFFSET_BITS=64 |
| 8 | +can make it behave like off64_t on 32-bit platforms. Since code is in the |
| 9 | +transition process to use off_t only, check is left here when using glibc. |
10 | 10 |
|
11 | 11 | Result variables: |
12 | 12 |
|
13 | | -* HAVE_FOPENCOOKIE - Whether 'fopencookie()' and 'cookie_io_functions_t' are |
14 | | - available. |
15 | | -* COOKIE_SEEKER_USES_OFF64_T - Whether 'fopencookie' seeker uses the 'off64_t' |
16 | | - type. |
| 13 | +* HAVE_FOPENCOOKIE |
| 14 | +* COOKIE_SEEKER_USES_OFF64_T |
17 | 15 | #]=============================================================================] |
18 | 16 |
|
19 | | -include(CheckSourceRuns) |
| 17 | +include(CheckSourceCompiles) |
20 | 18 | include(CheckSymbolExists) |
21 | 19 | include(CheckTypeSize) |
22 | 20 | include(CMakePushCheckState) |
@@ -51,29 +49,17 @@ set(HAVE_FOPENCOOKIE TRUE) |
51 | 49 |
|
52 | 50 | # Skip in consecutive configuration phases. |
53 | 51 | if(DEFINED PHP_HAS_COOKIE_SEEKER_OFF64_T) |
54 | | - if(PHP_HAS_COOKIE_SEEKER_OFF64_T) |
55 | | - set(COOKIE_SEEKER_USES_OFF64_T TRUE) |
56 | | - endif() |
| 52 | + set(COOKIE_SEEKER_USES_OFF64_T ${PHP_HAS_COOKIE_SEEKER_OFF64_T}) |
57 | 53 | return() |
58 | 54 | endif() |
59 | 55 |
|
60 | 56 | # GNU C library can have a different seeker definition using off64_t. |
61 | 57 | message(CHECK_START "Checking whether fopencookie seeker uses off64_t") |
62 | 58 |
|
63 | | -if( |
64 | | - NOT DEFINED PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE |
65 | | - AND CMAKE_CROSSCOMPILING |
66 | | - AND NOT CMAKE_CROSSCOMPILING_EMULATOR |
67 | | - AND CMAKE_SYSTEM_NAME STREQUAL "Linux" |
68 | | - AND PHP_C_STANDARD_LIBRARY STREQUAL "glibc" |
69 | | -) |
70 | | - set(PHP_HAS_COOKIE_SEEKER_OFF64_T_EXITCODE 0) |
71 | | -endif() |
72 | | - |
73 | 59 | cmake_push_check_state(RESET) |
74 | 60 | set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) |
75 | 61 |
|
76 | | - check_source_runs(C [[ |
| 62 | + check_source_compiles(C [[ |
77 | 63 | #include <stdio.h> |
78 | 64 | #include <stdlib.h> |
79 | 65 |
|
@@ -125,8 +111,9 @@ cmake_push_check_state(RESET) |
125 | 111 | cmake_pop_check_state() |
126 | 112 |
|
127 | 113 | if(PHP_HAS_COOKIE_SEEKER_OFF64_T) |
128 | | - set(COOKIE_SEEKER_USES_OFF64_T TRUE) |
129 | 114 | message(CHECK_PASS "yes") |
130 | 115 | else() |
131 | 116 | message(CHECK_FAIL "no") |
132 | 117 | endif() |
| 118 | + |
| 119 | +set(COOKIE_SEEKER_USES_OFF64_T ${PHP_HAS_COOKIE_SEEKER_OFF64_T}) |
0 commit comments