Skip to content

Commit 40e0d3a

Browse files
authored
Autotools: Check for crypt and crypt_r with AC_* macros (#15060)
This checks if crypt and crypt_r functions are available on the system in default libraries or in the crypt library with the AC_SEARCH_LIBS. The redundant HAVE_LIBCRYPT symbol is removed.
1 parent 499ea90 commit 40e0d3a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
152152
- Symbol HAVE_PHPDBG has been removed.
153153
- Symbols PHP_HAVE_AVX512_SUPPORTS and PHP_HAVE_AVX512_VBMI_SUPPORTS are now
154154
either defined to 1 or undefined.
155+
- Symbol HAVE_LIBCRYPT has been removed.
155156
- M4 macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and config.h).
156157
- M4 macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH).
157158
- M4 macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES).

ext/standard/config.m4

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,18 @@ AS_VAR_IF([PHP_EXTERNAL_LIBCRYPT], [no], [
8585
PHP_ADD_SOURCES([PHP_EXT_DIR([standard])],
8686
[crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c])
8787
], [
88-
PHP_CHECK_FUNC(crypt, crypt)
89-
PHP_CHECK_FUNC(crypt_r, crypt)
90-
AC_CHECK_HEADERS([crypt.h])
91-
AS_VAR_IF([ac_cv_func_crypt], [yes],,
92-
[AC_MSG_ERROR([Cannot use external libcrypt as crypt() is missing.])])
93-
AS_VAR_IF([ac_cv_func_crypt_r], [yes],
94-
[PHP_CRYPT_R_STYLE],
95-
[AC_MSG_ERROR([Cannot use external libcrypt as crypt_r() is missing.])])
88+
AC_SEARCH_LIBS([crypt], [crypt],
89+
[AC_DEFINE([HAVE_CRYPT], [1],
90+
[Define to 1 if you have the 'crypt' function.])],
91+
[AC_MSG_ERROR([Cannot use external libcrypt as crypt() is missing.])])
92+
93+
AC_SEARCH_LIBS([crypt_r], [crypt],
94+
[AC_DEFINE([HAVE_CRYPT_R], [1],
95+
[Define to 1 if you have the 'crypt_r' function.])],
96+
[AC_MSG_ERROR([Cannot use external libcrypt as crypt_r() is missing.])])
97+
98+
PHP_CRYPT_R_STYLE
99+
AC_CHECK_HEADERS([crypt.h])
96100
97101
AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
98102
AC_RUN_IFELSE([AC_LANG_SOURCE([[

0 commit comments

Comments
 (0)