2 dnl Copyright (C) 2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
11 if test $HAVE_WINSOCK2_H = 1; then
12 dnl Native Windows API (not Cygwin).
13 AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
14 [gl_cv_func_wsastartup], [
18 #ifdef HAVE_WINSOCK2_H
19 # include <winsock2.h>
21 WORD wVersionRequested = MAKEWORD(1, 1);
23 int err = WSAStartup(wVersionRequested, &wsaData);
25 gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
28 if test "$gl_cv_func_wsastartup" = "yes"; then
29 AC_DEFINE([WINDOWS_SOCKETS], 1, [Define if WSAStartup is needed.])
34 dnl Solaris has most socket functions in libsocket.
35 dnl Haiku has most socket functions in libnetwork.
36 dnl BeOS has most socket functions in libnet.
37 AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
43 char setsockopt();], [setsockopt();],
46 LIBS="$gl_save_LIBS -lsocket"
51 char setsockopt();], [setsockopt();],
52 [gl_cv_lib_socket="-lsocket"])
53 if test -z "$gl_cv_lib_socket"; then
54 LIBS="$gl_save_LIBS -lnetwork"
59 char setsockopt();], [setsockopt();],
60 [gl_cv_lib_socket="-lnetwork"])
61 if test -z "$gl_cv_lib_socket"; then
62 LIBS="$gl_save_LIBS -lnet"
67 char setsockopt();], [setsockopt();],
68 [gl_cv_lib_socket="-lnet"])
73 if test -z "$gl_cv_lib_socket"; then
74 gl_cv_lib_socket="none needed"
77 if test "$gl_cv_lib_socket" != "none needed"; then
78 LIBSOCKET="$gl_cv_lib_socket"
85 # Prerequisites of lib/sockets.c.
86 AC_DEFUN([gl_PREREQ_SOCKETS], [