xtrans.m4 revision e45ace2b
1dnl
2dnl Copyright (c) 2005, Oracle and/or its affiliates.
3dnl
4dnl Permission is hereby granted, free of charge, to any person obtaining a
5dnl copy of this software and associated documentation files (the "Software"),
6dnl to deal in the Software without restriction, including without limitation
7dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
8dnl and/or sell copies of the Software, and to permit persons to whom the
9dnl Software is furnished to do so, subject to the following conditions:
10dnl
11dnl The above copyright notice and this permission notice (including the next
12dnl paragraph) shall be included in all copies or substantial portions of the
13dnl Software.
14dnl
15dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21dnl DEALINGS IN THE SOFTWARE.
22dnl
23
24# XTRANS_TCP_FLAGS()
25# ------------------
26# Find needed libraries for TCP sockets, and check for IPv6 support
27AC_DEFUN([XTRANS_TCP_FLAGS],[
28 # SVR4 hides these in libraries other than libc
29 AC_SEARCH_LIBS(socket, [socket])
30 AC_SEARCH_LIBS(gethostbyname, [nsl])
31 if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
32   AC_CHECK_LIB([ws2_32],[main])
33 fi
34
35 # Needs to come after above checks for libsocket & libnsl for SVR4 systems
36 AC_ARG_ENABLE(ipv6,
37	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
38	[IPV6CONN=$enableval],
39	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
40 AC_MSG_CHECKING([if IPv6 support should be built])
41 if test "$IPV6CONN" = "yes"; then
42	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
43 fi
44 AC_MSG_RESULT($IPV6CONN)
45
46 # 4.3BSD-Reno added a new member to struct sockaddr_in
47 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
48	AC_DEFINE([BSD44SOCKETS],1,
49 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
50#include <sys/types.h>
51#include <sys/socket.h>
52#include <netinet/in.h>
53 ])
54
55 # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
56 AC_CHECK_TYPES([socklen_t], [], [], [
57AC_INCLUDES_DEFAULT
58#include <sys/socket.h>])
59
60 # XPG4v2/UNIX95 added msg_control - check to see if we need to define
61 # _XOPEN_SOURCE to get it (such as on Solaris)
62 AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
63                 [
64AC_INCLUDES_DEFAULT
65#include <sys/socket.h>
66                 ])
67 # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
68 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
69     unset ac_cv_member_struct_msghdr_msg_control
70     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
71     AC_CHECK_MEMBER([struct msghdr.msg_control],
72                     [AC_DEFINE([_XOPEN_SOURCE], [600],
73                       [Defined if needed to expose struct msghdr.msg_control])
74                     ], [], [
75#define _XOPEN_SOURCE 600
76AC_INCLUDES_DEFAULT
77#include <sys/socket.h>
78                     ])
79 fi
80 # If that didn't work, fall back to XPG5/UNIX98 with C89
81 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
82     unset ac_cv_member_struct_msghdr_msg_control
83     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
84     AC_CHECK_MEMBER([struct msghdr.msg_control],
85                     [AC_DEFINE([_XOPEN_SOURCE], [500],
86                       [Defined if needed to expose struct msghdr.msg_control])
87                     ], [], [
88#define _XOPEN_SOURCE 500
89AC_INCLUDES_DEFAULT
90#include <sys/socket.h>
91                     ])
92 fi
93
94
95]) # XTRANS_TCP_FLAGS
96
97# XTRANS_CONNECTION_FLAGS()
98# -------------------------
99# Standard checks for which Xtrans transports to use by the Xorg packages
100# that use Xtrans functions
101AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
102 AC_REQUIRE([AC_CANONICAL_HOST])
103 [case $host_os in
104	mingw*)	unixdef="no"   ;;
105	*)	unixdef="yes"  ;;
106 esac]
107 AC_ARG_ENABLE(unix-transport,
108	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
109	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
110 AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
111 if test "$UNIXCONN" = "yes"; then
112	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
113 fi
114 AC_MSG_RESULT($UNIXCONN)
115 AC_ARG_ENABLE(tcp-transport,
116	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
117	[TCPCONN=$enableval], [TCPCONN=yes])
118 AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
119 AC_MSG_RESULT($TCPCONN)
120 if test "$TCPCONN" = "yes"; then
121	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
122	XTRANS_TCP_FLAGS
123 fi
124 [case $host_os in
125	solaris*)		localdef="yes" ;;
126	*)			localdef="no"  ;;
127 esac]
128 AC_ARG_ENABLE(local-transport,
129	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
130	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
131 AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
132 AC_MSG_RESULT($LOCALCONN)
133 if test "$LOCALCONN" = "yes"; then
134	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
135 fi
136
137 # Other functions Xtrans may need
138 AC_CHECK_FUNCS([strcasecmp strlcpy])
139
140]) # XTRANS_CONNECTION_FLAGS
141
142
143# XTRANS_SECURE_RPC_FLAGS()
144# -------------------------
145# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
146# so that any necessary networking libraries are already found
147AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
148[AC_REQUIRE([XTRANS_TCP_FLAGS])
149 AC_ARG_ENABLE(secure-rpc,
150	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
151        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
152
153 if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
154	FOUND_SECURE_RPC="no"
155	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
156			[FOUND_SECURE_RPC="yes"])
157	if test "x$FOUND_SECURE_RPC" = "xno" ; then
158		if test "x$SECURE_RPC" = "xyes" ; then
159	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
160		fi
161		SECURE_RPC="no"
162	else
163		dnl FreeBSD keeps getsecretkey in librpcsvc
164		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
165		SECURE_RPC="yes"
166	fi
167 fi
168 AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
169 if test "x$SECURE_RPC" = "xyes" ; then
170	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
171 fi
172 AC_MSG_RESULT($SECURE_RPC)
173]) # XTRANS_SECURE_RPC_FLAGS
174
175