1dnl Process this file with autoconf to produce a configure script.
2
3# Initialize Autoconf
4AC_PREREQ([2.60])
5AC_INIT([libxcb],[1.17.0],
6        [https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues],
7        [libxcb])
8AC_CONFIG_AUX_DIR([build-aux])
9AC_CONFIG_MACRO_DIR([m4])
10AC_CONFIG_SRCDIR([xcb.pc.in])
11AC_CONFIG_HEADERS([src/config.h])
12
13# Initialize Automake
14AM_INIT_AUTOMAKE([foreign dist-xz])
15AM_PATH_PYTHON([3.0])
16
17# Set common system defines for POSIX extensions, such as _GNU_SOURCE
18# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
19# to avoid autoconf errors.
20AC_USE_SYSTEM_EXTENSIONS
21AC_SYS_LARGEFILE
22
23# Initialize libtool
24LT_PREREQ([2.2])
25LT_INIT([win32-dll])
26
27# Require xorg-macros minimum of 1.18 - Initial version
28m4_ifndef([XORG_MACROS_VERSION],
29          [m4_fatal([must install xorg-macros 1.18 or later before running autoconf/autogen])])
30XORG_MACROS_VERSION(1.18)
31XORG_DEFAULT_OPTIONS
32XORG_ENABLE_DEVEL_DOCS
33XORG_WITH_DOXYGEN
34
35# The dot drawing tool is checked by XORG_WITH_DOXYGEN, needed for xcb manual
36if test x"$HAVE_DOT" = xno; then
37    AC_MSG_WARN([dot not found - doxygen targets will be skipped])
38fi
39
40PKG_CHECK_MODULES(CHECK, [check >= 0.9.6], [HAVE_CHECK=yes], [HAVE_CHECK=no])
41AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes)
42
43XSLTPROC=no
44HTML_CHECK_RESULT=no
45if test x"$HAVE_CHECK" = xyes; then
46        AC_PATH_PROG(XSLTPROC, xsltproc, no)
47        if test x"$XSLTPROC" != xno; then
48                HTML_CHECK_RESULT=yes
49        fi
50fi
51AC_SUBST(HTML_CHECK_RESULT)
52
53# Checks for pkg-config packages
54PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.17.0)
55NEEDED="xau >= 0.99.2"
56case $host_os in
57linux*|darwin*|solaris*|dragonfly*|freebsd*|netbsd*) ;;
58     *) NEEDED="$NEEDED pthread-stubs" ;;
59esac
60PKG_CHECK_MODULES(NEEDED, $NEEDED)
61
62have_xdmcp="no"
63PKG_CHECK_MODULES(XDMCP, xdmcp,
64        AC_CHECK_LIB(Xdmcp, XdmcpWrap,
65                [
66                AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols])
67                NEEDED="$NEEDED xdmcp"
68                have_xdmcp="yes"
69                ],
70                [
71                XDMCP_CFLAGS=
72                XDMCP_LIBS=
73                ], [$XDMCP_LIBS]),
74        [AC_MSG_RESULT(no)])
75
76AC_SUBST(NEEDED)
77
78# Find the xcb-proto protocol descriptions
79AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
80XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
81AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
82AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
83
84# Find the xcb-proto version
85XCBPROTO_VERSION=`$PKG_CONFIG --modversion xcb-proto`
86AC_SUBST(XCBPROTO_VERSION)
87
88# Find the xcbgen Python package
89AC_MSG_CHECKING(XCBPROTO_XCBPYTHONDIR)
90XCBPROTO_XCBPYTHONDIR=`$PKG_CONFIG --variable=pythondir xcb-proto`
91AC_MSG_RESULT($XCBPROTO_XCBPYTHONDIR)
92AC_SUBST(XCBPROTO_XCBPYTHONDIR)
93
94AC_SEARCH_LIBS(getaddrinfo, socket)
95AC_SEARCH_LIBS(connect, socket)
96
97# Find support for sending a message from a socket
98AC_SEARCH_LIBS(sendmsg, socket, [have_sendmsg="yes"], [have_sendmsg="no"])
99
100# XPG4v2/UNIX95 added msg_control - check to see if we need to define
101# _XOPEN_SOURCE to get it (such as on Solaris)
102AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
103                 [
104AC_INCLUDES_DEFAULT
105#include <sys/socket.h>
106                 ])
107# First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
108if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
109    unset ac_cv_member_struct_msghdr_msg_control
110    AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
111    AC_CHECK_MEMBER([struct msghdr.msg_control],
112                    [AC_DEFINE([_XOPEN_SOURCE], [600],
113                       [Defined if needed to expose struct msghdr.msg_control])
114                    ], [], [
115#define _XOPEN_SOURCE 600
116AC_INCLUDES_DEFAULT
117#include <sys/socket.h>
118                     ])
119fi
120# If that didn't work, fall back to XPG5/UNIX98 with C89
121if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
122    unset ac_cv_member_struct_msghdr_msg_control
123    AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
124    AC_CHECK_MEMBER([struct msghdr.msg_control],
125                    [AC_DEFINE([_XOPEN_SOURCE], [500],
126                       [Defined if needed to expose struct msghdr.msg_control])
127                    ], [have_sendmsg="no"], [
128#define _XOPEN_SOURCE 500
129AC_INCLUDES_DEFAULT
130#include <sys/socket.h>
131                     ])
132fi
133
134case x$have_sendmsg in
135xyes)
136        AC_DEFINE([HAVE_SENDMSG],1,[Define if your platform supports sendmsg])
137        ;;
138esac
139
140have_win32="no"
141lt_enable_auto_import=""
142case $host_os in
143mingw*)
144        have_win32="yes"
145        lt_enable_auto_import="-Wl,--enable-auto-import"
146        ;;
147linux*)
148        AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets])
149        ;;
150esac
151
152AC_SUBST(lt_enable_auto_import)
153AM_CONDITIONAL([XCB_HAVE_WIN32], [test "x${have_win32}" = "xyes"])
154
155dnl define buffer queue size
156AC_ARG_WITH([queue-size],
157            AS_HELP_STRING([--with-queue-size=SIZE],
158            [Set the XCB buffer queue size (default is 16384)]),
159            [xcb_queue_buffer_size="$withval"],
160            [xcb_queue_buffer_size=16384])
161AC_DEFINE_UNQUOTED(XCB_QUEUE_BUFFER_SIZE, [$xcb_queue_buffer_size],
162                   [XCB buffer queue size])
163
164dnl check for the sockaddr_un.sun_len member
165AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
166                [AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])],
167                [],
168                [ #include <sys/types.h>
169                  #include <sys/un.h>
170                ])
171
172dnl check for support for Solaris Trusted Extensions
173AC_CHECK_HEADERS([tsol/label.h])
174AC_CHECK_FUNCS([is_system_labeled])
175
176dnl check for IOV_MAX, and fall back to UIO_MAXIOV on BSDish systems
177AC_CHECK_DECL([IOV_MAX], [],
178              [AC_CHECK_DECL([UIO_MAXIOV], [AC_DEFINE([IOV_MAX], [UIO_MAXIOV])],
179                                           [AC_DEFINE([IOV_MAX], [16], [Define if not provided by <limits.h>])],
180                                           [[#include <sys/uio.h>]])],
181              [[#include <limits.h>]])
182
183xcbincludedir='${includedir}/xcb'
184AC_SUBST(xcbincludedir)
185
186XCB_CHECK_VISIBILITY()
187
188AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAVE_GETADDRINFO, 1, [getaddrinfo() function is available])], )
189
190case $host_os in
191        # darwin through Snow Leopard has poll() but can't be used to poll character devices.
192        darwin@<:@789@:>@*|darwin10*) ;;
193        darwin*)
194                _ac_xorg_macosx_version_min=""
195                if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then
196                        _ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'`
197                else
198                        _ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
199                fi
200                case $_ac_xorg_macosx_version_min in
201                        10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
202                        *)
203                                AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
204                        ;;
205                esac
206                unset _ac_xorg_macosx_version_min
207                ;;
208        *)
209                AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
210        ;;
211esac
212
213dnl Link with winsock for socket functions on MinGW
214case $host_os in
215        *mingw*)
216                AC_CHECK_LIB([ws2_32],[main])
217                ;;
218        *)
219                ;;
220esac
221
222XCB_EXTENSION(Composite, yes)
223XCB_EXTENSION(Damage, yes)
224XCB_EXTENSION(Dbe, yes)
225XCB_EXTENSION(DPMS, yes)
226XCB_EXTENSION(DRI2, yes)
227XCB_EXTENSION(DRI3, $have_sendmsg)
228XCB_EXTENSION(GE, no)
229XCB_EXTENSION(GLX, yes)
230XCB_EXTENSION(Present, yes)
231XCB_EXTENSION(RandR, yes)
232XCB_EXTENSION(Record, yes)
233XCB_EXTENSION(Render, yes)
234XCB_EXTENSION(Resource, yes)
235XCB_EXTENSION(Screensaver, yes)
236XCB_EXTENSION(Shape, yes)
237XCB_EXTENSION(Shm, yes)
238XCB_EXTENSION(Sync, yes)
239XCB_EXTENSION(Xevie, no)
240XCB_EXTENSION(XFixes, yes)
241XCB_EXTENSION(XFree86-DRI, yes)
242XCB_EXTENSION(Xinerama, yes)
243XCB_EXTENSION(XInput, yes)
244XCB_EXTENSION(XKB, yes)
245XCB_EXTENSION(Xprint, no)
246XCB_EXTENSION(SELinux, no)
247XCB_EXTENSION(XTest, yes)
248XCB_EXTENSION(Xv, yes)
249XCB_EXTENSION(XvMC, yes)
250
251AC_ARG_WITH(serverside-support, AS_HELP_STRING([--with-serverside-support], [Build with support for server-side usage of xcb. This is still EXPERIMENTAL! ABI/API may change! (default: no)]), [XCB_SERVERSIDE_SUPPORT=$withval], [XCB_SERVERSIDE_SUPPORT=no])
252
253AM_CONDITIONAL(XCB_SERVERSIDE_SUPPORT, test "x$XCB_SERVERSIDE_SUPPORT" = "xyes")
254
255AC_CONFIG_FILES([
256Makefile
257doc/Makefile
258man/Makefile
259src/Makefile
260tests/Makefile
261])
262
263AC_CONFIG_FILES([
264xcb.pc
265xcb-composite.pc
266xcb-damage.pc
267xcb-dbe.pc
268xcb-dpms.pc
269xcb-dri2.pc
270xcb-dri3.pc
271xcb-ge.pc
272xcb-glx.pc
273xcb-present.pc
274xcb-randr.pc
275xcb-record.pc
276xcb-render.pc
277xcb-res.pc
278xcb-screensaver.pc
279xcb-shape.pc
280xcb-shm.pc
281xcb-sync.pc
282xcb-xevie.pc
283xcb-xf86dri.pc
284xcb-xfixes.pc
285xcb-xinerama.pc
286xcb-xinput.pc
287xcb-xkb.pc
288xcb-xprint.pc
289xcb-xselinux.pc
290xcb-xtest.pc
291xcb-xv.pc
292xcb-xvmc.pc
293])
294
295AC_CONFIG_FILES([
296doc/xcb.doxygen
297])
298
299AC_OUTPUT
300
301dnl Configuration output
302
303echo ""
304echo "  Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
305echo ""
306echo "  Configuration"
307echo "    XDM support.........: ${have_xdmcp}"
308echo "    sendmsg fd passing..: ${have_sendmsg}"
309echo "    Build unit tests....: ${HAVE_CHECK}"
310echo "      with html results.: ${HTML_CHECK_RESULT}"
311echo "    XCB buffer size.....: ${xcb_queue_buffer_size}"
312echo ""
313echo "  X11 extensions"
314echo "    Composite...........: ${BUILD_COMPOSITE}"
315echo "    Damage..............: ${BUILD_DAMAGE}"
316echo "    Dbe.................: ${BUILD_DBE}"
317echo "    Dpms................: ${BUILD_DPMS}"
318echo "    Dri2................: ${BUILD_DRI2}"
319echo "    Dri3................: ${BUILD_DRI3}"
320echo "    GenericEvent........: ${BUILD_GE}"
321echo "    Glx.................: ${BUILD_GLX}"
322echo "    Randr...............: ${BUILD_RANDR}"
323echo "    Record..............: ${BUILD_RECORD}"
324echo "    Render..............: ${BUILD_RENDER}"
325echo "    Resource............: ${BUILD_RESOURCE}"
326echo "    Screensaver.........: ${BUILD_SCREENSAVER}"
327echo "    selinux.............: ${BUILD_SELINUX}"
328echo "    Shape...............: ${BUILD_SHAPE}"
329echo "    Shm.................: ${BUILD_SHM}"
330echo "    Sync................: ${BUILD_SYNC}"
331echo "    Xevie...............: ${BUILD_XEVIE}"
332echo "    Xfixes..............: ${BUILD_XFIXES}"
333echo "    Xfree86-dri.........: ${BUILD_XFREE86_DRI}"
334echo "    xinerama............: ${BUILD_XINERAMA}"
335echo "    xinput..............: ${BUILD_XINPUT}"
336echo "    xkb.................: ${BUILD_XKB}"
337echo "    xprint..............: ${BUILD_XPRINT}"
338echo "    xtest...............: ${BUILD_XTEST}"
339echo "    xv..................: ${BUILD_XV}"
340echo "    xvmc................: ${BUILD_XVMC}"
341echo ""
342echo "  Used CFLAGS:"
343echo "    CPPFLAGS............: ${CPPFLAGS}"
344echo "    CFLAGS..............: ${CFLAGS}"
345echo ""
346echo "  Installation:"
347echo "    Prefix..............: ${prefix}"
348echo ""
349