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