2 Import('hostenv defines')
3 if hostenv['configure']:
4 conf = hostenv.Configure()
5 for h in ['sys/socket.h','sys/sockio.h','sys/un.h']:
6 if conf.CheckCHeader(h):
7 defines['HAVE_' + h.upper().replace('/','_').replace('.','_')] = 1
10 #include <sys/types.h>
11 #include <sys/socket.h>
12 #include <netinet/in.h>
16 struct sockaddr_in sock; sock.sin_len = sizeof(sock);
22 #include <sys/types.h>
25 #include <sys/socket.h>
30 struct sockaddr_un sunaddr;
31 sunaddr.sun_family = AF_UNIX;
36 conf.CheckFunc('gethostbyname2')
38 # The following test taken from the cvs sources
39 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
40 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
41 # libsocket.so which has a bad implementation of gethostbyname (it
42 # only looks in /etc/hosts), so we only look for -lsocket if we need
47 if not conf.CheckFunc('connect'):
48 for l in ['nsl_s','nsl','socket','inet']:
49 if conf.CheckLib(l, 'connect'):
50 connect_libs.append(l)
53 # HAVE_WORKING_AF_LOCAL
54 # FIXME: Try compiling build/tests/unixsock.c
59 hostenv.Library('socket_ipv4.c')
60 hostenv.Library('socket_ipv6.c')
61 hostenv.Library('socket_unix.c')
62 hostenv.Library('socket', ['socket.c','access.c','connect.c'])