summaryrefslogtreecommitdiffstats
path: root/gl/m4/sockets.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/sockets.m4')
-rw-r--r--gl/m4/sockets.m479
1 files changed, 3 insertions, 76 deletions
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
index aefb936..b407391 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,5 +1,5 @@
1# sockets.m4 serial 6 1# sockets.m4 serial 7
2dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,80 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_SOCKETS], 7AC_DEFUN([gl_SOCKETS],
8[ 8[
9 AC_REQUIRE([AC_C_INLINE]) 9 AC_REQUIRE([AC_C_INLINE])
10 10 AC_REQUIRE([gl_SOCKETLIB])
11 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
12 LIBSOCKET=
13 if test $HAVE_WINSOCK2_H = 1; then
14 dnl Native Windows API (not Cygwin).
15 AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
16 [gl_cv_func_wsastartup], [
17 gl_save_LIBS="$LIBS"
18 LIBS="$LIBS -lws2_32"
19 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
20#ifdef HAVE_WINSOCK2_H
21# include <winsock2.h>
22#endif]], [[
23 WORD wVersionRequested = MAKEWORD(1, 1);
24 WSADATA wsaData;
25 int err = WSAStartup(wVersionRequested, &wsaData);
26 WSACleanup ();]])],
27 gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
28 LIBS="$gl_save_LIBS"
29 ])
30 if test "$gl_cv_func_wsastartup" = "yes"; then
31 AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
32 LIBSOCKET='-lws2_32'
33 fi
34 else
35 dnl Unix API.
36 dnl Solaris has most socket functions in libsocket.
37 dnl Haiku has most socket functions in libnetwork.
38 dnl BeOS has most socket functions in libnet.
39 AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
40 gl_cv_lib_socket=
41 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
42#ifdef __cplusplus
43"C"
44#endif
45char setsockopt();]], [[setsockopt();]])],
46 [],
47 [gl_save_LIBS="$LIBS"
48 LIBS="$gl_save_LIBS -lsocket"
49 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
50#ifdef __cplusplus
51"C"
52#endif
53char setsockopt();]], [[setsockopt();]])],
54 [gl_cv_lib_socket="-lsocket"])
55 if test -z "$gl_cv_lib_socket"; then
56 LIBS="$gl_save_LIBS -lnetwork"
57 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
58#ifdef __cplusplus
59"C"
60#endif
61char setsockopt();]], [[setsockopt();]])],
62 [gl_cv_lib_socket="-lnetwork"])
63 if test -z "$gl_cv_lib_socket"; then
64 LIBS="$gl_save_LIBS -lnet"
65 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
66#ifdef __cplusplus
67"C"
68#endif
69char setsockopt();]], [[setsockopt();]])],
70 [gl_cv_lib_socket="-lnet"])
71 fi
72 fi
73 LIBS="$gl_save_LIBS"
74 ])
75 if test -z "$gl_cv_lib_socket"; then
76 gl_cv_lib_socket="none needed"
77 fi
78 ])
79 if test "$gl_cv_lib_socket" != "none needed"; then
80 LIBSOCKET="$gl_cv_lib_socket"
81 fi
82 fi
83 AC_SUBST([LIBSOCKET])
84 gl_PREREQ_SOCKETS 11 gl_PREREQ_SOCKETS
85]) 12])
86 13