Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / m4 / hostname.m4
1 # hostname.m4 serial 1 (gettext-0.11)
2 dnl Copyright (C) 2001-2002, 2015 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 # Prerequisites of the hostname.c program.
8 AC_DEFUN([gt_PREREQ_HOSTNAME],
9 [
10   AC_CHECK_HEADERS(arpa/inet.h)
11   AC_CHECK_FUNCS(gethostname gethostbyname inet_ntop)
12
13   AC_MSG_CHECKING([for IPv6 sockets])
14   AC_CACHE_VAL(gt_cv_socket_ipv6,[
15     AC_TRY_COMPILE([
16 #include <sys/types.h>
17 #include <sys/socket.h>
18 #include <netinet/in.h>],
19 [int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;],
20       gt_cv_socket_ipv6=yes, gt_cv_socket_ipv6=no)
21   ])
22   AC_MSG_RESULT($gt_cv_socket_ipv6)
23   if test $gt_cv_socket_ipv6 = yes; then
24     AC_DEFINE(HAVE_IPV6, 1, [Define if <sys/socket.h> defines AF_INET6.])
25   fi
26 ])