File: sockets.m4

package info (click to toggle)
gnu-smalltalk 3.1-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,300 kB
  • ctags: 13,999
  • sloc: ansic: 88,106; sh: 23,223; asm: 7,889; perl: 4,493; cpp: 3,539; awk: 1,483; yacc: 1,355; xml: 1,272; makefile: 1,192; lex: 843; sed: 258; objc: 124
file content (41 lines) | stat: -rw-r--r-- 1,483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
dnl I'd like this to be edited in -*- Autoconf -*- mode...
dnl
AC_DEFUN([GST_SOCKETS], [

AC_SEARCH_LIBS(listen, socket, [], [
    dnl Check for listen on MinGW. We need to include <winsock2.h>
    dnl to get the correct __stdcall name decoration
    AC_MSG_CHECKING([For listen in -lws2_32])
    OLD_LIBS="$LIBS"
    LIBS="-lws2_32 $LIBS"
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],[[listen(0,0);]])],
                   [ac_cv_lib_ws2_32_listen=yes
                    AC_MSG_RESULT(yes)],
                   [LIBS="$OLD_LIBS"
                    AC_MSG_RESULT(no)])])
AC_SEARCH_LIBS(gethostbyname, nsl)

gst_cv_sockets=yes
AC_CHECK_FUNC(socket, , gst_cv_sockets=no)
AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h, , gst_cv_sockets=no)
AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo], [], [],
	       [#include <netdb.h>])
AC_CHECK_MEMBER([struct addrinfo.ai_family],
		[AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
			   [Define if your system's netdb.h has struct addrinfo])], [],
	        [#include <netdb.h>])

dnl This is wrong for Windows, but anyway Windows does not have sa_len
AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])

if test "$ac_cv_lib_ws2_32_listen" = "yes"; then
    gst_cv_sockets=yes
fi
if test $gst_cv_sockets = yes; then
  GST_SOCKET_FAMILIES
  AC_CHECK_FUNCS(getipnodebyaddr)
  AC_REPLACE_FUNCS(getaddrinfo inet_ntop)
  AC_DEFINE(HAVE_SOCKETS, 1, [Define if your system has sockets.])
fi

])dnl