configure.ac revision 6747b715
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.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
30RELEASE_DATE="2010-10-30"
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_DEVEL_DOCS
722XORG_WITH_XMLTO(0.0.20)
723XORG_WITH_FOP
724
725dnl Handle installing libxf86config
726AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
727
728dnl DDX Detection... Yes, it's ugly to have it here... but we need to
729dnl handle this early on so that we don't require unsupported extensions
730case $host_os in
731	cygwin*)
732		DGA=no
733		DRI2=no
734		XF86VIDMODE=no
735		XSELINUX=no
736		XV=no
737		;;
738	darwin*)
739		DRI2=no
740
741		if test x$XQUARTZ = xauto; then
742			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
743		 		save_LDFLAGS=$LDFLAGS
744				LDFLAGS="$LDFLAGS -framework Carbon"
745				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
746				[xorg_cv_Carbon_framework=yes],
747				[xorg_cv_Carbon_framework=no])
748			LDFLAGS=$save_LDFLAGS])
749                
750			if test "X$xorg_cv_Carbon_framework" = Xyes; then
751				XQUARTZ=yes
752			else
753				XQUARTZ=no
754			fi
755		fi
756
757		if test "x$XQUARTZ" = xyes ; then
758			XQUARTZ=yes
759			XVFB=no
760			XNEST=no
761
762			COMPOSITE=no
763			DGA=no
764			DPMSExtension=no
765			XF86VIDMODE=no
766		fi
767		;;
768	*) XQUARTZ=no ;;
769esac
770
771dnl ---------------------------------------------------------------------------
772dnl Extension section
773dnl ---------------------------------------------------------------------------
774XEXT_INC='-I$(top_srcdir)/Xext'
775XEXT_LIB='$(top_builddir)/Xext/libXext.la'
776XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
777
778dnl Optional modules
779VIDEOPROTO="videoproto"
780COMPOSITEPROTO="compositeproto >= 0.4"
781RECORDPROTO="recordproto >= 1.13.99.1"
782SCRNSAVERPROTO="scrnsaverproto >= 1.1"
783RESOURCEPROTO="resourceproto"
784DRIPROTO="xf86driproto >= 2.1.0"
785DRI2PROTO="dri2proto >= 2.3"
786XINERAMAPROTO="xineramaproto"
787BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
788XCALIBRATEPROTO="xcalibrateproto"
789DGAPROTO="xf86dgaproto >= 2.0.99.1"
790GLPROTO="glproto >= 1.4.10"
791DMXPROTO="dmxproto >= 2.2.99.1"
792VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
793WINDOWSWMPROTO="windowswmproto"
794APPLEWMPROTO="applewmproto >= 1.4"
795
796dnl Core modules for most extensions, et al.
797SDK_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"
798# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
799AC_SUBST(SDK_REQUIRED_MODULES)
800
801dnl List of libraries that require a specific version
802LIBAPPLEWM="applewm >= 1.4"
803LIBDMX="dmx >= 1.0.99.1"
804LIBDRI="dri >= 7.8.0"
805LIBDRM="libdrm >= 2.3.0"
806LIBGL="gl >= 7.1.0"
807LIBXEXT="xext >= 1.0.99.4"
808LIBXFONT="xfont >= 1.4.2"
809LIBXI="xi >= 1.2.99.1"
810LIBXTST="xtst >= 1.0.99.2"
811LIBPCIACCESS="pciaccess >= 0.8.0"
812LIBGLIB="glib-2.0 >= 2.16"
813LIBUDEV="libudev >= 143"
814LIBSELINUX="libselinux >= 2.0.86"
815LIBDBUS="dbus-1 >= 1.0"
816LIBPIXMAN="pixman-1 >= 0.15.20"
817
818dnl Pixman is always required, but we separate it out so we can link
819dnl specific modules against it
820PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
821REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
822
823REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
824
825if test "x$CONFIG_UDEV" = xyes &&
826 { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
827	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
828fi
829
830PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
831if test "x$CONFIG_UDEV" = xauto; then
832	CONFIG_UDEV="$HAVE_LIBUDEV"
833fi
834AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
835if test "x$CONFIG_UDEV" = xyes; then
836	CONFIG_DBUS_API=no
837	CONFIG_HAL=no
838	if ! test "x$HAVE_LIBUDEV" = xyes; then
839		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
840	fi
841	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
842fi
843
844dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
845dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
846dnl API.
847PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
848if test "x$HAVE_DBUS" = xyes; then
849	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
850fi
851AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
852
853if test "x$CONFIG_DBUS_API" = xauto; then
854	CONFIG_DBUS_API="$HAVE_DBUS"
855fi
856if test "x$CONFIG_DBUS_API" = xyes; then
857	if ! test "x$HAVE_DBUS" = xyes; then
858		AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
859	fi
860
861	AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
862	CONFIG_NEED_DBUS="yes"
863fi
864AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
865
866PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
867if test "x$CONFIG_HAL" = xauto; then
868	CONFIG_HAL="$HAVE_HAL"
869fi
870if test "x$CONFIG_HAL" = xyes; then
871	if ! test "x$HAVE_HAL" = xyes; then
872		AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
873	fi
874
875	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
876	CONFIG_NEED_DBUS="yes"
877fi
878AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
879
880if test "x$CONFIG_NEED_DBUS" = xyes; then
881        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
882fi
883AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
884
885if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
886	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
887else
888	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
889fi
890AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
891		   [Use SIGIO handlers for input device events by default])
892
893AC_MSG_CHECKING([for glibc...])
894AC_PREPROC_IFELSE([
895#include <features.h>
896#ifndef __GLIBC__
897#error
898#endif
899], glibc=yes, glibc=no)
900AC_MSG_RESULT([$glibc])
901
902AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
903               [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
904                             [have_clock_gettime=no])])
905
906AC_MSG_CHECKING([for a useful monotonic clock ...])
907
908if ! test "x$have_clock_gettime" = xno; then
909    if ! test "x$have_clock_gettime" = xyes; then
910        CLOCK_LIBS="$have_clock_gettime"
911    else
912        CLOCK_LIBS=""
913    fi
914
915    LIBS_SAVE="$LIBS"
916    LIBS="$CLOCK_LIBS"
917    CPPFLAGS_SAVE="$CPPFLAGS"
918
919    if test x"$glibc" = xyes; then
920        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
921    fi
922
923    AC_RUN_IFELSE([
924#include <time.h>
925
926int main(int argc, char *argv[[]]) {
927    struct timespec tp;
928
929    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
930        return 0;
931    else
932        return 1;
933}
934    ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
935       [MONOTONIC_CLOCK="cross compiling"])
936
937    LIBS="$LIBS_SAVE"
938    CPPFLAGS="$CPPFLAGS_SAVE"
939else
940    MONOTONIC_CLOCK=no
941fi
942
943AC_MSG_RESULT([$MONOTONIC_CLOCK])
944
945if test "x$MONOTONIC_CLOCK" = xyes; then
946    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
947    LIBS="$LIBS $CLOCK_LIBS"
948fi
949
950AM_CONDITIONAL(XV, [test "x$XV" = xyes])
951if test "x$XV" = xyes; then
952	AC_DEFINE(XV, 1, [Support Xv extension])
953	AC_DEFINE(XvExtension, 1, [Build Xv extension])
954	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
955	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
956else
957	XVMC=no
958fi
959
960AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
961if test "x$XVMC" = xyes; then
962	AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
963fi
964
965AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
966if test "x$XREGISTRY" = xyes; then
967	AC_DEFINE(XREGISTRY, 1, [Build registry module])
968fi
969
970AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
971if test "x$COMPOSITE" = xyes; then
972	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
973	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
974	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
975	COMPOSITE_INC='-I$(top_srcdir)/composite'
976fi
977
978AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
979if test "x$MITSHM" = xyes; then
980	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
981	AC_DEFINE(HAS_SHM, 1, [Support SHM])
982fi
983
984AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
985if test "x$RECORD" = xyes; then
986	AC_DEFINE(XRECORD, 1, [Support Record extension])
987	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
988	RECORD_LIB='$(top_builddir)/record/librecord.la'
989fi
990
991AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
992if test "x$SCREENSAVER" = xyes; then
993	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
994	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
995fi
996
997AM_CONDITIONAL(RES, [test "x$RES" = xyes])
998if test "x$RES" = xyes; then
999	AC_DEFINE(RES, 1, [Support X resource extension])
1000	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
1001fi
1002
1003if test "x$GLX" = xyes; then
1004	PKG_CHECK_MODULES([XLIB], [x11])
1005	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
1006	AC_SUBST(XLIB_CFLAGS)
1007	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
1008	GLX_LIBS='$(top_builddir)/glx/libglx.la'
1009	GLX_SYS_LIBS="$GLX_SYS_LIBS"
1010else
1011        GLX=no
1012fi
1013AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
1014
1015if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
1016	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
1017else
1018	AIGLX=no
1019fi
1020AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
1021
1022if test "x$GLX_USE_TLS" = xyes -a "x$AIGLX" = xyes; then
1023	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
1024	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
1025fi
1026AC_SUBST([GLX_DEFINES])
1027
1028AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
1029if test "x$DRI" = xyes; then
1030	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1031	PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
1032	PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
1033	AC_SUBST(DRIPROTO_CFLAGS)
1034fi
1035
1036PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1037                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
1038case "$DRI2,$HAVE_DRI2PROTO" in
1039	yes,no)
1040		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
1041		;;
1042	yes,yes | auto,yes)
1043		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
1044		DRI2=yes
1045		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1046		;;
1047esac
1048AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
1049
1050if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
1051	if test "x$DRM" = xyes; then
1052		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
1053		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
1054	fi
1055fi
1056
1057if test "x$DRI2" = xyes; then
1058	save_CFLAGS=$CFLAGS
1059	CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
1060	AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
1061#include <GL/internal/dri_interface.h>
1062#ifndef __DRI_DRI2
1063#error DRI2 extension not available.
1064#endif]])],
1065			  [HAVE_DRI2EXTENSION=yes],
1066			  [HAVE_DRI2EXTENSION=no])
1067	CFLAGS=$save_CFLAGS
1068	if test "x$HAVE_DRI2EXTENSION" = xyes; then
1069		AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
1070		DRI2_AIGLX=yes
1071	else
1072		AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
1073		DRI2_AIGLX=no
1074	fi
1075fi
1076AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
1077
1078
1079AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
1080if test "x$XINERAMA" = xyes; then
1081	AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
1082	AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
1083	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1084	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
1085fi
1086
1087AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
1088if test "x$XACE" = xyes; then
1089	AC_DEFINE(XACE, 1, [Build X-ACE extension])
1090fi
1091
1092AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
1093if test "x$XSELINUX" = xyes; then
1094	if test "x$XACE" != xyes; then
1095		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
1096	fi
1097	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
1098	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1099	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1100	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1101	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
1102fi
1103
1104AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
1105if test "x$XCSECURITY" = xyes; then
1106	if test "x$XACE" != xyes; then
1107		AC_MSG_ERROR([cannot build Security extension without X-ACE])
1108	fi
1109	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
1110fi
1111
1112AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
1113if test "x$DBE" = xyes; then
1114	AC_DEFINE(DBE, 1, [Support DBE extension])
1115	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
1116fi
1117
1118AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
1119if test "x$XF86BIGFONT" = xyes; then
1120	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
1121	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
1122fi
1123
1124AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
1125if test "x$DPMSExtension" = xyes; then
1126	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
1127fi
1128
1129if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
1130   AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
1131   REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
1132else
1133   XCALIBRATE=no
1134fi
1135AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
1136
1137AC_DEFINE(RENDER, 1, [Support RENDER extension])
1138RENDER_LIB='$(top_builddir)/render/librender.la'
1139RENDER_INC='-I$(top_srcdir)/render'
1140
1141AC_DEFINE(RANDR, 1, [Support RANDR extension])
1142RANDR_LIB='$(top_builddir)/randr/librandr.la'
1143RANDR_INC='-I$(top_srcdir)/randr'
1144
1145AC_DEFINE(XFIXES,1,[Support XFixes extension])
1146FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
1147FIXES_INC='-I$(top_srcdir)/xfixes'
1148
1149AC_DEFINE(DAMAGE,1,[Support Damage extension])
1150DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
1151DAMAGE_INC='-I$(top_srcdir)/damageext'
1152MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
1153MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
1154
1155# XINPUT extension is integral part of the server
1156AC_DEFINE(XINPUT, 1, [Support X Input extension])
1157XI_LIB='$(top_builddir)/Xi/libXi.la'
1158XI_INC='-I$(top_srcdir)/Xi'
1159
1160AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
1161AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
1162AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
1163AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
1164AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
1165
1166AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
1167
1168AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
1169AC_ARG_WITH(xkb-bin-directory,
1170				AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
1171				[XKB_BIN_DIRECTORY="$withval"],
1172				[XKB_BIN_DIRECTORY="$bindir"])
1173
1174AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
1175
1176dnl Make sure XKM_OUTPUT_DIR is an absolute path
1177XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
1178if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
1179   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
1180fi
1181
1182dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
1183dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
1184
1185XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
1186XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
1187AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
1188AC_SUBST(XKB_COMPILED_DIR)
1189
1190if test "x$XKB_DFLT_RULES" = x; then
1191    case $host_os in
1192    linux*)
1193        dnl doesn't take AutoAddDevices into account, but whatever.
1194        if test "x$CONFIG_HAL" = xyes; then
1195            XKB_DFLT_RULES="evdev"
1196        else
1197            XKB_DFLT_RULES="base"
1198        fi
1199        ;;
1200    *)
1201        XKB_DFLT_RULES="base"
1202        ;;
1203    esac
1204fi
1205AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
1206AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
1207AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
1208AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
1209AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
1210
1211XKB_LIB='$(top_builddir)/xkb/libxkb.la'
1212XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
1213REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
1214
1215AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
1216                                        [Do not have 'strcasecmp'.]))
1217AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
1218                                        [Do not have 'strncasecmp'.]))
1219AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
1220                                       [Do not have 'strcasestr'.]))
1221
1222PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
1223if test "x$have_libxdmcp" = xyes; then
1224	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
1225fi
1226if test "x$XDMCP" = xauto; then
1227	if test "x$have_libxdmcp" = xyes; then
1228		XDMCP=yes
1229	else
1230		XDMCP=no
1231	fi
1232fi
1233if test "x$XDMAUTH" = xauto; then
1234	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
1235		XDMAUTH=yes
1236	else
1237		XDMAUTH=no
1238	fi
1239fi
1240
1241AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
1242if test "x$XDMCP" = xyes; then
1243	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
1244	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1245	XDMCP_MODULES="xdmcp"
1246fi
1247
1248AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
1249if test "x$XDMAUTH" = xyes; then
1250	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
1251	if ! test "x$XDMCP" = xyes; then
1252		REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1253		XDMCP_MODULES="xdmcp"
1254	fi
1255fi
1256
1257AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
1258AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
1259AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
1260AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
1261AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
1262AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
1263AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
1264AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
1265AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1266AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
1267
1268if test -z "$OSNAME"; then
1269    OSNAME="UNKNOWN"
1270fi
1271
1272AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
1273AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
1274AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
1275
1276AC_SUBST([VENDOR_NAME_SHORT])
1277AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
1278AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
1279AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
1280AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1281
1282AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
1283
1284if test "x$DEBUGGING" = xyes; then
1285       AC_DEFINE(DEBUG, 1, [Enable debugging code])
1286fi
1287AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
1288
1289# If unittests aren't explicitly disabled, check for required support
1290if test "x$UNITTESTS" != xno ; then
1291       PKG_CHECK_MODULES([GLIB], $LIBGLIB,
1292                         [HAVE_GLIB=yes], [HAVE_GLIB=no])
1293
1294       # Check if linker supports -wrap, passed via compiler flags
1295       # When cross-compiling, reports no, since unit tests run from
1296       # "make check", so would be running on build machine,  not target
1297       AC_MSG_CHECKING([whether the linker supports -wrap])
1298       save_LDFLAGS="$LDFLAGS"
1299       LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
1300       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1301	void __wrap_exit (int s)
1302	{
1303	    __real_exit (0);
1304	}]],
1305	[[exit (1);]])],
1306                     [linker_can_wrap="yes"],
1307                     [linker_can_wrap="no"],
1308                     [linker_can_wrap="no"])
1309       AC_MSG_RESULT([$linker_can_wrap])
1310       LDFLAGS="$save_LDFLAGS"
1311fi
1312
1313if test "x$UNITTESTS" = xauto; then
1314       if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
1315           UNITTESTS=yes
1316       else
1317           UNITTESTS=no
1318       fi
1319fi
1320if test "x$UNITTESTS" = xyes; then
1321       if test "x$HAVE_GLIB" = xno; then
1322           AC_MSG_ERROR([glib required to build unit tests])
1323       fi
1324       if test "x$linker_can_wrap" = xno; then
1325           AC_MSG_ERROR([ld -wrap support required to build unit tests])
1326       fi
1327       AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
1328       AC_SUBST([GLIB_LIBS])
1329       AC_SUBST([GLIB_CFLAGS])
1330fi
1331AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
1332
1333AC_DEFINE(XTEST, 1, [Support XTest extension])
1334AC_DEFINE(XSYNC, 1, [Support XSync extension])
1335AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
1336AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
1337
1338if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
1339  DIX_LIB='$(top_builddir)/dix/dix.O'
1340  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS)'
1341else
1342  DIX_LIB='$(top_builddir)/dix/libdix.la'
1343  OS_LIB='$(top_builddir)/os/libos.la'
1344fi
1345AC_SUBST([DIX_LIB])
1346AC_SUBST([OS_LIB])
1347
1348MAIN_LIB='$(top_builddir)/dix/libmain.la'
1349AC_SUBST([MAIN_LIB])
1350
1351MI_LIB='$(top_builddir)/mi/libmi.la'
1352MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
1353MI_INC='-I$(top_srcdir)/mi'
1354FB_LIB='$(top_builddir)/fb/libfb.la'
1355FB_INC='-I$(top_srcdir)/fb'
1356MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
1357MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
1358CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
1359
1360# SHA1 hashing
1361AC_ARG_WITH([sha1],
1362            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto],
1363                            [choose SHA1 implementation])])
1364AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
1365if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
1366	with_sha1=libc
1367fi
1368if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
1369	AC_MSG_ERROR([libc requested but not found])
1370fi
1371if test "x$with_sha1" = xlibc; then
1372	AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
1373		[Use libc SHA1 functions])
1374	SHA1_LIBS=""
1375fi
1376AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
1377if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
1378	with_sha1=CommonCrypto
1379fi
1380if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
1381	AC_MSG_ERROR([CommonCrypto requested but not found])
1382fi
1383if test "x$with_sha1" = xCommonCrypto; then
1384	AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
1385		[Use CommonCrypto SHA1 functions])
1386	SHA1_LIBS=""
1387fi
1388AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
1389if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
1390	with_sha1=libmd
1391fi
1392if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
1393	AC_MSG_ERROR([libmd requested but not found])
1394fi
1395if test "x$with_sha1" = xlibmd; then
1396	AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
1397	          [Use libmd SHA1 functions])
1398	SHA1_LIBS=-lmd
1399fi
1400PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
1401if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
1402   with_sha1=libsha1
1403fi
1404if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
1405	AC_MSG_ERROR([libsha1 requested but not found])
1406fi
1407if test "x$with_sha1" = xlibsha1; then
1408	AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
1409	          [Use libsha1 for SHA1])
1410	SHA1_LIBS=-lsha1
1411fi
1412AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
1413if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
1414	with_sha1=libgcrypt
1415fi
1416if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
1417	AC_MSG_ERROR([libgcrypt requested but not found])
1418fi
1419if test "x$with_sha1" = xlibgcrypt; then
1420	AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
1421	          [Use libgcrypt SHA1 functions])
1422	SHA1_LIBS=-lgcrypt
1423fi
1424# We don't need all of the OpenSSL libraries, just libcrypto
1425AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
1426PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
1427                  [HAVE_OPENSSL_PKC=no])
1428if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
1429	if test "x$with_sha1" = x; then
1430		with_sha1=libcrypto
1431	fi
1432else
1433	if test "x$with_sha1" = xlibcrypto; then
1434		AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
1435	fi
1436fi
1437if test "x$with_sha1" = xlibcrypto; then
1438	if test "x$HAVE_LIBCRYPTO" = xyes; then
1439		SHA1_LIBS=-lcrypto
1440	else
1441		SHA1_LIBS="$OPENSSL_LIBS"
1442		SHA1_CFLAGS="$OPENSSL_CFLAGS"
1443	fi
1444fi
1445AC_MSG_CHECKING([for SHA1 implementation])
1446if test "x$with_sha1" = x; then
1447	AC_MSG_ERROR([No suitable SHA1 implementation found])
1448fi
1449AC_MSG_RESULT([$with_sha1])
1450AC_SUBST(SHA1_LIBS)
1451AC_SUBST(SHA1_CFLAGS)
1452
1453PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
1454PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
1455
1456# Autotools has some unfortunate issues with library handling.  In order to
1457# get a server to rebuild when a dependency in the tree is changed, it must
1458# be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be
1459# listed there, or some versions of autotools will break (especially if a -L
1460# is required to find the library).  So, we keep two sets of libraries
1461# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
1462# will go into the _DEPENDENCIES and _LDADD of the server, and
1463# NAMESPACE_SYS_LIBS which will go into only the _LDADD.  The
1464# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
1465# NAMESPACE_SYS_LIBS.
1466#
1467# XSERVER_LIBS is the set of in-tree libraries which all servers require.
1468# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
1469# require.
1470#
1471XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
1472XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
1473XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
1474AC_SUBST([XSERVER_LIBS])
1475AC_SUBST([XSERVER_SYS_LIBS])
1476
1477UTILS_SYS_LIBS="${SYS_LIBS}"
1478AC_SUBST([UTILS_SYS_LIBS])
1479
1480# The Xorg binary needs to export symbols so that they can be used from modules
1481# Some platforms require extra flags to do this.   libtool should set the
1482# necessary flags for each platform when -export-dynamic is passed to it.
1483LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
1484AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
1485
1486dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
1487dnl we need to replicate that here until those can all be fixed
1488AC_MSG_CHECKING([if SVR4 needs to be defined])
1489AC_EGREP_CPP([I_AM_SVR4],[
1490#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
1491 I_AM_SVR4
1492#endif
1493],[
1494AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
1495AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
1496
1497XSERVER_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"
1498
1499dnl ---------------------------------------------------------------------------
1500dnl DDX section.
1501dnl ---------------------------------------------------------------------------
1502
1503dnl Xvfb DDX
1504
1505AC_MSG_CHECKING([whether to build Xvfb DDX])
1506AC_MSG_RESULT([$XVFB])
1507AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
1508
1509if test "x$XVFB" = xyes; then
1510	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"
1511	XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
1512	AC_SUBST([XVFB_LIBS])
1513	AC_SUBST([XVFB_SYS_LIBS])
1514fi
1515
1516
1517dnl Xnest DDX
1518
1519PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
1520AC_MSG_CHECKING([whether to build Xnest DDX])
1521if test "x$XNEST" = xauto; then
1522	XNEST="$have_xnest"
1523fi
1524AC_MSG_RESULT([$XNEST])
1525AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
1526
1527if test "x$XNEST" = xyes; then
1528	if test "x$have_xnest" = xno; then
1529		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
1530	fi
1531	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"
1532	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
1533	AC_SUBST([XNEST_LIBS])
1534	AC_SUBST([XNEST_SYS_LIBS])
1535fi
1536
1537
1538dnl Xorg DDX
1539
1540AC_MSG_CHECKING([whether to build Xorg DDX])
1541if test "x$XORG" = xauto; then
1542	XORG="yes"
1543	case $host_os in
1544		cygwin*) XORG="no" ;;
1545		darwin*) XORG="no" ;;
1546	esac
1547fi
1548AC_MSG_RESULT([$XORG])
1549
1550xorg_bus_linuxpci=no
1551xorg_bus_bsdpci=no
1552xorg_bus_sparc=no
1553
1554if test "x$XORG" = xyes; then
1555	XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
1556	XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
1557	XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
1558	XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
1559	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"
1560
1561	dnl ==================================================================
1562	dnl symbol visibility
1563	symbol_visibility=
1564	have_visibility=disabled
1565	if test x$SYMBOL_VISIBILITY != xno; then
1566	    AC_MSG_CHECKING(for symbol visibility support)
1567	    if test x$GCC = xyes; then
1568		VISIBILITY_CFLAGS="-fvisibility=hidden"
1569	    else
1570		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1571		if test x$SUNCC = xyes; then
1572		    VISIBILITY_CFLAGS="-xldscope=hidden"
1573		else
1574		    have_visibility=no
1575		fi
1576	    fi
1577	    if test x$have_visibility != xno; then
1578		save_CFLAGS="$CFLAGS"
1579		CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
1580		AC_TRY_COMPILE(
1581		    [#include <X11/Xfuncproto.h>
1582		     extern _X_HIDDEN int hidden_int;
1583		     extern _X_EXPORT int public_int;
1584		     extern _X_HIDDEN int hidden_int_func(void);
1585		     extern _X_EXPORT int public_int_func(void);],
1586		    [],
1587		    have_visibility=yes,
1588		    have_visibility=no)
1589		CFLAGS=$save_CFLAGS
1590	    fi
1591	    AC_MSG_RESULT([$have_visibility])
1592	    if test x$have_visibility != xno; then
1593		symbol_visibility=$VISIBILITY_CFLAGS
1594		XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
1595		XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
1596	    fi
1597	fi
1598	dnl added to xorg-server.pc
1599	AC_SUBST([symbol_visibility])
1600	dnl ===================================================================
1601
1602	PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
1603	SAVE_LIBS=$LIBS
1604	SAVE_CFLAGS=$CFLAGS
1605	CFLAGS=$PCIACCESS_CFLAGS
1606	LIBS=$PCIACCESS_LIBS
1607	AC_CHECK_FUNCS([pci_system_init_dev_mem])
1608	AC_CHECK_FUNCS([pci_device_enable])
1609	AC_CHECK_FUNCS([pci_device_is_boot_vga])
1610	AC_CHECK_FUNCS([pci_device_vgaarb_init])
1611	LIBS=$SAVE_LIBS
1612	CFLAGS=$SAVE_CFLAGS
1613	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
1614	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
1615
1616	case $host_os in
1617	  linux*)
1618		if test "x$LNXAPM" = xyes; then
1619			XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1620		fi
1621	  	XORG_OS="linux"
1622		XORG_OS_SUBDIR="linux"
1623		xorg_bus_linuxpci="yes"
1624		linux_acpi="no"
1625		case $host_cpu in
1626		  ia64*)
1627			linux_ia64=yes
1628			linux_acpi="yes"
1629			;;
1630		  alpha*)
1631		  	linux_alpha=yes
1632			;;
1633		  i*86|amd64*|x86_64*)
1634			linux_acpi="yes"
1635			;;
1636		  *)
1637			;;
1638		esac
1639		;;
1640	  freebsd* | kfreebsd*-gnu | dragonfly*)
1641	  	XORG_OS="freebsd"
1642		XORG_OS_SUBDIR="bsd"
1643		xorg_bus_bsdpci="yes"
1644		;;
1645	  netbsd*)
1646	  	XORG_OS="netbsd"
1647		XORG_OS_SUBDIR="bsd"
1648		xorg_bus_bsdpci="yes"
1649		;;
1650	  openbsd*)
1651		if test "x$ac_cv_BSD_APM" = xyes \
1652			-o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
1653			XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1654		fi
1655	  	XORG_OS="openbsd"
1656		XORG_OS_SUBDIR="bsd"
1657		xorg_bus_bsdpci="yes"
1658		;;
1659	  solaris*)
1660	  	XORG_OS="solaris"
1661		XORG_OS_SUBDIR="solaris"
1662		XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
1663		# Use the same stubs as BSD for old functions, since we now
1664		# use libpciaccess for PCI
1665		xorg_bus_bsdpci="yes"
1666		AC_CHECK_HEADERS([sys/kd.h])
1667		AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
1668		# Check for minimum supported release
1669		AC_MSG_CHECKING([Solaris version])
1670	        OS_MINOR=`echo ${host_os}|$SED -e 's/^.*solaris2\.//' -e s'/\..*$//'`
1671		if test "${OS_MINOR}" -ge 7 ; then
1672	        	AC_MSG_RESULT(Solaris ${OS_MINOR})
1673		else
1674			AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
1675		fi
1676		if test "${OS_MINOR}" -lt 8 ; then
1677			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
1678		fi
1679		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1680		if test "x$SUNCC" = "xyes"; then
1681			solaris_asm_inline="yes"
1682		fi
1683		AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
1684			
1685		case $host_cpu in
1686		  sparc*)	
1687			SOLARIS_INOUT_ARCH="sparcv8plus"
1688			;;
1689		  i*86)	
1690			if test x$SOLARIS_64 = xyes ; then
1691				SOLARIS_INOUT_ARCH="amd64"
1692			else
1693				SOLARIS_INOUT_ARCH="ia32"
1694			fi
1695			;;
1696		  *)
1697			AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
1698			are supported on Solaris in this release.   If you are \
1699			interested in porting Xorg to your platform, please email \
1700			xorg@lists.freedesktop.org.]) ;;
1701		esac
1702		AC_SUBST([SOLARIS_INOUT_ARCH])
1703		if test x$solaris_asm_inline = xyes ; then
1704			SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
1705			XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
1706		fi
1707		AC_SUBST([SOLARIS_ASM_CFLAGS])
1708		if test "x$SUPPORT_PC98" = xauto; then
1709			SUPPORT_PC98="no"
1710		fi
1711		;;
1712	  gnu*)
1713	  	XORG_OS="gnu"
1714		XORG_OS_SUBDIR="hurd"
1715		# Use the same stubs as BSD for old functions, since we now
1716		# use libpciaccess for PCI
1717		xorg_bus_bsdpci="yes"
1718		;;
1719	  *)
1720	  	XORG_OS="unknown"
1721		XORG_OS_SUBDIR="unknown"
1722		AC_MSG_ERROR([m4_text_wrap(m4_join([ ],
1723		[Your OS is unknown. Xorg currently only supports Linux,],
1724		[Free/Open/Net/DragonFlyBSD, Solaris/OpenSolaris, & GNU Hurd.],
1725		[If you are interested in porting Xorg to your platform,],
1726		[please email xorg@lists.freedesktop.org.]))])
1727		;;
1728	esac
1729
1730	case $host_cpu in
1731	  sparc*)
1732		xorg_bus_sparc="yes"
1733		;;
1734	  i*86)
1735		if test "x$SUPPORT_PC98" = xauto; then
1736			SUPPORT_PC98="yes"
1737		fi
1738		;;
1739	esac
1740
1741	if test "x$SUPPORT_PC98" = xauto; then
1742		SUPPORT_PC98="no"
1743	fi
1744	if test "x$SUPPORT_PC98" = xyes; then
1745		AC_DEFINE(SUPPORT_PC98, 1, [Support PC98])
1746	fi
1747	if test "x$XORG_OS_PCI" = x ; then
1748		XORG_OS_PCI=$XORG_OS
1749	fi
1750	if test "x$DGA" = xauto; then
1751		PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
1752	fi
1753	if test "x$DGA" = xyes; then
1754		XORG_MODULES="$XORG_MODULES $DGAPROTO"
1755		PKG_CHECK_MODULES(DGA, $DGAPROTO)
1756		AC_DEFINE(DGA, 1, [Support DGA extension])
1757		AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
1758	fi
1759
1760	if test "x$XF86VIDMODE" = xauto; then
1761		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
1762	fi
1763	if test "x$XF86VIDMODE" = xyes; then
1764		XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
1765		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
1766		AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
1767	fi
1768
1769	if test -n "$XORG_MODULES"; then
1770	        PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
1771	        XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
1772	        XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
1773	fi
1774
1775	AC_SUBST([XORG_LIBS])
1776	AC_SUBST([XORG_SYS_LIBS])
1777	AC_SUBST([XORG_INCS])
1778	AC_SUBST([XORG_OS])
1779	AC_SUBST([XORG_OS_SUBDIR])
1780
1781	AC_PATH_PROG(PERL, perl, no)
1782	dnl unlikely as this may be ...
1783	if test "x$PERL" = xno; then
1784		AC_MSG_ERROR([Perl is required to build the XFree86/Xorg DDX.])
1785	fi
1786	AC_SUBST(PERL)
1787
1788	AC_SUBST([XORG_CFLAGS])
1789
1790	dnl these only go in xorg-config.h
1791	XF86CONFIGFILE="xorg.conf"
1792	XF86CONFIGDIR="xorg.conf.d"
1793	AC_SUBST(XF86CONFIGDIR)
1794	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
1795	LOGPREFIX="$logdir/Xorg."
1796	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
1797	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
1798	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
1799	AC_DEFINE(XFree86LOADER, 1, [Building loadable XFree86 server])
1800	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
1801	AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
1802	AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
1803	AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
1804	AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
1805	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
1806	AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
1807	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
1808	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
1809	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
1810	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
1811	AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
1812	if test "x$VGAHW" = xyes; then
1813		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
1814	fi
1815
1816	driverdir="$moduledir/drivers"
1817	AC_SUBST([moduledir])
1818	AC_SUBST([driverdir])
1819	sdkdir="$includedir/xorg"
1820	extdir="$includedir/X11/extensions"
1821	sysconfigdir="$datadir/X11/$XF86CONFIGDIR"
1822	AC_SUBST([sdkdir])
1823	AC_SUBST([extdir])
1824	AC_SUBST([sysconfigdir])
1825	AC_SUBST([logdir])
1826
1827	# stuff the ABI versions into the pc file too
1828	extract_abi() {
1829	    grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' '  .' | awk '{ print $4$5 }'
1830	}
1831	abi_ansic=`extract_abi ANSIC`
1832	abi_videodrv=`extract_abi VIDEODRV`
1833	abi_xinput=`extract_abi XINPUT`
1834	abi_extension=`extract_abi EXTENSION`
1835	AC_SUBST([abi_ansic])
1836	AC_SUBST([abi_videodrv])
1837	AC_SUBST([abi_xinput])
1838	AC_SUBST([abi_extension])
1839fi
1840AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
1841AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
1842AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
1843AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
1844AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
1845AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
1846AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
1847AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
1848AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
1849AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
1850AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
1851
1852dnl XWin DDX
1853
1854AC_MSG_CHECKING([whether to build XWin DDX])
1855if test "x$XWIN" = xauto; then
1856	case $host_os in
1857		cygwin*) XWIN="yes" ;;
1858		mingw*) XWIN="yes" ;;
1859		*) XWIN="no" ;;
1860	esac
1861fi
1862AC_MSG_RESULT([$XWIN])
1863
1864if test "x$XWIN" = xyes; then
1865	AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
1866	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
1867	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
1868	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
1869	AC_CHECK_TOOL(WINDRES, windres)
1870
1871	PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau])
1872
1873	if test "x$WINDOWSWM" = xauto; then
1874		PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
1875	fi
1876	if test "x$WINDOWSWM" = xyes ; then
1877		PKG_CHECK_MODULES(WINDOWSWM, $WINDOWSWMPROTO)
1878		XWINMODULES_CFLAGS="$XWINMODULES_CFLAGS $WINDOWSWM_CFLAGS"
1879		AC_DEFINE(ROOTLESS,1,[Build Rootless code])
1880	fi
1881
1882	case $host_os in
1883		cygwin*)
1884			XWIN_SERVER_NAME=XWin
1885			AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
1886			;;
1887		mingw*)
1888			XWIN_SERVER_NAME=Xming
1889			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
1890			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
1891			XWIN_SYS_LIBS=-lwinsock2
1892			;;
1893	esac
1894	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"
1895	XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
1896	AC_SUBST(XWIN_LIBS)
1897	AC_SUBST(XWIN_SERVER_NAME)
1898	AC_SUBST(XWIN_SYS_LIBS)
1899
1900	if test "x$DEBUGGING" = xyes; then
1901		AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
1902		AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
1903		AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
1904	fi
1905
1906	AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
1907	AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
1908fi
1909AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
1910AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
1911AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
1912AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
1913AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
1914AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false])
1915AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
1916AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
1917AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
1918
1919dnl Darwin / OS X DDX
1920if test "x$XQUARTZ" = xyes; then
1921	AC_DEFINE(XQUARTZ,1,[Have Quartz])
1922	AC_DEFINE(ROOTLESS,1,[Build Rootless code])
1923
1924	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"
1925	AC_SUBST([DARWIN_LIBS])
1926
1927	AC_CHECK_LIB([Xplugin],[xp_init],[:])
1928
1929	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
1930
1931	PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)
1932
1933        if test "x$XQUARTZ_SPARKLE" = xyes ; then
1934                AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
1935        fi
1936
1937	if test "x$STANDALONE_XPBPROXY" = xyes ; then
1938		AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
1939	fi
1940fi
1941
1942# Support for objc in autotools is minimal and not documented.
1943OBJC='$(CC)'
1944OBJCLD='$(CCLD)'
1945OBJCLINK='$(LINK)'
1946OBJCFLAGS='$(CFLAGS)'
1947AC_SUBST([OBJC])
1948AC_SUBST([OBJCCLD])
1949AC_SUBST([OBJCLINK])
1950AC_SUBST([OBJCFLAGS])
1951# internal, undocumented automake func follows :(
1952_AM_DEPENDENCIES([OBJC])
1953AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
1954AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
1955AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
1956
1957dnl DMX DDX
1958PKG_CHECK_MODULES(
1959	[DMXMODULES],
1960	[xmuu $LIBXEXT x11 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
1961	[PKG_CHECK_MODULES(
1962		[XDMXCONFIG_DEP],
1963		[xaw7 xmu xt xpm x11],
1964		[have_dmx=yes],
1965		[have_dmx=no])],
1966	[have_dmx=no])
1967AC_MSG_CHECKING([whether to build Xdmx DDX])
1968if test "x$DMX" = xauto; then
1969	DMX="$have_dmx"
1970	case $host_os in
1971		cygwin*) DMX="no" ;;
1972		darwin*) DMX="no" ;;
1973	esac
1974fi
1975AC_MSG_RESULT([$DMX])
1976AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
1977
1978if test "x$DMX" = xyes; then
1979	if test "x$have_dmx" = xno; then
1980		AC_MSG_ERROR([Xdmx build explicitly requested, but required
1981		              modules not found.])
1982	fi
1983	DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
1984	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
1985	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"
1986	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
1987	AC_SUBST([XDMX_CFLAGS])
1988	AC_SUBST([XDMX_LIBS])
1989	AC_SUBST([XDMX_SYS_LIBS])
1990
1991dnl USB sources in DMX require <linux/input.h>
1992	AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
1993			DMX_BUILD_USB="no")
1994dnl Linux sources in DMX require <linux/keyboard.h>
1995	AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
1996			DMX_BUILD_LNX="no")
1997	AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
1998	AC_SUBST(XDMXCONFIG_DEP_LIBS)
1999	PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11])
2000	AC_SUBST(DMXEXAMPLES_DEP_LIBS)
2001	PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11])
2002	AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
2003	PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11])
2004	AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
2005	PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11])
2006	AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
2007	PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11])
2008	AC_SUBST(XRESEXAMPLES_DEP_LIBS)
2009	PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11])
2010	AC_SUBST(X11EXAMPLES_DEP_LIBS)
2011
2012fi
2013AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
2014AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
2015
2016dnl kdrive DDX
2017
2018XEPHYR_LIBS=
2019XEPHYR_INCS=
2020
2021AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
2022
2023if test "$KDRIVE" = yes; then
2024    AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
2025    AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
2026
2027    AC_CHECK_HEADERS([linux/fb.h])
2028    if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
2029        XFBDEV=yes
2030    fi
2031
2032    if test "x$XFBDEV" = xyes; then
2033        KDRIVEFBDEVLIB=yes
2034        AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
2035    fi
2036
2037
2038    PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
2039    if test "x$HAVE_TSLIB" = xno; then
2040        AC_CHECK_LIB(ts, ts_open, [HAVE_TSLIB="yes"])
2041    fi
2042
2043    if test "xTSLIB" = xauto; then
2044        TSLIB="$HAVE_TSLIB"
2045    fi
2046
2047    if test "x$TSLIB" = xyes; then
2048        if ! test "x$HAVE_TSLIB" = xyes; then
2049            AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
2050        else
2051            AC_DEFINE(TSLIB, 1, [Have tslib support])
2052        fi
2053    fi
2054
2055    if test "x$KDRIVE_KBD" = xyes; then
2056       AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
2057    fi
2058    if test "x$KDRIVE_EVDEV" = xyes; then
2059       AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
2060    fi
2061    if test "x$KDRIVE_MOUSE" = xyes; then
2062       AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
2063    fi
2064
2065    XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
2066    if test "x$XV" = xyes; then
2067        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
2068    fi
2069    if test "x$DRI" = xyes && test "x$GLX" = xyes; then
2070        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
2071    fi
2072
2073    PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
2074    if test "x$XEPHYR" = xauto; then
2075        XEPHYR=$xephyr
2076    fi
2077    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
2078        AC_MSG_ERROR([Xephyr dependencies missing])
2079    fi
2080
2081    # Xephyr needs nanosleep() which is in librt on Solaris
2082    AC_CHECK_FUNC([nanosleep], [],
2083        AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
2084    
2085    # damage shadow extension glx (NOTYET) fb mi
2086    KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
2087    KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
2088    KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
2089    KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
2090    
2091    KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
2092
2093    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"
2094    KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
2095    case $host_os in
2096	*linux*)
2097	    KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
2098            KDRIVELINUX=yes
2099	    if test "x$KDRIVE_EVDEV" = xauto; then
2100		KDRIVE_EVDEV=yes
2101	    fi
2102	    if test "x$KDRIVE_KBD" = xauto; then
2103		KDRIVE_KBD=yes
2104	    fi
2105	    if test "x$KDRIVE_MOUSE" = xauto; then
2106		KDRIVE_MOUSE=yes
2107	    fi
2108	    ;;
2109	*)
2110	    if test "x$KDRIVE_EVDEV" = xauto; then
2111		KDRIVE_EVDEV=no
2112	    fi
2113	    if test "x$KDRIVE_KBD" = xauto; then
2114		KDRIVE_KBD=no
2115	    fi
2116	    if test "x$KDRIVE_MOUSE" = xauto; then
2117		KDRIVE_MOUSE=no
2118	    fi
2119	    ;;
2120    esac
2121    KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
2122    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
2123    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
2124    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB"
2125    KDRIVE_LIBS="$TSLIB_LIBS $KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
2126
2127    AC_SUBST([XEPHYR_LIBS])
2128    AC_SUBST([XEPHYR_INCS])
2129fi
2130AC_SUBST([KDRIVE_INCS])
2131AC_SUBST([KDRIVE_PURE_INCS])
2132AC_SUBST([KDRIVE_CFLAGS])
2133AC_SUBST([KDRIVE_PURE_LIBS])
2134AC_SUBST([KDRIVE_LOCAL_LIBS])
2135AC_SUBST([KDRIVE_LIBS])
2136AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
2137AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
2138AM_CONDITIONAL(KDRIVE_KBD,   [test "x$KDRIVE_KBD" = xyes])
2139AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
2140AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
2141AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
2142AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
2143AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
2144AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
2145
2146dnl and the rest of these are generic, so they're in config.h
2147dnl 
2148dnl though, thanks to the passing of some significant amount of time, the
2149dnl above is probably a complete fallacy, and you should not rely on it.
2150dnl but this is still actually better than imake, honest. -daniels
2151
2152AC_TRY_COMPILE([
2153#include <features.h>
2154#ifndef __GLIBC__
2155#error not glibc
2156#endif
2157], [], [AC_DEFINE(_GNU_SOURCE, 1,
2158	[ Enable GNU and other extensions to the C environment for glibc])])
2159
2160AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
2161
2162AC_SUBST([RELEASE_DATE])
2163BUILD_DATE="`date +'%Y%m%d'`"
2164AC_SUBST([BUILD_DATE])
2165BUILD_TIME="`date +'1%H%M%S'`"
2166AC_SUBST([BUILD_TIME])
2167
2168DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
2169
2170AC_SUBST([DIX_CFLAGS])
2171
2172AC_SUBST([libdir])
2173AC_SUBST([exec_prefix])
2174AC_SUBST([prefix])
2175
2176AC_OUTPUT([
2177Makefile
2178glx/Makefile
2179include/Makefile
2180composite/Makefile
2181damageext/Makefile
2182dbe/Makefile
2183dix/Makefile
2184doc/Makefile
2185doc/xml/Makefile
2186doc/xml/dtrace/Makefile
2187doc/xml/xserver.ent
2188fb/Makefile
2189record/Makefile
2190config/Makefile
2191mi/Makefile
2192miext/Makefile
2193miext/damage/Makefile
2194miext/shadow/Makefile
2195miext/cw/Makefile
2196miext/rootless/Makefile
2197os/Makefile
2198randr/Makefile
2199render/Makefile
2200xkb/Makefile
2201Xext/Makefile
2202Xi/Makefile
2203xfixes/Makefile
2204exa/Makefile
2205hw/Makefile
2206hw/xfree86/Makefile
2207hw/xfree86/common/Makefile
2208hw/xfree86/common/xf86Build.h
2209hw/xfree86/ddc/Makefile
2210hw/xfree86/dixmods/Makefile
2211hw/xfree86/dixmods/extmod/Makefile
2212hw/xfree86/doc/Makefile
2213hw/xfree86/doc/devel/Makefile
2214hw/xfree86/doc/man/Makefile
2215hw/xfree86/doc/sgml/Makefile
2216hw/xfree86/dri/Makefile
2217hw/xfree86/dri2/Makefile
2218hw/xfree86/exa/Makefile
2219hw/xfree86/fbdevhw/Makefile
2220hw/xfree86/i2c/Makefile
2221hw/xfree86/int10/Makefile
2222hw/xfree86/loader/Makefile
2223hw/xfree86/modes/Makefile
2224hw/xfree86/os-support/Makefile
2225hw/xfree86/os-support/bsd/Makefile
2226hw/xfree86/os-support/bus/Makefile
2227hw/xfree86/os-support/hurd/Makefile
2228hw/xfree86/os-support/misc/Makefile
2229hw/xfree86/os-support/linux/Makefile
2230hw/xfree86/os-support/sco/Makefile
2231hw/xfree86/os-support/solaris/Makefile
2232hw/xfree86/os-support/sysv/Makefile
2233hw/xfree86/parser/Makefile
2234hw/xfree86/ramdac/Makefile
2235hw/xfree86/shadowfb/Makefile
2236hw/xfree86/vbe/Makefile
2237hw/xfree86/vgahw/Makefile
2238hw/xfree86/x86emu/Makefile
2239hw/xfree86/xaa/Makefile
2240hw/xfree86/xf8_16bpp/Makefile
2241hw/xfree86/utils/Makefile
2242hw/xfree86/utils/cvt/Makefile
2243hw/xfree86/utils/gtf/Makefile
2244hw/dmx/config/Makefile
2245hw/dmx/doc/Makefile
2246hw/dmx/examples/Makefile
2247hw/dmx/input/Makefile
2248hw/dmx/glxProxy/Makefile
2249hw/dmx/Makefile
2250hw/vfb/Makefile
2251hw/xnest/Makefile
2252hw/xwin/Makefile
2253hw/xwin/glx/Makefile
2254hw/xquartz/Makefile
2255hw/xquartz/GL/Makefile
2256hw/xquartz/bundle/Makefile
2257hw/xquartz/doc/Makefile
2258hw/xquartz/mach-startup/Makefile
2259hw/xquartz/pbproxy/Makefile
2260hw/xquartz/xpr/Makefile
2261hw/kdrive/Makefile
2262hw/kdrive/ephyr/Makefile
2263hw/kdrive/fake/Makefile
2264hw/kdrive/fbdev/Makefile
2265hw/kdrive/linux/Makefile
2266hw/kdrive/src/Makefile
2267test/Makefile
2268test/xi2/Makefile
2269xorg-server.pc
2270])
2271