xtrans.m4 revision b53e5eea
1dnl $XdotOrg: lib/xtrans/xtrans.m4,v 1.6 2005/07/26 18:59:11 alanc Exp $
2dnl
3dnl Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
4dnl 
5dnl Permission to use, copy, modify, distribute, and sell this software and its
6dnl documentation for any purpose is hereby granted without fee, provided that
7dnl the above copyright notice appear in all copies and that both that
8dnl copyright notice and this permission notice appear in supporting
9dnl documentation.
10dnl 
11dnl The above copyright notice and this permission notice shall be included
12dnl in all copies or substantial portions of the Software.
13dnl 
14dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20dnl OTHER DEALINGS IN THE SOFTWARE.
21dnl 
22dnl Except as contained in this notice, the name of the copyright holders shall
23dnl not be used in advertising or otherwise to promote the sale, use or
24dnl other dealings in this Software without prior written authorization
25dnl from the copyright holders.
26dnl 
27
28# XTRANS_TCP_FLAGS()
29# ------------------
30# Find needed libraries for TCP sockets, and check for IPv6 support
31AC_DEFUN([XTRANS_TCP_FLAGS],[
32 # SVR4 hides these in libraries other than libc
33 AC_SEARCH_LIBS(socket, [socket])
34 AC_SEARCH_LIBS(gethostbyname, [nsl])
35 if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
36   AC_HAVE_LIBRARY([ws2_32])
37 fi
38
39 # Needs to come after above checks for libsocket & libnsl for SVR4 systems
40 AC_ARG_ENABLE(ipv6, 
41	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
42	[IPV6CONN=$enableval], 
43	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
44 AC_MSG_CHECKING([if IPv6 support should be built])
45 if test "$IPV6CONN" = "yes"; then
46	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
47 fi
48 AC_MSG_RESULT($IPV6CONN)
49
50 # 4.3BSD-Reno added a new member to struct sockaddr_in
51 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 
52	AC_DEFINE([BSD44SOCKETS],1,
53 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
54#include <sys/types.h>
55#include <sys/socket.h>
56#include <netinet/in.h>
57 ])
58
59 # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
60 AC_CHECK_TYPES([socklen_t], [], [], [
61AC_INCLUDES_DEFAULT
62#include <sys/socket.h>])
63 
64]) # XTRANS_TCP_FLAGS
65
66# XTRANS_CONNECTION_FLAGS()
67# -------------------------
68# Standard checks for which Xtrans transports to use by the Xorg packages
69# that use Xtrans functions
70AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
71 AC_REQUIRE([AC_CANONICAL_HOST])
72 AC_REQUIRE([AC_TYPE_SIGNAL])
73 [case $host_os in
74	mingw*)	unixdef="no"   ;;
75	*)	unixdef="yes"  ;;
76 esac]
77 AC_ARG_ENABLE(unix-transport,
78	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
79	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
80 AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
81 if test "$UNIXCONN" = "yes"; then
82	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
83 fi
84 AC_MSG_RESULT($UNIXCONN)
85 AC_ARG_ENABLE(tcp-transport, 
86	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
87	[TCPCONN=$enableval], [TCPCONN=yes])
88 AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
89 AC_MSG_RESULT($TCPCONN)
90 if test "$TCPCONN" = "yes"; then
91	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
92	XTRANS_TCP_FLAGS
93 fi
94 [case $host_os in
95	solaris*|sco*|sysv4*)	localdef="yes" ;;
96	*)			localdef="no"  ;;
97 esac]
98 AC_ARG_ENABLE(local-transport,
99	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
100	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
101 AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
102 AC_MSG_RESULT($LOCALCONN)
103 if test "$LOCALCONN" = "yes"; then
104	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
105 fi
106 
107]) # XTRANS_CONNECTION_FLAGS
108
109
110# XTRANS_SECURE_RPC_FLAGS()
111# -------------------------
112# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
113# so that any necessary networking libraries are already found
114AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
115[AC_REQUIRE([XTRANS_TCP_FLAGS])
116 AC_ARG_ENABLE(secure-rpc, 
117	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
118        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
119
120 if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
121	FOUND_SECURE_RPC="no"
122	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
123			[FOUND_SECURE_RPC="yes"])
124	if test "x$FOUND_SECURE_RPC" = "xno" ; then
125		if test "x$SECURE_RPC" = "xyes" ; then
126	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
127		fi	
128		SECURE_RPC="no"
129	else
130		dnl FreeBSD keeps getsecretkey in librpcsvc
131		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
132		SECURE_RPC="yes"
133	fi
134 fi
135 AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
136 if test "x$SECURE_RPC" = "xyes" ; then
137	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
138 fi
139 AC_MSG_RESULT($SECURE_RPC)
140]) # XTRANS_SECURE_RPC_FLAGS
141
142