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