@@ -33,10 +33,6 @@ include(CMakePushCheckState)
3333function (_php_check_crypt)
3434 message (CHECK_START "Checking basic crypt functionality" )
3535
36- unset (HAVE_CRYPT_H CACHE )
37- unset (HAVE_CRYPT CACHE )
38- unset (HAVE_CRYPT_R CACHE )
39-
4036 cmake_push_check_state(RESET)
4137 set (CMAKE_REQUIRED_LIBRARIES Crypt::Crypt)
4238 set (CMAKE_REQUIRED_QUIET TRUE )
@@ -74,11 +70,6 @@ endfunction()
7470function (_php_check_crypt_r result)
7571 set (${result} TRUE PARENT_SCOPE)
7672
77- unset (CRYPT_R_CRYPTD CACHE )
78- unset (CRYPT_R_STRUCT_CRYPT_DATA CACHE )
79- unset (CRYPT_R_GNU_SOURCE CACHE )
80- unset (_CRYPT_R_STRUCT_CRYPT_DATA CACHE )
81-
8273 message (CHECK_START "Checking crypt_r() data struct" )
8374
8475 cmake_push_check_state(RESET)
@@ -144,6 +135,7 @@ function(_php_check_crypt_r result)
144135 TRUE
145136 CACHE INTERNAL
146137 "Whether 'crypt_r()' uses 'struct crypt_data'."
138+ FORCE
147139 )
148140
149141 message (CHECK_PASS "GNU struct crypt_data" )
@@ -162,14 +154,15 @@ function(_php_check_crypt_r result)
162154
163155 return 0;
164156 }
165- ]] _CRYPT_R_STRUCT_CRYPT_DATA )
157+ ]] PHP_HAS_CRYPT_R_STRUCT_CRYPT_DATA )
166158
167- if (_CRYPT_R_STRUCT_CRYPT_DATA )
159+ if (PHP_HAS_CRYPT_R_STRUCT_CRYPT_DATA )
168160 set (
169161 CRYPT_R_STRUCT_CRYPT_DATA
170162 TRUE
171163 CACHE INTERNAL
172164 "Whether 'crypt_r()' uses 'struct crypt_data'."
165+ FORCE
173166 )
174167
175168 message (CHECK_PASS "struct crypt_data" )
@@ -186,13 +179,6 @@ endfunction()
186179
187180# Check if crypt library is usable.
188181function (_php_check_crypt_is_usable)
189- unset (_crypt_des CACHE )
190- unset (_crypt_ext_des CACHE )
191- unset (_crypt_md5 CACHE )
192- unset (_crypt_blowfish CACHE )
193- unset (_crypt_sha512 CACHE )
194- unset (_crypt_sha256 CACHE )
195-
196182 cmake_push_check_state(RESET)
197183 set (CMAKE_REQUIRED_QUIET TRUE )
198184
@@ -209,7 +195,7 @@ function(_php_check_crypt_is_usable)
209195 message (CHECK_START "Checking for standard DES algo" )
210196 if (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR)
211197 message (CHECK_PASS "yes (cross-compiling)" )
212- set (_PHP_CRYPT_DES_EXITCODE 0)
198+ set (PHP_HAS_CRYPT_DES_EXITCODE 0)
213199 endif ()
214200 check_source_runs(C [[
215201 #include <string.h>
@@ -230,8 +216,8 @@ function(_php_check_crypt_is_usable)
230216 char *encrypted = crypt("rasmuslerdorf", "rl");
231217 return !encrypted || strcmp(encrypted, "rl.3StKT.4T8M");
232218 }
233- ]] _PHP_CRYPT_HAVE_DES )
234- if (_PHP_CRYPT_HAVE_DES )
219+ ]] PHP_HAS_CRYPT_DES )
220+ if (PHP_HAS_CRYPT_DES )
235221 message (CHECK_PASS "yes" )
236222 else ()
237223 message (CHECK_FAIL "no" )
@@ -259,8 +245,8 @@ function(_php_check_crypt_is_usable)
259245 char *encrypted = crypt("rasmuslerdorf", "_J9..rasm");
260246 return !encrypted || strcmp(encrypted, "_J9..rasmBYk8r9AiWNc");
261247 }
262- ]] _PHP_CRYPT_HAVE_EXT_DES )
263- if (_PHP_CRYPT_HAVE_EXT_DES )
248+ ]] PHP_HAS_CRYPT_EXT_DES )
249+ if (PHP_HAS_CRYPT_EXT_DES )
264250 message (CHECK_PASS "yes" )
265251 else ()
266252 message (CHECK_FAIL "no" )
@@ -298,8 +284,8 @@ function(_php_check_crypt_is_usable)
298284 encrypted = crypt("rasmuslerdorf", salt);
299285 return !encrypted || strcmp(encrypted, answer);
300286 }
301- ]] _PHP_CRYPT_HAVE_MD5 )
302- if (_PHP_CRYPT_HAVE_MD5 )
287+ ]] PHP_HAS_CRYPT_MD5 )
288+ if (PHP_HAS_CRYPT_MD5 )
303289 message (CHECK_PASS "yes" )
304290 else ()
305291 message (CHECK_FAIL "no" )
@@ -335,8 +321,8 @@ function(_php_check_crypt_is_usable)
335321 encrypted = crypt("rasmuslerdorf", salt);
336322 return !encrypted || strcmp(encrypted, answer);
337323 }
338- ]] _PHP_CRYPT_HAVE_BLOWFISH )
339- if (_PHP_CRYPT_HAVE_BLOWFISH )
324+ ]] PHP_HAS_CRYPT_BLOWFISH )
325+ if (PHP_HAS_CRYPT_BLOWFISH )
340326 message (CHECK_PASS "yes" )
341327 else ()
342328 message (CHECK_FAIL "no" )
@@ -370,8 +356,8 @@ function(_php_check_crypt_is_usable)
370356 encrypted = crypt("rasmuslerdorf", salt);
371357 return !encrypted || strcmp(encrypted, answer);
372358 }
373- ]] _PHP_CRYPT_HAVE_SHA256 )
374- if (_PHP_CRYPT_HAVE_SHA256 )
359+ ]] PHP_HAS_CRYPT_SHA256 )
360+ if (PHP_HAS_CRYPT_SHA256 )
375361 message (CHECK_PASS "yes" )
376362 else ()
377363 message (CHECK_FAIL "no" )
@@ -405,9 +391,9 @@ function(_php_check_crypt_is_usable)
405391 encrypted = crypt("rasmuslerdorf", salt);
406392 return !encrypted || strcmp(encrypted, answer);
407393 }
408- ]] _PHP_CRYPT_HAVE_SHA512 )
394+ ]] PHP_HAS_CRYPT_SHA512 )
409395
410- if (_PHP_CRYPT_HAVE_SHA512 )
396+ if (PHP_HAS_CRYPT_SHA512 )
411397 message (CHECK_PASS "yes" )
412398 else ()
413399 message (CHECK_FAIL "no" )
0 commit comments