~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to m4/reorganization/code_checks/ipv6.m4

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_ARG_ENABLE([ipv6],
 
2
[  --disable-ipv6          disable IPv6 support],
 
3
want_ipv6=$enableval, want_ipv6="yes")
 
4
 
 
5
if test "$want_ipv6" = "yes"
 
6
then
 
7
    AC_MSG_CHECKING([for IPv6 support])
 
8
    AC_CACHE_VAL([have_cv_ipv6],[
 
9
                AC_TRY_RUN([
 
10
                    #include <sys/types.h>
 
11
                    #include <sys/socket.h>
 
12
                    #include <netdb.h>
 
13
                    #include <unistd.h>
 
14
                    int main(int argc, char **argv)
 
15
                    {
 
16
                            struct addrinfo *res, hints;
 
17
                            int sd;
 
18
 
 
19
                        if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
 
20
                            return 1;
 
21
                        close(sd);
 
22
                        /* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
 
23
                        memset(&hints, 0, sizeof(hints));
 
24
                        hints.ai_family = AF_UNSPEC;
 
25
                        if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
 
26
                            return 1;
 
27
                        freeaddrinfo(res);
 
28
                        return 0;
 
29
                    }
 
30
                ],
 
31
                [have_cv_ipv6=yes],
 
32
                [have_cv_ipv6=no],
 
33
                [have_cv_ipv6=no])
 
34
                ])
 
35
    AC_MSG_RESULT([$have_cv_ipv6])
 
36
    if test "$have_cv_ipv6" = yes; then
 
37
        AC_DEFINE(SUPPORT_IPv6, 1, [Support for IPv6])
 
38
    fi
 
39
fi