configure.ac revision 8223e2f2
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.57)
29AC_INIT([xorg-server], 1.9.5, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
30RELEASE_DATE="2011-03-17"
31AC_CONFIG_SRCDIR([Makefile.am])
32AM_INIT_AUTOMAKE([foreign dist-bzip2])
33AM_MAINTAINER_MODE
34
35# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
36m4_ifndef([XORG_MACROS_VERSION],
37          [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
38XORG_MACROS_VERSION(1.10)
39XORG_DEFAULT_OPTIONS
40XORG_WITH_DOXYGEN(1.6.1)
41XORG_CHECK_SGML_DOCTOOLS(1.5)
42
43m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
44XORG_FONT_MACROS_VERSION(1.1)
45
46dnl this gets generated by autoheader, and thus contains all the defines.  we
47dnl don't ever actually use it, internally.
48AC_CONFIG_HEADERS(include/do-not-use-config.h)
49dnl xorg-server.h is an external header, designed to be included by loadable
50dnl drivers.
51AC_CONFIG_HEADERS(include/xorg-server.h)
52dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
53dnl dix/).
54AC_CONFIG_HEADERS(include/dix-config.h)
55dnl xorg-config.h covers the Xorg DDX.
56AC_CONFIG_HEADERS(include/xorg-config.h)
57dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
58AC_CONFIG_HEADERS(include/xkb-config.h)
59dnl xwin-config.h covers the XWin DDX.
60AC_CONFIG_HEADERS(include/xwin-config.h)
61dnl kdrive-config.h covers the kdrive DDX
62AC_CONFIG_HEADERS(include/kdrive-config.h)
63dnl version-config.h covers the version numbers so they can be bumped without
64dnl forcing an entire recompile.x
65AC_CONFIG_HEADERS(include/version-config.h)
66
67AC_PROG_CC
68AM_PROG_AS
69AC_PROG_INSTALL
70AC_PROG_LN_S
71AC_LIBTOOL_WIN32_DLL
72AC_DISABLE_STATIC
73AC_PROG_LIBTOOL
74DOLT
75AC_PROG_MAKE_SET
76PKG_PROG_PKG_CONFIG
77AC_PROG_LEX
78AC_PROG_YACC
79AC_SYS_LARGEFILE
80XORG_PROG_RAWCPP
81AC_PROG_SED
82
83# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
84# easier overrides at build time.
85XSERVER_CFLAGS='$(CWARNFLAGS)'
86
87dnl Check for dtrace program (needed to build Xserver dtrace probes)
88dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
89dnl ISDN trace program named dtrace
90AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
91	     [Enable dtrace probes (default: enabled if dtrace found)]),
92	     [WDTRACE=$withval], [WDTRACE=auto])
93if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
94	AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
95	if test "x$DTRACE" = "xnot_found" ; then
96		if test "x$WDTRACE" = "xyes" ; then
97			AC_MSG_FAILURE([dtrace requested but not found])
98		fi
99		WDTRACE="no"
100	else
101		AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
102		if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
103			WDTRACE="no"
104		fi
105	fi
106fi
107if test "x$WDTRACE" != "xno" ; then
108  AC_DEFINE(XSERVER_DTRACE, 1, 
109      [Define to 1 if the DTrace Xserver provider probes should be built in.])
110
111# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
112# object files, and require linking with those as relocatable objects, not .a
113# archives. MacOS X handles all this in the normal compiler toolchain, and on
114# some releases (like Tiger), will error out on dtrace -G.  For now, other
115# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
116# ports appear to, based on my web searches, but have not yet been tested).
117	case $host_os in
118		darwin*)	SPECIAL_DTRACE_OBJECTS=no ;;
119		*)		SPECIAL_DTRACE_OBJECTS=yes ;;
120	esac
121fi
122AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
123AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
124
125AC_HEADER_DIRENT
126AC_HEADER_STDC
127AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])
128
129dnl Checks for typedefs, structures, and compiler characteristics.
130AC_C_CONST
131AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
132
133AC_CHECK_SIZEOF([unsigned long])
134if test "$ac_cv_sizeof_unsigned_long" = 8; then
135	AC_DEFINE(_XSERVER64, 1, [Define to 1 if unsigned long is 64 bits.])
136fi
137
138AC_TYPE_PID_T
139
140# Checks for headers/macros for byte swapping
141# Known variants:
142#	<byteswap.h> bswap_16, bswap_32, bswap_64  (glibc)
143#	<sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
144#	<sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
145#	and a fallback to local macros if none of the above are found
146
147# if <byteswap.h> is found, assume it's the correct version
148AC_CHECK_HEADERS([byteswap.h])
149
150# if <sys/endian.h> is found, have to check which version
151AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
152
153if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
154	AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
155	AC_LINK_IFELSE([AC_LANG_PROGRAM([
156#include <sys/types.h>
157#include <sys/endian.h>
158 ], [
159int a = 1, b;
160b = __swap16(a);
161 ])
162], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
163	AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
164
165	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
166	AC_LINK_IFELSE([AC_LANG_PROGRAM([
167#include <sys/types.h>
168#include <sys/endian.h>
169 ], [
170int a = 1, b;
171b = bswap16(a);
172 ])
173], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
174	AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
175
176    	if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
177		USE_SYS_ENDIAN_H=yes
178		BSWAP=bswap
179	else	
180	    	if test "$SYS_ENDIAN__SWAP" = "yes" ; then
181			USE_SYS_ENDIAN_H=yes
182			BSWAP=__swap
183		else
184			USE_SYS_ENDIAN_H=no
185		fi
186	fi
187
188	if test "$USE_SYS_ENDIAN_H" = "yes" ; then
189	    AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
190		[Define to use byteswap macros from <sys/endian.h>])
191	    AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
192			[Define to 16-bit byteswap macro])
193	    AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
194			[Define to 32-bit byteswap macro])
195	    AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
196			[Define to 64-bit byteswap macro])
197	fi
198fi
199
200dnl Check to see if dlopen is in default libraries (like Solaris, which
201dnl has it in libc), or if libdl is needed to get it.
202AC_CHECK_FUNC([dlopen], [],
203	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
204AC_SUBST(DLOPEN_LIBS)
205
206dnl Checks for library functions.
207AC_FUNC_VPRINTF
208AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
209		strtol getopt getopt_long vsnprintf walkcontext backtrace \
210		getisax getzoneid shmctl64 strcasestr ffs])
211AC_FUNC_ALLOCA
212dnl Old HAS_* names used in os/*.c.
213AC_CHECK_FUNC([getdtablesize],
214	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
215AC_CHECK_FUNC([getifaddrs],
216	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
217AC_CHECK_FUNC([getpeereid],
218	AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
219AC_CHECK_FUNC([getpeerucred],
220	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
221AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
222AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])	
223AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
224
225AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
226
227dnl Check for mmap support for Xvfb
228AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
229
230dnl Find the math libary
231AC_CHECK_LIB(m, sqrt)
232AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
233
234AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
235
236dnl AGPGART headers
237AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
238AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
239
240dnl APM header
241AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
242AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
243
244dnl fbdev header
245AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
246AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
247
248dnl MTRR header
249AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
250if test "x$ac_cv_asm_mtrr_h" = xyes; then
251	HAVE_MTRR=yes
252fi
253
254dnl BSD MTRR header
255AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
256if test "x$ac_cv_memrange_h" = xyes; then
257	HAVE_MTRR=yes
258fi
259
260if test "x$HAVE_MTRR" = xyes; then
261	AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
262fi
263
264dnl A NetBSD MTRR header
265AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
266if test "x$ac_cv_machine_mtrr_h" = xyes; then
267	AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
268		support is available])
269fi
270
271dnl FreeBSD kldload support (sys/linker.h)
272AC_CHECK_HEADERS([sys/linker.h],
273	[ac_cv_sys_linker_h=yes],
274	[ac_cv_sys_linker_h=no],
275	[#include <sys/param.h>])
276AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
277
278AC_CACHE_CHECK([for SYSV IPC],
279		ac_cv_sysv_ipc,
280		[AC_TRY_LINK([
281#include <sys/types.h>
282#include <sys/ipc.h>
283#include <sys/shm.h>
284],[
285{ 
286    int id;
287    id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
288    if (id < 0) return -1;
289    return shmctl(id, IPC_RMID, 0);
290}],
291	[ac_cv_sysv_ipc=yes],
292	[ac_cv_sysv_ipc=no])])
293if test "x$ac_cv_sysv_ipc" = xyes; then
294	AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
295fi
296
297dnl OpenBSD /dev/xf86 aperture driver 
298if test -c /dev/xf86 ; then
299	AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
300fi
301
302dnl BSD APM support 
303AC_CHECK_HEADER([machine/apmvar.h],[
304	AC_CHECK_HEADER([sys/event.h],
305		ac_cv_BSD_KQUEUE_APM=yes,
306		ac_cv_BSD_APM=yes)])
307
308AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
309AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
310	
311dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
312AC_CHECK_HEADER([execinfo.h],[
313    AC_CHECK_LIB(c, backtrace, [
314        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
315        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
316    ])]
317)
318
319dnl ARM needs additional compiler flags for proper backtraces if GCC is
320dnl used. Compile a dummy program with the -mapcs-frame option. If it
321dnl succeeds, we know that we are building for ARM with GCC.
322old_CFLAGS="$CFLAGS"
323CFLAGS="-mapcs-frame"
324AC_COMPILE_IFELSE(
325        AC_LANG_PROGRAM([[ ]]),
326        ARM_BACKTRACE_CFLAGS="$CFLAGS",
327        ARM_BACKTRACE_CFLAGS=""
328)
329CFLAGS="$old_CFLAGS"
330AC_SUBST(ARM_BACKTRACE_CFLAGS)
331
332dnl ---------------------------------------------------------------------------
333dnl Bus options and CPU capabilities.  Replaces logic in
334dnl hw/xfree86/os-support/bus/Makefile.am, among others.
335dnl ---------------------------------------------------------------------------
336DEFAULT_INT10="x86emu"
337
338dnl Override defaults as needed for specific platforms:
339
340case $host_cpu in
341  alpha*)
342	ALPHA_VIDEO=yes
343	case $host_os in
344	        *freebsd*)	SYS_LIBS=-lio ;;
345		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
346	esac
347	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
348	;;
349  arm*)
350	ARM_VIDEO=yes
351	;;
352  i*86)
353	I386_VIDEO=yes
354	case $host_os in
355		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
356		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
357		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
358				SYS_LIBS=-li386
359				;;
360		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
361				SYS_LIBS=-li386
362				;;
363	esac
364        ;;
365  powerpc*)
366	PPC_VIDEO=yes
367	case $host_os in
368		*freebsd*)	DEFAULT_INT10=stub ;;
369	esac
370	;;
371  sparc*)
372	SPARC64_VIDEO=yes
373	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
374	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
375	;;
376  x86_64*|amd64*)
377	I386_VIDEO=yes
378	case $host_os in
379		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
380		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
381		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
382				SYS_LIBS=-lx86_64
383				;;
384		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
385				SYS_LIBS=-lamd64
386				;;
387	esac
388	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
389	;;
390  ia64*)
391  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
392	;;
393  s390*)
394  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
395	;;
396esac
397AC_SUBST(GLX_ARCH_DEFINES)
398
399dnl BSD *_video.c selection
400AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
401AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
402AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
403AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
404AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
405
406DRI=no
407USE_SIGIO_BY_DEFAULT="yes"
408dnl it would be nice to autodetect these *CONS_SUPPORTs
409case $host_os in
410  *freebsd* | *dragonfly*)
411	case $host_os in
412		kfreebsd*-gnu) ;;
413		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
414	esac
415	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
416	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
417	AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
418	DRI=yes
419	;;
420  *netbsd*)
421	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
422	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
423	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
424	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
425	DRI=yes
426	;;
427  *openbsd*)
428	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
429	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
430	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
431	;;
432  *linux*)
433	DRI=yes
434	;;
435  *solaris*)
436	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
437	# Disable use of SIGIO by default until some system bugs are
438	# fixed - see Sun/OpenSolaris bug id 6879897
439	USE_SIGIO_BY_DEFAULT="no"
440	;;
441  darwin*)
442	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
443	;;
444  cygwin*)
445	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
446	;;
447esac
448
449dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
450dnl major number
451PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
452PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
453if test "x$PVS" = "x"; then
454	PVS="0"
455fi
456
457VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
458VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
459
460VENDOR_NAME="The X.Org Foundation"
461VENDOR_NAME_SHORT="X.Org"
462VENDOR_WEB="http://wiki.x.org"
463
464m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
465
466dnl Build options.
467AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
468		  [Obsolete - use --enable-strict-compilation instead]),
469  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))
470
471AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
472				  [Enable debugging (default: disabled)]),
473			        [DEBUGGING=$enableval], [DEBUGGING=no])
474AC_ARG_ENABLE(unit-tests,    AS_HELP_STRING([--enable-unit-tests],
475                                  [Enable unit-tests (default: auto)]),
476                                [UNITTESTS=$enableval], [UNITTESTS=auto])
477AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
478  [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
479                                [USE_SIGIO_BY_DEFAULT=$enableval], [])
480AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
481				[INT10="$withval"],
482				[INT10="$DEFAULT_INT10"])
483AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
484				  [Vendor string reported by the server]),
485				[ VENDOR_NAME="$withval" ], [])
486AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
487				  [Short version of vendor string reported by the server]),
488				[ VENDOR_NAME_SHORT="$withval" ], [])
489AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
490				  [Vendor web address reported by the server]),
491				[ VENDOR_WEB="$withval" ], [])
492AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
493				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
494				[ moduledir="$withval" ],
495				[ moduledir="${libdir}/xorg/modules" ])
496AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
497				  [Directory where log files are kept (default: $localstatedir/log)]),
498				[ logdir="$withval" ],
499				[ logdir="$localstatedir/log" ])
500AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
501				  [Builder address (default: xorg@lists.freedesktop.org)]),
502				[ BUILDERADDR="$withval" ],
503				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
504AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
505				[ OSNAME="$withval" ],
506				[ OSNAME=`uname -srm` ])
507AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
508				[ OSVENDOR="$withval" ],
509				[ OSVENDOR="" ])
510AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
511				[ BUILDERSTRING="$withval" ]
512				[ ])
513
514dnl Determine font path
515XORG_FONTROOTDIR
516XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
517XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
518XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
519XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
520XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
521XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
522
523dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
524dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
525dnl compiling, assume default font path uses standard FONTROOTDIR directories.
526DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
527if test "$cross_compiling" != yes; then
528	AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
529		[DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
530		[case $host_os in
531			darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
532		esac])
533fi
534AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
535				[ FONTPATH="$withval" ],
536				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
537
538AC_MSG_CHECKING([for default font path])
539AC_MSG_RESULT([$FONTPATH])
540
541AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
542				[ XKBPATH="$withval" ],
543				[ XKBPATH="${datadir}/X11/xkb" ])
544AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
545				[ XKBOUTPUT="$withval" ],
546				[ XKBOUTPUT="compiled" ])
547AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
548                                   [Keyboard ruleset (default: base/evdev)]),
549                                [ XKB_DFLT_RULES="$withval" ],
550                                [ XKB_DFLT_RULES="" ])
551AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
552                                   [Keyboard model (default: pc105)]),
553                                [ XKB_DFLT_MODEL="$withval" ],
554                                [ XKB_DFLT_MODEL="pc105" ])
555AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
556                                   [Keyboard layout (default: us)]),
557                                [ XKB_DFLT_LAYOUT="$withval" ],
558                                [ XKB_DFLT_LAYOUT="us" ])
559AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
560                                   [Keyboard variant (default: (none))]),
561                                [ XKB_DFLT_VARIANT="$withval" ],
562                                [ XKB_DFLT_VARIANT="" ])
563AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
564                                   [Keyboard layout options (default: (none))]),
565                                [ XKB_DFLT_OPTIONS="$withval" ],
566                                [ XKB_DFLT_OPTIONS="" ])
567AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
568				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
569				[ SERVERCONFIG="$withval" ],
570				[ SERVERCONFIG="${libdir}/xorg" ])
571AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
572				[ APPLE_APPLICATIONS_DIR="${withval}" ],
573				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
574AC_SUBST([APPLE_APPLICATIONS_DIR])
575AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
576				[ APPLE_APPLICATION_NAME="${withval}" ],
577				[ APPLE_APPLICATION_NAME="X11" ])
578AC_SUBST([APPLE_APPLICATION_NAME])
579AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
580                                [ LAUNCHD_ID_PREFIX="${withval}" ],
581                                [ LAUNCHD_ID_PREFIX="org.x" ])
582AC_SUBST([LAUNCHD_ID_PREFIX])
583AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$LAUNCHD_ID_PREFIX", [Prefix to use for launchd identifiers])
584AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
585				[ XQUARTZ_SPARKLE="${enableval}" ],
586				[ XQUARTZ_SPARKLE="no" ])
587AC_SUBST([XQUARTZ_SPARKLE])
588AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
589                                [BUILDDOCS=$enableval],
590                                [BUILDDOCS=no])
591AC_ARG_ENABLE(install-libxf86config,
592				AS_HELP_STRING([--enable-install-libxf86config],
593				[Install libxf86config (default: disabled)]),
594				[INSTALL_LIBXF86CONFIG=$enableval],
595				[INSTALL_LIBXF86CONFIG=no])
596AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
597				[SYMBOL_VISIBILITY=$enableval],
598				[SYMBOL_VISIBILITY=auto])
599AC_ARG_ENABLE(pc98,     	AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
600				[SUPPORT_PC98=$enableval],
601				[SUPPORT_PC98=auto])
602
603dnl GLX build options
604AC_ARG_WITH(dri-driver-path,  AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
605				[ DRI_DRIVER_PATH="$withval" ],
606				[ DRI_DRIVER_PATH="${libdir}/dri" ])
607AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
608                                [AIGLX=$enableval],
609                                [AIGLX=yes])
610AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]),
611                                [GLX_USE_TLS=$enableval],
612                                [GLX_USE_TLS=no])
613
614dnl Extensions.
615AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
616AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
617AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
618AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
619AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
620AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
621AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
622AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
623AC_ARG_ENABLE(screensaver,    AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
624AC_ARG_ENABLE(xdmcp,          AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
625AC_ARG_ENABLE(xdm-auth-1,     AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
626AC_ARG_ENABLE(glx,            AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
627AC_ARG_ENABLE(dri,            AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
628AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
629AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
630AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
631AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
632AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
633AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
634AC_ARG_ENABLE(xcalibrate,     AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
635AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
636AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
637AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
638AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
639AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
640AC_ARG_ENABLE(config-dbus,    AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
641AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
642AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
643AC_ARG_ENABLE(xaa,               AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
644AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
645AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
646AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
647AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
648AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
649
650dnl DDXes.
651AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
652AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
653AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
654AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
655AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
656AC_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])
657AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
658dnl kdrive and its subsystems
659AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
660AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
661AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
662AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
663dnl kdrive options
664AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
665AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
666AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
667
668
669dnl chown/chmod to be setuid root as part of build
670dnl Replaces InstallXserverSetUID in imake
671AC_ARG_ENABLE(install-setuid, 
672    AS_HELP_STRING([--enable-install-setuid],
673       [Install Xorg server as owned by root with setuid bit (default: auto)]),
674    [SETUID=$enableval], [SETUID=auto])
675AC_MSG_CHECKING([to see if we can install the Xorg server as root])
676if test "x$SETUID" = "xauto" ; then
677	case $host_os in
678	    cygwin*)		SETUID="no"  ;;
679	    darwin*)		SETUID="no"  ;;
680	    *)
681	   	case $host_cpu in
682		    sparc)	SETUID="no"  ;;
683		    *)		SETUID="yes" ;;
684		esac
685	esac
686	if test "x$SETUID" = xyes; then
687		touch testfile
688		chown root testfile > /dev/null 2>&1 || SETUID="no"
689		rm -f testfile
690	fi
691fi
692AC_MSG_RESULT([$SETUID])
693AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])
694
695dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
696dnl was not expanded, since xorg-server with no transport types is rather useless.
697dnl
698dnl If you're seeing an error here, be sure you installed the lib/xtrans module
699dnl first and if it's not in the default location, that you set the ACLOCAL
700dnl environment variable to find it, such as:
701dnl	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
702m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
703
704# Transport selection macro from xtrans.m4
705XTRANS_CONNECTION_FLAGS
706
707# Secure RPC detection macro from xtrans.m4
708XTRANS_SECURE_RPC_FLAGS
709AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
710
711AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
712AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
713AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
714if test "x$INT10" = xyes; then
715	dnl VM86 headers
716	AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
717fi
718
719dnl Handle building documentation
720AM_CONDITIONAL(BUILDDOCS, test "x$BUILDDOCS" = xyes)
721XORG_ENABLE_DOCS
722XORG_ENABLE_DEVEL_DOCS
723XORG_WITH_XMLTO(0.0.20)
724XORG_WITH_FOP
725
726dnl Handle installing libxf86config
727AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
728
729dnl DDX Detection... Yes, it's ugly to have it here... but we need to
730dnl handle this early on so that we don't require unsupported extensions
731case $host_os in
732	cygwin*)
733		DGA=no
734		DRI2=no
735		XF86VIDMODE=no
736		XSELINUX=no
737		XV=no
738		;;
739	darwin*)
740		DRI2=no
741
742		if test x$XQUARTZ = xauto; then
743			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
744		 		save_LDFLAGS=$LDFLAGS
745				LDFLAGS="$LDFLAGS -framework Carbon"
746				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
747				[xorg_cv_Carbon_framework=yes],
748				[xorg_cv_Carbon_framework=no])
749			LDFLAGS=$save_LDFLAGS])
750                
751			if test "X$xorg_cv_Carbon_framework" = Xyes; then
752				XQUARTZ=yes
753			else
754				XQUARTZ=no
755			fi
756		fi
757
758		if test "x$XQUARTZ" = xyes ; then
759			XQUARTZ=yes
760			XVFB=no
761			XNEST=no
762
763			COMPOSITE=no
764			DGA=no
765			DPMSExtension=no
766			XF86VIDMODE=no
767		fi
768		;;
769	*) XQUARTZ=no ;;
770esac
771
772dnl ---------------------------------------------------------------------------
773dnl Extension section
774dnl ---------------------------------------------------------------------------
775XEXT_INC='-I$(top_srcdir)/Xext'
776XEXT_LIB='$(top_builddir)/Xext/libXext.la'
777XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
778
779dnl Optional modules
780VIDEOPROTO="videoproto"
781COMPOSITEPROTO="compositeproto >= 0.4"
782RECORDPROTO="recordproto >= 1.13.99.1"
783SCRNSAVERPROTO="scrnsaverproto >= 1.1"
784RESOURCEPROTO="resourceproto"
785DRIPROTO="xf86driproto >= 2.1.0"
786DRI2PROTO="dri2proto >= 2.3"
787XINERAMAPROTO="xineramaproto"
788BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
789XCALIBRATEPROTO="xcalibrateproto"
790DGAPROTO="xf86dgaproto >= 2.0.99.1"
791GLPROTO="glproto >= 1.4.10"
792DMXPROTO="dmxproto >= 2.2.99.1"
793VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
794WINDOWSWMPROTO="windowswmproto"
795APPLEWMPROTO="applewmproto >= 1.4"
796
797dnl Core modules for most extensions, et al.
798SDK_REQUIRED_MODULES="[xproto >= 7.0.17] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.0.99.3] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
799# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
800AC_SUBST(SDK_REQUIRED_MODULES)
801
802dnl List of libraries that require a specific version
803LIBAPPLEWM="applewm >= 1.4"
804LIBDMX="dmx >= 1.0.99.1"
805LIBDRI="dri >= 7.8.0"
806LIBDRM="libdrm >= 2.3.0"
807LIBGL="gl >= 7.1.0"
808LIBXEXT="xext >= 1.0.99.4"
809LIBXFONT="xfont >= 1.4.2"
810LIBXI="xi >= 1.2.99.1"
811LIBXTST="xtst >= 1.0.99.2"
812LIBPCIACCESS="pciaccess >= 0.8.0"
813LIBGLIB="glib-2.0 >= 2.16"
814LIBUDEV="libudev >= 143"
815LIBSELINUX="libselinux >= 2.0.86"
816LIBDBUS="dbus-1 >= 1.0"
817LIBPIXMAN="pixman-1 >= 0.15.20"
818
819dnl Pixman is always required, but we separate it out so we can link
820dnl specific modules against it
821PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
822REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
823
824REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
825
826if test "x$CONFIG_UDEV" = xyes &&
827 { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
828	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
829fi
830
831PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
832if test "x$CONFIG_UDEV" = xauto; then
833	CONFIG_UDEV="$HAVE_LIBUDEV"
834fi
835AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
836if test "x$CONFIG_UDEV" = xyes; then
837	CONFIG_DBUS_API=no
838	CONFIG_HAL=no
839	if ! test "x$HAVE_LIBUDEV" = xyes; then
840		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
841	fi
842	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
843fi
844
845dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
846dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
847dnl API.
848PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
849if test "x$HAVE_DBUS" = xyes; then
850	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
851fi
852AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
853
854if test "x$CONFIG_DBUS_API" = xauto; then
855	CONFIG_DBUS_API="$HAVE_DBUS"
856fi
857if test "x$CONFIG_DBUS_API" = xyes; then
858	if ! test "x$HAVE_DBUS" = xyes; then
859		AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
860	fi
861
862	AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
863	CONFIG_NEED_DBUS="yes"
864fi
865AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
866
867PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
868if test "x$CONFIG_HAL" = xauto; then
869	CONFIG_HAL="$HAVE_HAL"
870fi
871if test "x$CONFIG_HAL" = xyes; then
872	if ! test "x$HAVE_HAL" = xyes; then
873		AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
874	fi
875
876	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
877	CONFIG_NEED_DBUS="yes"
878fi
879AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
880
881if test "x$CONFIG_NEED_DBUS" = xyes; then
882        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
883fi
884AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
885
886if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
887	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
888else
889	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
890fi
891AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
892		   [Use SIGIO handlers for input device events by default])
893
894AC_MSG_CHECKING([for glibc...])
895AC_PREPROC_IFELSE([
896#include <features.h>
897#ifndef __GLIBC__
898#error
899#endif
900], glibc=yes, glibc=no)
901AC_MSG_RESULT([$glibc])
902
903AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
904               [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
905                             [have_clock_gettime=no])])
906
907AC_MSG_CHECKING([for a useful monotonic clock ...])
908
909if ! test "x$have_clock_gettime" = xno; then
910    if ! test "x$have_clock_gettime" = xyes; then
911        CLOCK_LIBS="$have_clock_gettime"
912    else
913        CLOCK_LIBS=""
914    fi
915
916    LIBS_SAVE="$LIBS"
917    LIBS="$CLOCK_LIBS"
918    CPPFLAGS_SAVE="$CPPFLAGS"
919
920    if test x"$glibc" = xyes; then
921        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
922    fi
923
924    AC_RUN_IFELSE([
925#include <time.h>
926
927int main(int argc, char *argv[[]]) {
928    struct timespec tp;
929
930    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
931        return 0;
932    else
933        return 1;
934}
935    ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
936       [MONOTONIC_CLOCK="cross compiling"])
937
938    LIBS="$LIBS_SAVE"
939    CPPFLAGS="$CPPFLAGS_SAVE"
940else
941    MONOTONIC_CLOCK=no
942fi
943
944AC_MSG_RESULT([$MONOTONIC_CLOCK])
945
946if test "x$MONOTONIC_CLOCK" = xyes; then
947    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
948    LIBS="$LIBS $CLOCK_LIBS"
949fi
950
951AM_CONDITIONAL(XV, [test "x$XV" = xyes])
952if test "x$XV" = xyes; then
953	AC_DEFINE(XV, 1, [Support Xv extension])
954	AC_DEFINE(XvExtension, 1, [Build Xv extension])
955	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
956	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
957else
958	XVMC=no
959fi
960
961AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
962if test "x$XVMC" = xyes; then
963	AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
964fi
965
966AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
967if test "x$XREGISTRY" = xyes; then
968	AC_DEFINE(XREGISTRY, 1, [Build registry module])
969fi
970
971AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
972if test "x$COMPOSITE" = xyes; then
973	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
974	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
975	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
976	COMPOSITE_INC='-I$(top_srcdir)/composite'
977fi
978
979AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
980if test "x$MITSHM" = xyes; then
981	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
982	AC_DEFINE(HAS_SHM, 1, [Support SHM])
983fi
984
985AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
986if test "x$RECORD" = xyes; then
987	AC_DEFINE(XRECORD, 1, [Support Record extension])
988	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
989	RECORD_LIB='$(top_builddir)/record/librecord.la'
990fi
991
992AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
993if test "x$SCREENSAVER" = xyes; then
994	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
995	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
996fi
997
998AM_CONDITIONAL(RES, [test "x$RES" = xyes])
999if test "x$RES" = xyes; then
1000	AC_DEFINE(RES, 1, [Support X resource extension])
1001	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
1002fi
1003
1004if test "x$GLX" = xyes; then
1005	PKG_CHECK_MODULES([XLIB], [x11])
1006	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
1007	AC_SUBST(XLIB_CFLAGS)
1008	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
1009	GLX_LIBS='$(top_builddir)/glx/libglx.la'
1010	GLX_SYS_LIBS="$GLX_SYS_LIBS"
1011else
1012        GLX=no
1013fi
1014AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
1015
1016if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
1017	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
1018else
1019	AIGLX=no
1020fi
1021AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
1022
1023if test "x$GLX_USE_TLS" = xyes -a "x$AIGLX" = xyes; then
1024	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
1025	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
1026fi
1027AC_SUBST([GLX_DEFINES])
1028
1029AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
1030if test "x$DRI" = xyes; then
1031	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1032	PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
1033	PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
1034	AC_SUBST(DRIPROTO_CFLAGS)
1035fi
1036
1037PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1038                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
1039case "$DRI2,$HAVE_DRI2PROTO" in
1040	yes,no)
1041		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
1042		;;
1043	yes,yes | auto,yes)
1044		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
1045		DRI2=yes
1046		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1047		;;
1048esac
1049AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
1050
1051if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
1052	if test "x$DRM" = xyes; then
1053		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
1054		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
1055	fi
1056fi
1057
1058if test "x$DRI2" = xyes; then
1059	save_CFLAGS=$CFLAGS
1060	CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
1061	AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
1062#include <GL/internal/dri_interface.h>
1063#ifndef __DRI_DRI2
1064#error DRI2 extension not available.
1065#endif]])],
1066			  [HAVE_DRI2EXTENSION=yes],
1067			  [HAVE_DRI2EXTENSION=no])
1068	CFLAGS=$save_CFLAGS
1069	if test "x$HAVE_DRI2EXTENSION" = xyes; then
1070		AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
1071		DRI2_AIGLX=yes
1072	else
1073		AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
1074		DRI2_AIGLX=no
1075	fi
1076fi
1077AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
1078
1079
1080AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
1081if test "x$XINERAMA" = xyes; then
1082	AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
1083	AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
1084	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1085	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
1086fi
1087
1088AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
1089if test "x$XACE" = xyes; then
1090	AC_DEFINE(XACE, 1, [Build X-ACE extension])
1091fi
1092
1093AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
1094if test "x$XSELINUX" = xyes; then
1095	if test "x$XACE" != xyes; then
1096		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
1097	fi
1098	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
1099	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1100	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1101	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1102	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
1103fi
1104
1105AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
1106if test "x$XCSECURITY" = xyes; then
1107	if test "x$XACE" != xyes; then
1108		AC_MSG_ERROR([cannot build Security extension without X-ACE])
1109	fi
1110	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
1111fi
1112
1113AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
1114if test "x$DBE" = xyes; then
1115	AC_DEFINE(DBE, 1, [Support DBE extension])
1116	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
1117fi
1118
1119AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
1120if test "x$XF86BIGFONT" = xyes; then
1121	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
1122	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
1123fi
1124
1125AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
1126if test "x$DPMSExtension" = xyes; then
1127	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
1128fi
1129
1130if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
1131   AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
1132   REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
1133else
1134   XCALIBRATE=no
1135fi
1136AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
1137
1138AC_DEFINE(RENDER, 1, [Support RENDER extension])
1139RENDER_LIB='$(top_builddir)/render/librender.la'
1140RENDER_INC='-I$(top_srcdir)/render'
1141
1142AC_DEFINE(RANDR, 1, [Support RANDR extension])
1143RANDR_LIB='$(top_builddir)/randr/librandr.la'
1144RANDR_INC='-I$(top_srcdir)/randr'
1145
1146AC_DEFINE(XFIXES,1,[Support XFixes extension])
1147FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
1148FIXES_INC='-I$(top_srcdir)/xfixes'
1149
1150AC_DEFINE(DAMAGE,1,[Support Damage extension])
1151DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
1152DAMAGE_INC='-I$(top_srcdir)/damageext'
1153MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
1154MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
1155
1156# XINPUT extension is integral part of the server
1157AC_DEFINE(XINPUT, 1, [Support X Input extension])
1158XI_LIB='$(top_builddir)/Xi/libXi.la'
1159XI_INC='-I$(top_srcdir)/Xi'
1160
1161AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
1162AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
1163AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
1164AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
1165AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
1166
1167AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
1168
1169AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
1170AC_ARG_WITH(xkb-bin-directory,
1171				AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
1172				[XKB_BIN_DIRECTORY="$withval"],
1173				[XKB_BIN_DIRECTORY="$bindir"])
1174
1175AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
1176
1177dnl Make sure XKM_OUTPUT_DIR is an absolute path
1178XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
1179if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
1180   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
1181fi
1182
1183dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
1184dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
1185
1186XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
1187XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
1188AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
1189AC_SUBST(XKB_COMPILED_DIR)
1190
1191if test "x$XKB_DFLT_RULES" = x; then
1192    case $host_os in
1193    linux*)
1194        dnl doesn't take AutoAddDevices into account, but whatever.
1195        if test "x$CONFIG_HAL" = xyes; then
1196            XKB_DFLT_RULES="evdev"
1197        else
1198            XKB_DFLT_RULES="base"
1199        fi
1200        ;;
1201    *)
1202        XKB_DFLT_RULES="base"
1203        ;;
1204    esac
1205fi
1206AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
1207AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
1208AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
1209AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
1210AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
1211
1212XKB_LIB='$(top_builddir)/xkb/libxkb.la'
1213XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
1214REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
1215
1216AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
1217                                        [Do not have 'strcasecmp'.]))
1218AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
1219                                        [Do not have 'strncasecmp'.]))
1220AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
1221                                       [Do not have 'strcasestr'.]))
1222
1223PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
1224if test "x$have_libxdmcp" = xyes; then
1225	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
1226fi
1227if test "x$XDMCP" = xauto; then
1228	if test "x$have_libxdmcp" = xyes; then
1229		XDMCP=yes
1230	else
1231		XDMCP=no
1232	fi
1233fi
1234if test "x$XDMAUTH" = xauto; then
1235	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
1236		XDMAUTH=yes
1237	else
1238		XDMAUTH=no
1239	fi
1240fi
1241
1242AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
1243if test "x$XDMCP" = xyes; then
1244	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
1245	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1246	XDMCP_MODULES="xdmcp"
1247fi
1248
1249AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
1250if test "x$XDMAUTH" = xyes; then
1251	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
1252	if ! test "x$XDMCP" = xyes; then
1253		REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1254		XDMCP_MODULES="xdmcp"
1255	fi
1256fi
1257
1258AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
1259AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
1260AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
1261AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
1262AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
1263AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
1264AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
1265AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
1266AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1267AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
1268
1269if test -z "$OSNAME"; then
1270    OSNAME="UNKNOWN"
1271fi
1272
1273AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
1274AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
1275AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
1276
1277AC_SUBST([VENDOR_NAME_SHORT])
1278AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
1279AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
1280AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
1281AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1282
1283AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
1284
1285if test "x$DEBUGGING" = xyes; then
1286       AC_DEFINE(DEBUG, 1, [Enable debugging code])
1287fi
1288AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
1289
1290# If unittests aren't explicitly disabled, check for required support
1291if test "x$UNITTESTS" != xno ; then
1292       PKG_CHECK_MODULES([GLIB], $LIBGLIB,
1293                         [HAVE_GLIB=yes], [HAVE_GLIB=no])
1294
1295       # Check if linker supports -wrap, passed via compiler flags
1296       # When cross-compiling, reports no, since unit tests run from
1297       # "make check", so would be running on build machine,  not target
1298       AC_MSG_CHECKING([whether the linker supports -wrap])
1299       save_LDFLAGS="$LDFLAGS"
1300       LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
1301       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1302	void __wrap_exit (int s)
1303	{
1304	    __real_exit (0);
1305	}]],
1306	[[exit (1);]])],
1307                     [linker_can_wrap="yes"],
1308                     [linker_can_wrap="no"],
1309                     [linker_can_wrap="no"])
1310       AC_MSG_RESULT([$linker_can_wrap])
1311       LDFLAGS="$save_LDFLAGS"
1312fi
1313
1314if test "x$UNITTESTS" = xauto; then
1315       if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
1316           UNITTESTS=yes
1317       else
1318           UNITTESTS=no
1319       fi
1320fi
1321if test "x$UNITTESTS" = xyes; then
1322       if test "x$HAVE_GLIB" = xno; then
1323           AC_MSG_ERROR([glib required to build unit tests])
1324       fi
1325       if test "x$linker_can_wrap" = xno; then
1326           AC_MSG_ERROR([ld -wrap support required to build unit tests])
1327       fi
1328       AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
1329       AC_SUBST([GLIB_LIBS])
1330       AC_SUBST([GLIB_CFLAGS])
1331fi
1332AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
1333
1334AC_DEFINE(XTEST, 1, [Support XTest extension])
1335AC_DEFINE(XSYNC, 1, [Support XSync extension])
1336AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
1337AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
1338
1339if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
1340  DIX_LIB='$(top_builddir)/dix/dix.O'
1341  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
1342else
1343  DIX_LIB='$(top_builddir)/dix/libdix.la'
1344  OS_LIB='$(top_builddir)/os/libos.la'
1345fi
1346AC_SUBST([DIX_LIB])
1347AC_SUBST([OS_LIB])
1348
1349MAIN_LIB='$(top_builddir)/dix/libmain.la'
1350AC_SUBST([MAIN_LIB])
1351
1352MI_LIB='$(top_builddir)/mi/libmi.la'
1353MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
1354MI_INC='-I$(top_srcdir)/mi'
1355FB_LIB='$(top_builddir)/fb/libfb.la'
1356FB_INC='-I$(top_srcdir)/fb'
1357MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
1358MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
1359CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
1360
1361# SHA1 hashing
1362AC_ARG_WITH([sha1],
1363            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto],
1364                            [choose SHA1 implementation])])
1365AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
1366if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
1367	with_sha1=libc
1368fi
1369if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
1370	AC_MSG_ERROR([libc requested but not found])
1371fi
1372if test "x$with_sha1" = xlibc; then
1373	AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
1374		[Use libc SHA1 functions])
1375	SHA1_LIBS=""
1376fi
1377AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
1378if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
1379	with_sha1=CommonCrypto
1380fi
1381if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
1382	AC_MSG_ERROR([CommonCrypto requested but not found])
1383fi
1384if test "x$with_sha1" = xCommonCrypto; then
1385	AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
1386		[Use CommonCrypto SHA1 functions])
1387	SHA1_LIBS=""
1388fi
1389AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
1390if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
1391	with_sha1=libmd
1392fi
1393if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
1394	AC_MSG_ERROR([libmd requested but not found])
1395fi
1396if test "x$with_sha1" = xlibmd; then
1397	AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
1398	          [Use libmd SHA1 functions])
1399	SHA1_LIBS=-lmd
1400fi
1401PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
1402if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
1403   with_sha1=libsha1
1404fi
1405if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
1406	AC_MSG_ERROR([libsha1 requested but not found])
1407fi
1408if test "x$with_sha1" = xlibsha1; then
1409	AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
1410	          [Use libsha1 for SHA1])
1411	SHA1_LIBS=-lsha1
1412fi
1413AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
1414if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
1415	with_sha1=libgcrypt
1416fi
1417if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
1418	AC_MSG_ERROR([libgcrypt requested but not found])
1419fi
1420if test "x$with_sha1" = xlibgcrypt; then
1421	AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
1422	          [Use libgcrypt SHA1 functions])
1423	SHA1_LIBS=-lgcrypt
1424fi
1425# We don't need all of the OpenSSL libraries, just libcrypto
1426AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
1427PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
1428                  [HAVE_OPENSSL_PKC=no])
1429if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
1430	if test "x$with_sha1" = x; then
1431		with_sha1=libcrypto
1432	fi
1433else
1434	if test "x$with_sha1" = xlibcrypto; then
1435		AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
1436	fi
1437fi
1438if test "x$with_sha1" = xlibcrypto; then
1439	if test "x$HAVE_LIBCRYPTO" = xyes; then
1440		SHA1_LIBS=-lcrypto
1441	else
1442		SHA1_LIBS="$OPENSSL_LIBS"
1443		SHA1_CFLAGS="$OPENSSL_CFLAGS"
1444	fi
1445fi
1446AC_MSG_CHECKING([for SHA1 implementation])
1447if test "x$with_sha1" = x; then
1448	AC_MSG_ERROR([No suitable SHA1 implementation found])
1449fi
1450AC_MSG_RESULT([$with_sha1])
1451AC_SUBST(SHA1_LIBS)
1452AC_SUBST(SHA1_CFLAGS)
1453
1454PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
1455PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
1456
1457# Autotools has some unfortunate issues with library handling.  In order to
1458# get a server to rebuild when a dependency in the tree is changed, it must
1459# be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be
1460# listed there, or some versions of autotools will break (especially if a -L
1461# is required to find the library).  So, we keep two sets of libraries
1462# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
1463# will go into the _DEPENDENCIES and _LDADD of the server, and
1464# NAMESPACE_SYS_LIBS which will go into only the _LDADD.  The
1465# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
1466# NAMESPACE_SYS_LIBS.
1467#
1468# XSERVER_LIBS is the set of in-tree libraries which all servers require.
1469# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
1470# require.
1471#
1472XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
1473XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
1474XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
1475AC_SUBST([XSERVER_LIBS])
1476AC_SUBST([XSERVER_SYS_LIBS])
1477
1478UTILS_SYS_LIBS="${SYS_LIBS}"
1479AC_SUBST([UTILS_SYS_LIBS])
1480
1481# The Xorg binary needs to export symbols so that they can be used from modules
1482# Some platforms require extra flags to do this.   libtool should set the
1483# necessary flags for each platform when -export-dynamic is passed to it.
1484LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
1485AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
1486
1487dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
1488dnl we need to replicate that here until those can all be fixed
1489AC_MSG_CHECKING([if SVR4 needs to be defined])
1490AC_EGREP_CPP([I_AM_SVR4],[
1491#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
1492 I_AM_SVR4
1493#endif
1494],[
1495AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
1496AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
1497
1498XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
1499
1500dnl ---------------------------------------------------------------------------
1501dnl DDX section.
1502dnl ---------------------------------------------------------------------------
1503
1504dnl Xvfb DDX
1505
1506AC_MSG_CHECKING([whether to build Xvfb DDX])
1507AC_MSG_RESULT([$XVFB])
1508AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
1509
1510if test "x$XVFB" = xyes; then
1511	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
1512	XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
1513	AC_SUBST([XVFB_LIBS])
1514	AC_SUBST([XVFB_SYS_LIBS])
1515fi
1516
1517
1518dnl Xnest DDX
1519
1520PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
1521AC_MSG_CHECKING([whether to build Xnest DDX])
1522if test "x$XNEST" = xauto; then
1523	XNEST="$have_xnest"
1524fi
1525AC_MSG_RESULT([$XNEST])
1526AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
1527
1528if test "x$XNEST" = xyes; then
1529	if test "x$have_xnest" = xno; then
1530		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
1531	fi
1532	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
1533	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
1534	AC_SUBST([XNEST_LIBS])
1535	AC_SUBST([XNEST_SYS_LIBS])
1536fi
1537
1538
1539dnl Xorg DDX
1540
1541AC_MSG_CHECKING([whether to build Xorg DDX])
1542if test "x$XORG" = xauto; then
1543	XORG="yes"
1544	case $host_os in
1545		cygwin*) XORG="no" ;;
1546		darwin*) XORG="no" ;;
1547	esac
1548fi
1549AC_MSG_RESULT([$XORG])
1550
1551xorg_bus_linuxpci=no
1552xorg_bus_bsdpci=no
1553xorg_bus_sparc=no
1554
1555if test "x$XORG" = xyes; then
1556	XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
1557	XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
1558	XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
1559	XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
1560	XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
1561
1562	dnl ==================================================================
1563	dnl symbol visibility
1564	symbol_visibility=
1565	have_visibility=disabled
1566	if test x$SYMBOL_VISIBILITY != xno; then
1567	    AC_MSG_CHECKING(for symbol visibility support)
1568	    if test x$GCC = xyes; then
1569		VISIBILITY_CFLAGS="-fvisibility=hidden"
1570	    else
1571		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1572		if test x$SUNCC = xyes; then
1573		    VISIBILITY_CFLAGS="-xldscope=hidden"
1574		else
1575		    have_visibility=no
1576		fi
1577	    fi
1578	    if test x$have_visibility != xno; then
1579		save_CFLAGS="$CFLAGS"
1580		CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
1581		AC_TRY_COMPILE(
1582		    [#include <X11/Xfuncproto.h>
1583		     extern _X_HIDDEN int hidden_int;
1584		     extern _X_EXPORT int public_int;
1585		     extern _X_HIDDEN int hidden_int_func(void);
1586		     extern _X_EXPORT int public_int_func(void);],
1587		    [],
1588		    have_visibility=yes,
1589		    have_visibility=no)
1590		CFLAGS=$save_CFLAGS
1591	    fi
1592	    AC_MSG_RESULT([$have_visibility])
1593	    if test x$have_visibility != xno; then
1594		symbol_visibility=$VISIBILITY_CFLAGS
1595		XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
1596		XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
1597	    fi
1598	fi
1599	dnl added to xorg-server.pc
1600	AC_SUBST([symbol_visibility])
1601	dnl ===================================================================
1602
1603	PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
1604	SAVE_LIBS=$LIBS
1605	SAVE_CFLAGS=$CFLAGS
1606	CFLAGS=$PCIACCESS_CFLAGS
1607	LIBS=$PCIACCESS_LIBS
1608	AC_CHECK_FUNCS([pci_system_init_dev_mem])
1609	AC_CHECK_FUNCS([pci_device_enable])
1610	AC_CHECK_FUNCS([pci_device_is_boot_vga])
1611	AC_CHECK_FUNCS([pci_device_vgaarb_init])
1612	LIBS=$SAVE_LIBS
1613	CFLAGS=$SAVE_CFLAGS
1614	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
1615	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
1616
1617	case $host_os in
1618	  linux*)
1619		if test "x$LNXAPM" = xyes; then
1620			XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1621		fi
1622	  	XORG_OS="linux"
1623		XORG_OS_SUBDIR="linux"
1624		xorg_bus_linuxpci="yes"
1625		linux_acpi="no"
1626		case $host_cpu in
1627		  ia64*)
1628			linux_ia64=yes
1629			linux_acpi="yes"
1630			;;
1631		  alpha*)
1632		  	linux_alpha=yes
1633			;;
1634		  i*86|amd64*|x86_64*)
1635			linux_acpi="yes"
1636			;;
1637		  *)
1638			;;
1639		esac
1640		;;
1641	  freebsd* | kfreebsd*-gnu | dragonfly*)
1642	  	XORG_OS="freebsd"
1643		XORG_OS_SUBDIR="bsd"
1644		xorg_bus_bsdpci="yes"
1645		;;
1646	  netbsd*)
1647	  	XORG_OS="netbsd"
1648		XORG_OS_SUBDIR="bsd"
1649		xorg_bus_bsdpci="yes"
1650		;;
1651	  openbsd*)
1652		if test "x$ac_cv_BSD_APM" = xyes \
1653			-o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
1654			XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1655		fi
1656	  	XORG_OS="openbsd"
1657		XORG_OS_SUBDIR="bsd"
1658		xorg_bus_bsdpci="yes"
1659		;;
1660	  solaris*)
1661	  	XORG_OS="solaris"
1662		XORG_OS_SUBDIR="solaris"
1663		XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1664		# Use the same stubs as BSD for old functions, since we now
1665		# use libpciaccess for PCI
1666		xorg_bus_bsdpci="yes"
1667		AC_CHECK_HEADERS([sys/kd.h])
1668		AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
1669		# Check for minimum supported release
1670		AC_MSG_CHECKING([Solaris version])
1671	        OS_MINOR=`echo ${host_os}|$SED -e 's/^.*solaris2\.//' -e s'/\..*$//'`
1672		if test "${OS_MINOR}" -ge 7 ; then
1673	        	AC_MSG_RESULT(Solaris ${OS_MINOR})
1674		else
1675			AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
1676		fi
1677		if test "${OS_MINOR}" -lt 8 ; then
1678			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
1679		fi
1680		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1681		if test "x$SUNCC" = "xyes"; then
1682			solaris_asm_inline="yes"
1683		fi
1684		AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
1685			
1686		case $host_cpu in
1687		  sparc*)	
1688			SOLARIS_INOUT_ARCH="sparcv8plus"
1689			;;
1690		  i*86)	
1691			if test x$SOLARIS_64 = xyes ; then
1692				SOLARIS_INOUT_ARCH="amd64"
1693			else
1694				SOLARIS_INOUT_ARCH="ia32"
1695			fi
1696			;;
1697		  *)
1698			AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
1699			are supported on Solaris in this release.   If you are \
1700			interested in porting Xorg to your platform, please email \
1701			xorg@lists.freedesktop.org.]) ;;
1702		esac
1703		AC_SUBST([SOLARIS_INOUT_ARCH])
1704		if test x$solaris_asm_inline = xyes ; then
1705			SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
1706			XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
1707		fi
1708		AC_SUBST([SOLARIS_ASM_CFLAGS])
1709		if test "x$SUPPORT_PC98" = xauto; then
1710			SUPPORT_PC98="no"
1711		fi
1712		;;
1713	  gnu*)
1714	  	XORG_OS="gnu"
1715		XORG_OS_SUBDIR="hurd"
1716		# Use the same stubs as BSD for old functions, since we now
1717		# use libpciaccess for PCI
1718		xorg_bus_bsdpci="yes"
1719		;;
1720	  *)
1721	  	XORG_OS="unknown"
1722		XORG_OS_SUBDIR="unknown"
1723		AC_MSG_ERROR([m4_text_wrap(m4_join([ ],
1724		[Your OS is unknown. Xorg currently only supports Linux,],
1725		[Free/Open/Net/DragonFlyBSD, Solaris/OpenSolaris, & GNU Hurd.],
1726		[If you are interested in porting Xorg to your platform,],
1727		[please email xorg@lists.freedesktop.org.]))])
1728		;;
1729	esac
1730
1731	case $host_cpu in
1732	  sparc*)
1733		xorg_bus_sparc="yes"
1734		;;
1735	  i*86)
1736		if test "x$SUPPORT_PC98" = xauto; then
1737			SUPPORT_PC98="yes"
1738		fi
1739		;;
1740	esac
1741
1742	if test "x$SUPPORT_PC98" = xauto; then
1743		SUPPORT_PC98="no"
1744	fi
1745	if test "x$SUPPORT_PC98" = xyes; then
1746		AC_DEFINE(SUPPORT_PC98, 1, [Support PC98])
1747	fi
1748	if test "x$XORG_OS_PCI" = x ; then
1749		XORG_OS_PCI=$XORG_OS
1750	fi
1751	if test "x$DGA" = xauto; then
1752		PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
1753	fi
1754	if test "x$DGA" = xyes; then
1755		XORG_MODULES="$XORG_MODULES $DGAPROTO"
1756		PKG_CHECK_MODULES(DGA, $DGAPROTO)
1757		AC_DEFINE(DGA, 1, [Support DGA extension])
1758		AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
1759	fi
1760
1761	if test "x$XF86VIDMODE" = xauto; then
1762		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
1763	fi
1764	if test "x$XF86VIDMODE" = xyes; then
1765		XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
1766		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
1767		AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
1768	fi
1769
1770	if test -n "$XORG_MODULES"; then
1771	        PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
1772	        XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
1773	        XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
1774	fi
1775
1776	AC_SUBST([XORG_LIBS])
1777	AC_SUBST([XORG_SYS_LIBS])
1778	AC_SUBST([XORG_INCS])
1779	AC_SUBST([XORG_OS])
1780	AC_SUBST([XORG_OS_SUBDIR])
1781
1782	AC_PATH_PROG(PERL, perl, no)
1783	dnl unlikely as this may be ...
1784	if test "x$PERL" = xno; then
1785		AC_MSG_ERROR([Perl is required to build the XFree86/Xorg DDX.])
1786	fi
1787	AC_SUBST(PERL)
1788
1789	AC_SUBST([XORG_CFLAGS])
1790
1791	dnl these only go in xorg-config.h
1792	XF86CONFIGFILE="xorg.conf"
1793	XF86CONFIGDIR="xorg.conf.d"
1794	AC_SUBST(XF86CONFIGDIR)
1795	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
1796	LOGPREFIX="$logdir/Xorg."
1797	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
1798	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
1799	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
1800	AC_DEFINE(XFree86LOADER, 1, [Building loadable XFree86 server])
1801	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
1802	AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
1803	AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
1804	AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
1805	AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
1806	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
1807	AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
1808	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
1809	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
1810	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
1811	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
1812	AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
1813	if test "x$VGAHW" = xyes; then
1814		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
1815	fi
1816
1817	driverdir="$moduledir/drivers"
1818	AC_SUBST([moduledir])
1819	AC_SUBST([driverdir])
1820	sdkdir="$includedir/xorg"
1821	extdir="$includedir/X11/extensions"
1822	sysconfigdir="$datadir/X11/$XF86CONFIGDIR"
1823	AC_SUBST([sdkdir])
1824	AC_SUBST([extdir])
1825	AC_SUBST([sysconfigdir])
1826	AC_SUBST([logdir])
1827
1828	# stuff the ABI versions into the pc file too
1829	extract_abi() {
1830	    grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' '  .' | awk '{ print $4$5 }'
1831	}
1832	abi_ansic=`extract_abi ANSIC`
1833	abi_videodrv=`extract_abi VIDEODRV`
1834	abi_xinput=`extract_abi XINPUT`
1835	abi_extension=`extract_abi EXTENSION`
1836	AC_SUBST([abi_ansic])
1837	AC_SUBST([abi_videodrv])
1838	AC_SUBST([abi_xinput])
1839	AC_SUBST([abi_extension])
1840fi
1841AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
1842AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
1843AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
1844AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
1845AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
1846AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
1847AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
1848AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
1849AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
1850AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
1851AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
1852
1853dnl XWin DDX
1854
1855AC_MSG_CHECKING([whether to build XWin DDX])
1856if test "x$XWIN" = xauto; then
1857	case $host_os in
1858		cygwin*) XWIN="yes" ;;
1859		mingw*) XWIN="yes" ;;
1860		*) XWIN="no" ;;
1861	esac
1862fi
1863AC_MSG_RESULT([$XWIN])
1864
1865if test "x$XWIN" = xyes; then
1866	AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
1867	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
1868	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
1869	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
1870	AC_CHECK_TOOL(WINDRES, windres)
1871
1872	PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau])
1873
1874	if test "x$WINDOWSWM" = xauto; then
1875		PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
1876	fi
1877	if test "x$WINDOWSWM" = xyes ; then
1878		PKG_CHECK_MODULES(WINDOWSWM, $WINDOWSWMPROTO)
1879		XWINMODULES_CFLAGS="$XWINMODULES_CFLAGS $WINDOWSWM_CFLAGS"
1880		AC_DEFINE(ROOTLESS,1,[Build Rootless code])
1881	fi
1882
1883	case $host_os in
1884		cygwin*)
1885			XWIN_SERVER_NAME=XWin
1886			AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
1887			;;
1888		mingw*)
1889			XWIN_SERVER_NAME=Xming
1890			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
1891			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
1892			XWIN_SYS_LIBS=-lwinsock2
1893			;;
1894	esac
1895	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 $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
1896	XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
1897	AC_SUBST(XWIN_LIBS)
1898	AC_SUBST(XWIN_SERVER_NAME)
1899	AC_SUBST(XWIN_SYS_LIBS)
1900
1901	if test "x$DEBUGGING" = xyes; then
1902		AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
1903		AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
1904		AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
1905	fi
1906
1907	AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
1908	AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
1909fi
1910AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
1911AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
1912AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
1913AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
1914AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
1915AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false])
1916AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
1917AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
1918AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
1919
1920dnl Darwin / OS X DDX
1921if test "x$XQUARTZ" = xyes; then
1922	AC_DEFINE(XQUARTZ,1,[Have Quartz])
1923	AC_DEFINE(ROOTLESS,1,[Build Rootless code])
1924
1925	DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
1926	AC_SUBST([DARWIN_LIBS])
1927
1928	AC_CHECK_LIB([Xplugin],[xp_init],[:])
1929
1930	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
1931
1932	PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)
1933
1934        if test "x$XQUARTZ_SPARKLE" = xyes ; then
1935                AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
1936        fi
1937
1938	if test "x$STANDALONE_XPBPROXY" = xyes ; then
1939		AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
1940	fi
1941fi
1942
1943# Support for objc in autotools is minimal and not documented.
1944OBJC='$(CC)'
1945OBJCLD='$(CCLD)'
1946OBJCLINK='$(LINK)'
1947OBJCFLAGS='$(CFLAGS)'
1948AC_SUBST([OBJC])
1949AC_SUBST([OBJCCLD])
1950AC_SUBST([OBJCLINK])
1951AC_SUBST([OBJCFLAGS])
1952# internal, undocumented automake func follows :(
1953_AM_DEPENDENCIES([OBJC])
1954AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
1955AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
1956AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
1957
1958dnl DMX DDX
1959PKG_CHECK_MODULES(
1960	[DMXMODULES],
1961	[xmuu $LIBXEXT x11 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
1962	[PKG_CHECK_MODULES(
1963		[XDMXCONFIG_DEP],
1964		[xaw7 xmu xt xpm x11],
1965		[have_dmx=yes],
1966		[have_dmx=no])],
1967	[have_dmx=no])
1968AC_MSG_CHECKING([whether to build Xdmx DDX])
1969if test "x$DMX" = xauto; then
1970	DMX="$have_dmx"
1971	case $host_os in
1972		cygwin*) DMX="no" ;;
1973		darwin*) DMX="no" ;;
1974	esac
1975fi
1976AC_MSG_RESULT([$DMX])
1977AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
1978
1979if test "x$DMX" = xyes; then
1980	if test "x$have_dmx" = xno; then
1981		AC_MSG_ERROR([Xdmx build explicitly requested, but required
1982		              modules not found.])
1983	fi
1984	DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
1985	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
1986	XDMX_LIBS="$FB_LIB $MI_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XEXT_LIB $MAIN_LIB $DIX_LIB $OS_LIB $FIXES_LIB"
1987	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
1988	AC_SUBST([XDMX_CFLAGS])
1989	AC_SUBST([XDMX_LIBS])
1990	AC_SUBST([XDMX_SYS_LIBS])
1991
1992dnl USB sources in DMX require <linux/input.h>
1993	AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
1994			DMX_BUILD_USB="no")
1995dnl Linux sources in DMX require <linux/keyboard.h>
1996	AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
1997			DMX_BUILD_LNX="no")
1998	AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
1999	AC_SUBST(XDMXCONFIG_DEP_LIBS)
2000	PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11])
2001	AC_SUBST(DMXEXAMPLES_DEP_LIBS)
2002	PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11])
2003	AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
2004	PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11])
2005	AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
2006	PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11])
2007	AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
2008	PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11])
2009	AC_SUBST(XRESEXAMPLES_DEP_LIBS)
2010	PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11])
2011	AC_SUBST(X11EXAMPLES_DEP_LIBS)
2012
2013fi
2014AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
2015AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
2016
2017dnl kdrive DDX
2018
2019XEPHYR_LIBS=
2020XEPHYR_INCS=
2021
2022AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
2023
2024if test "$KDRIVE" = yes; then
2025    AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
2026    AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
2027
2028    AC_CHECK_HEADERS([linux/fb.h])
2029    if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
2030        XFBDEV=yes
2031    fi
2032
2033    if test "x$XFBDEV" = xyes; then
2034        KDRIVEFBDEVLIB=yes
2035        AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
2036    fi
2037
2038
2039    PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
2040    if test "x$HAVE_TSLIB" = xno; then
2041        AC_CHECK_LIB(ts, ts_open, [
2042			HAVE_TSLIB="yes"
2043			TSLIB_LIBS="-lts"
2044		])
2045    fi
2046
2047    if test "xTSLIB" = xauto; then
2048        TSLIB="$HAVE_TSLIB"
2049    fi
2050
2051    if test "x$TSLIB" = xyes; then
2052        if ! test "x$HAVE_TSLIB" = xyes; then
2053            AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
2054        else
2055            AC_DEFINE(TSLIB, 1, [Have tslib support])
2056        fi
2057    fi
2058
2059    if test "x$KDRIVE_KBD" = xyes; then
2060       AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
2061    fi
2062    if test "x$KDRIVE_EVDEV" = xyes; then
2063       AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
2064    fi
2065    if test "x$KDRIVE_MOUSE" = xyes; then
2066       AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
2067    fi
2068
2069    XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
2070    if test "x$XV" = xyes; then
2071        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
2072    fi
2073    if test "x$DRI" = xyes && test "x$GLX" = xyes; then
2074        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
2075    fi
2076
2077    PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
2078    if test "x$XEPHYR" = xauto; then
2079        XEPHYR=$xephyr
2080    fi
2081    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
2082        AC_MSG_ERROR([Xephyr dependencies missing])
2083    fi
2084
2085    # Xephyr needs nanosleep() which is in librt on Solaris
2086    AC_CHECK_FUNC([nanosleep], [],
2087        AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
2088    
2089    # damage shadow extension glx (NOTYET) fb mi
2090    KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
2091    KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
2092    KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
2093    KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
2094    
2095    KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
2096
2097    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
2098    KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
2099    case $host_os in
2100	*linux*)
2101	    KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
2102            KDRIVELINUX=yes
2103	    if test "x$KDRIVE_EVDEV" = xauto; then
2104		KDRIVE_EVDEV=yes
2105	    fi
2106	    if test "x$KDRIVE_KBD" = xauto; then
2107		KDRIVE_KBD=yes
2108	    fi
2109	    if test "x$KDRIVE_MOUSE" = xauto; then
2110		KDRIVE_MOUSE=yes
2111	    fi
2112	    ;;
2113	*)
2114	    if test "x$KDRIVE_EVDEV" = xauto; then
2115		KDRIVE_EVDEV=no
2116	    fi
2117	    if test "x$KDRIVE_KBD" = xauto; then
2118		KDRIVE_KBD=no
2119	    fi
2120	    if test "x$KDRIVE_MOUSE" = xauto; then
2121		KDRIVE_MOUSE=no
2122	    fi
2123	    ;;
2124    esac
2125    KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
2126    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
2127    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
2128    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
2129    KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
2130
2131    AC_SUBST([XEPHYR_LIBS])
2132    AC_SUBST([XEPHYR_INCS])
2133fi
2134AC_SUBST([KDRIVE_INCS])
2135AC_SUBST([KDRIVE_PURE_INCS])
2136AC_SUBST([KDRIVE_CFLAGS])
2137AC_SUBST([KDRIVE_PURE_LIBS])
2138AC_SUBST([KDRIVE_LOCAL_LIBS])
2139AC_SUBST([KDRIVE_LIBS])
2140AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
2141AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
2142AM_CONDITIONAL(KDRIVE_KBD,   [test "x$KDRIVE_KBD" = xyes])
2143AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
2144AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
2145AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
2146AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
2147AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
2148AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
2149
2150dnl and the rest of these are generic, so they're in config.h
2151dnl 
2152dnl though, thanks to the passing of some significant amount of time, the
2153dnl above is probably a complete fallacy, and you should not rely on it.
2154dnl but this is still actually better than imake, honest. -daniels
2155
2156AC_TRY_COMPILE([
2157#include <features.h>
2158#ifndef __GLIBC__
2159#error not glibc
2160#endif
2161], [], [AC_DEFINE(_GNU_SOURCE, 1,
2162	[ Enable GNU and other extensions to the C environment for glibc])])
2163
2164AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
2165
2166AC_SUBST([RELEASE_DATE])
2167BUILD_DATE="`date +'%Y%m%d'`"
2168AC_SUBST([BUILD_DATE])
2169BUILD_TIME="`date +'1%H%M%S'`"
2170AC_SUBST([BUILD_TIME])
2171
2172DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
2173
2174AC_SUBST([DIX_CFLAGS])
2175
2176AC_SUBST([libdir])
2177AC_SUBST([exec_prefix])
2178AC_SUBST([prefix])
2179
2180AC_OUTPUT([
2181Makefile
2182glx/Makefile
2183include/Makefile
2184composite/Makefile
2185damageext/Makefile
2186dbe/Makefile
2187dix/Makefile
2188doc/Makefile
2189doc/xml/Makefile
2190doc/xml/dtrace/Makefile
2191doc/xml/xserver.ent
2192fb/Makefile
2193record/Makefile
2194config/Makefile
2195mi/Makefile
2196miext/Makefile
2197miext/damage/Makefile
2198miext/shadow/Makefile
2199miext/cw/Makefile
2200miext/rootless/Makefile
2201os/Makefile
2202randr/Makefile
2203render/Makefile
2204xkb/Makefile
2205Xext/Makefile
2206Xi/Makefile
2207xfixes/Makefile
2208exa/Makefile
2209hw/Makefile
2210hw/xfree86/Makefile
2211hw/xfree86/common/Makefile
2212hw/xfree86/common/xf86Build.h
2213hw/xfree86/ddc/Makefile
2214hw/xfree86/dixmods/Makefile
2215hw/xfree86/dixmods/extmod/Makefile
2216hw/xfree86/doc/Makefile
2217hw/xfree86/doc/devel/Makefile
2218hw/xfree86/doc/man/Makefile
2219hw/xfree86/doc/sgml/Makefile
2220hw/xfree86/dri/Makefile
2221hw/xfree86/dri2/Makefile
2222hw/xfree86/exa/Makefile
2223hw/xfree86/fbdevhw/Makefile
2224hw/xfree86/i2c/Makefile
2225hw/xfree86/int10/Makefile
2226hw/xfree86/loader/Makefile
2227hw/xfree86/modes/Makefile
2228hw/xfree86/os-support/Makefile
2229hw/xfree86/os-support/bsd/Makefile
2230hw/xfree86/os-support/bus/Makefile
2231hw/xfree86/os-support/hurd/Makefile
2232hw/xfree86/os-support/misc/Makefile
2233hw/xfree86/os-support/linux/Makefile
2234hw/xfree86/os-support/sco/Makefile
2235hw/xfree86/os-support/solaris/Makefile
2236hw/xfree86/os-support/sysv/Makefile
2237hw/xfree86/parser/Makefile
2238hw/xfree86/ramdac/Makefile
2239hw/xfree86/shadowfb/Makefile
2240hw/xfree86/vbe/Makefile
2241hw/xfree86/vgahw/Makefile
2242hw/xfree86/x86emu/Makefile
2243hw/xfree86/xaa/Makefile
2244hw/xfree86/xf8_16bpp/Makefile
2245hw/xfree86/utils/Makefile
2246hw/xfree86/utils/cvt/Makefile
2247hw/xfree86/utils/gtf/Makefile
2248hw/dmx/config/Makefile
2249hw/dmx/doc/Makefile
2250hw/dmx/examples/Makefile
2251hw/dmx/input/Makefile
2252hw/dmx/glxProxy/Makefile
2253hw/dmx/Makefile
2254hw/vfb/Makefile
2255hw/xnest/Makefile
2256hw/xwin/Makefile
2257hw/xwin/glx/Makefile
2258hw/xquartz/Makefile
2259hw/xquartz/GL/Makefile
2260hw/xquartz/bundle/Makefile
2261hw/xquartz/doc/Makefile
2262hw/xquartz/mach-startup/Makefile
2263hw/xquartz/pbproxy/Makefile
2264hw/xquartz/xpr/Makefile
2265hw/kdrive/Makefile
2266hw/kdrive/ephyr/Makefile
2267hw/kdrive/fake/Makefile
2268hw/kdrive/fbdev/Makefile
2269hw/kdrive/linux/Makefile
2270hw/kdrive/src/Makefile
2271test/Makefile
2272test/xi2/Makefile
2273xorg-server.pc
2274])
2275