Skip to content

Autotools: Refactor getaddrinfo check #14783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,10 @@ AC_CHECK_FUNCS([nanosleep],,

dnl Check for getaddrinfo, should be a better way, but... Also check for working
dnl getaddrinfo.
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
AC_CACHE_CHECK([for getaddrinfo], [php_cv_func_getaddrinfo],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>],
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);])],
[AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <netdb.h>
#include <sys/types.h>
#include <string.h>
Expand Down Expand Up @@ -700,21 +701,16 @@ int main(void) {
freeaddrinfo(ai);
return 0;
}
]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [
dnl Cross compilation.
case $host_alias in
*linux*|*midipix)
ac_cv_func_getaddrinfo=yes
;;
*)
ac_cv_func_getaddrinfo=no
;;
esac
])],
[ac_cv_func_getaddrinfo=no])])
if test "$ac_cv_func_getaddrinfo" = yes; then
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
fi
[php_cv_func_getaddrinfo=yes],
[php_cv_func_getaddrinfo=no],
[AS_CASE([$host_alias],
[*linux*|*midipix], [php_cv_func_getaddrinfo=yes],
[php_cv_func_getaddrinfo=no])])],
[php_cv_func_getaddrinfo=no])])
AS_VAR_IF([php_cv_func_getaddrinfo], [yes],
[AC_DEFINE([HAVE_GETADDRINFO], [1],
[Define to 1 if you have the 'getaddrinfo' function.])])

dnl on FreeBSD, copy_file_range() works only with the undocumented flag 0x01000000;
dnl until the problem is fixed properly, copy_file_range() is used only on Linux
Expand Down
Loading