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