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