Skip to content

Commit ec277ce

Browse files
authored
Autotools: Refactor IPv6 check (#14782)
- Configure option and check grouped together for readability - Cache variable ac_cv_ipv6_support renamed to php_cv_have_ipv6 - AS_VAR_IF used and CS synced - Over-quoted argument reduced
1 parent 063213b commit ec277ce

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

configure.ac

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -563,20 +563,6 @@ AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*openbsd*], [true]
563563
dnl Check for __attribute__ ((__aligned__)) support in the compiler.
564564
PHP_CHECK_VARIABLE_ATTRIBUTE([aligned])
565565

566-
dnl Check for IPv6 support.
567-
AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
568-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
569-
#include <sys/socket.h>
570-
#include <netinet/in.h>]], [[
571-
struct sockaddr_in6 s;
572-
struct in6_addr t = in6addr_any;
573-
int i = AF_INET6;
574-
(void)s;
575-
t.s6_addr[0] = 0;
576-
(void)i;
577-
]])],
578-
[ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
579-
580566
dnl Checks for library functions.
581567
dnl ----------------------------------------------------------------------------
582568

@@ -1012,9 +998,26 @@ PHP_ARG_ENABLE([ipv6],
1012998
[yes],
1013999
[no])
10141000

1015-
if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then
1016-
AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
1017-
fi
1001+
AS_VAR_IF([PHP_IPV6], [yes],
1002+
[AC_CACHE_CHECK([for IPv6 support], [php_cv_have_ipv6],
1003+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
1004+
#include <sys/types.h>
1005+
#include <sys/socket.h>
1006+
#include <netinet/in.h>
1007+
], [[
1008+
struct sockaddr_in6 s;
1009+
struct in6_addr t = in6addr_any;
1010+
int i = AF_INET6;
1011+
(void)s;
1012+
t.s6_addr[0] = 0;
1013+
(void)i;
1014+
]])],
1015+
[php_cv_have_ipv6=yes],
1016+
[php_cv_have_ipv6=no])])
1017+
])
1018+
AS_VAR_IF([php_cv_have_ipv6], [yes],
1019+
[AC_DEFINE([HAVE_IPV6], [1],
1020+
[Define to 1 if IPv6 is enabled and supported.])])
10181021

10191022
dnl DTRACE checks. Note: this has to be done after SAPI configuration.
10201023
PHP_ARG_ENABLE([dtrace],

0 commit comments

Comments
 (0)