configure.ac revision 9ace9065
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.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
30RELEASE_DATE="2011-07-08"
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 ARM needs additional compiler flags for proper backtraces if GCC is
316dnl used. Compile a dummy program with the -mapcs-frame option. If it
317dnl succeeds, we know that we are building for ARM with GCC.
318old_CFLAGS="$CFLAGS"
319CFLAGS="-mapcs-frame"
320AC_COMPILE_IFELSE(
321        AC_LANG_PROGRAM([[ ]]),
322        ARM_BACKTRACE_CFLAGS="$CFLAGS",
323        ARM_BACKTRACE_CFLAGS=""
324)
325CFLAGS="$old_CFLAGS"
326AC_SUBST(ARM_BACKTRACE_CFLAGS)
327
328dnl ---------------------------------------------------------------------------
329dnl Bus options and CPU capabilities.  Replaces logic in
330dnl hw/xfree86/os-support/bus/Makefile.am, among others.
331dnl ---------------------------------------------------------------------------
332DEFAULT_INT10="x86emu"
333
334dnl Override defaults as needed for specific platforms:
335
336case $host_cpu in
337  alpha*)
338	ALPHA_VIDEO=yes
339	case $host_os in
340	        *freebsd*)	SYS_LIBS=-lio ;;
341		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
342	esac
343	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
344	;;
345  arm*)
346	ARM_VIDEO=yes
347	;;
348  i*86)
349	I386_VIDEO=yes
350	case $host_os in
351		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
352		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
353		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
354				SYS_LIBS=-li386
355				;;
356		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
357				SYS_LIBS=-li386
358				;;
359	esac
360        ;;
361  powerpc*)
362	PPC_VIDEO=yes
363	case $host_os in
364		*freebsd*)	DEFAULT_INT10=stub ;;
365	esac
366	;;
367  sparc*)
368	SPARC64_VIDEO=yes
369	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
370	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
371	;;
372  x86_64*|amd64*)
373	I386_VIDEO=yes
374	case $host_os in
375		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
376		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
377		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
378				SYS_LIBS=-lx86_64
379				;;
380		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
381				SYS_LIBS=-lamd64
382				;;
383	esac
384	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
385	;;
386  ia64*)
387  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
388	;;
389  s390*)
390  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
391	;;
392esac
393AC_SUBST(GLX_ARCH_DEFINES)
394
395dnl BSD *_video.c selection
396AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
397AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
398AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
399AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
400AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
401
402DRI=no
403USE_SIGIO_BY_DEFAULT="yes"
404dnl it would be nice to autodetect these *CONS_SUPPORTs
405case $host_os in
406  *freebsd* | *dragonfly*)
407	case $host_os in
408		kfreebsd*-gnu) ;;
409		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
410	esac
411	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
412	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
413	AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
414	DRI=yes
415	;;
416  *netbsd*)
417	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
418	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
419	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
420	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
421	DRI=yes
422	;;
423  *openbsd*)
424	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
425	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
426	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
427	;;
428  *linux*)
429	DRI=yes
430	;;
431  *solaris*)
432	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
433	# Disable use of SIGIO by default until some system bugs are
434	# fixed - see Sun/OpenSolaris bug id 6879897
435	USE_SIGIO_BY_DEFAULT="no"
436	;;
437  darwin*)
438	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
439	;;
440  cygwin*)
441	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
442	;;
443esac
444
445dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
446dnl major number
447PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
448PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
449if test "x$PVS" = "x"; then
450	PVS="0"
451fi
452
453VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
454VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
455
456VENDOR_NAME="The X.Org Foundation"
457VENDOR_NAME_SHORT="X.Org"
458VENDOR_WEB="http://wiki.x.org"
459
460m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
461
462dnl Build options.
463AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
464		  [Obsolete - use --enable-strict-compilation instead]),
465  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))
466
467AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
468				  [Enable debugging (default: disabled)]),
469			        [DEBUGGING=$enableval], [DEBUGGING=no])
470AC_ARG_ENABLE(unit-tests,    AS_HELP_STRING([--enable-unit-tests],
471                                  [Enable unit-tests (default: auto)]),
472                                [UNITTESTS=$enableval], [UNITTESTS=auto])
473AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
474  [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
475                                [USE_SIGIO_BY_DEFAULT=$enableval], [])
476AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
477				[INT10="$withval"],
478				[INT10="$DEFAULT_INT10"])
479AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
480				  [Vendor string reported by the server]),
481				[ VENDOR_NAME="$withval" ], [])
482AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
483				  [Short version of vendor string reported by the server]),
484				[ VENDOR_NAME_SHORT="$withval" ], [])
485AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
486				  [Vendor web address reported by the server]),
487				[ VENDOR_WEB="$withval" ], [])
488AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
489				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
490				[ moduledir="$withval" ],
491				[ moduledir="${libdir}/xorg/modules" ])
492AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
493				  [Directory where log files are kept (default: $localstatedir/log)]),
494				[ logdir="$withval" ],
495				[ logdir="$localstatedir/log" ])
496AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
497				  [Builder address (default: xorg@lists.freedesktop.org)]),
498				[ BUILDERADDR="$withval" ],
499				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
500AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
501				[ OSNAME="$withval" ],
502				[ OSNAME=`uname -srm` ])
503AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
504				[ OSVENDOR="$withval" ],
505				[ OSVENDOR="" ])
506AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
507				[ BUILDERSTRING="$withval" ]
508				[ ])
509
510dnl Determine font path
511XORG_FONTROOTDIR
512XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
513XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
514XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
515XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
516XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
517XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
518
519dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
520dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
521dnl compiling, assume default font path uses standard FONTROOTDIR directories.
522DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
523if test "$cross_compiling" != yes; then
524	AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
525		[DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
526		[case $host_os in
527			darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
528		esac])
529fi
530AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
531				[ FONTPATH="$withval" ],
532				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
533
534AC_MSG_CHECKING([for default font path])
535AC_MSG_RESULT([$FONTPATH])
536
537AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
538				[ XKBPATH="$withval" ],
539				[ XKBPATH="${datadir}/X11/xkb" ])
540AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
541				[ XKBOUTPUT="$withval" ],
542				[ XKBOUTPUT="compiled" ])
543AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
544                                   [Keyboard ruleset (default: base/evdev)]),
545                                [ XKB_DFLT_RULES="$withval" ],
546                                [ XKB_DFLT_RULES="" ])
547AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
548                                   [Keyboard model (default: pc105)]),
549                                [ XKB_DFLT_MODEL="$withval" ],
550                                [ XKB_DFLT_MODEL="pc105" ])
551AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
552                                   [Keyboard layout (default: us)]),
553                                [ XKB_DFLT_LAYOUT="$withval" ],
554                                [ XKB_DFLT_LAYOUT="us" ])
555AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
556                                   [Keyboard variant (default: (none))]),
557                                [ XKB_DFLT_VARIANT="$withval" ],
558                                [ XKB_DFLT_VARIANT="" ])
559AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
560                                   [Keyboard layout options (default: (none))]),
561                                [ XKB_DFLT_OPTIONS="$withval" ],
562                                [ XKB_DFLT_OPTIONS="" ])
563AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
564				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
565				[ SERVERCONFIG="$withval" ],
566				[ SERVERCONFIG="${libdir}/xorg" ])
567AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
568				[ APPLE_APPLICATIONS_DIR="${withval}" ],
569				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
570AC_SUBST([APPLE_APPLICATIONS_DIR])
571AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
572				[ APPLE_APPLICATION_NAME="${withval}" ],
573				[ APPLE_APPLICATION_NAME="X11" ])
574AC_SUBST([APPLE_APPLICATION_NAME])
575AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
576                                [ LAUNCHD_ID_PREFIX="${withval}" ],
577                                [ LAUNCHD_ID_PREFIX="org.x" ])
578AC_SUBST([LAUNCHD_ID_PREFIX])
579AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$LAUNCHD_ID_PREFIX", [Prefix to use for launchd identifiers])
580AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
581				[ XQUARTZ_SPARKLE="${enableval}" ],
582				[ XQUARTZ_SPARKLE="no" ])
583AC_SUBST([XQUARTZ_SPARKLE])
584AC_ARG_ENABLE(install-libxf86config,
585				AS_HELP_STRING([--enable-install-libxf86config],
586				[Install libxf86config (default: disabled)]),
587				[INSTALL_LIBXF86CONFIG=$enableval],
588				[INSTALL_LIBXF86CONFIG=no])
589AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
590				[SYMBOL_VISIBILITY=$enableval],
591				[SYMBOL_VISIBILITY=auto])
592AC_ARG_ENABLE(pc98,     	AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
593				[SUPPORT_PC98=$enableval],
594				[SUPPORT_PC98=auto])
595
596dnl GLX build options
597AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
598                                [AIGLX=$enableval],
599                                [AIGLX=yes])
600AX_TLS
601AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
602                                [GLX_USE_TLS=$enableval
603                                 if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
604                                   AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.])
605                                 fi],
606                                [GLX_USE_TLS=no
607                                 if test "${ac_cv_tls}" != "none" ; then
608                                   GLX_USE_TLS=yes
609                                 fi])
610AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
611
612dnl Extensions.
613AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
614AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
615AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
616AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
617AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
618AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
619AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
620AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
621AC_ARG_ENABLE(screensaver,    AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
622AC_ARG_ENABLE(xdmcp,          AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
623AC_ARG_ENABLE(xdm-auth-1,     AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
624AC_ARG_ENABLE(glx,            AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
625AC_ARG_ENABLE(dri,            AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
626AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
627AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
628AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
629AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
630AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
631AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
632AC_ARG_ENABLE(xcalibrate,     AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
633AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
634AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
635AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
636AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
637AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
638AC_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])
639AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
640AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
641AC_ARG_ENABLE(xaa,               AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
642AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
643AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
644AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
645AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
646AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
647
648dnl DDXes.
649AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
650AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
651AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
652AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
653AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
654AC_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])
655AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
656dnl kdrive and its subsystems
657AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
658AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
659AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
660AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
661dnl kdrive options
662AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
663AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
664AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
665
666
667dnl chown/chmod to be setuid root as part of build
668dnl Replaces InstallXserverSetUID in imake
669AC_ARG_ENABLE(install-setuid, 
670    AS_HELP_STRING([--enable-install-setuid],
671       [Install Xorg server as owned by root with setuid bit (default: auto)]),
672    [SETUID=$enableval], [SETUID=auto])
673AC_MSG_CHECKING([to see if we can install the Xorg server as root])
674if test "x$SETUID" = "xauto" ; then
675	case $host_os in
676	    cygwin*)		SETUID="no"  ;;
677	    darwin*)		SETUID="no"  ;;
678	    *)
679	   	case $host_cpu in
680		    sparc)	SETUID="no"  ;;
681		    *)		SETUID="yes" ;;
682		esac
683	esac
684	if test "x$SETUID" = xyes; then
685		touch testfile
686		chown root testfile > /dev/null 2>&1 || SETUID="no"
687		rm -f testfile
688	fi
689fi
690AC_MSG_RESULT([$SETUID])
691AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])
692
693dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
694dnl was not expanded, since xorg-server with no transport types is rather useless.
695dnl
696dnl If you're seeing an error here, be sure you installed the lib/xtrans module
697dnl first and if it's not in the default location, that you set the ACLOCAL
698dnl environment variable to find it, such as:
699dnl	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
700m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
701
702# Transport selection macro from xtrans.m4
703XTRANS_CONNECTION_FLAGS
704
705# Secure RPC detection macro from xtrans.m4
706XTRANS_SECURE_RPC_FLAGS
707AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
708
709AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
710AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
711AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
712if test "x$INT10" = xyes; then
713	dnl VM86 headers
714	AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
715fi
716
717XORG_ENABLE_DOCS
718XORG_ENABLE_DEVEL_DOCS
719XORG_WITH_XMLTO(0.0.20)
720XORG_WITH_FOP
721
722dnl Handle installing libxf86config
723AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
724
725dnl DDX Detection... Yes, it's ugly to have it here... but we need to
726dnl handle this early on so that we don't require unsupported extensions
727case $host_os in
728	cygwin*)
729		DGA=no
730		DRI2=no
731		XF86VIDMODE=no
732		XSELINUX=no
733		XV=no
734		;;
735	darwin*)
736		DRI2=no
737
738		if test x$XQUARTZ = xauto; then
739			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
740		 		save_LDFLAGS=$LDFLAGS
741				LDFLAGS="$LDFLAGS -framework Carbon"
742				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
743				[xorg_cv_Carbon_framework=yes],
744				[xorg_cv_Carbon_framework=no])
745			LDFLAGS=$save_LDFLAGS])
746                
747			if test "X$xorg_cv_Carbon_framework" = Xyes; then
748				XQUARTZ=yes
749			else
750				XQUARTZ=no
751			fi
752		fi
753
754		if test "x$XQUARTZ" = xyes ; then
755			XQUARTZ=yes
756			XVFB=no
757			XNEST=no
758
759			COMPOSITE=no
760			DGA=no
761			DPMSExtension=no
762			XF86VIDMODE=no
763		fi
764		;;
765	*) XQUARTZ=no ;;
766esac
767
768dnl ---------------------------------------------------------------------------
769dnl Extension section
770dnl ---------------------------------------------------------------------------
771XEXT_INC='-I$(top_srcdir)/Xext'
772XEXT_LIB='$(top_builddir)/Xext/libXext.la'
773XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
774
775dnl Optional modules
776VIDEOPROTO="videoproto"
777COMPOSITEPROTO="compositeproto >= 0.4"
778RECORDPROTO="recordproto >= 1.13.99.1"
779SCRNSAVERPROTO="scrnsaverproto >= 1.1"
780RESOURCEPROTO="resourceproto"
781DRIPROTO="xf86driproto >= 2.1.0"
782DRI2PROTO="dri2proto >= 2.3"
783XINERAMAPROTO="xineramaproto"
784BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
785XCALIBRATEPROTO="xcalibrateproto"
786DGAPROTO="xf86dgaproto >= 2.0.99.1"
787GLPROTO="glproto >= 1.4.10"
788DMXPROTO="dmxproto >= 2.2.99.1"
789VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
790WINDOWSWMPROTO="windowswmproto"
791APPLEWMPROTO="applewmproto >= 1.4"
792
793dnl Core modules for most extensions, et al.
794SDK_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"
795# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
796AC_SUBST(SDK_REQUIRED_MODULES)
797
798dnl List of libraries that require a specific version
799LIBAPPLEWM="applewm >= 1.4"
800LIBDMX="dmx >= 1.0.99.1"
801LIBDRI="dri >= 7.8.0"
802LIBDRM="libdrm >= 2.3.0"
803LIBGL="gl >= 7.1.0"
804LIBXEXT="xext >= 1.0.99.4"
805LIBXFONT="xfont >= 1.4.2"
806LIBXI="xi >= 1.2.99.1"
807LIBXTST="xtst >= 1.0.99.2"
808LIBPCIACCESS="pciaccess >= 0.8.0"
809LIBGLIB="glib-2.0 >= 2.16"
810LIBUDEV="libudev >= 143"
811LIBSELINUX="libselinux >= 2.0.86"
812LIBDBUS="dbus-1 >= 1.0"
813LIBPIXMAN="pixman-1 >= 0.15.20"
814
815dnl Pixman is always required, but we separate it out so we can link
816dnl specific modules against it
817PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
818REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
819
820REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
821
822if test "x$CONFIG_UDEV" = xyes &&
823 { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
824	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
825fi
826
827PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
828if test "x$CONFIG_UDEV" = xauto; then
829	CONFIG_UDEV="$HAVE_LIBUDEV"
830fi
831AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
832if test "x$CONFIG_UDEV" = xyes; then
833	CONFIG_DBUS_API=no
834	CONFIG_HAL=no
835	if ! test "x$HAVE_LIBUDEV" = xyes; then
836		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
837	fi
838	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
839fi
840
841dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
842dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
843dnl API.
844PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
845if test "x$HAVE_DBUS" = xyes; then
846	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
847fi
848AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
849
850if test "x$CONFIG_DBUS_API" = xauto; then
851	CONFIG_DBUS_API="$HAVE_DBUS"
852fi
853if test "x$CONFIG_DBUS_API" = xyes; then
854	if ! test "x$HAVE_DBUS" = xyes; then
855		AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
856	fi
857
858	AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
859	CONFIG_NEED_DBUS="yes"
860fi
861AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
862
863PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
864if test "x$CONFIG_HAL" = xauto; then
865	CONFIG_HAL="$HAVE_HAL"
866fi
867if test "x$CONFIG_HAL" = xyes; then
868	if ! test "x$HAVE_HAL" = xyes; then
869		AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
870	fi
871
872	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
873	CONFIG_NEED_DBUS="yes"
874fi
875AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
876
877if test "x$CONFIG_NEED_DBUS" = xyes; then
878        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
879fi
880AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
881
882if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
883	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
884else
885	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
886fi
887AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
888		   [Use SIGIO handlers for input device events by default])
889
890AC_MSG_CHECKING([for glibc...])
891AC_PREPROC_IFELSE([
892#include <features.h>
893#ifndef __GLIBC__
894#error
895#endif
896], glibc=yes, glibc=no)
897AC_MSG_RESULT([$glibc])
898
899AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
900               [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
901                             [have_clock_gettime=no])])
902
903AC_MSG_CHECKING([for a useful monotonic clock ...])
904
905if ! test "x$have_clock_gettime" = xno; then
906    if ! test "x$have_clock_gettime" = xyes; then
907        CLOCK_LIBS="$have_clock_gettime"
908    else
909        CLOCK_LIBS=""
910    fi
911
912    LIBS_SAVE="$LIBS"
913    LIBS="$CLOCK_LIBS"
914    CPPFLAGS_SAVE="$CPPFLAGS"
915
916    if test x"$glibc" = xyes; then
917        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
918    fi
919
920    AC_RUN_IFELSE([
921#include <time.h>
922
923int main(int argc, char *argv[[]]) {
924    struct timespec tp;
925
926    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
927        return 0;
928    else
929        return 1;
930}
931    ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
932       [MONOTONIC_CLOCK="cross compiling"])
933
934    LIBS="$LIBS_SAVE"
935    CPPFLAGS="$CPPFLAGS_SAVE"
936else
937    MONOTONIC_CLOCK=no
938fi
939
940AC_MSG_RESULT([$MONOTONIC_CLOCK])
941
942if test "x$MONOTONIC_CLOCK" = xyes; then
943    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
944    LIBS="$LIBS $CLOCK_LIBS"
945fi
946
947AM_CONDITIONAL(XV, [test "x$XV" = xyes])
948if test "x$XV" = xyes; then
949	AC_DEFINE(XV, 1, [Support Xv extension])
950	AC_DEFINE(XvExtension, 1, [Build Xv extension])
951	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
952	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
953else
954	XVMC=no
955fi
956
957AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
958if test "x$XVMC" = xyes; then
959	AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
960fi
961
962AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
963if test "x$XREGISTRY" = xyes; then
964	AC_DEFINE(XREGISTRY, 1, [Build registry module])
965fi
966
967AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
968if test "x$COMPOSITE" = xyes; then
969	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
970	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
971	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
972	COMPOSITE_INC='-I$(top_srcdir)/composite'
973fi
974
975AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
976if test "x$MITSHM" = xyes; then
977	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
978	AC_DEFINE(HAS_SHM, 1, [Support SHM])
979fi
980
981AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
982if test "x$RECORD" = xyes; then
983	AC_DEFINE(XRECORD, 1, [Support Record extension])
984	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
985	RECORD_LIB='$(top_builddir)/record/librecord.la'
986fi
987
988AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
989if test "x$SCREENSAVER" = xyes; then
990	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
991	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
992fi
993
994AM_CONDITIONAL(RES, [test "x$RES" = xyes])
995if test "x$RES" = xyes; then
996	AC_DEFINE(RES, 1, [Support X resource extension])
997	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
998fi
999
1000if test "x$GLX" = xyes; then
1001	PKG_CHECK_MODULES([XLIB], [x11])
1002	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
1003	AC_SUBST(XLIB_CFLAGS)
1004	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
1005	GLX_LIBS='$(top_builddir)/glx/libglx.la'
1006	GLX_SYS_LIBS="$GLX_SYS_LIBS"
1007else
1008        GLX=no
1009fi
1010AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
1011
1012if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then
1013	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
1014else
1015	AIGLX=no
1016fi
1017AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
1018
1019if test "x$GLX_USE_TLS" = xyes ; then
1020	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
1021	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
1022fi
1023AC_SUBST([GLX_DEFINES])
1024
1025AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
1026if test "x$DRI" = xyes; then
1027	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1028	PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
1029	PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
1030	AC_SUBST(DRIPROTO_CFLAGS)
1031fi
1032
1033PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1034                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
1035case "$DRI2,$HAVE_DRI2PROTO" in
1036	yes,no)
1037		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
1038		;;
1039	yes,yes | auto,yes)
1040		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
1041		DRI2=yes
1042		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1043		;;
1044esac
1045AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
1046
1047if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
1048	if test "x$DRM" = xyes; then
1049		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
1050		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
1051	fi
1052fi
1053
1054if test "x$DRI2" = xyes; then
1055	save_CFLAGS=$CFLAGS
1056	CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
1057	AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
1058#include <GL/internal/dri_interface.h>
1059#ifndef __DRI_DRI2
1060#error DRI2 extension not available.
1061#endif]])],
1062			  [HAVE_DRI2EXTENSION=yes],
1063			  [HAVE_DRI2EXTENSION=no])
1064	CFLAGS=$save_CFLAGS
1065	if test "x$HAVE_DRI2EXTENSION" = xyes; then
1066		AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
1067		DRI2_AIGLX=yes
1068	else
1069		AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
1070		DRI2_AIGLX=no
1071	fi
1072fi
1073AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
1074
1075
1076AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
1077if test "x$XINERAMA" = xyes; then
1078	AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
1079	AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
1080	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1081	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
1082fi
1083
1084AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
1085if test "x$XACE" = xyes; then
1086	AC_DEFINE(XACE, 1, [Build X-ACE extension])
1087fi
1088
1089AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
1090if test "x$XSELINUX" = xyes; then
1091	if test "x$XACE" != xyes; then
1092		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
1093	fi
1094	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
1095	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1096	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1097	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1098	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
1099fi
1100
1101AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
1102if test "x$XCSECURITY" = xyes; then
1103	if test "x$XACE" != xyes; then
1104		AC_MSG_ERROR([cannot build Security extension without X-ACE])
1105	fi
1106	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
1107fi
1108
1109AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
1110if test "x$DBE" = xyes; then
1111	AC_DEFINE(DBE, 1, [Support DBE extension])
1112	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
1113fi
1114
1115AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
1116if test "x$XF86BIGFONT" = xyes; then
1117	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
1118	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
1119fi
1120
1121AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
1122if test "x$DPMSExtension" = xyes; then
1123	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
1124fi
1125
1126if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
1127   AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
1128   REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
1129else
1130   XCALIBRATE=no
1131fi
1132AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
1133
1134AC_DEFINE(RENDER, 1, [Support RENDER extension])
1135RENDER_LIB='$(top_builddir)/render/librender.la'
1136RENDER_INC='-I$(top_srcdir)/render'
1137
1138AC_DEFINE(RANDR, 1, [Support RANDR extension])
1139RANDR_LIB='$(top_builddir)/randr/librandr.la'
1140RANDR_INC='-I$(top_srcdir)/randr'
1141
1142AC_DEFINE(XFIXES,1,[Support XFixes extension])
1143FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
1144FIXES_INC='-I$(top_srcdir)/xfixes'
1145
1146AC_DEFINE(DAMAGE,1,[Support Damage extension])
1147DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
1148DAMAGE_INC='-I$(top_srcdir)/damageext'
1149MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
1150MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
1151
1152# XINPUT extension is integral part of the server
1153AC_DEFINE(XINPUT, 1, [Support X Input extension])
1154XI_LIB='$(top_builddir)/Xi/libXi.la'
1155XI_INC='-I$(top_srcdir)/Xi'
1156
1157AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
1158AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
1159AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
1160AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
1161AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
1162
1163AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
1164
1165AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
1166AC_ARG_WITH(xkb-bin-directory,
1167				AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
1168				[XKB_BIN_DIRECTORY="$withval"],
1169				[XKB_BIN_DIRECTORY="$bindir"])
1170
1171AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
1172
1173dnl Make sure XKM_OUTPUT_DIR is an absolute path
1174XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
1175if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
1176   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
1177fi
1178
1179dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
1180dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
1181
1182XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
1183XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
1184AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
1185AC_SUBST(XKB_COMPILED_DIR)
1186
1187if test "x$XKB_DFLT_RULES" = x; then
1188    case $host_os in
1189    linux*)
1190        dnl doesn't take AutoAddDevices into account, but whatever.
1191        if test "x$CONFIG_HAL" = xyes; then
1192            XKB_DFLT_RULES="evdev"
1193        else
1194            XKB_DFLT_RULES="base"
1195        fi
1196        ;;
1197    *)
1198        XKB_DFLT_RULES="base"
1199        ;;
1200    esac
1201fi
1202AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
1203AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
1204AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
1205AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
1206AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
1207
1208XKB_LIB='$(top_builddir)/xkb/libxkb.la'
1209XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
1210REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
1211
1212AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
1213                                        [Do not have 'strcasecmp'.]))
1214AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
1215                                        [Do not have 'strncasecmp'.]))
1216AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
1217                                       [Do not have 'strcasestr'.]))
1218
1219PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
1220if test "x$have_libxdmcp" = xyes; then
1221	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
1222fi
1223if test "x$XDMCP" = xauto; then
1224	if test "x$have_libxdmcp" = xyes; then
1225		XDMCP=yes
1226	else
1227		XDMCP=no
1228	fi
1229fi
1230if test "x$XDMAUTH" = xauto; then
1231	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
1232		XDMAUTH=yes
1233	else
1234		XDMAUTH=no
1235	fi
1236fi
1237
1238AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
1239if test "x$XDMCP" = xyes; then
1240	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
1241	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1242	XDMCP_MODULES="xdmcp"
1243fi
1244
1245AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
1246if test "x$XDMAUTH" = xyes; then
1247	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
1248	if ! test "x$XDMCP" = xyes; then
1249		REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
1250		XDMCP_MODULES="xdmcp"
1251	fi
1252fi
1253
1254AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
1255AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
1256AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
1257AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
1258dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
1259AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
1260AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
1261AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
1262AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
1263AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1264AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
1265
1266if test -z "$OSNAME"; then
1267    OSNAME="UNKNOWN"
1268fi
1269
1270AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
1271AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
1272AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
1273
1274AC_SUBST([VENDOR_NAME_SHORT])
1275AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
1276AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
1277AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
1278AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
1279
1280AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
1281
1282if test "x$DEBUGGING" = xyes; then
1283       AC_DEFINE(DEBUG, 1, [Enable debugging code])
1284fi
1285AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
1286
1287# If unittests aren't explicitly disabled, check for required support
1288if test "x$UNITTESTS" != xno ; then
1289       PKG_CHECK_MODULES([GLIB], $LIBGLIB,
1290                         [HAVE_GLIB=yes], [HAVE_GLIB=no])
1291
1292       # Check if linker supports -wrap, passed via compiler flags
1293       # When cross-compiling, reports no, since unit tests run from
1294       # "make check", so would be running on build machine,  not target
1295       AC_MSG_CHECKING([whether the linker supports -wrap])
1296       save_LDFLAGS="$LDFLAGS"
1297       LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
1298       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1299	void __wrap_exit (int s)
1300	{
1301	    __real_exit (0);
1302	}]],
1303	[[exit (1);]])],
1304                     [linker_can_wrap="yes"],
1305                     [linker_can_wrap="no"],
1306                     [linker_can_wrap="no"])
1307       AC_MSG_RESULT([$linker_can_wrap])
1308       LDFLAGS="$save_LDFLAGS"
1309fi
1310
1311if test "x$UNITTESTS" = xauto; then
1312       if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
1313           UNITTESTS=yes
1314       else
1315           UNITTESTS=no
1316       fi
1317fi
1318if test "x$UNITTESTS" = xyes; then
1319       if test "x$HAVE_GLIB" = xno; then
1320           AC_MSG_ERROR([glib required to build unit tests])
1321       fi
1322       if test "x$linker_can_wrap" = xno; then
1323           AC_MSG_ERROR([ld -wrap support required to build unit tests])
1324       fi
1325       AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
1326       AC_SUBST([GLIB_LIBS])
1327       AC_SUBST([GLIB_CFLAGS])
1328fi
1329AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
1330
1331AC_DEFINE(XTEST, 1, [Support XTest extension])
1332AC_DEFINE(XSYNC, 1, [Support XSync extension])
1333AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
1334AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
1335
1336if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
1337  DIX_LIB='$(top_builddir)/dix/dix.O'
1338  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
1339else
1340  DIX_LIB='$(top_builddir)/dix/libdix.la'
1341  OS_LIB='$(top_builddir)/os/libos.la'
1342fi
1343AC_SUBST([DIX_LIB])
1344AC_SUBST([OS_LIB])
1345
1346MAIN_LIB='$(top_builddir)/dix/libmain.la'
1347AC_SUBST([MAIN_LIB])
1348
1349MI_LIB='$(top_builddir)/mi/libmi.la'
1350MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
1351MI_INC='-I$(top_srcdir)/mi'
1352FB_LIB='$(top_builddir)/fb/libfb.la'
1353FB_INC='-I$(top_srcdir)/fb'
1354MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
1355MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
1356MIEXT_SYNC_INC='-I$(top_srcdir)/miext/sync'
1357MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.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_SYNC_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_SYNC_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_SYNC_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_SYNC_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_SYNC_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])
1915AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
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_SYNC_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 $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"
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, [
2041			HAVE_TSLIB="yes"
2042			TSLIB_LIBS="-lts"
2043		])
2044    fi
2045
2046    if test "xTSLIB" = xauto; then
2047        TSLIB="$HAVE_TSLIB"
2048    fi
2049
2050    if test "x$TSLIB" = xyes; then
2051        if ! test "x$HAVE_TSLIB" = xyes; then
2052            AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
2053        else
2054            AC_DEFINE(TSLIB, 1, [Have tslib support])
2055        fi
2056    fi
2057
2058    if test "x$KDRIVE_KBD" = xyes; then
2059       AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
2060    fi
2061    if test "x$KDRIVE_EVDEV" = xyes; then
2062       AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
2063    fi
2064    if test "x$KDRIVE_MOUSE" = xyes; then
2065       AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
2066    fi
2067
2068    XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
2069    if test "x$XV" = xyes; then
2070        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
2071    fi
2072    if test "x$DRI" = xyes && test "x$GLX" = xyes; then
2073        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
2074    fi
2075
2076    PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
2077    if test "x$XEPHYR" = xauto; then
2078        XEPHYR=$xephyr
2079    fi
2080    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
2081        AC_MSG_ERROR([Xephyr dependencies missing])
2082    fi
2083
2084    # Xephyr needs nanosleep() which is in librt on Solaris
2085    AC_CHECK_FUNC([nanosleep], [],
2086        AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
2087    
2088    # damage shadow extension glx (NOTYET) fb mi
2089    KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
2090    KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
2091    KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
2092    KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
2093    
2094    KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
2095
2096    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"
2097    KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
2098    case $host_os in
2099	*linux*)
2100	    KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
2101            KDRIVELINUX=yes
2102	    if test "x$KDRIVE_EVDEV" = xauto; then
2103		KDRIVE_EVDEV=yes
2104	    fi
2105	    if test "x$KDRIVE_KBD" = xauto; then
2106		KDRIVE_KBD=yes
2107	    fi
2108	    if test "x$KDRIVE_MOUSE" = xauto; then
2109		KDRIVE_MOUSE=yes
2110	    fi
2111	    ;;
2112	*)
2113	    if test "x$KDRIVE_EVDEV" = xauto; then
2114		KDRIVE_EVDEV=no
2115	    fi
2116	    if test "x$KDRIVE_KBD" = xauto; then
2117		KDRIVE_KBD=no
2118	    fi
2119	    if test "x$KDRIVE_MOUSE" = xauto; then
2120		KDRIVE_MOUSE=no
2121	    fi
2122	    ;;
2123    esac
2124    KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
2125    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
2126    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
2127    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
2128    KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
2129
2130    AC_SUBST([XEPHYR_LIBS])
2131    AC_SUBST([XEPHYR_INCS])
2132fi
2133AC_SUBST([KDRIVE_INCS])
2134AC_SUBST([KDRIVE_PURE_INCS])
2135AC_SUBST([KDRIVE_CFLAGS])
2136AC_SUBST([KDRIVE_PURE_LIBS])
2137AC_SUBST([KDRIVE_LOCAL_LIBS])
2138AC_SUBST([KDRIVE_LIBS])
2139AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
2140AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
2141AM_CONDITIONAL(KDRIVE_KBD,   [test "x$KDRIVE_KBD" = xyes])
2142AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
2143AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
2144AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
2145AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
2146AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
2147AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
2148
2149dnl and the rest of these are generic, so they're in config.h
2150dnl 
2151dnl though, thanks to the passing of some significant amount of time, the
2152dnl above is probably a complete fallacy, and you should not rely on it.
2153dnl but this is still actually better than imake, honest. -daniels
2154
2155AC_TRY_COMPILE([
2156#include <features.h>
2157#ifndef __GLIBC__
2158#error not glibc
2159#endif
2160], [], [AC_DEFINE(_GNU_SOURCE, 1,
2161	[ Enable GNU and other extensions to the C environment for glibc])])
2162
2163AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
2164
2165AC_SUBST([RELEASE_DATE])
2166BUILD_DATE="`date +'%Y%m%d'`"
2167AC_SUBST([BUILD_DATE])
2168BUILD_TIME="`date +'1%H%M%S'`"
2169AC_SUBST([BUILD_TIME])
2170
2171DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
2172
2173AC_SUBST([DIX_CFLAGS])
2174
2175AC_SUBST([libdir])
2176AC_SUBST([exec_prefix])
2177AC_SUBST([prefix])
2178
2179AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/loader/sdksyms.dep])
2180
2181AC_OUTPUT([
2182Makefile
2183glx/Makefile
2184include/Makefile
2185composite/Makefile
2186damageext/Makefile
2187dbe/Makefile
2188dix/Makefile
2189doc/Makefile
2190doc/man/Makefile
2191doc/xml/Makefile
2192doc/xml/dtrace/Makefile
2193doc/xml/xserver.ent
2194fb/Makefile
2195record/Makefile
2196config/Makefile
2197mi/Makefile
2198miext/Makefile
2199miext/sync/Makefile
2200miext/damage/Makefile
2201miext/shadow/Makefile
2202miext/cw/Makefile
2203miext/rootless/Makefile
2204os/Makefile
2205randr/Makefile
2206render/Makefile
2207xkb/Makefile
2208Xext/Makefile
2209Xi/Makefile
2210xfixes/Makefile
2211exa/Makefile
2212hw/Makefile
2213hw/xfree86/Makefile
2214hw/xfree86/common/Makefile
2215hw/xfree86/common/xf86Build.h
2216hw/xfree86/ddc/Makefile
2217hw/xfree86/dixmods/Makefile
2218hw/xfree86/dixmods/extmod/Makefile
2219hw/xfree86/doc/Makefile
2220hw/xfree86/doc/devel/Makefile
2221hw/xfree86/doc/man/Makefile
2222hw/xfree86/doc/sgml/Makefile
2223hw/xfree86/dri/Makefile
2224hw/xfree86/dri2/Makefile
2225hw/xfree86/exa/Makefile
2226hw/xfree86/exa/man/Makefile
2227hw/xfree86/fbdevhw/Makefile
2228hw/xfree86/fbdevhw/man/Makefile
2229hw/xfree86/i2c/Makefile
2230hw/xfree86/int10/Makefile
2231hw/xfree86/loader/Makefile
2232hw/xfree86/modes/Makefile
2233hw/xfree86/os-support/Makefile
2234hw/xfree86/os-support/bsd/Makefile
2235hw/xfree86/os-support/bus/Makefile
2236hw/xfree86/os-support/hurd/Makefile
2237hw/xfree86/os-support/misc/Makefile
2238hw/xfree86/os-support/linux/Makefile
2239hw/xfree86/os-support/solaris/Makefile
2240hw/xfree86/parser/Makefile
2241hw/xfree86/ramdac/Makefile
2242hw/xfree86/shadowfb/Makefile
2243hw/xfree86/vbe/Makefile
2244hw/xfree86/vgahw/Makefile
2245hw/xfree86/x86emu/Makefile
2246hw/xfree86/xaa/Makefile
2247hw/xfree86/utils/Makefile
2248hw/xfree86/utils/man/Makefile
2249hw/xfree86/utils/cvt/Makefile
2250hw/xfree86/utils/gtf/Makefile
2251hw/dmx/config/Makefile
2252hw/dmx/config/man/Makefile
2253hw/dmx/doc/Makefile
2254hw/dmx/doc/doxygen.conf
2255hw/dmx/examples/Makefile
2256hw/dmx/input/Makefile
2257hw/dmx/glxProxy/Makefile
2258hw/dmx/Makefile
2259hw/dmx/man/Makefile
2260hw/vfb/Makefile
2261hw/vfb/man/Makefile
2262hw/xnest/Makefile
2263hw/xnest/man/Makefile
2264hw/xwin/Makefile
2265hw/xwin/glx/Makefile
2266hw/xwin/man/Makefile
2267hw/xquartz/Makefile
2268hw/xquartz/GL/Makefile
2269hw/xquartz/bundle/Makefile
2270hw/xquartz/man/Makefile
2271hw/xquartz/mach-startup/Makefile
2272hw/xquartz/pbproxy/Makefile
2273hw/xquartz/xpr/Makefile
2274hw/kdrive/Makefile
2275hw/kdrive/ephyr/Makefile
2276hw/kdrive/ephyr/man/Makefile
2277hw/kdrive/fake/Makefile
2278hw/kdrive/fbdev/Makefile
2279hw/kdrive/linux/Makefile
2280hw/kdrive/src/Makefile
2281test/Makefile
2282test/xi2/Makefile
2283xorg-server.pc
2284])
2285