configure.ac revision 2f76b07d
1dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
2dnl
3dnl Permission is hereby granted, free of charge, to any person obtaining a
4dnl copy of this software and associated documentation files (the "Software"),
5dnl to deal in the Software without restriction, including without limitation
6dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
7dnl and/or sell copies of the Software, and to permit persons to whom the
8dnl Software is furnished to do so, subject to the following conditions:
9dnl
10dnl The above copyright notice and this permission notice (including the next
11dnl paragraph) shall be included in all copies or substantial portions of the
12dnl Software.
13dnl
14dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20dnl DEALINGS IN THE SOFTWARE.
21dnl
22dnl Authors: Keith Packard <keithp@keithp.com>
23dnl          Daniel Stone <daniel@fooishbar.org>
24dnl          an unwitting cast of miscellaneous others
25dnl
26dnl Process this file with autoconf to create configure.
27
28AC_PREREQ(2.60)
29AC_INIT([xorg-server], 21.1.18, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
30RELEASE_DATE="2025-06-18"
31RELEASE_NAME="Caramel Ice Cream"
32AC_CONFIG_SRCDIR([Makefile.am])
33AC_CONFIG_MACRO_DIR([m4])
34AM_INIT_AUTOMAKE([foreign dist-xz])
35AC_USE_SYSTEM_EXTENSIONS
36
37# Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
38m4_ifndef([XORG_MACROS_VERSION],
39          [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])])
40XORG_MACROS_VERSION(1.14)
41XORG_DEFAULT_OPTIONS
42XORG_WITH_DOXYGEN(1.6.1)
43XORG_CHECK_SGML_DOCTOOLS(1.8)
44XORG_ENABLE_DOCS
45XORG_ENABLE_DEVEL_DOCS
46XORG_WITH_XMLTO(0.0.20)
47XORG_WITH_FOP
48XORG_WITH_XSLTPROC
49XORG_ENABLE_UNIT_TESTS
50XORG_LD_WRAP([optional])
51
52m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install font-util 1.1 or later before running autoconf/autogen])])
53XORG_FONT_MACROS_VERSION(1.1)
54
55dnl this gets generated by autoheader, and thus contains all the defines.  we
56dnl don't ever actually use it, internally.
57AC_CONFIG_HEADERS(include/do-not-use-config.h)
58dnl xorg-server.h is an external header, designed to be included by loadable
59dnl drivers.
60AC_CONFIG_HEADERS(include/xorg-server.h)
61dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
62dnl dix/).
63AC_CONFIG_HEADERS(include/dix-config.h)
64dnl xorg-config.h covers the Xorg DDX.
65AC_CONFIG_HEADERS(include/xorg-config.h)
66dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
67AC_CONFIG_HEADERS(include/xkb-config.h)
68dnl xwin-config.h covers the XWin DDX.
69AC_CONFIG_HEADERS(include/xwin-config.h)
70dnl version-config.h covers the version numbers so they can be bumped without
71dnl forcing an entire recompile.x
72AC_CONFIG_HEADERS(include/version-config.h)
73
74AM_PROG_AS
75AC_PROG_LN_S
76LT_PREREQ([2.2])
77LT_INIT([disable-static win32-dll])
78PKG_PROG_PKG_CONFIG
79AC_PROG_LEX
80AC_PROG_YACC
81AC_SYS_LARGEFILE
82XORG_PROG_RAWCPP
83
84# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
85# easier overrides at build time.
86XSERVER_CFLAGS='$(CWARNFLAGS)'
87
88dnl Explicitly add -fno-strict-aliasing since this option should disappear
89dnl from util-macros CWARNFLAGS
90if  test "x$GCC" = xyes ; then
91    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
92fi
93
94dnl Check for dtrace program (needed to build Xserver dtrace probes)
95dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
96dnl ISDN trace program named dtrace
97AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
98	     [Enable dtrace probes (default: enabled if dtrace found)]),
99	     [WDTRACE=$withval], [WDTRACE=auto])
100if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
101	AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
102	if test "x$DTRACE" = "xnot_found" ; then
103		if test "x$WDTRACE" = "xyes" ; then
104			AC_MSG_FAILURE([dtrace requested but not found])
105		fi
106		WDTRACE="no"
107	else
108		AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
109		if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
110			WDTRACE="no"
111		fi
112	fi
113fi
114if test "x$WDTRACE" != "xno" ; then
115  AC_DEFINE(XSERVER_DTRACE, 1, 
116      [Define to 1 if the DTrace Xserver provider probes should be built in.])
117
118# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
119# object files, and require linking with those as relocatable objects, not .a
120# archives. MacOS X handles all this in the normal compiler toolchain, and on
121# some releases (like Tiger), will error out on dtrace -G.  For now, other
122# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
123# ports appear to, based on my web searches, but have not yet been tested).
124	case $host_os in
125		darwin*)	SPECIAL_DTRACE_OBJECTS=no ;;
126		*)		SPECIAL_DTRACE_OBJECTS=yes ;;
127	esac
128fi
129AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
130AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
131
132AC_HEADER_DIRENT
133AC_HEADER_STDC
134AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \
135 fnmatch.h sys/mkdev.h sys/sysmacros.h sys/utsname.h])
136
137dnl Checks for typedefs, structures, and compiler characteristics.
138AC_C_CONST
139AC_C_TYPEOF
140AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]),
141               AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order]))
142
143AC_CHECK_SIZEOF([unsigned long])
144if test "$ac_cv_sizeof_unsigned_long" = 8; then
145	AC_DEFINE(_XSERVER64, 1, [Define to 1 if unsigned long is 64 bits.])
146fi
147
148AC_TYPE_PID_T
149
150dnl Check to see if dlopen is in default libraries (like Solaris, which
151dnl has it in libc), or if libdl is needed to get it.
152AC_CHECK_FUNC([dlopen], [],
153	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
154AC_SUBST(DLOPEN_LIBS)
155
156dnl Checks for library functions.
157AC_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \
158	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
159	mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
160	walkcontext setitimer poll epoll_create1 mkostemp memfd_create \
161	sigprocmask isastream])
162AC_CONFIG_LIBOBJ_DIR([os])
163AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
164	timingsafe_memcmp])
165AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
166
167# Checks for non-standard functions and fallback to libbsd if we can
168# We only check for arc4random_buf, because if we have that, we don't
169# need/use getentropy.
170AC_LINK_IFELSE([AC_LANG_CALL([], [arc4random_buf])],
171               [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"])
172AS_IF([test "x$TRY_LIBBSD" = "xyes"],
173      [PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
174	CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
175	LIBS="$LIBS $LIBBSD_LIBS"
176], [:])])
177
178AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
179
180dnl Check for SO_PEERCRED #define
181AC_CACHE_CHECK([for SO_PEERCRED in sys/socket.h],
182	       [xorg_cv_sys_have_so_peercred],
183	       [AC_EGREP_CPP(yes_have_so_peercred,[
184#include <sys/types.h>
185#include <sys/socket.h>
186#ifdef SO_PEERCRED
187yes_have_so_peercred
188#endif
189],
190	       [xorg_cv_sys_have_so_peercred=yes],
191	       [xorg_cv_sys_have_so_peercred=no])])
192
193dnl define NO_LOCAL_CLIENT_CRED if no getpeereid, getpeerucred or SO_PEERCRED
194if test "x$ac_cv_func_getpeereid" = xno && test "x$ac_cv_func_getpeerucred" = xno && test "x$xorg_cv_sys_have_so_peercred" = xno ; then
195	AC_DEFINE([NO_LOCAL_CLIENT_CRED], 1, [Define to 1 if no local socket credentials interface exists])
196fi
197
198dnl Find the math library, then check for cbrt function in it.
199AC_CHECK_LIB(m, sqrt)
200AC_CHECK_FUNCS([cbrt])
201
202dnl AGPGART headers
203AC_ARG_ENABLE(agp, AS_HELP_STRING([--enable-agp],
204				  [Enable AGP support (default: auto)]),
205			          [AGP=$enableval], [AGP=auto])
206if test "x$AGP" = "xauto" ; then
207    AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
208fi
209AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
210
211dnl fbdev header
212AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
213AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
214
215dnl FreeBSD kldload support (sys/linker.h)
216AC_CHECK_HEADERS([sys/linker.h],
217	[ac_cv_sys_linker_h=yes],
218	[ac_cv_sys_linker_h=no],
219	[#include <sys/param.h>])
220AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
221
222AC_CACHE_CHECK([for SYSV IPC],
223		ac_cv_sysv_ipc,
224               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
225#include <sys/types.h>
226#include <sys/ipc.h>
227#include <sys/shm.h>
228#include <sys/stat.h>
229]],[[
230{ 
231    int id;
232    id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
233    if (id < 0) return -1;
234    return shmctl(id, IPC_RMID, 0);
235}]])],
236       [ac_cv_sysv_ipc=yes],
237       [ac_cv_sysv_ipc=no])])
238if test "x$ac_cv_sysv_ipc" = xyes; then
239	AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
240fi
241
242dnl OpenBSD /dev/xf86 aperture driver 
243if test -c /dev/xf86 ; then
244	AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
245fi
246	
247dnl glibc backtrace support check
248AC_CHECK_HEADER([execinfo.h],[
249    AC_CHECK_LIB(c, backtrace, [
250        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
251        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
252    ])]
253)
254
255dnl ---------------------------------------------------------------------------
256dnl Bus options and CPU capabilities.  Replaces logic in
257dnl hw/xfree86/os-support/bus/Makefile.am, among others.
258dnl ---------------------------------------------------------------------------
259DEFAULT_INT10="x86emu"
260
261dnl Override defaults as needed for specific platforms:
262
263case $host_cpu in
264  alpha*)
265	ALPHA_VIDEO=yes
266	case $host_os in
267	        *freebsd*)	SYS_LIBS=-lio ;;
268		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
269	esac
270	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
271	;;
272  arm*)
273	ARM_VIDEO=yes
274	DEFAULT_INT10="stub"
275	;;
276  i*86)
277	I386_VIDEO=yes
278	case $host_os in
279		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
280		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
281		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
282				SYS_LIBS=-li386
283				;;
284		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
285				SYS_LIBS=-li386
286				;;
287	esac
288        ;;
289  powerpc*)
290	PPC_VIDEO=yes
291	case $host_os in
292		*freebsd*)	DEFAULT_INT10=stub ;;
293	esac
294	;;
295  sparc*)
296	SPARC64_VIDEO=yes
297	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
298	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
299	;;
300  x86_64*|amd64*)
301	I386_VIDEO=yes
302	case $host_os in
303		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
304		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
305		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
306				SYS_LIBS=-lx86_64
307				;;
308		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
309				SYS_LIBS=-lamd64
310				;;
311	esac
312	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
313	;;
314  ia64*)
315  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
316	;;
317  s390*)
318  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
319	;;
320esac
321AC_SUBST(GLX_ARCH_DEFINES)
322
323dnl BSD *_video.c selection
324AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
325AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
326AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
327AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
328AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
329
330DRI=no
331dnl it would be nice to autodetect these *CONS_SUPPORTs
332case $host_os in
333  *freebsd* | *dragonfly*)
334	case $host_os in
335		kfreebsd*-gnu) ;;
336		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
337	esac
338	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
339	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
340	AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
341	DRI=yes
342	;;
343  *netbsd*)
344	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
345	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
346	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
347	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
348	DRI=yes
349	;;
350  *openbsd*)
351	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
352	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
353	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
354	;;
355  *linux*)
356	DRI=yes
357	;;
358  *solaris*)
359	DRI=yes
360	;;
361  darwin*)
362	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
363	;;
364  cygwin*|mingw*)
365	CFLAGS="$CFLAGS -DFD_SETSIZE=512"
366	;;
367esac
368
369dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
370dnl major number
371PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
372
373dnl Convert to the old-style 1.x.y version scheme used up to 1.20.x for
374dnl backwards compatibility
375VENDOR_RELEASE="((10000000) + (($PVMAJOR) * 100000) + (($PVM) * 1000) + $PVP)"
376VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
377
378VENDOR_NAME="The X.Org Foundation"
379VENDOR_NAME_SHORT="X.Org"
380VENDOR_WEB="http://wiki.x.org"
381
382dnl Build options.
383AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
384		  [Obsolete - use --enable-strict-compilation instead]),
385  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))
386
387AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
388				  [Enable debugging (default: disabled)]),
389			        [DEBUGGING=$enableval], [DEBUGGING=no])
390AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
391				[INT10="$withval"],
392				[INT10="$DEFAULT_INT10"])
393AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
394				  [Vendor string reported by the server]),
395				[ VENDOR_NAME="$withval" ], [])
396AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
397				  [Short version of vendor string reported by the server]),
398				[ VENDOR_NAME_SHORT="$withval" ], [])
399AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
400				  [Vendor web address reported by the server]),
401				[ VENDOR_WEB="$withval" ], [])
402AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
403				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
404				[ moduledir="$withval" ],
405				[ moduledir="${libdir}/xorg/modules" ])
406AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
407				  [Directory where log files are kept (default: $localstatedir/log)]),
408				[ logdir="$withval" ],
409				[ logdir="$localstatedir/log" ])
410AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
411				  [Builder address (default: xorg@lists.freedesktop.org)]),
412				[ BUILDERADDR="$withval" ],
413				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
414AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
415				[ BUILDERSTRING="$withval" ]
416				[ ])
417AC_ARG_ENABLE(listen-tcp,    AS_HELP_STRING([--enable-listen-tcp],
418                                            [Listen on TCP by default (default:disabled)]),
419                                [LISTEN_TCP=$enableval], [LISTEN_TCP=no])
420AC_ARG_ENABLE(listen-unix,   AS_HELP_STRING([--disable-listen-unix],
421                                            [Listen on Unix by default (default:enabled)]),
422                                [LISTEN_UNIX=$enableval], [LISTEN_UNIX=yes])
423
424AC_ARG_ENABLE(listen-local,  AS_HELP_STRING([--disable-listen-local],
425                                            [Listen on local by default (default:enabled)]),
426                                [LISTEN_LOCAL=$enableval], [LISTEN_LOCAL=yes])
427
428case $host_os in
429    linux*)
430        FALLBACK_INPUT_DRIVER="libinput"
431        ;;
432    *)
433        FALLBACK_INPUT_DRIVER=""
434        ;;
435esac
436AC_ARG_WITH(fallback-input-driver,
437            AC_HELP_STRING([--with-fallback-input-driver=$FALLBACK_INPUT_DRIVER],
438                           [Input driver fallback if the requested driver for a device is unavailable]),
439                           [ FALLBACK_INPUT_DRIVER=$withval ], [])
440if test "x$FALLBACK_INPUT_DRIVER" = "xno"; then
441    FALLBACK_INPUT_DRIVER=""
442fi
443AC_MSG_CHECKING([for fallback input driver])
444AC_MSG_RESULT([$FALLBACK_INPUT_DRIVER])
445AC_DEFINE_UNQUOTED(FALLBACK_INPUT_DRIVER, ["$FALLBACK_INPUT_DRIVER"], [ Fallback input driver ])
446
447dnl Determine font path
448XORG_FONTROOTDIR
449XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
450XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
451XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
452XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
453XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
454XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
455
456dnl Uses --with-default-font-path if set, otherwise uses standard
457dnl subdirectories of FONTROOTDIR. Some distros set the default font path to
458dnl "catalogue:/etc/X11/fontpath.d,built-ins"
459DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
460case $host_os in
461    darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
462esac
463
464AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
465				[ FONTPATH="$withval" ],
466				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
467
468AC_MSG_CHECKING([for default font path])
469AC_MSG_RESULT([$FONTPATH])
470
471AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: auto)]),
472				[ XKBPATH="$withval" ],
473				[ XKBPATH="auto" ])
474AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
475				[ XKBOUTPUT="$withval" ],
476				[ XKBOUTPUT="compiled" ])
477AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
478                                   [Keyboard ruleset (default: base/evdev)]),
479                                [ XKB_DFLT_RULES="$withval" ],
480                                [ XKB_DFLT_RULES="" ])
481AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
482                                   [Keyboard model (default: pc105)]),
483                                [ XKB_DFLT_MODEL="$withval" ],
484                                [ XKB_DFLT_MODEL="pc105" ])
485AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
486                                   [Keyboard layout (default: us)]),
487                                [ XKB_DFLT_LAYOUT="$withval" ],
488                                [ XKB_DFLT_LAYOUT="us" ])
489AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
490                                   [Keyboard variant (default: (none))]),
491                                [ XKB_DFLT_VARIANT="$withval" ],
492                                [ XKB_DFLT_VARIANT="" ])
493AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
494                                   [Keyboard layout options (default: (none))]),
495                                [ XKB_DFLT_OPTIONS="$withval" ],
496                                [ XKB_DFLT_OPTIONS="" ])
497AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
498				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
499				[ SERVERCONFIG="$withval" ],
500				[ SERVERCONFIG="${libdir}/xorg" ])
501AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
502				[ APPLE_APPLICATIONS_DIR="${withval}" ],
503				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
504AC_SUBST([APPLE_APPLICATIONS_DIR])
505AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
506				[ APPLE_APPLICATION_NAME="${withval}" ],
507				[ APPLE_APPLICATION_NAME="X11" ])
508AC_SUBST([APPLE_APPLICATION_NAME])
509AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREFIX], [Prefix to use for bundle identifiers (default: org.x)]),
510                               [ BUNDLE_ID_PREFIX="${withval}" ])
511AC_SUBST([BUNDLE_ID_PREFIX])
512AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
513m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | cut -f1-3 -d. | tr -d '\n']))
514AC_ARG_WITH(bundle-version,    AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's CFBundleVersion (default: ]DEFAULT_BUNDLE_VERSION[)]),
515                               [ BUNDLE_VERSION="${withval}" ],
516                               [ BUNDLE_VERSION="DEFAULT_BUNDLE_VERSION" ])
517AC_SUBST([BUNDLE_VERSION])
518AC_ARG_WITH(bundle-version-string, AS_HELP_STRING([--with-bundle-version-string=VERSION], [Version to use for X11.app's CFBundleShortVersionString (default: ]AC_PACKAGE_VERSION[)]),
519                               [ BUNDLE_VERSION_STRING="${withval}" ],
520                               [ BUNDLE_VERSION_STRING="${PACKAGE_VERSION}" ])
521AC_SUBST([BUNDLE_VERSION_STRING])
522AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
523				[ XQUARTZ_SPARKLE="${enableval}" ],
524				[ XQUARTZ_SPARKLE="no" ])
525AC_SUBST([XQUARTZ_SPARKLE])
526AC_ARG_WITH(sparkle-feed-url,  AS_HELP_STRING([--with-sparkle-feed-url=URL], [URL for the Sparkle feed (default: https://www.xquartz.org/releases/sparkle/release.xml)]),
527                               [ XQUARTZ_SPARKLE_FEED_URL="${withval}" ],
528                               [ XQUARTZ_SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle/release.xml" ])
529AC_SUBST([XQUARTZ_SPARKLE_FEED_URL])
530AC_ARG_ENABLE(visibility,     AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
531				[SYMBOL_VISIBILITY=$enableval],
532				[SYMBOL_VISIBILITY=auto])
533
534dnl GLX build options
535AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Path to Khronos OpenGL registry database files (default: auto)]),
536				[KHRONOS_SPEC_DIR="${withval}"],
537				[KHRONOS_SPEC_DIR=auto])
538
539dnl Extensions.
540AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
541AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
542AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
543AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
544AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
545AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
546AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
547AC_ARG_ENABLE(screensaver,    AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
548AC_ARG_ENABLE(xdmcp,          AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
549AC_ARG_ENABLE(xdm-auth-1,     AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
550AC_ARG_ENABLE(glx,            AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
551AC_ARG_ENABLE(dri,            AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
552AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
553AC_ARG_ENABLE(dri3,           AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto])
554AC_ARG_ENABLE(present,	      AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes])
555AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
556AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
557AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
558AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
559AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
560AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
561AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
562AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
563AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
564AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
565AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
566AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
567AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
568AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
569AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
570AC_ARG_ENABLE(windowsdri,     AS_HELP_STRING([--enable-windowsdri], [Build XWin with WindowsDRI extension (default: auto)]), [WINDOWSDRI=$enableval], [WINDOWSDRI=auto])
571AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
572AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
573AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
574AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
575AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
576AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
577AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
578
579dnl DDXes.
580AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
581AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
582AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
583AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
584AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
585AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
586AC_ARG_ENABLE(glamor,         AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=auto])
587AC_ARG_ENABLE(xf86-input-inputtest, AS_HELP_STRING([--enable-xf86-input-inputtest], [Build Xorg test input driver (default: yes)]), [XORG_DRIVER_INPUT_INPUTTEST=$enableval], [XORG_DRIVER_INPUT_INPUTTEST=yes])
588dnl kdrive and its subsystems
589AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
590AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
591dnl kdrive options
592AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
593AC_ARG_ENABLE(xshmfence,      AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="auto"])
594
595
596dnl chown/chmod to be setuid root as part of build
597dnl Replaces InstallXserverSetUID in imake
598AC_ARG_ENABLE(install-setuid, 
599    AS_HELP_STRING([--enable-install-setuid],
600       [Install Xorg server as owned by root with setuid bit (default: auto)]),
601    [SETUID=$enableval], [SETUID=auto])
602AC_MSG_CHECKING([to see if we can install the Xorg server as root])
603if test "x$SETUID" = "xauto" ; then
604	case $host_os in
605	    cygwin*)		SETUID="no"  ;;
606	    mingw*)		SETUID="no"  ;;
607	    darwin*)		SETUID="no"  ;;
608	    *)
609	   	case $host_cpu in
610		    sparc)	SETUID="no"  ;;
611		    *)		SETUID="yes" ;;
612		esac
613	esac
614	if test "x$SETUID" = xyes; then
615		touch testfile
616		chown root testfile > /dev/null 2>&1 || SETUID="no"
617		rm -f testfile
618	fi
619fi
620AC_MSG_RESULT([$SETUID])
621AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])
622
623dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
624dnl was not expanded, since xorg-server with no transport types is rather useless.
625dnl
626dnl If you're seeing an error here, be sure you installed the lib/xtrans module
627dnl first and if it's not in the default location, that you set the ACLOCAL
628dnl environment variable to find it, such as:
629dnl	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
630m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
631
632# Transport selection macro from xtrans.m4
633XTRANS_CONNECTION_FLAGS
634
635# Secure RPC detection macro from xtrans.m4
636XTRANS_SECURE_RPC_FLAGS
637AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
638
639AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
640AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
641AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
642
643dnl DDX Detection... Yes, it's ugly to have it here... but we need to
644dnl handle this early on so that we don't require unsupported extensions
645case $host_os in
646	cygwin* | mingw*)
647		CONFIG_HAL=no
648		CONFIG_UDEV=no
649		CONFIG_UDEV_KMS=no
650		DGA=no
651		DRM=no
652		DRI2=no
653		DRI3=no
654		INT10MODULE=no
655		PCI=no
656		VGAHW=no
657		XF86UTILS=no
658		XF86VIDMODE=no
659		XSELINUX=no
660		SYMBOL_VISIBILITY=no
661		;;
662	darwin*)
663		PCI=no
664		INT10MODULE=no
665		VGAHW=no
666		DRM=no
667		DRI2=no
668		DRI3=no
669
670		if test x$XQUARTZ = xauto; then
671			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
672		 		save_LDFLAGS=$LDFLAGS
673				LDFLAGS="$LDFLAGS -framework Carbon"
674				AC_LINK_IFELSE([AC_LANG_SOURCE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}])],
675				               [xorg_cv_Carbon_framework=yes],
676				               [xorg_cv_Carbon_framework=no])
677			        LDFLAGS=$save_LDFLAGS])
678                
679			if test "X$xorg_cv_Carbon_framework" = Xyes; then
680				XQUARTZ=yes
681			else
682				XQUARTZ=no
683			fi
684		fi
685
686		if test "x$XQUARTZ" = xyes ; then
687			XQUARTZ=yes
688			XVFB=no
689			XNEST=no
690
691			DGA=no
692			DPMSExtension=no
693			XF86VIDMODE=no
694		fi
695		;;
696	gnu*)
697		DRM=no
698		DRI2=no
699		DRI3=no
700		;;
701	*) XQUARTZ=no ;;
702esac
703
704dnl ---------------------------------------------------------------------------
705dnl Extension section
706dnl ---------------------------------------------------------------------------
707XEXT_INC='-I$(top_srcdir)/Xext'
708XEXT_LIB='$(top_builddir)/Xext/libXext.la'
709
710dnl Optional modules
711VIDEOPROTO="videoproto"
712COMPOSITEPROTO="compositeproto >= 0.4"
713RECORDPROTO="recordproto >= 1.13.99.1"
714SCRNSAVERPROTO="scrnsaverproto >= 1.1"
715RESOURCEPROTO="resourceproto >= 1.2.0"
716DRIPROTO="xf86driproto >= 2.1.0"
717DRI2PROTO="dri2proto >= 2.8"
718DRI3PROTO="dri3proto >= 1.2"
719XINERAMAPROTO="xineramaproto"
720BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
721DGAPROTO="xf86dgaproto >= 2.0.99.1"
722GLPROTO="glproto >= 1.4.17"
723VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
724APPLEWMPROTO="applewmproto >= 1.4"
725LIBXSHMFENCE="xshmfence >= 1.1"
726
727dnl Required modules
728XPROTO="xproto >= 7.0.31"
729RANDRPROTO="randrproto >= 1.6.0"
730RENDERPROTO="renderproto >= 0.11"
731XEXTPROTO="xextproto >= 7.2.99.901"
732INPUTPROTO="inputproto >= 2.3.99.1"
733KBPROTO="kbproto >= 1.0.3"
734FONTSPROTO="fontsproto >= 2.1.3"
735FIXESPROTO="fixesproto >= 6.0"
736DAMAGEPROTO="damageproto >= 1.1"
737XCMISCPROTO="xcmiscproto >= 1.2.0"
738BIGREQSPROTO="bigreqsproto >= 1.1.0"
739XTRANS="xtrans >= 1.3.5"
740PRESENTPROTO="presentproto >= 1.2"
741
742dnl List of libraries that require a specific version
743LIBAPPLEWM="applewm >= 1.4"
744LIBDRI="dri >= 7.8.0"
745LIBDRM="libdrm >= 2.4.89"
746LIBEGL="egl"
747LIBGBM="gbm >= 10.2.0"
748LIBGL="gl >= 1.2"
749LIBXEXT="xext >= 1.0.99.4"
750LIBXFONT="xfont2 >= 2.0.0"
751LIBXI="xi >= 1.2.99.1"
752LIBXTST="xtst >= 1.0.99.2"
753LIBPCIACCESS="pciaccess >= 0.12.901"
754LIBUDEV="libudev >= 143"
755LIBSELINUX="libselinux >= 2.0.86"
756LIBDBUS="dbus-1 >= 1.0"
757LIBPIXMAN="pixman-1 >= 0.27.2"
758LIBXCVT="libxcvt"
759
760dnl Pixman is always required, but we separate it out so we can link
761dnl specific modules against it
762PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
763REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
764
765dnl Core modules for most extensions, et al.
766SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $KBPROTO $FONTSPROTO $LIBPIXMAN"
767# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
768AC_SUBST(SDK_REQUIRED_MODULES)
769
770AC_CHECK_DECL([PTHREAD_MUTEX_RECURSIVE], [HAVE_RECURSIVE_MUTEX=yes], [HAVE_RECURSIVE_MUTEX=no], [[#include <pthread.h>]])
771
772THREAD_DEFAULT=no
773
774if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then
775	THREAD_DEFAULT=yes
776fi
777
778case $host_os in
779	mingw*) THREAD_DEFAULT=no  ;;
780	*)
781esac
782
783AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread],
784	     [Enable input threads]),
785	     [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT])
786
787if test "x$INPUTTHREAD" = "xyes" ; then
788    AX_PTHREAD(,AC_MSG_ERROR([threaded input requested but no pthread support has been found]))
789    SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS"
790    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
791    AC_DEFINE(INPUTTHREAD, 1, [Use a separate input thread])
792
793    save_LIBS="$LIBS"
794    LIBS="$LIBS $SYS_LIBS"
795    dnl MacOS X 10.6 & higher
796    AC_MSG_CHECKING(for pthread_setname_np(const char*))
797    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
798	                            [pthread_setname_np("example")])],
799                   [AC_MSG_RESULT(yes)
800		    AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
801		              [Have function pthread_setname_np(const char*)])],
802                   [AC_MSG_RESULT(no)])
803    dnl GNU libc 2.12 & higher, Solaris 11.3 & higher
804    AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
805    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
806                             [pthread_setname_np(pthread_self(), "example")])],
807                   [AC_MSG_RESULT(yes)
808		    AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
809	                      [Have function pthread_setname_np(pthread_t, const char*)])],
810		   [AC_MSG_RESULT(no)])
811    LIBS="$save_LIBS"
812fi
813
814REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
815
816dnl systemd socket activation
817dnl activate the code in libxtrans that grabs systemd's socket fds
818dnl libsystemd-daemon was moved into libsystemd in version 209
819LIBSYSTEMD="libsystemd >= 209"
820AC_ARG_WITH([systemd-daemon],
821	AS_HELP_STRING([--with-systemd-daemon],
822		[support systemd socket activation (default: auto)]),
823	[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
824if test "x$WITH_SYSTEMD_DAEMON" = "xyes" -o "x$WITH_SYSTEMD_DAEMON" = "xauto" ; then
825	PKG_CHECK_MODULES([SYSTEMD_DAEMON], [$LIBSYSTEMD],
826			  [HAVE_SYSTEMD_DAEMON=yes;
827			   LIBSYSTEMD_DAEMON="$LIBSYSTEMD"],
828			  [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
829					     [HAVE_SYSTEMD_DAEMON=yes;
830					      LIBSYSTEMD_DAEMON=libsystemd-daemon],
831					     [HAVE_SYSTEMD_DAEMON=no])])
832	if test "x$HAVE_SYSTEMD_DAEMON" = xyes; then
833		AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
834		REQUIRED_LIBS="$REQUIRED_LIBS $LIBSYSTEMD_DAEMON"
835	elif test "x$WITH_SYSTEMD_DAEMON" = xyes; then
836		AC_MSG_ERROR([systemd support requested but no library has been found])
837	fi
838fi
839AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
840
841if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then
842	AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
843fi
844
845PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
846if test "x$CONFIG_UDEV" = xauto; then
847	CONFIG_UDEV="$HAVE_LIBUDEV"
848fi
849AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
850if test "x$CONFIG_UDEV" = xyes; then
851	CONFIG_HAL=no
852	if test "x$CONFIG_UDEV_KMS" = xauto; then
853		CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
854	fi
855	if ! test "x$HAVE_LIBUDEV" = xyes; then
856		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
857	fi
858	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
859	if test "x$CONFIG_UDEV_KMS" = xyes; then
860		AC_DEFINE(CONFIG_UDEV_KMS, 1, [Use libudev for kms enumeration])
861	fi
862	SAVE_LIBS=$LIBS
863	SAVE_CFLAGS=$CFLAGS
864	CFLAGS="$CFLAGS $UDEV_CFLAGS"
865	LIBS=$UDEV_LIBS
866	AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag])
867	AC_CHECK_FUNCS([udev_enumerate_add_match_tag])
868	LIBS=$SAVE_LIBS
869	CFLAGS=$SAVE_CFLAGS
870fi
871AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])
872
873PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
874if test "x$HAVE_DBUS" = xyes; then
875	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
876fi
877AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
878
879PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
880if test "x$CONFIG_HAL" = xauto; then
881	CONFIG_HAL="$HAVE_HAL"
882fi
883if test "x$CONFIG_HAL" = xyes; then
884	if ! test "x$HAVE_HAL" = xyes; then
885		AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
886	fi
887
888	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
889	NEED_DBUS="yes"
890fi
891AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
892
893if test "x$SYSTEMD_LOGIND" = xauto; then
894        if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
895                SYSTEMD_LOGIND=yes
896        else
897                SYSTEMD_LOGIND=no
898        fi
899fi
900if test "x$SYSTEMD_LOGIND" = xyes; then
901        if ! test "x$HAVE_DBUS" = xyes; then
902                AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.])
903        fi
904        if ! test "x$CONFIG_UDEV" = xyes ; then
905                AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.])
906        fi
907
908        AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration])
909        NEED_DBUS="yes"
910fi
911AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes])
912
913if test "x$SUID_WRAPPER" = xyes; then
914        dnl This is a define so that if some platforms want to put the wrapper
915        dnl somewhere else this can be easily changed
916        AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install the Xorg binary and Xorg.wrap])
917        SETUID="no"
918fi
919AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes])
920
921if test "x$NEED_DBUS" = xyes; then
922        AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
923fi
924AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes])
925
926if test "x$CONFIG_WSCONS" = xauto; then
927	case $host_os in
928		*openbsd*)
929			CONFIG_WSCONS=yes;
930			;;
931		*)
932			CONFIG_WSCONS=no;
933			;;
934	esac
935fi
936AM_CONDITIONAL(CONFIG_WSCONS, [test "x$CONFIG_WSCONS" = xyes])
937if test "x$CONFIG_WSCONS" = xyes; then
938	AC_DEFINE(CONFIG_WSCONS, 1, [Use wscons for input auto configuration])
939fi
940
941
942AC_MSG_CHECKING([for glibc...])
943AC_PREPROC_IFELSE([AC_LANG_SOURCE([
944#include <features.h>
945#ifndef __GLIBC__
946#error
947#endif
948])], glibc=yes, glibc=no)
949AC_MSG_RESULT([$glibc])
950
951AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
952               [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
953                             [have_clock_gettime=no])])
954
955AC_MSG_CHECKING([for a useful monotonic clock ...])
956
957if ! test "x$have_clock_gettime" = xno; then
958    if ! test "x$have_clock_gettime" = xyes; then
959        CLOCK_LIBS="$have_clock_gettime"
960    else
961        CLOCK_LIBS=""
962    fi
963
964    LIBS_SAVE="$LIBS"
965    LIBS="$CLOCK_LIBS"
966    CPPFLAGS_SAVE="$CPPFLAGS"
967
968    if test x"$glibc" = xyes; then
969        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
970    fi
971
972    AC_RUN_IFELSE([AC_LANG_SOURCE([
973#include <time.h>
974
975int main(int argc, char *argv[[]]) {
976    struct timespec tp;
977
978    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
979        return 0;
980    else
981        return 1;
982}
983    ])], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
984       [MONOTONIC_CLOCK="cross compiling"])
985
986    if test "$MONOTONIC_CLOCK" = "cross compiling"; then
987        AC_CHECK_DECL([CLOCK_MONOTONIC],[MONOTONIC_CLOCK="guessing yes"],[MONOTONIC_CLOCK=no],[#include <time.h>])
988    fi
989
990    LIBS="$LIBS_SAVE"
991    CPPFLAGS="$CPPFLAGS_SAVE"
992else
993    MONOTONIC_CLOCK=no
994fi
995
996AC_MSG_RESULT([$MONOTONIC_CLOCK])
997if test "$MONOTONIC_CLOCK" = "guessing yes"; then
998	MONOTONIC_CLOCK=yes
999fi
1000
1001if test "x$MONOTONIC_CLOCK" = xyes; then
1002    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
1003    LIBS="$LIBS $CLOCK_LIBS"
1004fi
1005
1006AM_CONDITIONAL(XV, [test "x$XV" = xyes])
1007if test "x$XV" = xyes; then
1008	AC_DEFINE(XV, 1, [Support Xv extension])
1009	AC_DEFINE(XvExtension, 1, [Build Xv extension])
1010	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
1011	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
1012else
1013	XVMC=no
1014fi
1015
1016AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
1017if test "x$XVMC" = xyes; then
1018	AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
1019fi
1020
1021AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
1022if test "x$COMPOSITE" = xyes; then
1023	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
1024	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
1025	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
1026	COMPOSITE_INC='-I$(top_srcdir)/composite'
1027fi
1028
1029if test "x$MITSHM" = xauto; then
1030	MITSHM="$ac_cv_sysv_ipc"
1031fi
1032AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
1033if test "x$MITSHM" = xyes; then
1034	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
1035	AC_DEFINE(HAS_SHM, 1, [Support SHM])
1036fi
1037
1038AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
1039if test "x$RECORD" = xyes; then
1040	AC_DEFINE(XRECORD, 1, [Support Record extension])
1041	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
1042	RECORD_LIB='$(top_builddir)/record/librecord.la'
1043fi
1044
1045AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
1046if test "x$SCREENSAVER" = xyes; then
1047	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
1048	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
1049	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $SCRNSAVERPROTO"
1050fi
1051
1052HASHTABLE=no
1053AM_CONDITIONAL(RES, [test "x$RES" = xyes])
1054if test "x$RES" = xyes; then
1055	AC_DEFINE(RES, 1, [Support X resource extension])
1056	HASHTABLE=yes
1057	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
1058	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
1059fi
1060
1061if test "x$LISTEN_TCP" = xyes; then
1062	AC_DEFINE(LISTEN_TCP, 1, [Listen on TCP socket])
1063fi
1064if test "x$LISTEN_UNIX" = xyes; then
1065	AC_DEFINE(LISTEN_UNIX, 1, [Listen on Unix socket])
1066fi
1067if test "x$LISTEN_LOCAL" = xyes; then
1068	AC_DEFINE(LISTEN_LOCAL, 1, [Listen on local socket])
1069fi
1070
1071# The XRes extension may support client ID tracking only if it has
1072# been specifically enabled. Client ID tracking is implicitly not
1073# supported if XRes extension is disabled.
1074AC_MSG_CHECKING([whether to track client ids])
1075if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then
1076	AC_DEFINE(CLIENTIDS, 1, [Support client ID tracking])
1077else
1078	CLIENTIDS=no
1079fi
1080if test "x$CLIENTIDS" = xyes; then
1081	case $host_os in
1082	openbsd*)
1083		SYS_LIBS="$SYS_LIBS -lkvm"
1084	;;
1085	esac
1086fi
1087AC_MSG_RESULT([$CLIENTIDS])
1088AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])
1089
1090AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
1091if test "x$DRI" = xyes; then
1092	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1093	REQUIRED_MODULES="$REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
1094	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
1095fi
1096
1097PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1098                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
1099case "$DRI2,$HAVE_DRI2PROTO" in
1100	yes,no)
1101		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
1102		;;
1103	yes,yes | auto,yes)
1104		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
1105		DRI2=yes
1106		LIBGL="gl >= 1.2"
1107		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1108		;;
1109esac
1110AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
1111
1112AC_ARG_ENABLE(xtrans-send-fds,	AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
1113
1114case "x$XTRANS_SEND_FDS" in
1115xauto)
1116	case "$host_os" in
1117	linux*|solaris*|freebsd*|dragonfly*|openbsd*)
1118		XTRANS_SEND_FDS=yes
1119		;;
1120	*)
1121		XTRANS_SEND_FDS=no
1122		;;
1123	esac
1124esac
1125
1126case "x$XTRANS_SEND_FDS" in
1127xyes)
1128	AC_DEFINE(XTRANS_SEND_FDS, 1, [Enable xtrans fd passing support])
1129	;;
1130esac
1131
1132case "$DRI3,$XTRANS_SEND_FDS" in
1133	yes,yes | auto,yes)
1134		;;
1135	yes,no)
1136		AC_MSG_ERROR([DRI3 requested, but xtrans fd passing support not found.])
1137		DRI3=no
1138		;;
1139	no,*)
1140		;;
1141	*)
1142		AC_MSG_NOTICE([DRI3 disabled because xtrans fd passing support not found.])
1143		DRI3=no
1144		;;
1145esac
1146
1147PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
1148                  [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
1149
1150case "$DRI3,$HAVE_DRI3PROTO" in
1151	yes,yes | auto,yes)
1152		REQUIRED_MODULES="$REQUIRED_MODULES dri3proto"
1153		;;
1154	yes,no)
1155		AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
1156		DRI3=no
1157		;;
1158	no,*)
1159		;;
1160	*)
1161		AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
1162		DRI3=no
1163		;;
1164esac
1165
1166AC_CHECK_FUNCS([sigaction])
1167
1168BUSFAULT=no
1169
1170case x"$ac_cv_func_sigaction" in
1171	xyes)
1172		AC_DEFINE(HAVE_SIGACTION, 1, [Have sigaction function])
1173		BUSFAULT=yes
1174		;;
1175esac
1176
1177case x"$BUSFAULT" in
1178	xyes)
1179		AC_DEFINE(BUSFAULT, 1, [Include busfault OS API])
1180		;;
1181esac
1182
1183AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes)
1184
1185
1186PKG_CHECK_MODULES([XSHMFENCE], $LIBXSHMFENCE, [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
1187if test "x$XSHMFENCE" = "xauto"; then
1188    XSHMFENCE="$HAVE_XSHMFENCE"
1189fi
1190
1191if test "x$XSHMFENCE" = "xyes"; then
1192    if test "x$HAVE_XSHMFENCE" != "xyes"; then
1193        AC_MSG_ERROR([xshmfence requested but not installed.])
1194    fi
1195    AC_DEFINE(HAVE_XSHMFENCE, 1, [Have xshmfence support])
1196    REQUIRED_LIBS="$REQUIRED_LIBS $LIBXSHMFENCE"
1197fi
1198
1199AM_CONDITIONAL(XSHMFENCE, [test "x$XSHMFENCE" = xyes])
1200
1201case "$DRI3,$XSHMFENCE" in
1202	yes,yes | auto,yes)
1203		;;
1204	yes,no)
1205		AC_MSG_ERROR([DRI3 requested, but xshmfence not found.])
1206		DRI3=no
1207		;;
1208	no,*)
1209		;;
1210	*)
1211		AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
1212		DRI3=no
1213		;;
1214esac
1215
1216case x"$DRI3" in
1217	xyes|xauto)
1218		DRI3=yes
1219		AC_DEFINE(DRI3, 1, [Build DRI3 extension])
1220		DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
1221		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
1222		AC_MSG_NOTICE([DRI3 enabled]);
1223		;;
1224esac
1225
1226AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)
1227
1228if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$XORG" = xyes; then
1229	if test "x$DRM" = xyes; then
1230		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
1231		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
1232	fi
1233fi
1234
1235if test "x$GLX" = xyes; then
1236	PKG_CHECK_MODULES([XLIB], [x11])
1237	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
1238	AC_SUBST(XLIB_CFLAGS)
1239	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
1240	HASHTABLE=yes
1241	GLX_LIBS='$(top_builddir)/glx/libglx.la $(top_builddir)/glx/libglxvnd.la'
1242	GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
1243else
1244        GLX=no
1245fi
1246AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
1247
1248AM_CONDITIONAL(HASHTABLE, test "x$HASHTABLE" = xyes)
1249
1250AC_SUBST([GLX_DEFINES])
1251AC_SUBST([GLX_SYS_LIBS])
1252
1253AM_CONDITIONAL(PRESENT, [test "x$PRESENT" = xyes])
1254if test "x$PRESENT" = xyes; then
1255	AC_DEFINE(PRESENT, 1, [Support Present extension])
1256	REQUIRED_MODULES="$REQUIRED_MODULES $PRESENTPROTO"
1257	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $PRESENTPROTO"
1258	PRESENT_INC='-I$(top_srcdir)/present'
1259	PRESENT_LIB='$(top_builddir)/present/libpresent.la'
1260fi
1261
1262AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
1263if test "x$XINERAMA" = xyes; then
1264	AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
1265	AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
1266	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1267	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
1268fi
1269
1270AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
1271if test "x$XACE" = xyes; then
1272	AC_DEFINE(XACE, 1, [Build X-ACE extension])
1273fi
1274
1275AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
1276if test "x$XSELINUX" = xyes; then
1277	if test "x$XACE" != xyes; then
1278		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
1279	fi
1280	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
1281	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1282	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1283	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1284	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
1285fi
1286
1287AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
1288if test "x$XCSECURITY" = xyes; then
1289	if test "x$XACE" != xyes; then
1290		AC_MSG_ERROR([cannot build Security extension without X-ACE])
1291	fi
1292	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
1293fi
1294
1295AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
1296if test "x$DBE" = xyes; then
1297	AC_DEFINE(DBE, 1, [Support DBE extension])
1298	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
1299	DBE_INC='-I$(top_srcdir)/dbe'
1300fi
1301
1302AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
1303if test "x$XF86BIGFONT" = xyes; then
1304	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
1305	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
1306	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $BIGFONTPROTO"
1307fi
1308
1309AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
1310if test "x$DPMSExtension" = xyes; then
1311	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
1312fi
1313
1314AC_DEFINE(RENDER, 1, [Support RENDER extension])
1315RENDER_LIB='$(top_builddir)/render/librender.la'
1316RENDER_INC='-I$(top_srcdir)/render'
1317
1318AC_DEFINE(RANDR, 1, [Support RANDR extension])
1319RANDR_LIB='$(top_builddir)/randr/librandr.la'
1320RANDR_INC='-I$(top_srcdir)/randr'
1321
1322AC_DEFINE(XFIXES,1,[Support XFixes extension])
1323FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
1324FIXES_INC='-I$(top_srcdir)/xfixes'
1325
1326AC_DEFINE(DAMAGE,1,[Support Damage extension])
1327DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
1328DAMAGE_INC='-I$(top_srcdir)/damageext'
1329MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
1330MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
1331
1332# XINPUT extension is integral part of the server
1333AC_DEFINE(XINPUT, 1, [Support X Input extension])
1334XI_LIB='$(top_builddir)/Xi/libXi.la'
1335XI_INC='-I$(top_srcdir)/Xi'
1336
1337AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
1338AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
1339AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
1340
1341AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
1342
1343if test "x$XKBPATH" = "xauto"; then
1344    XKBPATH=$(pkg-config --variable datadir xkbcomp || echo ${datadir})/X11/xkb
1345fi
1346
1347AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
1348AC_ARG_WITH(xkb-bin-directory,
1349				AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program (default: auto)]),
1350				[XKB_BIN_DIRECTORY="$withval"],
1351				[XKB_BIN_DIRECTORY="auto"])
1352
1353if test "x$XKB_BIN_DIRECTORY" = "xauto"; then
1354    XKB_BIN_DIRECTORY=$(pkg-config --variable bindir xkbcomp)
1355    if test -z $XKB_BIN_DIRECTORY; then
1356        XKB_BIN_DIRECTORY="$bindir"
1357    fi
1358fi
1359
1360AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
1361
1362dnl Make sure XKM_OUTPUT_DIR is an absolute path
1363XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
1364if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
1365   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
1366fi
1367
1368dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
1369dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
1370
1371XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
1372XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
1373AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
1374AC_SUBST(XKB_COMPILED_DIR)
1375
1376if test "x$XKB_DFLT_RULES" = x; then
1377    case $host_os in
1378    linux*)
1379        dnl doesn't take AutoAddDevices into account, but whatever.
1380        XKB_DFLT_RULES="evdev"
1381        ;;
1382    *)
1383        XKB_DFLT_RULES="base"
1384        ;;
1385    esac
1386fi
1387AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
1388AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
1389AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
1390AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
1391AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
1392AC_SUBST([XKB_DFLT_RULES])
1393AC_SUBST([XKB_DFLT_MODEL])
1394AC_SUBST([XKB_DFLT_LAYOUT])
1395AC_SUBST([XKB_DFLT_VARIANT])
1396AC_SUBST([XKB_DFLT_OPTIONS])
1397
1398XKB_LIB='$(top_builddir)/xkb/libxkb.la'
1399XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
1400REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
1401
1402PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
1403if test "x$XDMCP" = xauto; then
1404	if test "x$have_libxdmcp" = xyes; then
1405		XDMCP=yes
1406	else
1407		XDMCP=no
1408	fi
1409fi
1410if test "x$XDMAUTH" = xauto; then
1411	if test "x$have_libxdmcp" = xyes; then
1412		XDMAUTH=yes
1413	else
1414		XDMAUTH=no
1415	fi
1416fi
1417
1418AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
1419if test "x$XDMCP" = xyes; then
1420	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
1421	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1422	XDMCP_MODULES="xdmcp"
1423fi
1424
1425AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
1426if test "x$XDMAUTH" = xyes; then
1427	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
1428	if ! test "x$XDMCP" = xyes; then
1429		REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1430		XDMCP_MODULES="xdmcp"
1431	fi
1432fi
1433
1434if test "x$XF86VIDMODE" = xauto; then
1435	PKG_CHECK_EXISTS($VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
1436fi
1437if test "x$XF86VIDMODE" = xyes; then
1438	AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
1439fi
1440AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
1441
1442AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
1443AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
1444AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
1445dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
1446AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
1447AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
1448AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
1449AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1450AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
1451
1452AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
1453
1454AC_SUBST([VENDOR_NAME_SHORT])
1455AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
1456AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
1457AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
1458AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1459
1460if test "x$DEBUGGING" = xyes; then
1461       AC_DEFINE(DEBUG, 1, [Enable debugging code])
1462fi
1463AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
1464
1465AC_DEFINE(XTEST, 1, [Support XTest extension])
1466AC_DEFINE(XSYNC, 1, [Support XSync extension])
1467AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
1468AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
1469
1470if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
1471  DIX_LIB='$(top_builddir)/dix/dix.O'
1472  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
1473else
1474  DIX_LIB='$(top_builddir)/dix/libdix.la'
1475  OS_LIB='$(top_builddir)/os/libos.la'
1476fi
1477AC_SUBST([DIX_LIB])
1478AC_SUBST([OS_LIB])
1479
1480MAIN_LIB='$(top_builddir)/dix/libmain.la'
1481AC_SUBST([MAIN_LIB])
1482
1483MI_LIB='$(top_builddir)/mi/libmi.la'
1484MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
1485MI_INC='-I$(top_srcdir)/mi'
1486FB_LIB='$(top_builddir)/fb/libfb.la'
1487FB_INC='-I$(top_srcdir)/fb'
1488MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
1489MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
1490MIEXT_SYNC_INC='-I$(top_srcdir)/miext/sync'
1491MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.la'
1492CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
1493
1494# SHA1 hashing
1495AC_ARG_WITH([sha1],
1496            [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|nettlestatic|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
1497                            [choose SHA1 implementation])])
1498AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
1499if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
1500	with_sha1=libc
1501fi
1502if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
1503	AC_MSG_ERROR([libc requested but not found])
1504fi
1505if test "x$with_sha1" = xlibc; then
1506	AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
1507		[Use libc SHA1 functions])
1508	SHA1_LIBS=""
1509fi
1510AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
1511if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
1512	with_sha1=CommonCrypto
1513fi
1514if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
1515	AC_MSG_ERROR([CommonCrypto requested but not found])
1516fi
1517if test "x$with_sha1" = xCommonCrypto; then
1518	AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
1519		[Use CommonCrypto SHA1 functions])
1520	SHA1_LIBS=""
1521fi
1522dnl stdcall functions cannot be tested with AC_CHECK_LIB
1523AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
1524if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
1525	with_sha1=CryptoAPI
1526fi
1527if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
1528	AC_MSG_ERROR([CryptoAPI requested but not found])
1529fi
1530if test "x$with_sha1" = xCryptoAPI; then
1531	AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
1532		[Use CryptoAPI SHA1 functions])
1533	SHA1_LIBS=""
1534fi
1535AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
1536if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
1537	with_sha1=libmd
1538fi
1539if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
1540	AC_MSG_ERROR([libmd requested but not found])
1541fi
1542if test "x$with_sha1" = xlibmd; then
1543	AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
1544	          [Use libmd SHA1 functions])
1545	SHA1_LIBS=-lmd
1546fi
1547PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
1548if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
1549   with_sha1=libsha1
1550fi
1551if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
1552	AC_MSG_ERROR([libsha1 requested but not found])
1553fi
1554if test "x$with_sha1" = xlibsha1; then
1555	AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
1556	          [Use libsha1 for SHA1])
1557	SHA1_LIBS=-lsha1
1558fi
1559AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
1560if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
1561	with_sha1=libnettle
1562fi
1563if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
1564	AC_MSG_ERROR([libnettle requested but not found])
1565fi
1566if test "x$with_sha1" = xlibnettle; then
1567	AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
1568	          [Use libnettle SHA1 functions])
1569	SHA1_LIBS=-lnettle
1570fi
1571if test "x$with_sha1" = xnettlestatic && test "x$HAVE_LIBNETTLE" != xyes; then
1572	AC_MSG_ERROR([nettlestatic requested but libnettle not found])
1573fi
1574if test "x$with_sha1" = xnettlestatic; then
1575	AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
1576	          [Use static libnettle SHA1 functions])
1577	SHA1_LIBS=-l:libnettle.a
1578fi
1579AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
1580if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
1581	with_sha1=libgcrypt
1582fi
1583if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
1584	AC_MSG_ERROR([libgcrypt requested but not found])
1585fi
1586if test "x$with_sha1" = xlibgcrypt; then
1587	AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
1588	          [Use libgcrypt SHA1 functions])
1589	SHA1_LIBS=-lgcrypt
1590fi
1591# We don't need all of the OpenSSL libraries, just libcrypto
1592AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
1593PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
1594                  [HAVE_OPENSSL_PKC=no])
1595if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
1596	if test "x$with_sha1" = x; then
1597		with_sha1=libcrypto
1598	fi
1599else
1600	if test "x$with_sha1" = xlibcrypto; then
1601		AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
1602	fi
1603fi
1604if test "x$with_sha1" = xlibcrypto; then
1605	if test "x$HAVE_LIBCRYPTO" = xyes; then
1606		SHA1_LIBS=-lcrypto
1607	else
1608		SHA1_LIBS="$OPENSSL_LIBS"
1609		SHA1_CFLAGS="$OPENSSL_CFLAGS"
1610	fi
1611fi
1612AC_MSG_CHECKING([for SHA1 implementation])
1613if test "x$with_sha1" = x; then
1614	AC_MSG_ERROR([No suitable SHA1 implementation found])
1615fi
1616AC_MSG_RESULT([$with_sha1])
1617AC_SUBST(SHA1_LIBS)
1618AC_SUBST(SHA1_CFLAGS)
1619
1620PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
1621PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
1622
1623PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
1624if test "x$LIBUNWIND" = "xauto"; then
1625    LIBUNWIND="$HAVE_LIBUNWIND"
1626fi
1627
1628if test "x$LIBUNWIND" = "xyes"; then
1629    if test "x$HAVE_LIBUNWIND" != "xyes"; then
1630        AC_MSG_ERROR([libunwind requested but not installed.])
1631    fi
1632    AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
1633fi
1634
1635AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = xyes])
1636
1637# Autotools has some unfortunate issues with library handling.  In order to
1638# get a server to rebuild when a dependency in the tree is changed, it must
1639# be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be
1640# listed there, or some versions of autotools will break (especially if a -L
1641# is required to find the library).  So, we keep two sets of libraries
1642# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
1643# will go into the _DEPENDENCIES and _LDADD of the server, and
1644# NAMESPACE_SYS_LIBS which will go into only the _LDADD.  The
1645# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
1646# NAMESPACE_SYS_LIBS.
1647#
1648# XSERVER_LIBS is the set of in-tree libraries which all servers require.
1649# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
1650# require.
1651#
1652XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
1653XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
1654XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
1655AC_SUBST([XSERVER_LIBS])
1656AC_SUBST([XSERVER_SYS_LIBS])
1657
1658UTILS_SYS_LIBS="${SYS_LIBS}"
1659AC_SUBST([UTILS_SYS_LIBS])
1660
1661# The Xorg binary needs to export symbols so that they can be used from modules
1662# Some platforms require extra flags to do this.   libtool should set the
1663# necessary flags for each platform when -export-dynamic is passed to it.
1664LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
1665LD_NO_UNDEFINED_FLAG=
1666XORG_DRIVER_LIBS=
1667case "$host_os" in
1668    cygwin*)
1669	LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-all,--out-implib,lib\$@.a"
1670	LD_NO_UNDEFINED_FLAG="-no-undefined -Wl,\$(top_builddir)/hw/xfree86/libXorg.exe.a"
1671	XORG_DRIVER_LIBS="-lXorg.exe -L\${moduledir} -lshadow -lfb -no-undefined"
1672	CYGWIN=yes
1673	;;
1674    solaris*)
1675	# We use AC_LINK_IFELSE to generate a temporary program conftest$EXEEXT
1676	# that we can link against for testing if the system linker is new
1677	# enough to support -z parent=<program> for verifying loadable modules
1678	# are only calling functions defined in either the loading program or
1679	# the libraries they're linked with.
1680	AC_LINK_IFELSE(
1681	    [AC_LANG_SOURCE([int main(int argc, char **argv) { return 0; }])],
1682	    [mv conftest$EXEEXT conftest.parent
1683	     XORG_CHECK_LINKER_FLAGS([-Wl,-z,parent=conftest.parent -G],
1684		[LD_NO_UNDEFINED_FLAG="-Wl,-z,defs -Wl,-z,parent=\$(top_builddir)/hw/xfree86/Xorg"
1685# Not set yet, since this gets exported in xorg-server.pc to all the drivers,
1686# and they're not all fixed to build correctly with it yet.
1687#		 XORG_DRIVER_LIBS="-Wl,-z,defs -Wl,-z,parent=${bindir}/Xorg"
1688         ],[],
1689		[AC_LANG_SOURCE([extern int main(int argc, char **argv);
1690			int call_main(void) { return main(0, (void *)0); }])])
1691	     rm -f conftest.parent
1692	    ])
1693	;;
1694esac
1695AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
1696AC_SUBST([LD_NO_UNDEFINED_FLAG])
1697AC_SUBST([XORG_DRIVER_LIBS])
1698AM_CONDITIONAL([CYGWIN], [test x"$CYGWIN" = xyes])
1699AM_CONDITIONAL([NO_UNDEFINED], [test x"$LD_NO_UNDEFINED_FLAG" != x])
1700
1701dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
1702dnl we need to replicate that here until those can all be fixed
1703AC_MSG_CHECKING([if SVR4 needs to be defined])
1704AC_EGREP_CPP([I_AM_SVR4],[
1705#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
1706 I_AM_SVR4
1707#endif
1708],[
1709AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
1710AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
1711
1712XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC $PRESENT_INC"
1713
1714dnl ---------------------------------------------------------------------------
1715dnl DDX section.
1716dnl ---------------------------------------------------------------------------
1717
1718dnl Xvfb DDX
1719
1720AC_MSG_CHECKING([whether to build Xvfb DDX])
1721AC_MSG_RESULT([$XVFB])
1722AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
1723
1724if test "x$XVFB" = xyes; then
1725	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
1726	XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
1727	AC_SUBST([XVFB_LIBS])
1728	AC_SUBST([XVFB_SYS_LIBS])
1729fi
1730
1731
1732dnl Xnest DDX
1733
1734PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
1735AC_MSG_CHECKING([whether to build Xnest DDX])
1736if test "x$XNEST" = xauto; then
1737	XNEST="$have_xnest"
1738fi
1739AC_MSG_RESULT([$XNEST])
1740AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
1741
1742if test "x$XNEST" = xyes; then
1743	if test "x$have_xnest" = xno; then
1744		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
1745	fi
1746	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $DAMAGE_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $RENDER_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
1747	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
1748	AC_SUBST([XNEST_LIBS])
1749	AC_SUBST([XNEST_SYS_LIBS])
1750fi
1751
1752
1753dnl Xorg DDX
1754
1755AC_MSG_CHECKING([whether to build Xorg DDX])
1756if test "x$XORG" = xauto; then
1757	XORG="yes"
1758	case $host_os in
1759		cygwin*) XORG="no" ;;
1760		mingw*)  XORG="no" ;;
1761		darwin*) XORG="no" ;;
1762	esac
1763fi
1764AC_MSG_RESULT([$XORG])
1765
1766if test "x$XORG" = xyes; then
1767	PKG_CHECK_MODULES([LIBXCVT], $LIBXCVT)
1768
1769	XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
1770	XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
1771	XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
1772	XORG_CFLAGS="$XORGSERVER_CFLAGS $LIBXCVT_CFLAGS -DHAVE_XORG_CONFIG_H"
1773	XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"
1774	XORG_SYS_LIBS="$XORG_SYS_LIBS $LIBXCVT_LIBS"
1775
1776	dnl ==================================================================
1777	dnl symbol visibility
1778	symbol_visibility=
1779	have_visibility=disabled
1780	if test x$SYMBOL_VISIBILITY != xno; then
1781	    AC_MSG_CHECKING(for symbol visibility support)
1782	    if test x$GCC = xyes; then
1783		VISIBILITY_CFLAGS="-fvisibility=hidden"
1784	    else
1785		if test x$SUNCC = xyes; then
1786		    VISIBILITY_CFLAGS="-xldscope=hidden"
1787		else
1788		    have_visibility=no
1789		fi
1790	    fi
1791	    if test x$have_visibility != xno; then
1792		save_CFLAGS="$CFLAGS"
1793		proto_inc=`$PKG_CONFIG --cflags xproto`
1794		CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc"
1795		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1796		    [#include <X11/Xfuncproto.h>
1797		     extern _X_HIDDEN int hidden_int;
1798		     extern _X_EXPORT int public_int;
1799		     extern _X_HIDDEN int hidden_int_func(void);
1800		     extern _X_EXPORT int public_int_func(void);]],
1801		    [])],
1802		    have_visibility=yes,
1803		    have_visibility=no)
1804		CFLAGS=$save_CFLAGS
1805	    fi
1806	    AC_MSG_RESULT([$have_visibility])
1807	    if test x$have_visibility != xno; then
1808		symbol_visibility=$VISIBILITY_CFLAGS
1809		XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
1810		XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
1811	    fi
1812	fi
1813	dnl added to xorg-server.pc
1814	AC_SUBST([symbol_visibility])
1815	dnl ===================================================================
1816
1817	dnl ===================================================================
1818	dnl ================= beginning of PCI configuration ==================
1819	dnl ===================================================================
1820	xorg_bus_bsdpci=no
1821	xorg_bus_sparc=no
1822
1823	AC_MSG_CHECKING([whether to build Xorg PCI functions])
1824	if test "x$PCI" = xyes; then
1825		PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
1826		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS"
1827		XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS"
1828		XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS"
1829
1830		AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
1831		AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
1832		case $host_os in
1833		  gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
1834			xorg_bus_bsdpci="yes"
1835			;;
1836		esac
1837		case $host_cpu in
1838		  sparc*)
1839			xorg_bus_sparc="yes"
1840			;;
1841		esac
1842	else
1843		if test "x$CONFIG_UDEV_KMS" = xyes; then
1844			AC_MSG_ERROR([Platform device enumeration requires libpciaccess])
1845		fi
1846		if test "x$INT10MODULE" = xyes && test "x$INT10" != xstub; then
1847			AC_MSG_ERROR([Cannot build int10 without libpciaccess])
1848		fi
1849	fi
1850	AC_MSG_RESULT([$PCI])
1851
1852	if test "x$CONFIG_UDEV_KMS" = xyes; then
1853		AC_DEFINE(XSERVER_PLATFORM_BUS, 1, [X server supports platform device enumeration])
1854	fi
1855	AC_MSG_RESULT([$XSERVER_PLATFORM_BUS])
1856	dnl ===================================================================
1857	dnl ==================== end of PCI configuration =====================
1858	dnl ===================================================================
1859
1860	case $host_os in
1861	  linux*)
1862		XORG_OS_SUBDIR="linux"
1863		linux_acpi="no"
1864		case $host_cpu in
1865		  i*86|amd64*|x86_64*|ia64*)
1866			linux_acpi=$enable_linux_acpi
1867			;;
1868		  *)
1869			;;
1870		esac
1871		dnl APM header
1872		AC_CHECK_HEADERS([linux/apm_bios.h], [linux_apm=$enable_linux_apm])
1873		;;
1874	  freebsd* | kfreebsd*-gnu | dragonfly*)
1875		XORG_OS_SUBDIR="bsd"
1876		;;
1877	  netbsd*)
1878		XORG_OS_SUBDIR="bsd"
1879		;;
1880	  openbsd*)
1881		XORG_OS_SUBDIR="bsd"
1882		;;
1883	  solaris*)
1884		XORG_OS_SUBDIR="solaris"
1885		AC_CHECK_HEADERS([sys/kd.h])
1886		AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
1887		# Check for minimum supported release
1888		AC_MSG_CHECKING([Solaris version])
1889	        OS_MINOR=`echo ${host_os}|$SED -e 's/^.*solaris2\.//' -e s'/\..*$//'`
1890		if test "${OS_MINOR}" -ge 7 ; then
1891	        	AC_MSG_RESULT(Solaris ${OS_MINOR})
1892		else
1893			AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
1894		fi
1895		if test "${OS_MINOR}" -lt 8 ; then
1896			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
1897		fi
1898		AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
1899			
1900		case $host_cpu in
1901		  sparc*)	
1902			SOLARIS_INOUT_ARCH="sparcv8plus"
1903			;;
1904		  i*86|x86_64*)
1905			if test x$SOLARIS_64 = xyes ; then
1906				SOLARIS_INOUT_ARCH="amd64"
1907			else
1908				SOLARIS_INOUT_ARCH="ia32"
1909			fi
1910			;;
1911		  *)
1912			AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
1913			are supported on Solaris in this release.   If you are \
1914			interested in porting Xorg to your platform, please email \
1915			xorg@lists.freedesktop.org.]) ;;
1916		esac
1917		AC_SUBST([SOLARIS_INOUT_ARCH])
1918		;;
1919	  gnu*)
1920		XORG_OS_SUBDIR="hurd"
1921		;;
1922	  cygwin*)
1923		XORG_OS_SUBDIR="stub"
1924		;;
1925	  *)
1926		XORG_OS_SUBDIR="stub"
1927		AC_MSG_NOTICE([m4_text_wrap(m4_join([ ],
1928		[Your OS is unknown.],
1929		[If you are interested in porting Xorg to your platform,],
1930		[please email xorg@lists.freedesktop.org.]))])
1931		;;
1932	esac
1933
1934	if test "x$DGA" = xauto; then
1935		PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
1936	fi
1937	if test "x$DGA" = xyes; then
1938		XORG_MODULES="$XORG_MODULES $DGAPROTO"
1939		PKG_CHECK_MODULES(DGA, $DGAPROTO)
1940		AC_DEFINE(DGA, 1, [Support DGA extension])
1941		AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
1942	fi
1943
1944	if test "x$XF86VIDMODE" = xyes; then
1945		XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
1946	fi
1947
1948	if test -n "$XORG_MODULES"; then
1949	        PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
1950	        XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
1951	        XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
1952	fi
1953
1954	if test "x$DRM" = xyes -a "x$DRI2" = xyes; then
1955		XORG_DRIVER_MODESETTING=yes
1956	fi
1957
1958	AC_SUBST([XORG_LIBS])
1959	AC_SUBST([XORG_SYS_LIBS])
1960	AC_SUBST([XORG_INCS])
1961	AC_SUBST([XORG_OS_SUBDIR])
1962	AC_SUBST([XORG_CFLAGS])
1963
1964	dnl these only go in xorg-config.h
1965	XF86CONFIGFILE="xorg.conf"
1966	XF86CONFIGDIR="xorg.conf.d"
1967	AC_SUBST(XF86CONFIGDIR)
1968	LOGPREFIX="Xorg."
1969	XDG_DATA_HOME=".local/share"
1970	XDG_DATA_HOME_LOGDIR="xorg"
1971	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
1972	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
1973	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
1974	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
1975	AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
1976	AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
1977	AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
1978	AC_DEFINE_DIR(XCONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
1979	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
1980	AC_DEFINE_DIR(XCONFIGDIR, XF86CONFIGDIR, [Name of configuration directory])
1981	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
1982	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
1983	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
1984	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
1985	AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME])
1986	AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME])
1987	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
1988	if test "x$VGAHW" = xyes; then
1989		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
1990	fi
1991
1992	driverdir="$moduledir/drivers"
1993	AC_SUBST([moduledir])
1994	AC_SUBST([driverdir])
1995	sdkdir="$includedir/xorg"
1996	extdir="$includedir/X11/extensions"
1997	sysconfigdir="$datadir/X11/$XF86CONFIGDIR"
1998	AC_SUBST([sdkdir])
1999	AC_SUBST([extdir])
2000	AC_SUBST([sysconfigdir])
2001	AC_SUBST([logdir])
2002
2003	# stuff the ABI versions into the pc file too
2004	extract_abi() {
2005	    grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' '  .' | awk '{ print $4$5 }'
2006	}
2007	abi_ansic=`extract_abi ANSIC`
2008	abi_videodrv=`extract_abi VIDEODRV`
2009	abi_xinput=`extract_abi XINPUT`
2010	abi_extension=`extract_abi EXTENSION`
2011	AC_SUBST([abi_ansic])
2012	AC_SUBST([abi_videodrv])
2013	AC_SUBST([abi_xinput])
2014	AC_SUBST([abi_extension])
2015fi
2016AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
2017AM_CONDITIONAL([XORG_BUS_PCI], [test "x$PCI" = xyes])
2018AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
2019AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
2020AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
2021AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes])
2022AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
2023AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
2024AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
2025AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes])
2026AM_CONDITIONAL([XORG_DRIVER_INPUT_INPUTTEST], [test "x$XORG_DRIVER_INPUT_INPUTTEST" = xyes])
2027
2028dnl glamor
2029if test "x$GLAMOR" = xauto; then
2030	if echo "$XORG" "$XEPHYR" | grep -q yes ; then
2031		GLAMOR=yes
2032	fi
2033fi
2034
2035AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes])
2036
2037if test "x$GLAMOR" = xyes; then
2038	AC_DEFINE(GLAMOR, 1, [Build glamor])
2039	PKG_CHECK_MODULES([GLAMOR], [epoxy])
2040
2041	PKG_CHECK_EXISTS(epoxy >= 1.4.4,
2042			 [AC_DEFINE(GLAMOR_HAS_EGL_QUERY_DMABUF, 1, [Have GLAMOR_HAS_EGL_QUERY_DMABUF])],
2043			 [])
2044
2045	PKG_CHECK_EXISTS(epoxy >= 1.5.4,
2046			 [AC_DEFINE(GLAMOR_HAS_EGL_QUERY_DRIVER, 1, [Have GLAMOR_HAS_EGL_QUERY_DRIVER])],
2047			 [])
2048
2049	PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no])
2050	if test "x$GBM" = xyes; then
2051		AC_DEFINE(GLAMOR_HAS_GBM, 1,
2052			  [Build glamor with GBM-based EGL support])
2053		AC_CHECK_DECL(GBM_BO_USE_LINEAR,
2054			[AC_DEFINE(GLAMOR_HAS_GBM_LINEAR, 1, [Have GBM_BO_USE_LINEAR])], [],
2055			[#include <stdlib.h>
2056			 #include <gbm.h>])
2057		dnl 17.1.0 is required for gbm_bo_create_with_modifiers
2058		PKG_CHECK_EXISTS(gbm >= 17.1.0,
2059				 [AC_DEFINE(GBM_BO_WITH_MODIFIERS, 1, [Have gbm_bo_create_with_modifiers])],
2060				 [])
2061	else
2062		if test "x$XORG" = xyes; then
2063			AC_MSG_ERROR([Glamor for Xorg requires $LIBGBM])
2064		fi
2065	fi
2066fi
2067AM_CONDITIONAL([GLAMOR_EGL], [test "x$GBM" = xyes])
2068
2069dnl XWin DDX
2070
2071AC_MSG_CHECKING([whether to build XWin DDX])
2072if test "x$XWIN" = xauto; then
2073	case $host_os in
2074		cygwin*) XWIN="yes" ;;
2075		mingw*) XWIN="yes" ;;
2076		*) XWIN="no" ;;
2077	esac
2078fi
2079AC_MSG_RESULT([$XWIN])
2080
2081if test "x$XWIN" = xyes; then
2082	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
2083	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
2084	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
2085	AC_CHECK_TOOL(WINDRES, windres)
2086
2087	PKG_CHECK_MODULES([XWINMODULES],[xcb-aux xcb-composite xcb-image xcb-ewmh xcb-icccm xcb-xfixes])
2088
2089	if test "x$WINDOWSDRI" = xauto; then
2090		PKG_CHECK_EXISTS([windowsdriproto], [WINDOWSDRI=yes], [WINDOWSDRI=no])
2091	fi
2092	if test "x$WINDOWSDRI" = xyes ; then
2093		PKG_CHECK_MODULES(WINDOWSDRI, [windowsdriproto])
2094	fi
2095
2096	case $host_os in
2097		cygwin*)
2098			XWIN_SERVER_NAME=XWin
2099			AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
2100			;;
2101		mingw*)
2102			XWIN_SERVER_NAME=Xming
2103			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
2104			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
2105			XWIN_SYS_LIBS="-lpthread -lws2_32"
2106			;;
2107	esac
2108
2109	XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
2110	XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
2111	AC_SUBST(XWIN_LIBS)
2112	AC_SUBST(XWIN_SERVER_NAME)
2113	AC_SUBST(XWIN_SYS_LIBS)
2114
2115	if test "x$DEBUGGING" = xyes; then
2116		AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
2117		AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
2118		AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
2119	fi
2120
2121	AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
2122	AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
2123
2124dnl XWin requires OpenGL spec files in order to generate wrapper code for native GL functions
2125	if [test "x$XWIN" = xyes && test "x$GLX" = xyes] ; then
2126           AC_CHECK_PROG(PYTHON3, python3, python3)
2127           if test -z "$PYTHON3"; then
2128                AC_MSG_ERROR([python3 not found])
2129           fi
2130           AC_MSG_CHECKING(for python module lxml)
2131           $PYTHON3 -c "import lxml;"
2132           if test $? -ne 0 ; then
2133                AC_MSG_ERROR([not found])
2134           fi
2135           AC_MSG_RESULT(yes)
2136           if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then
2137		PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry])
2138		KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir`
2139           fi
2140           AC_SUBST(KHRONOS_SPEC_DIR)
2141	fi
2142
2143fi
2144AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
2145AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$GLX" = xyes])
2146AM_CONDITIONAL(XWIN_WINDOWS_DRI, [test "x$XWIN" = xyes && test "x$WINDOWSDRI" = xyes])
2147
2148dnl Darwin / OS X DDX
2149if test "x$XQUARTZ" = xyes; then
2150	AC_DEFINE(XQUARTZ,1,[Have Quartz])
2151	AC_DEFINE(ROOTLESS,1,[Build Rootless code])
2152
2153	XQUARTZ_LIBS="$COMPOSITE_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $PRESENT_LIB"
2154	AC_SUBST([XQUARTZ_LIBS])
2155
2156	AC_CHECK_LIB([Xplugin],[xp_init],[:])
2157
2158	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
2159
2160	PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)
2161
2162        if test "x$XQUARTZ_SPARKLE" = xyes ; then
2163                AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
2164        fi
2165
2166	if test "x$STANDALONE_XPBPROXY" = xyes ; then
2167		AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
2168	fi
2169fi
2170
2171AM_CONDITIONAL(PSEUDORAMIX, [test "x$XQUARTZ" = xyes -o "x$XWIN" = xyes ])
2172
2173# Support for objc in autotools is minimal and not documented.
2174OBJC='$(CC)'
2175OBJCLD='$(CCLD)'
2176OBJCLINK='$(LINK)'
2177OBJCFLAGS='$(CFLAGS)'
2178AC_SUBST([OBJC])
2179AC_SUBST([OBJCCLD])
2180AC_SUBST([OBJCLINK])
2181AC_SUBST([OBJCFLAGS])
2182# internal, undocumented automake func follows :(
2183_AM_DEPENDENCIES([OBJC])
2184AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
2185AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
2186AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
2187
2188dnl kdrive DDX
2189
2190XEPHYR_LIBS=
2191XEPHYR_INCS=
2192
2193AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
2194
2195if test "$KDRIVE" = yes; then
2196    XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-renderutil xcb-aux xcb-image xcb-icccm xcb-shm >= 1.9.3 xcb-keysyms xcb-randr xcb-xkb"
2197    if test "x$XV" = xyes; then
2198        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
2199    fi
2200    if test "x$DRI" = xyes && test "x$GLX" = xyes; then
2201        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBDRM xcb-glx xcb-xf86dri > 1.6"
2202    fi
2203    if test "x$GLAMOR" = xyes; then
2204        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb"
2205    fi
2206
2207    if test "x$XEPHYR" = xauto; then
2208        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"])
2209    elif test "x$XEPHYR" = xyes ; then
2210        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS)
2211    fi
2212
2213    # Xephyr needs nanosleep() which is in librt on Solaris
2214    AC_CHECK_FUNC([nanosleep], [],
2215        AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
2216    
2217    # damage shadow extension glx (NOTYET) fb mi
2218    KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
2219    KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
2220    KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
2221    KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
2222    
2223    KDRIVE_CFLAGS="$XSERVER_CFLAGS"
2224
2225    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
2226    KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
2227    KDRIVE_MAIN_LIB="$MAIN_LIB"
2228    KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
2229    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
2230    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
2231    KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
2232
2233    AC_SUBST([XEPHYR_LIBS])
2234    AC_SUBST([XEPHYR_INCS])
2235fi
2236AC_SUBST([KDRIVE_INCS])
2237AC_SUBST([KDRIVE_PURE_INCS])
2238AC_SUBST([KDRIVE_CFLAGS])
2239AC_SUBST([KDRIVE_PURE_LIBS])
2240AC_SUBST([KDRIVE_MAIN_LIB])
2241AC_SUBST([KDRIVE_LOCAL_LIBS])
2242AC_SUBST([KDRIVE_LIBS])
2243AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
2244
2245
2246dnl and the rest of these are generic, so they're in config.h
2247dnl 
2248dnl though, thanks to the passing of some significant amount of time, the
2249dnl above is probably a complete fallacy, and you should not rely on it.
2250dnl but this is still actually better than imake, honest. -daniels
2251
2252AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2253#include <features.h>
2254#ifndef __GLIBC__
2255#error not glibc
2256#endif
2257]], [])], [AC_DEFINE(_GNU_SOURCE, 1,
2258	[ Enable GNU and other extensions to the C environment for glibc])])
2259
2260AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
2261AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir])
2262
2263AC_SUBST([RELEASE_DATE])
2264
2265DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
2266
2267AC_SUBST([DIX_CFLAGS])
2268
2269AC_SUBST([libdir])
2270AC_SUBST([exec_prefix])
2271AC_SUBST([prefix])
2272
2273AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep])
2274
2275if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then
2276    AC_MSG_WARN([
2277             ***********************************************
2278             Neither HAL nor udev backend will be enabled.
2279             Input device hotplugging will not be available!
2280             ***********************************************])
2281fi
2282
2283AC_CONFIG_FILES([
2284Makefile
2285glx/Makefile
2286include/Makefile
2287composite/Makefile
2288damageext/Makefile
2289dbe/Makefile
2290dix/Makefile
2291doc/Makefile
2292doc/dtrace/Makefile
2293man/Makefile
2294fb/Makefile
2295glamor/Makefile
2296record/Makefile
2297config/Makefile
2298mi/Makefile
2299miext/Makefile
2300miext/sync/Makefile
2301miext/damage/Makefile
2302miext/shadow/Makefile
2303miext/rootless/Makefile
2304os/Makefile
2305pseudoramiX/Makefile
2306randr/Makefile
2307render/Makefile
2308xkb/Makefile
2309Xext/Makefile
2310Xi/Makefile
2311xfixes/Makefile
2312exa/Makefile
2313dri3/Makefile
2314present/Makefile
2315hw/Makefile
2316hw/xfree86/Makefile
2317hw/xfree86/Xorg.sh
2318hw/xfree86/common/Makefile
2319hw/xfree86/ddc/Makefile
2320hw/xfree86/dixmods/Makefile
2321hw/xfree86/doc/Makefile
2322hw/xfree86/dri/Makefile
2323hw/xfree86/dri2/Makefile
2324hw/xfree86/dri2/pci_ids/Makefile
2325hw/xfree86/drivers/Makefile
2326hw/xfree86/drivers/inputtest/Makefile
2327hw/xfree86/drivers/modesetting/Makefile
2328hw/xfree86/exa/Makefile
2329hw/xfree86/exa/man/Makefile
2330hw/xfree86/fbdevhw/Makefile
2331hw/xfree86/fbdevhw/man/Makefile
2332hw/xfree86/glamor_egl/Makefile
2333hw/xfree86/i2c/Makefile
2334hw/xfree86/int10/Makefile
2335hw/xfree86/loader/Makefile
2336hw/xfree86/man/Makefile
2337hw/xfree86/modes/Makefile
2338hw/xfree86/os-support/Makefile
2339hw/xfree86/os-support/bsd/Makefile
2340hw/xfree86/os-support/bus/Makefile
2341hw/xfree86/os-support/hurd/Makefile
2342hw/xfree86/os-support/misc/Makefile
2343hw/xfree86/os-support/linux/Makefile
2344hw/xfree86/os-support/solaris/Makefile
2345hw/xfree86/os-support/stub/Makefile
2346hw/xfree86/parser/Makefile
2347hw/xfree86/ramdac/Makefile
2348hw/xfree86/shadowfb/Makefile
2349hw/xfree86/vgahw/Makefile
2350hw/xfree86/x86emu/Makefile
2351hw/xfree86/xkb/Makefile
2352hw/xfree86/utils/Makefile
2353hw/xfree86/utils/man/Makefile
2354hw/xfree86/utils/gtf/Makefile
2355hw/vfb/Makefile
2356hw/vfb/man/Makefile
2357hw/xnest/Makefile
2358hw/xnest/man/Makefile
2359hw/xwin/Makefile
2360hw/xwin/dri/Makefile
2361hw/xwin/glx/Makefile
2362hw/xwin/man/Makefile
2363hw/xwin/winclipboard/Makefile
2364hw/xquartz/Makefile
2365hw/xquartz/GL/Makefile
2366hw/xquartz/bundle/Makefile
2367hw/xquartz/man/Makefile
2368hw/xquartz/mach-startup/Makefile
2369hw/xquartz/pbproxy/Makefile
2370hw/xquartz/xpr/Makefile
2371hw/kdrive/Makefile
2372hw/kdrive/ephyr/Makefile
2373hw/kdrive/ephyr/man/Makefile
2374hw/kdrive/src/Makefile
2375test/Makefile
2376xserver.ent
2377xorg-server.pc
2378])
2379AC_OUTPUT
2380