aboutsummaryrefslogtreecommitdiff
path: root/X11/xtrans/xtrans.m4
blob: d84442e86591467c9f3c27b8a10edd62d9f2c80d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
dnl
dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
dnl and/or sell copies of the Software, and to permit persons to whom the
dnl Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice (including the next
dnl paragraph) shall be included in all copies or substantial portions of the
dnl Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl

# XTRANS_TCP_FLAGS()
# ------------------
# Find needed libraries for TCP sockets, and check for IPv6 support
AC_DEFUN([XTRANS_TCP_FLAGS],[
 # SVR4 hides these in libraries other than libc
 AC_SEARCH_LIBS(socket, [socket])
 AC_SEARCH_LIBS(gethostbyname, [nsl])
 if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
   AC_HAVE_LIBRARY([ws2_32])
 fi

 # Needs to come after above checks for libsocket & libnsl for SVR4 systems
 AC_ARG_ENABLE(ipv6,
	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
	[IPV6CONN=$enableval],
	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
 AC_MSG_CHECKING([if IPv6 support should be built])
 if test "$IPV6CONN" = "yes"; then
	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
 fi
 AC_MSG_RESULT($IPV6CONN)

 # 4.3BSD-Reno added a new member to struct sockaddr_in
 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
	AC_DEFINE([BSD44SOCKETS],1,
 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
 ])

 # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
 AC_CHECK_TYPES([socklen_t], [], [], [
AC_INCLUDES_DEFAULT
#include <sys/socket.h>])

 # XPG4v2/UNIX95 added msg_control - check to see if we need to define
 # _XOPEN_SOURCE to get it (such as on Solaris)
 AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
                 [
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
                 ])
 # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
     unset ac_cv_member_struct_msghdr_msg_control
     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
     AC_CHECK_MEMBER([struct msghdr.msg_control],
                     [AC_DEFINE([_XOPEN_SOURCE], [600],
                       [Defined if needed to expose struct msghdr.msg_control])
                     ], [], [
#define _XOPEN_SOURCE 600
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
                     ])
 fi
 # If that didn't work, fall back to XPG5/UNIX98 with C89
 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
     unset ac_cv_member_struct_msghdr_msg_control
     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
     AC_CHECK_MEMBER([struct msghdr.msg_control],
                     [AC_DEFINE([_XOPEN_SOURCE], [500],
                       [Defined if needed to expose struct msghdr.msg_control])
                     ], [], [
#define _XOPEN_SOURCE 500
AC_INCLUDES_DEFAULT
#include <sys/socket.h>
                     ])
 fi


]) # XTRANS_TCP_FLAGS

# XTRANS_CONNECTION_FLAGS()
# -------------------------
# Standard checks for which Xtrans transports to use by the Xorg packages
# that use Xtrans functions
AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
 AC_REQUIRE([AC_CANONICAL_HOST])
 AC_REQUIRE([AC_TYPE_SIGNAL])
 [case $host_os in
	mingw*)	unixdef="no"   ;;
	*)	unixdef="yes"  ;;
 esac]
 AC_ARG_ENABLE(unix-transport,
	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
 AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
 if test "$UNIXCONN" = "yes"; then
	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
 fi
 AC_MSG_RESULT($UNIXCONN)
 AC_ARG_ENABLE(tcp-transport,
	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
	[TCPCONN=$enableval], [TCPCONN=yes])
 AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
 AC_MSG_RESULT($TCPCONN)
 if test "$TCPCONN" = "yes"; then
	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
	XTRANS_TCP_FLAGS
 fi
 [case $host_os in
	solaris*|sco*|sysv4*)	localdef="yes" ;;
	*)			localdef="no"  ;;
 esac]
 AC_ARG_ENABLE(local-transport,
	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
 AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
 AC_MSG_RESULT($LOCALCONN)
 if test "$LOCALCONN" = "yes"; then
	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
 fi

]) # XTRANS_CONNECTION_FLAGS


# XTRANS_SECURE_RPC_FLAGS()
# -------------------------
# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
# so that any necessary networking libraries are already found
AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
[AC_REQUIRE([XTRANS_TCP_FLAGS])
 AC_ARG_ENABLE(secure-rpc,
	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
        [SECURE_RPC=$enableval], [SECURE_RPC="try"])

 if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
	FOUND_SECURE_RPC="no"
	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
			[FOUND_SECURE_RPC="yes"])
	if test "x$FOUND_SECURE_RPC" = "xno" ; then
		if test "x$SECURE_RPC" = "xyes" ; then
	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
		fi
		SECURE_RPC="no"
	else
		dnl FreeBSD keeps getsecretkey in librpcsvc
		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
		SECURE_RPC="yes"
	fi
 fi
 AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
 if test "x$SECURE_RPC" = "xyes" ; then
	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
 fi
 AC_MSG_RESULT($SECURE_RPC)
]) # XTRANS_SECURE_RPC_FLAGS