@@ -21,7 +21,7 @@ See also:
2121https://www.gnu.org/software/autoconf-archive/ax_func_which_gethostbyname_r.html
2222#]=============================================================================]
2323
24- include (CheckSourceCompiles )
24+ include (CheckPrototypeDefinition )
2525include (CMakePushCheckState)
2626include (PHP/SearchLibraries)
2727
@@ -61,53 +61,44 @@ function(_php_check_gethostbyname_r)
6161 set (CMAKE_REQUIRED_QUIET TRUE )
6262
6363 # Check for 6 arguments signature.
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-
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+ )
7772 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_6)
7873 cmake_pop_check_state()
7974 message (CHECK_PASS "six" )
8075 return ()
8176 endif ()
8277
8378 # Check for 5 arguments signature.
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)
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+ )
9587 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_5)
9688 cmake_pop_check_state()
9789 message (CHECK_PASS "five" )
9890 return ()
9991 endif ()
10092
10193 # Check for 3 arguments signature.
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)
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+ )
111102 if (PHP_HAVE_FUNC_GETHOSTBYNAME_R_3)
112103 cmake_pop_check_state()
113104 message (CHECK_PASS "three" )
0 commit comments