@@ -21,7 +21,7 @@ See also:
2121https://www.gnu.org/software/autoconf-archive/ax_func_which_gethostbyname_r.html
2222#]=============================================================================]
2323
24- include (CheckPrototypeDefinition )
24+ include (CheckSourceCompiles )
2525include (CMakePushCheckState)
2626include (PHP/SearchLibraries)
2727
@@ -61,44 +61,53 @@ function(_php_check_gethostbyname_r)
6161 set (CMAKE_REQUIRED_QUIET TRUE )
6262
6363 # Check for 6 arguments signature.
64- check_prototype_definition(
65- gethostbyname_r
66- "int gethostbyname_r(const char *name, struct hostent *ret, char *buf, \
67- size_t buflen, struct hostent **result, int *h_errnop)"
68- "0"
69- netdb.h
70- PHP_HAVE_FUNC_GETHOSTBYNAME_R_6
71- )
64+ check_source_compiles(C [[
65+ #include <netdb.h>
66+ int gethostbyname_r(
67+ const char *name,
68+ struct hostent *ret,
69+ char *buf,
70+ size_t buflen,
71+ struct hostent **result,
72+ int *h_errnop
73+ );
74+ int main(void) { return 0; }
75+ ]] PHP_HAVE_FUNC_GETHOSTBYNAME_R_6)
76+
7277 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_6)
7378 cmake_pop_check_state()
7479 message (CHECK_PASS "six" )
7580 return ()
7681 endif ()
7782
7883 # Check for 5 arguments signature.
79- check_prototype_definition(
80- gethostbyname_r
81- "struct hostent *gethostbyname_r(const char *name, struct hostent *result, \
82- char *buffer, int buflen, int *h_errnop)"
83- "0"
84- netdb.h
85- PHP_HAVE_FUNC_GETHOSTBYNAME_R_5
86- )
84+ check_source_compiles(C [[
85+ #include <netdb.h>
86+ struct hostent *gethostbyname_r(
87+ const char *name,
88+ struct hostent *result,
89+ char *buffer,
90+ int buflen,
91+ int *h_errnop
92+ );
93+ int main(void) { return 0; }
94+ ]] PHP_HAVE_FUNC_GETHOSTBYNAME_R_5)
8795 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_5)
8896 cmake_pop_check_state()
8997 message (CHECK_PASS "five" )
9098 return ()
9199 endif ()
92100
93101 # Check for 3 arguments signature.
94- check_prototype_definition(
95- gethostbyname_r
96- "int gethostbyname_r(const char *name, struct hostent *htent, \
97- struct hostent_data *data)"
98- "0"
99- netdb.h
100- PHP_HAVE_FUNC_GETHOSTBYNAME_R_3
101- )
102+ check_source_compiles(C [[
103+ #include <netdb.h>
104+ int gethostbyname_r(
105+ const char *name,
106+ struct hostent *htent,
107+ struct hostent_data *data
108+ );
109+ int main(void) { return 0; }
110+ ]] PHP_HAVE_FUNC_GETHOSTBYNAME_R_3)
102111 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_3)
103112 cmake_pop_check_state()
104113 message (CHECK_PASS "three" )
0 commit comments