Mercurial > hg > octave-jordi > gnulib-hg
annotate m4/sockets.m4 @ 11386:23f58a4ffca0
Followup to 2008-12-22: Remove unnecessary AC_FUNC_MBRTOWC invocations.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 10 Mar 2009 01:19:40 +0100 |
parents | de8c1000fcee |
children | 56ceeef91c22 |
rev | line source |
---|---|
11156
de8c1000fcee
sockets: Call AC_C_INLINE.
Simon Josefsson <simon@josefsson.org>
parents:
11007
diff
changeset
|
1 # sockets.m4 serial 5 |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
10819
diff
changeset
|
2 dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
9642 | 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. | |
6 | |
7 AC_DEFUN([gl_SOCKETS], | |
8 [ | |
11156
de8c1000fcee
sockets: Call AC_C_INLINE.
Simon Josefsson <simon@josefsson.org>
parents:
11007
diff
changeset
|
9 AC_REQUIRE([AC_C_INLINE]) |
de8c1000fcee
sockets: Call AC_C_INLINE.
Simon Josefsson <simon@josefsson.org>
parents:
11007
diff
changeset
|
10 |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
11 gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
12 LIBSOCKET= |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
13 if test $HAVE_WINSOCK2_H = 1; then |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
14 dnl Native Windows API (not Cygwin). |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
15 AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
16 [gl_cv_func_wsastartup], [ |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
17 gl_save_LIBS="$LIBS" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
18 LIBS="$LIBS -lws2_32" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
19 AC_TRY_LINK([ |
9642 | 20 #ifdef HAVE_WINSOCK2_H |
21 # include <winsock2.h> | |
22 #endif], [ | |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
23 WORD wVersionRequested = MAKEWORD(1, 1); |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
24 WSADATA wsaData; |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
25 int err = WSAStartup(wVersionRequested, &wsaData); |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
26 WSACleanup ();], |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
27 gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
28 LIBS="$gl_save_LIBS" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
29 ]) |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
30 if test "$gl_cv_func_wsastartup" = "yes"; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
10819
diff
changeset
|
31 AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
32 LIBSOCKET='-lws2_32' |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
33 fi |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
34 else |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
35 dnl Unix API. |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
36 dnl Solaris has most socket functions in libsocket. |
10819
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
37 dnl Haiku has most socket functions in libnetwork. |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
38 dnl BeOS has most socket functions in libnet. |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
39 AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
40 gl_cv_lib_socket= |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
41 AC_TRY_LINK([extern |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
42 #ifdef __cplusplus |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
43 "C" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
44 #endif |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
45 char setsockopt();], [setsockopt();], |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
46 [], |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
47 [gl_save_LIBS="$LIBS" |
10819
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
48 LIBS="$gl_save_LIBS -lsocket" |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
49 AC_TRY_LINK([extern |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
50 #ifdef __cplusplus |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
51 "C" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
52 #endif |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
53 char setsockopt();], [setsockopt();], |
10819
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
54 [gl_cv_lib_socket="-lsocket"]) |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
55 if test -z "$gl_cv_lib_socket"; then |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
56 LIBS="$gl_save_LIBS -lnetwork" |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
57 AC_TRY_LINK([extern |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
58 #ifdef __cplusplus |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
59 "C" |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
60 #endif |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
61 char setsockopt();], [setsockopt();], |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
62 [gl_cv_lib_socket="-lnetwork"]) |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
63 if test -z "$gl_cv_lib_socket"; then |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
64 LIBS="$gl_save_LIBS -lnet" |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
65 AC_TRY_LINK([extern |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
66 #ifdef __cplusplus |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
67 "C" |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
68 #endif |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
69 char setsockopt();], [setsockopt();], |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
70 [gl_cv_lib_socket="-lnet"]) |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
71 fi |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
72 fi |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
73 LIBS="$gl_save_LIBS" |
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
74 ]) |
10819
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
75 if test -z "$gl_cv_lib_socket"; then |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
76 gl_cv_lib_socket="none needed" |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
77 fi |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
78 ]) |
10819
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
79 if test "$gl_cv_lib_socket" != "none needed"; then |
bb8ef9cffa38
Add support for Haiku and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
10537
diff
changeset
|
80 LIBSOCKET="$gl_cv_lib_socket" |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
81 fi |
9642 | 82 fi |
10537
b7e56ec1bd65
Set LIBSOCKET instead of augmenting LIBS. Also handle Solaris -lsocket.
Bruno Haible <bruno@clisp.org>
parents:
9642
diff
changeset
|
83 AC_SUBST([LIBSOCKET]) |
9642 | 84 gl_PREREQ_SOCKETS |
85 ]) | |
86 | |
87 # Prerequisites of lib/sockets.c. | |
88 AC_DEFUN([gl_PREREQ_SOCKETS], [ | |
89 : | |
90 ]) |