2
dnl Copyright (C) 1993-2004 Free Software Foundation, Inc.
3
dnl This file is free software, distributed under the terms of the GNU
4
dnl General Public License. As a special exception to the GNU General
5
dnl Public License, this file may be distributed as part of a program
6
dnl that contains a configuration script generated by Autoconf, under
7
dnl the same distribution terms as the rest of that program.
9
dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
13
AC_DEFUN([CL_TCPCONN],
14
[CL_COMPILE_CHECK([IPv4 sockets], cl_cv_socket_ipv4,
15
[#include <sys/types.h>
16
#include <sys/socket.h>
17
#include <netinet/in.h>],
18
[int x = AF_INET; struct in_addr y; struct sockaddr_in z;],
19
AC_DEFINE(HAVE_IPV4,,[<sys/socket.h> defines AF_INET]))
20
CL_COMPILE_CHECK([IPv6 sockets], cl_cv_socket_ipv6,
21
[#include <sys/types.h>
22
#include <sys/socket.h>
23
#include <netinet/in.h>],
24
[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;],
25
AC_DEFINE(HAVE_IPV6,,[<sys/socket.h> defines AF_INET6]))
26
if test $cl_cv_socket_ipv6 = no; then
27
CL_COMPILE_CHECK([IPv6 sockets in linux/in6.h], cl_cv_socket_ipv6_linux,
28
[#include <sys/types.h>
29
#include <sys/socket.h>
30
#include <netinet/in.h>
31
#include <linux/in6.h>],
32
[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;],
33
AC_DEFINE(IPV6_NEED_LINUX_IN6_H,,[need <linux/in6.h> for the in6_addr and sockaddr_in6 types])
36
AC_CHECK_FUNCS(inet_pton inet_ntop inet_addr setsockopt getsockopt)
37
AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)dnl
38
if test $ac_cv_func_inet_addr = yes; then
39
CL_PROTO([inet_addr], [
40
for x in '' 'const'; do
41
for y in 'struct in_addr' 'unsigned long' 'unsigned int'; do
42
if test -z "$have_inet_addr"; then
47
#include <sys/types.h>
48
#include <netinet/in.h>
49
#ifdef HAVE_ARPA_INET_H
50
#include <arpa/inet.h>
53
#include <sys/socket.h>
56
], [$y inet_addr ($x char *);], [$y inet_addr();], [
57
cl_cv_proto_inet_addr_ret="$y"
58
cl_cv_proto_inet_addr_arg1="$x"
63
if test -z "$have_inet_addr"; then
64
echo "*** Missing autoconfiguration support for this platform." 1>&2
65
echo "*** Please report this as a bug to the CLISP developers." 1>&2
66
echo "*** When doing this, please also show your system's inet_addr() declaration." 1>&2
69
], [extern $cl_cv_proto_inet_addr_ret inet_addr ($cl_cv_proto_inet_addr_arg1 char*);])
70
AC_DEFINE_UNQUOTED(RET_INET_ADDR_TYPE,$cl_cv_proto_inet_addr_ret,[return type of inet_addr()])
71
AC_DEFINE_UNQUOTED(INET_ADDR_CONST,$cl_cv_proto_inet_addr_arg1,[declaration of inet_addr() needs const])
72
if test "$cl_cv_proto_inet_addr_ret" = "struct in_addr"; then
73
AC_DEFINE(INET_ADDR_SUFFIX,[.s_addr],[Define as .s_addr if the return type of inet_addr() is a struct type, as empty if it is a scalar type])
75
AC_DEFINE(INET_ADDR_SUFFIX,[])
78
AC_CHECK_HEADERS(netinet/tcp.h,,,
79
dnl AIX 4 requires <netinet/in.h> to be included before <netinet/tcp.h>.
80
[#if HAVE_NETINET_IN_H
81
#include <netinet/in.h>
84
if test $ac_cv_func_setsockopt = yes; then
85
CL_PROTO([setsockopt], [
86
for z in 'int' 'unsigned int' 'size_t'; do
87
for y in 'char*' 'void*'; do
88
for x in '' 'const'; do
89
if test -z "$have_setsockopt_decl"; then
91
#include <sys/types.h>
92
#include <sys/socket.h>
93
], [int setsockopt (int, int, int, $x $y, $z);], [int setsockopt ();], [
94
cl_cv_proto_setsockopt_const="$x"
95
cl_cv_proto_setsockopt_arg_t="$y"
96
cl_cv_proto_setsockopt_optlen_t="$z"
97
have_setsockopt_decl=1])
102
if test -z "$have_setsockopt_decl"; then
103
echo "*** Missing autoconfiguration support for this platform." 1>&2
104
echo "*** Please report this as a bug to the CLISP developers." 1>&2
105
echo "*** When doing this, please also show your system's setsockopt() declaration." 1>&2
108
], [extern int setsockopt (int, int, int, $cl_cv_proto_setsockopt_const $cl_cv_proto_setsockopt_arg_t, $cl_cv_proto_setsockopt_optlen_t);])
109
AC_DEFINE_UNQUOTED(SETSOCKOPT_CONST,$cl_cv_proto_setsockopt_const,[declaration of setsockopt() needs const])
110
AC_DEFINE_UNQUOTED(SETSOCKOPT_ARG_T,$cl_cv_proto_setsockopt_arg_t,[type of `optval' in setsockopt() declaration])
111
AC_DEFINE_UNQUOTED(SETSOCKOPT_OPTLEN_T,$cl_cv_proto_setsockopt_optlen_t,[type of `optlen' in setsockopt() declaration])