upload tizen2.0 source
[framework/uifw/xorg/lib/xtrans.git] / xtrans.m4
1 dnl
2 dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3 dnl
4 dnl Permission is hereby granted, free of charge, to any person obtaining a
5 dnl copy of this software and associated documentation files (the "Software"),
6 dnl to deal in the Software without restriction, including without limitation
7 dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 dnl and/or sell copies of the Software, and to permit persons to whom the
9 dnl Software is furnished to do so, subject to the following conditions:
10 dnl
11 dnl The above copyright notice and this permission notice (including the next
12 dnl paragraph) shall be included in all copies or substantial portions of the
13 dnl Software.
14 dnl
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 dnl DEALINGS IN THE SOFTWARE.
22 dnl
23
24 # XTRANS_TCP_FLAGS()
25 # ------------------
26 # Find needed libraries for TCP sockets, and check for IPv6 support
27 AC_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_HAVE_LIBRARY([ws2_32])
33  fi
34
35  # Needs to come after above checks for libsocket & libnsl for SVR4 systems
36  AC_ARG_ENABLE(ipv6,
37         AC_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], [], [], [
57 AC_INCLUDES_DEFAULT
58 #include <sys/socket.h>])
59
60 ]) # XTRANS_TCP_FLAGS
61
62 # XTRANS_CONNECTION_FLAGS()
63 # -------------------------
64 # Standard checks for which Xtrans transports to use by the Xorg packages
65 # that use Xtrans functions
66 AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
67  AC_REQUIRE([AC_CANONICAL_HOST])
68  AC_REQUIRE([AC_TYPE_SIGNAL])
69  [case $host_os in
70         mingw*) unixdef="no"   ;;
71         *)      unixdef="yes"  ;;
72  esac]
73  AC_ARG_ENABLE(unix-transport,
74         AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
75         [UNIXCONN=$enableval], [UNIXCONN=$unixdef])
76  AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
77  if test "$UNIXCONN" = "yes"; then
78         AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
79  fi
80  AC_MSG_RESULT($UNIXCONN)
81  AC_ARG_ENABLE(tcp-transport,
82         AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
83         [TCPCONN=$enableval], [TCPCONN=yes])
84  AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
85  AC_MSG_RESULT($TCPCONN)
86  if test "$TCPCONN" = "yes"; then
87         AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
88         XTRANS_TCP_FLAGS
89  fi
90  [case $host_os in
91         solaris*|sco*|sysv4*)   localdef="yes" ;;
92         *)                      localdef="no"  ;;
93  esac]
94  AC_ARG_ENABLE(local-transport,
95         AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
96         [LOCALCONN=$enableval], [LOCALCONN=$localdef])
97  AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
98  AC_MSG_RESULT($LOCALCONN)
99  if test "$LOCALCONN" = "yes"; then
100         AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
101  fi
102
103 ]) # XTRANS_CONNECTION_FLAGS
104
105
106 # XTRANS_SECURE_RPC_FLAGS()
107 # -------------------------
108 # Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
109 # so that any necessary networking libraries are already found
110 AC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
111 [AC_REQUIRE([XTRANS_TCP_FLAGS])
112  AC_ARG_ENABLE(secure-rpc,
113         AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
114         [SECURE_RPC=$enableval], [SECURE_RPC="try"])
115
116  if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
117         FOUND_SECURE_RPC="no"
118         AC_CHECK_FUNCS([authdes_seccreate authdes_create],
119                         [FOUND_SECURE_RPC="yes"])
120         if test "x$FOUND_SECURE_RPC" = "xno" ; then
121                 if test "x$SECURE_RPC" = "xyes" ; then
122         AC_MSG_ERROR([Secure RPC requested, but required functions not found])
123                 fi
124                 SECURE_RPC="no"
125         else
126                 dnl FreeBSD keeps getsecretkey in librpcsvc
127                 AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
128                 SECURE_RPC="yes"
129         fi
130  fi
131  AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
132  if test "x$SECURE_RPC" = "xyes" ; then
133         AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
134  fi
135  AC_MSG_RESULT($SECURE_RPC)
136 ]) # XTRANS_SECURE_RPC_FLAGS
137