Skip to content

Use preprocessor to check for AI_V4MAPPED, AI_ALL and AI_IDN #13513

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
Feb 26, 2024
Merged
Show file tree
Hide file tree
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
39 changes: 0 additions & 39 deletions ext/sockets/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,6 @@ if test "$PHP_SOCKETS" != "no"; then
dnl Check for field ss_family in sockaddr_storage (missing in AIX until 5.3)
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[#include <sys/socket.h>])

dnl Check for AI_V4MAPPED flag
AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ac_cv_gai_ai_v4mapped],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <netdb.h>
]], [[int flag = AI_V4MAPPED;]])],
[ac_cv_gai_ai_v4mapped=yes], [ac_cv_gai_ai_v4mapped=no])
])

if test "$ac_cv_gai_ai_v4mapped" = yes; then
AC_DEFINE(HAVE_AI_V4MAPPED,1,[Whether you have AI_V4MAPPED])
fi

dnl Check for AI_ALL flag
AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ac_cv_gai_ai_all],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <netdb.h>
]], [[int flag = AI_ALL;]])],
[ac_cv_gai_ai_all=yes], [ac_cv_gai_ai_all=no])
])

if test "$ac_cv_gai_ai_all" = yes; then
AC_DEFINE(HAVE_AI_ALL,1,[Whether you have AI_ALL])
fi

dnl Check for AI_IDN flag
AC_CACHE_CHECK([if getaddrinfo supports AI_IDN],[ac_cv_gai_ai_idn],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <netdb.h>
]], [[int flag = AI_IDN;]])],
[ac_cv_gai_ai_idn=yes], [ac_cv_gai_ai_idn=no])
])

if test "$ac_cv_gai_ai_idn" = yes; then
AC_DEFINE(HAVE_AI_IDN,1,[Whether you have AI_IDN])
fi

dnl Check for struct ucred. Checking the header is not enough (DragonFlyBSD).
AC_CHECK_TYPES([struct ucred],,,
[#ifndef _GNU_SOURCE
Expand Down
2 changes: 1 addition & 1 deletion ext/sockets/sockaddr_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_

memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
#if HAVE_AI_V4MAPPED
#ifdef AI_V4MAPPED
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
#else
hints.ai_flags = AI_ADDRCONFIG;
Expand Down
6 changes: 3 additions & 3 deletions ext/sockets/sockets.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1591,14 +1591,14 @@
* @cvalue AI_NUMERICHOST
*/
const AI_NUMERICHOST = UNKNOWN;
#if HAVE_AI_V4MAPPED
#ifdef AI_V4MAPPED
/**
* @var int
* @cvalue AI_V4MAPPED
*/
const AI_V4MAPPED = UNKNOWN;
#endif
#if HAVE_AI_ALL
#ifdef AI_ALL
/**
* @var int
* @cvalue AI_ALL
Expand All @@ -1610,7 +1610,7 @@
* @cvalue AI_ADDRCONFIG
*/
const AI_ADDRCONFIG = UNKNOWN;
#if HAVE_AI_IDN
#ifdef AI_IDN
/**
* @var int
* @cvalue AI_IDN
Expand Down
10 changes: 5 additions & 5 deletions ext/sockets/sockets_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.