1 AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/un.h)
6 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
7 AC_TRY_COMPILE([#include <sys/types.h>
8 #include <sys/socket.h>
9 #include <netinet/in.h>],
10 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
11 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
12 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
13 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
16 # The following test taken from the cvs sources
17 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
18 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
19 # libsocket.so which has a bad implementation of gethostbyname (it
20 # only looks in /etc/hosts), so we only look for -lsocket if we need
22 AC_CHECK_FUNCS(connect)
23 if test x"$ac_cv_func_connect" = x"no"; then
24 AC_CHECK_LIB_EXT(nsl_s, SOCKET_LIBS, connect)
25 AC_CHECK_LIB_EXT(nsl, SOCKET_LIBS, connect)
26 AC_CHECK_LIB_EXT(socket, SOCKET_LIBS, connect)
27 AC_CHECK_LIB_EXT(inet, SOCKET_LIBS, connect)
28 SMB_ENABLE(EXT_SOCKET,YES)
29 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
31 if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" ||
32 test x"$ac_cv_lib_ext_nsl_connect" = x"yes" ||
33 test x"$ac_cv_lib_ext_socket_connect" = x"yes" ||
34 test x"$ac_cv_lib_ext_inet_connect" = x"yes"; then
35 AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
37 AC_MSG_ERROR([no connect() function available!])
41 SMB_EXT_LIB(EXT_SOCKET,[${SOCKET_LIBS}],[${SOCKET_CFLAGS}],[${SOCKET_CPPFLAGS}],[${SOCKET_LDFLAGS}])
43 AC_CHECK_FUNCS(gethostbyname)
44 if test x"$ac_cv_func_gethostbyname" = x"no"; then
45 AC_CHECK_LIB_EXT(nsl_s, NSL_LIBS, gethostbyname)
46 AC_CHECK_LIB_EXT(nsl, NSl_LIBS, gethostbyname)
47 AC_CHECK_LIB_EXT(socket, NSL_LIBS, gethostbyname)
48 SMB_ENABLE(EXT_NSL,YES)
49 dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here, because the value
51 if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" != x"yes" &&
52 test x"$ac_cv_lib_ext_nsl_gethostbyname" != x"yes" &&
53 test x"$ac_cv_lib_ext_socket_gethostbyname" != x"yes"; then
54 AC_MSG_ERROR([no gethostbyname() function available!])
58 SMB_EXT_LIB(EXT_NSL,[${NSL_LIBS}],[],[],[])
60 ############################################
61 # check for unix domain sockets
62 AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
64 #include <sys/types.h>
67 #include <sys/socket.h>
70 struct sockaddr_un sunaddr;
71 sunaddr.sun_family = AF_UNIX;
73 samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
74 SMB_ENABLE(socket_unix, NO)
75 if test x"$samba_cv_unixsocket" = x"yes"; then
76 SMB_ENABLE(socket_unix, YES)
77 AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
80 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
81 AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
82 samba_cv_HAVE_WORKING_AF_LOCAL=yes,
83 samba_cv_HAVE_WORKING_AF_LOCAL=no,
84 samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
85 if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
87 AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
90 dnl test for ipv6 using the gethostbyname2() function. That should be sufficient
92 AC_CHECK_FUNCS(gethostbyname2, have_ipv6=true, have_ipv6=false)
93 SMB_ENABLE(socket_ipv6, NO)
94 if $have_ipv6 = true; then
95 SMB_ENABLE(socket_ipv6, YES)
96 AC_DEFINE(HAVE_SOCKET_IPV6,1,[Whether the system has ipv6 support])
98 dnl don't build ipv6 by default, unless the above test enables it, or
99 dnl the configure uses --with-static-modules=socket_ipv6
101 AC_CHECK_HEADERS(arpa/inet.h net/if.h netdb.h netinet/in.h sys/time.h)
102 AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
106 # look for a method of finding the list of network interfaces
108 # This tests need LIBS="$NSL_LIBS $SOCKET_LIBS"
111 LIBS="$NSL_LIBS $SOCKET_LIBS"
113 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
115 #define HAVE_IFACE_AIX 1
116 #define AUTOCONF_TEST 1
117 #include "confdefs.h"
118 #include "${srcdir-.}/lib/socket/netif.c"],
119 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
120 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
121 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
124 if test $iface = no; then
125 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
127 #define HAVE_IFACE_IFCONF 1
128 #define AUTOCONF_TEST 1
129 #include "confdefs.h"
130 #include "${srcdir-.}/lib/socket/netif.c"],
131 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
132 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
133 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
137 if test $iface = no; then
138 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
140 #define HAVE_IFACE_IFREQ 1
141 #define AUTOCONF_TEST 1
142 #include "confdefs.h"
143 #include "${srcdir-.}/lib/socket/netif.c"],
144 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
145 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
146 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])