xtrans.m4 revision 73143b9a
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
36 # Needs to come after above checks for libsocket & libnsl for SVR4 systems
37 AC_ARG_ENABLE(ipv6, 
38	AC_HELP_STRING([--enable-IPv6],[Enable IPv6 support]),
39	[IPV6CONN=$enableval], 
40	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
41 AC_MSG_CHECKING([if IPv6 support should be built])
42 if test "$IPV6CONN" = "yes"; then
43	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
44 fi
45 AC_MSG_RESULT($IPV6CONN)
46
47 # 4.3BSD-Reno added a new member to struct sockaddr_in
48 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 
49	AC_DEFINE([BSD44SOCKETS],1,
50 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
51#include <sys/types.h>
52#include <sys/socket.h>
53#include <netinet/in.h>
54 ])
55
56 # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
57 AC_CHECK_TYPES([socklen_t], [], [], [
58AC_INCLUDES_DEFAULT
59#include <sys/socket.h>])
60 
61]) # XTRANS_TCP_FLAGS
62
63# XTRANS_CONNECTION_FLAGS()
64# -------------------------
65# Standard checks for which Xtrans transports to use by the Xorg packages
66# that use Xtrans functions
67AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
68 AC_REQUIRE([AC_CANONICAL_HOST])
69 AC_REQUIRE([AC_TYPE_SIGNAL])
70 [case $host_os in
71	mingw*)	unixdef="no"   ;;
72	*)	unixdef="yes"  ;;
73 esac]
74 AC_ARG_ENABLE(unix-transport,
75	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
76	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
77 AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
78 if test "$UNIXCONN" = "yes"; then
79	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
80 fi
81 AC_MSG_RESULT($UNIXCONN)
82 AC_ARG_ENABLE(tcp-transport, 
83	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
84	[TCPCONN=$enableval], [TCPCONN=yes])
85 AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
86 AC_MSG_RESULT($TCPCONN)
87 if test "$TCPCONN" = "yes"; then
88	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
89	XTRANS_TCP_FLAGS
90 fi
91 [case $host_os in
92	solaris*|sco*|sysv4*)	localdef="yes" ;;
93	*)			localdef="no"  ;;
94 esac]
95 AC_ARG_ENABLE(local-transport,
96	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
97	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
98 AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
99 AC_MSG_RESULT($LOCALCONN)
100 if test "$LOCALCONN" = "yes"; then
101	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
102 fi
103 
104]) # XTRANS_CONNECTION_FLAGS
105
106
107# XTRANS_SECURE_RPC_FLAGS()
108# -------------------------
109# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
110# so that any necessary networking libraries are already found
111AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
112[AC_REQUIRE([XTRANS_TCP_FLAGS])
113 AC_ARG_ENABLE(secure-rpc, 
114	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
115        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
116
117 if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
118	FOUND_SECURE_RPC="no"
119	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
120			[FOUND_SECURE_RPC="yes"])
121	if test "x$FOUND_SECURE_RPC" = "xno" ; then
122		if test "x$SECURE_RPC" = "xyes" ; then
123	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
124		fi	
125		SECURE_RPC="no"
126	else
127		dnl FreeBSD keeps getsecretkey in librpcsvc
128		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
129		SECURE_RPC="yes"
130	fi
131 fi
132 AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
133 if test "x$SECURE_RPC" = "xyes" ; then
134	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
135 fi
136 AC_MSG_RESULT($SECURE_RPC)
137]) # XTRANS_SECURE_RPC_FLAGS
138
139