Skip to content

Commit 8c6bbba

Browse files
committed
Windows build: Use GREP_HEADER() instead of CHECK_FUNC_IN_HEADER()
This removes the following unused compile definitions: - HAVE_OSSL_SET_MAX_THREADS - HAVE_ARGON2ID_HASH_RAW The CHECK_FUNC_IN_HEADER() function defines the 'HAVE_<FUNCTION>' compile definitions to 0 or 1, but these aren't used in the code. Defining such preprocessor macros makes it difficult to track and sync with other build systems.
1 parent f46bc8e commit 8c6bbba

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

ext/openssl/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (PHP_OPENSSL != "no") {
1818
if (PHP_OPENSSL_ARGON2 != "no") {
1919
if (PHP_ZTS != "no") {
2020
WARNING("OpenSSL argon2 hashing not supported in ZTS mode for now");
21-
} else if (!CHECK_FUNC_IN_HEADER("openssl/thread.h", "OSSL_set_max_threads", PHP_PHP_BUILD + "\\include")) {
21+
} else if (!GREP_HEADER("openssl/thread.h", "OSSL_set_max_threads", PHP_PHP_BUILD + "\\include")) {
2222
WARNING("OpenSSL argon2 hashing requires OpenSSL >= 3.2");
2323
} else {
2424
AC_DEFINE("HAVE_OPENSSL_ARGON2", 1, "Define to 1 to enable OpenSSL argon2 password hashing.");

ext/standard/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG_WITH("password-argon2", "Argon2 support", "no");
55
if (PHP_PASSWORD_ARGON2 != "no") {
66
if (CHECK_LIB("argon2_a.lib;argon2.lib", null, PHP_PASSWORD_ARGON2)
77
&& CHECK_HEADER_ADD_INCLUDE("argon2.h", "CFLAGS")) {
8-
if (!CHECK_FUNC_IN_HEADER("argon2.h", "argon2id_hash_raw", PHP_PHP_BUILD + "\\include", "CFLAGS")) {
8+
if (!GREP_HEADER("argon2.h", "argon2id_hash_raw", PHP_PHP_BUILD + "\\include")) {
99
ERROR("Please verify that Argon2 header and libraries >= 20161029 are installed");
1010
}
1111
AC_DEFINE('HAVE_ARGON2LIB', 1, "Define to 1 if the system has the 'libargon2' library.");

win32/build/confutils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,11 @@ function OLD_CHECK_LIB(libnames, target, path_to_check)
929929

930930
}
931931

932+
/**
933+
* Checks whether function exists in the given header. Same as GREP_HEADER() but
934+
* it also defines the 'HAVE_<FUNC_NAME>' preprocessor macro to 1 or 0. In new
935+
* code rather use GREP_HEADER() and define the macro explicitly when needed.
936+
*/
932937
function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag)
933938
{
934939
var c = false;
@@ -955,6 +960,9 @@ function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag
955960
return false;
956961
}
957962

963+
/**
964+
* Checks whether specified regular expression is found in the given header.
965+
*/
958966
function GREP_HEADER(header_name, regex, path_to_check)
959967
{
960968
var c = false;

0 commit comments

Comments
 (0)