1# This file is part of Mailfromd. -*- autoconf -*- 2# Copyright (C) 2011-2021 Sergey Poznyakoff 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3, or (at your option) 7# any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17AC_DEFUN([MF_ENABLE_IPV6], 18 [AC_ARG_ENABLE(ipv6, 19 [AC_HELP_STRING([--enable-ipv6], [enable IPv6 support])], 20 [status_ipv6=$enableval], 21 [status_ipv6=maybe]) 22 23 if test $status_ipv6 != no; then 24 working_ipv6=no 25 AC_EGREP_CPP(MAILFROMD_AF_INET6_DEFINED,[ 26#include <sys/socket.h> 27#if defined(AF_INET6) 28MAILFROMD_AF_INET6_DEFINED 29#endif 30],[working_ipv6=yes]) 31 32 AC_CHECK_TYPE([struct sockaddr_storage], 33 [working_ipv6=yes], [working_ipv6=no], 34 [#include <sys/socket.h>]) 35 AC_CHECK_TYPE([struct sockaddr_in6], 36 [working_ipv6=yes], [working_ipv6=no], 37 [#include <sys/types.h> 38 #include <netinet/in.h>]) 39 AC_CHECK_TYPE([struct addrinfo], 40 [working_ipv6=yes], [working_ipv6=no], 41 [#include <netdb.h>]) 42 AC_CHECK_FUNC([getnameinfo], 43 [working_ipv6=yes], [working_ipv6=no], 44 [#include <netdb.h>]) 45 if test $working_ipv6 = yes; then 46 AC_RUN_IFELSE([AC_LANG_PROGRAM(AC_INCLUDES_DEFAULT([ 47#include <stdlib.h> 48#include <sys/socket.h> 49#include <netdb.h> 50]), 51 [ 52struct addrinfo *res; 53return getaddrinfo("::1", "25", NULL, &res) != 0; 54 ])], 55 [working_ipv6=yes], [working_ipv6=no]) 56 fi 57 58 if test $working_ipv6 = no; then 59 if test $status_ipv6 = yes; then 60 AC_MSG_ERROR([IPv6 support is required but not available]) 61 fi 62 fi 63 status_ipv6=$working_ipv6 64 if test $status_ipv6 = yes; then 65 AC_DEFINE_UNQUOTED([GACOPYZ_IPV6],1, 66 [Define to 1 if IPv6 support is enabled]) 67 fi 68 fi])