configure.ac 80.5 KB
Newer Older
1
dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
Daniel Stone's avatar
Daniel Stone committed
2
dnl
3
4
5
6
7
8
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
dnl and/or sell copies of the Software, and to permit persons to whom the
dnl Software is furnished to do so, subject to the following conditions:
Daniel Stone's avatar
Daniel Stone committed
9
dnl
10
11
12
dnl The above copyright notice and this permission notice (including the next
dnl paragraph) shall be included in all copies or substantial portions of the
dnl Software.
Daniel Stone's avatar
Daniel Stone committed
13
dnl
14
15
16
17
18
19
20
21
22
23
24
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl
dnl Authors: Keith Packard <keithp@keithp.com>
dnl          Daniel Stone <daniel@fooishbar.org>
dnl          an unwitting cast of miscellaneous others
Daniel Stone's avatar
Daniel Stone committed
25
26
27
dnl
dnl Process this file with autoconf to create configure.

28
AC_PREREQ(2.57)
29
30
AC_INIT([xorg-server], 1.11.2.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2011-12-09"
Daniel Stone's avatar
Daniel Stone committed
31
AC_CONFIG_SRCDIR([Makefile.am])
32
AM_INIT_AUTOMAKE([foreign dist-bzip2])
Daniel Stone's avatar
Daniel Stone committed
33
AM_MAINTAINER_MODE
34

35
# Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
36
m4_ifndef([XORG_MACROS_VERSION],
37
38
          [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.14)
39
XORG_DEFAULT_OPTIONS
40
XORG_WITH_DOXYGEN(1.6.1)
41
XORG_CHECK_SGML_DOCTOOLS(1.8)
42
43
44
45
XORG_ENABLE_DOCS
XORG_ENABLE_DEVEL_DOCS
XORG_WITH_XMLTO(0.0.20)
XORG_WITH_FOP
46
XORG_WITH_XSLTPROC
47
48
XORG_ENABLE_UNIT_TESTS
XORG_LD_WRAP
49

50
51
52
m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
XORG_FONT_MACROS_VERSION(1.1)

Daniel Stone's avatar
Daniel Stone committed
53
54
55
56
57
58
59
60
dnl this gets generated by autoheader, and thus contains all the defines.  we
dnl don't ever actually use it, internally.
AC_CONFIG_HEADERS(include/do-not-use-config.h)
dnl xorg-server.h is an external header, designed to be included by loadable
dnl drivers.
AC_CONFIG_HEADERS(include/xorg-server.h)
dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
dnl dix/).
61
AC_CONFIG_HEADERS(include/dix-config.h)
62
63
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
Kevin E Martin's avatar
Kevin E Martin committed
64
65
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
AC_CONFIG_HEADERS(include/xkb-config.h)
Jeremy Huddleston's avatar
Jeremy Huddleston committed
66
67
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
68
69
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
70
71
72
dnl version-config.h covers the version numbers so they can be bumped without
dnl forcing an entire recompile.x
AC_CONFIG_HEADERS(include/version-config.h)
73

Daniel Stone's avatar
Daniel Stone committed
74
75
76
AM_PROG_AS
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
77
AC_DISABLE_STATIC
Daniel Stone's avatar
Daniel Stone committed
78
79
80
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
81
82
AC_PROG_LEX
AC_PROG_YACC
83
AC_SYS_LARGEFILE
84
XORG_PROG_RAWCPP
Daniel Stone's avatar
Daniel Stone committed
85

86
87
88
89
# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
# easier overrides at build time.
XSERVER_CFLAGS='$(CWARNFLAGS)'

90
dnl Check for dtrace program (needed to build Xserver dtrace probes)
91
92
dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
dnl ISDN trace program named dtrace
93
94
95
96
97
98
99
100
101
102
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
	     [Enable dtrace probes (default: enabled if dtrace found)]),
	     [WDTRACE=$withval], [WDTRACE=auto])
if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
	AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
	if test "x$DTRACE" = "xnot_found" ; then
		if test "x$WDTRACE" = "xyes" ; then
			AC_MSG_FAILURE([dtrace requested but not found])
		fi
		WDTRACE="no"
103
104
105
106
107
	else
		AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
		if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
			WDTRACE="no"
		fi
108
109
110
111
112
	fi
fi
if test "x$WDTRACE" != "xno" ; then
  AC_DEFINE(XSERVER_DTRACE, 1, 
      [Define to 1 if the DTrace Xserver provider probes should be built in.])
113
114
115
116
117
118
119
120
121
122
123

# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
# object files, and require linking with those as relocatable objects, not .a
# archives. MacOS X handles all this in the normal compiler toolchain, and on
# some releases (like Tiger), will error out on dtrace -G.  For now, other
# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
# ports appear to, based on my web searches, but have not yet been tested).
	case $host_os in
		darwin*)	SPECIAL_DTRACE_OBJECTS=no ;;
		*)		SPECIAL_DTRACE_OBJECTS=yes ;;
	esac
124
125
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
126
AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
127

Daniel Stone's avatar
Daniel Stone committed
128
129
AC_HEADER_DIRENT
AC_HEADER_STDC
130
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])
Daniel Stone's avatar
Daniel Stone committed
131

132
dnl Checks for typedefs, structures, and compiler characteristics.
Daniel Stone's avatar
Daniel Stone committed
133
AC_C_CONST
134
135
136
137
138
139
AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])

AC_CHECK_SIZEOF([unsigned long])
if test "$ac_cv_sizeof_unsigned_long" = 8; then
	AC_DEFINE(_XSERVER64, 1, [Define to 1 if unsigned long is 64 bits.])
fi
140

Daniel Stone's avatar
Daniel Stone committed
141
142
AC_TYPE_PID_T

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Checks for headers/macros for byte swapping
# Known variants:
#	<byteswap.h> bswap_16, bswap_32, bswap_64  (glibc)
#	<sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
#	<sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
#	and a fallback to local macros if none of the above are found

# if <byteswap.h> is found, assume it's the correct version
AC_CHECK_HEADERS([byteswap.h])

# if <sys/endian.h> is found, have to check which version
AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])

if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
	AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
	AC_LINK_IFELSE([AC_LANG_PROGRAM([
159
#include <sys/types.h>
160
161
162
163
164
165
166
167
#include <sys/endian.h>
 ], [
int a = 1, b;
b = __swap16(a);
 ])
], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
	AC_MSG_RESULT([$SYS_ENDIAN__SWAP])

168
	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
169
	AC_LINK_IFELSE([AC_LANG_PROGRAM([
170
#include <sys/types.h>
171
172
173
#include <sys/endian.h>
 ], [
int a = 1, b;
174
b = bswap16(a);
175
176
177
178
179
180
 ])
], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
	AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])

    	if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
		USE_SYS_ENDIAN_H=yes
181
		BSWAP=bswap
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
	else	
	    	if test "$SYS_ENDIAN__SWAP" = "yes" ; then
			USE_SYS_ENDIAN_H=yes
			BSWAP=__swap
		else
			USE_SYS_ENDIAN_H=no
		fi
	fi

	if test "$USE_SYS_ENDIAN_H" = "yes" ; then
	    AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
		[Define to use byteswap macros from <sys/endian.h>])
	    AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
			[Define to 16-bit byteswap macro])
	    AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
			[Define to 32-bit byteswap macro])
	    AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
			[Define to 64-bit byteswap macro])
	fi
fi

203
204
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
205
206
AC_CHECK_FUNC([dlopen], [],
	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
207
AC_SUBST(DLOPEN_LIBS)
208

209
dnl Checks for library functions.
Daniel Stone's avatar
Daniel Stone committed
210
AC_FUNC_VPRINTF
211
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
212
		strtol getopt getopt_long vsnprintf walkcontext backtrace \
213
		getisax getzoneid shmctl64 strcasestr ffs vasprintf])
Daniel Stone's avatar
Daniel Stone committed
214
AC_FUNC_ALLOCA
215
216
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
217
	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
218
AC_CHECK_FUNC([getifaddrs],
219
	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
220
AC_CHECK_FUNC([getpeereid],
221
	AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
222
AC_CHECK_FUNC([getpeerucred],
223
	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
224
225
AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])	
226
AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
Daniel Stone's avatar
Daniel Stone committed
227

Adam Jackson's avatar
Adam Jackson committed
228
229
AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])

Alan Coopersmith's avatar
Alan Coopersmith committed
230
dnl Check for mmap support for Xvfb
231
AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
Alan Coopersmith's avatar
Alan Coopersmith committed
232

233
dnl Find the math libary
Daniel Stone's avatar
Daniel Stone committed
234
AC_CHECK_LIB(m, sqrt)
235
AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
Daniel Stone's avatar
Daniel Stone committed
236
237
238

AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])

239
dnl AGPGART headers
240
AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
Donnie Berkholz's avatar
Donnie Berkholz committed
241
AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
Daniel Stone's avatar
Daniel Stone committed
242

243
dnl APM header
244
245
AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
Daniel Stone's avatar
Daniel Stone committed
246

247
dnl fbdev header
248
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
249
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
Daniel Stone's avatar
Daniel Stone committed
250

251
dnl MTRR header
252
253
254
255
AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
if test "x$ac_cv_asm_mtrr_h" = xyes; then
	HAVE_MTRR=yes
fi
Daniel Stone's avatar
Daniel Stone committed
256

257
258
dnl BSD MTRR header
AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
Donnie Berkholz's avatar
Donnie Berkholz committed
259
if test "x$ac_cv_memrange_h" = xyes; then
260
261
262
263
264
	HAVE_MTRR=yes
fi

if test "x$HAVE_MTRR" = xyes; then
	AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
265
266
267
fi

dnl A NetBSD MTRR header
268
269
AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
if test "x$ac_cv_machine_mtrr_h" = xyes; then
270
271
272
273
274
	AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
		support is available])
fi

dnl FreeBSD kldload support (sys/linker.h)
275
AC_CHECK_HEADERS([sys/linker.h],
276
	[ac_cv_sys_linker_h=yes],
277
278
	[ac_cv_sys_linker_h=no],
	[#include <sys/param.h>])
Donnie Berkholz's avatar
Donnie Berkholz committed
279
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
280

Daniel Stone's avatar
Daniel Stone committed
281
282
AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
283
		[AC_TRY_LINK([
Matthieu Herrb's avatar
Matthieu Herrb committed
284
285
#include <sys/types.h>
#include <sys/ipc.h>
Daniel Stone's avatar
Daniel Stone committed
286
#include <sys/shm.h>
287
],[
288
{ 
Daniel Stone's avatar
Daniel Stone committed
289
290
291
292
293
294
295
    int id;
    id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
    if (id < 0) return -1;
    return shmctl(id, IPC_RMID, 0);
}],
	[ac_cv_sysv_ipc=yes],
	[ac_cv_sysv_ipc=no])])
296
297
if test "x$ac_cv_sysv_ipc" = xyes; then
	AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
Daniel Stone's avatar
Daniel Stone committed
298
299
fi

300
301
302
303
304
dnl OpenBSD /dev/xf86 aperture driver 
if test -c /dev/xf86 ; then
	AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
fi

Matthieu Herrb's avatar
Matthieu Herrb committed
305
306
307
308
309
310
311
312
313
dnl BSD APM support 
AC_CHECK_HEADER([machine/apmvar.h],[
	AC_CHECK_HEADER([sys/event.h],
		ac_cv_BSD_KQUEUE_APM=yes,
		ac_cv_BSD_APM=yes)])

AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
	
314
315
316
317
dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
AC_CHECK_HEADER([execinfo.h],[
    AC_CHECK_LIB(c, backtrace, [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
318
        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
319
    ])]
320
321
)

322
323
324
325
dnl ---------------------------------------------------------------------------
dnl Bus options and CPU capabilities.  Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
326
327
DEFAULT_INT10="x86emu"

328
dnl Override defaults as needed for specific platforms:
329

Daniel Stone's avatar
Daniel Stone committed
330
case $host_cpu in
331
332
333
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
334
	        *freebsd*)	SYS_LIBS=-lio ;;
335
336
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
337
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
338
339
340
	;;
  arm*)
	ARM_VIDEO=yes
Daniel Stone's avatar
Daniel Stone committed
341
342
	;;
  i*86)
343
	I386_VIDEO=yes
344
	case $host_os in
345
		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
346
		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
347
348
349
		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
				SYS_LIBS=-li386
				;;
350
351
352
		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
				SYS_LIBS=-li386
				;;
353
	esac
Daniel Stone's avatar
Daniel Stone committed
354
        ;;
355
356
357
358
359
360
361
362
363
  powerpc*)
	PPC_VIDEO=yes
	case $host_os in
		*freebsd*)	DEFAULT_INT10=stub ;;
	esac
	;;
  sparc*)
	SPARC64_VIDEO=yes
	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
364
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
365
366
367
368
369
	;;
  x86_64*|amd64*)
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
370
		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
371
372
373
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
				SYS_LIBS=-lx86_64
				;;
374
375
376
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
				SYS_LIBS=-lamd64
				;;
377
	esac
378
379
380
381
382
383
384
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  ia64*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  s390*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
385
386
	;;
esac
387
AC_SUBST(GLX_ARCH_DEFINES)
388
389

dnl BSD *_video.c selection
Donnie Berkholz's avatar
Donnie Berkholz committed
390
391
392
393
394
AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
395

396
DRI=no
397
USE_SIGIO_BY_DEFAULT="yes"
398
399
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
400
  *freebsd* | *dragonfly*)
401
402
403
404
	case $host_os in
		kfreebsd*-gnu) ;;
		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
	esac
405
406
407
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
	AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
408
	DRI=yes
409
410
411
412
	;;
  *netbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
413
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
414
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
415
	DRI=yes
416
417
418
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
419
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
420
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
421
	;;
422
423
424
  *linux*)
	DRI=yes
	;;
425
426
  *solaris*)
	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
427
428
429
	# Disable use of SIGIO by default until some system bugs are
	# fixed - see Sun/OpenSolaris bug id 6879897
	USE_SIGIO_BY_DEFAULT="no"
430
	;;
Jeremy Huddleston's avatar
Jeremy Huddleston committed
431
432
433
  darwin*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	;;
434
435
436
  cygwin*)
	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
	;;
Daniel Stone's avatar
Daniel Stone committed
437
438
esac

439
440
441
dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
dnl major number
PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
442
PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
443
444
445
446
447
448
449
450
451
452
if test "x$PVS" = "x"; then
	PVS="0"
fi

VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"

VENDOR_NAME="The X.Org Foundation"
VENDOR_NAME_SHORT="X.Org"
VENDOR_WEB="http://wiki.x.org"
Daniel Stone's avatar
Daniel Stone committed
453

454
455
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])

456
dnl Build options.
457
AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
458
459
460
		  [Obsolete - use --enable-strict-compilation instead]),
  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))

461
462
463
AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
				  [Enable debugging (default: disabled)]),
			        [DEBUGGING=$enableval], [DEBUGGING=no])
464
AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
465
466
  [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
                                [USE_SIGIO_BY_DEFAULT=$enableval], [])
467
AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
Daniel Stone's avatar
Daniel Stone committed
468
469
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
470
AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
471
				  [Vendor string reported by the server]),
472
				[ VENDOR_NAME="$withval" ], [])
473
AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
474
				  [Short version of vendor string reported by the server]),
475
				[ VENDOR_NAME_SHORT="$withval" ], [])
476
477
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
478
				[ VENDOR_WEB="$withval" ], [])
479
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
480
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
Daniel Stone's avatar
Daniel Stone committed
481
				[ moduledir="$withval" ],
482
				[ moduledir="${libdir}/xorg/modules" ])
483
484
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
485
486
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
487
488
AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
				  [Builder address (default: xorg@lists.freedesktop.org)]),
Daniel Stone's avatar
Daniel Stone committed
489
490
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
491
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
492
				[ OSNAME="$withval" ],
493
				[ OSNAME=`uname -srm` ])
494
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
495
496
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
497
498
499
AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
				[ BUILDERSTRING="$withval" ]
				[ ])
500
501
502
503
504
505
506
507
508
509
510

dnl Determine font path
XORG_FONTROOTDIR
XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)

dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
511
512
513
514
515
516
517
518
519
520
dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
dnl compiling, assume default font path uses standard FONTROOTDIR directories.
DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
if test "$cross_compiling" != yes; then
	AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
		[DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
		[case $host_os in
			darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
		esac])
fi
521
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
522
				[ FONTPATH="$withval" ],
523
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
524

525
526
527
AC_MSG_CHECKING([for default font path])
AC_MSG_RESULT([$FONTPATH])

528
AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
529
530
				[ XKBPATH="$withval" ],
				[ XKBPATH="${datadir}/X11/xkb" ])
531
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
532
				[ XKBOUTPUT="$withval" ],
533
				[ XKBOUTPUT="compiled" ])
534
535
AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                   [Keyboard ruleset (default: base/evdev)]),
536
537
                                [ XKB_DFLT_RULES="$withval" ],
                                [ XKB_DFLT_RULES="" ])
538
AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
539
                                   [Keyboard model (default: pc105)]),
540
                                [ XKB_DFLT_MODEL="$withval" ],
541
                                [ XKB_DFLT_MODEL="pc105" ])
542
543
AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                   [Keyboard layout (default: us)]),
544
545
                                [ XKB_DFLT_LAYOUT="$withval" ],
                                [ XKB_DFLT_LAYOUT="us" ])
546
547
AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
                                   [Keyboard variant (default: (none))]),
548
549
                                [ XKB_DFLT_VARIANT="$withval" ],
                                [ XKB_DFLT_VARIANT="" ])
550
551
AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
                                   [Keyboard layout options (default: (none))]),
552
553
                                [ XKB_DFLT_OPTIONS="$withval" ],
                                [ XKB_DFLT_OPTIONS="" ])
554
555
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
556
				[ SERVERCONFIG="$withval" ],
557
				[ SERVERCONFIG="${libdir}/xorg" ])
558
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
559
				[ APPLE_APPLICATIONS_DIR="${withval}" ],
560
				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
561
AC_SUBST([APPLE_APPLICATIONS_DIR])
562
563
564
565
AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
				[ APPLE_APPLICATION_NAME="${withval}" ],
				[ APPLE_APPLICATION_NAME="X11" ])
AC_SUBST([APPLE_APPLICATION_NAME])
566
567
568
569
AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
                                [ BUNDLE_ID_PREFIX="${withval}" ],
                                [ BUNDLE_ID_PREFIX="org.x" ])
AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
570
                               [ BUNDLE_ID_PREFIX="${withval}" ])
571
572
AC_SUBST([BUNDLE_ID_PREFIX])
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
573
574
575
576
AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
				[ XQUARTZ_SPARKLE="${enableval}" ],
				[ XQUARTZ_SPARKLE="no" ])
AC_SUBST([XQUARTZ_SPARKLE])
577
578
579
580
581
AC_ARG_ENABLE(install-libxf86config,
				AS_HELP_STRING([--enable-install-libxf86config],
				[Install libxf86config (default: disabled)]),
				[INSTALL_LIBXF86CONFIG=$enableval],
				[INSTALL_LIBXF86CONFIG=no])
582
583
584
AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
				[SYMBOL_VISIBILITY=$enableval],
				[SYMBOL_VISIBILITY=auto])
585
586
587
AC_ARG_ENABLE(pc98,     	AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
				[SUPPORT_PC98=$enableval],
				[SUPPORT_PC98=auto])
588

589
590
591
592
dnl GLX build options
AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
                                [AIGLX=$enableval],
                                [AIGLX=yes])
593
XORG_TLS
594
AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
595
596
597
598
                                [GLX_USE_TLS=$enableval
                                 if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
                                   AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.])
                                 fi],
599
600
601
602
603
                                [GLX_USE_TLS=no
                                 if test "${ac_cv_tls}" != "none" ; then
                                   GLX_USE_TLS=yes
                                 fi])
AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
604
605
606
AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Path to Khronos OpenGL registry database files (default: auto)]),
				[KHRONOS_SPEC_DIR="${withval}"],
				[KHRONOS_SPEC_DIR=auto])
607

608
dnl Extensions.
609
AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
610
AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
611
612
AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
613
AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
614
AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
615
AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
616
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
617
618
619
620
621
AC_ARG_ENABLE(screensaver,    AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
AC_ARG_ENABLE(xdmcp,          AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1,     AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
AC_ARG_ENABLE(glx,            AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
AC_ARG_ENABLE(dri,            AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
622
AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
623
AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
624
AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
625
AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
626
627
AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
628
AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
629
AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
630
AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
631
AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
632
AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
633
AC_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])
Daniel Stone's avatar
Daniel Stone committed
634
AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
635
AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
636
AC_ARG_ENABLE(xaa,               AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
637
AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
638
AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
639
AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
640
AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
641
AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
642
AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
643
644
645

dnl DDXes.
AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
646
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
647
AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
648
AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
649
AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
Adam Jackson's avatar
Adam Jackson committed
650
AC_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])
Jeremy Huddleston's avatar
Jeremy Huddleston committed
651
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
652
dnl kdrive and its subsystems
653
AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
Adam Jackson's avatar
Adam Jackson committed
654
AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
Daniel Stone's avatar
Daniel Stone committed
655
656
AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
657
dnl kdrive options
658
659
660
AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
661

662

663
664
665
666
667
668
dnl chown/chmod to be setuid root as part of build
dnl Replaces InstallXserverSetUID in imake
AC_ARG_ENABLE(install-setuid, 
    AS_HELP_STRING([--enable-install-setuid],
       [Install Xorg server as owned by root with setuid bit (default: auto)]),
    [SETUID=$enableval], [SETUID=auto])
669
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
670
671
if test "x$SETUID" = "xauto" ; then
	case $host_os in
672
	    cygwin*)		SETUID="no"  ;;
673
674
675
676
677
678
679
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
680
681
682
683
684
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
685
fi
686
AC_MSG_RESULT([$SETUID])
687
688
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

689
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
Daniel Stone's avatar
Daniel Stone committed
690
dnl was not expanded, since xorg-server with no transport types is rather useless.
691
692
693
694
695
dnl
dnl If you're seeing an error here, be sure you installed the lib/xtrans module
dnl first and if it's not in the default location, that you set the ACLOCAL
dnl environment variable to find it, such as:
dnl	ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
696
m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
697
698
699

# Transport selection macro from xtrans.m4
XTRANS_CONNECTION_FLAGS
Daniel Stone's avatar
Daniel Stone committed
700

701
702
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
703
AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
704

705
706
707
708
709
710
AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
if test "x$INT10" = xyes; then
	dnl VM86 headers
	AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
Kevin E Martin's avatar
Kevin E Martin committed
711
712
fi

713
714
715
dnl Handle installing libxf86config
AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])

716
717
dnl DDX Detection... Yes, it's ugly to have it here... but we need to
dnl handle this early on so that we don't require unsupported extensions
718
case $host_os in
719
720
721
722
723
724
725
	cygwin*)
		DGA=no
		DRI2=no
		XF86VIDMODE=no
		XSELINUX=no
		XV=no
		;;
726
	darwin*)
Jeremy Huddleston's avatar
Jeremy Huddleston committed
727
728
		DRI2=no

729
730
731
732
733
		if test x$XQUARTZ = xauto; then
			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
		 		save_LDFLAGS=$LDFLAGS
				LDFLAGS="$LDFLAGS -framework Carbon"
				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
734
735
736
				               [xorg_cv_Carbon_framework=yes],
				               [xorg_cv_Carbon_framework=no])
			        LDFLAGS=$save_LDFLAGS])
737
738
739
740
741
742
743
744
                
			if test "X$xorg_cv_Carbon_framework" = Xyes; then
				XQUARTZ=yes
			else
				XQUARTZ=no
			fi
		fi

745
746
747
748
		AC_CHECK_FUNC(dispatch_async,
		              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
		              [])

749
750
751
752
753
754
755
756
757
758
759
		if test "x$XQUARTZ" = xyes ; then
			XQUARTZ=yes
			XVFB=no
			XNEST=no

			COMPOSITE=no
			DGA=no
			DPMSExtension=no
			XF86VIDMODE=no
		fi
		;;
760
	*) XQUARTZ=no ;;
761
762
esac

763
764
765
766
767
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
768
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
769

770
771
772
773
774
775
776
dnl Optional modules
VIDEOPROTO="videoproto"
COMPOSITEPROTO="compositeproto >= 0.4"
RECORDPROTO="recordproto >= 1.13.99.1"
SCRNSAVERPROTO="scrnsaverproto >= 1.1"
RESOURCEPROTO="resourceproto"
DRIPROTO="xf86driproto >= 2.1.0"
777
DRI2PROTO="dri2proto >= 2.6"
778
779
780
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
781
GLPROTO="glproto >= 1.4.14"
Peter Hutterer's avatar
Peter Hutterer committed
782
DMXPROTO="dmxproto >= 2.2.99.1"
783
784
785
786
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
APPLEWMPROTO="applewmproto >= 1.4"

787
dnl Core modules for most extensions, et al.
788
SDK_REQUIRED_MODULES="[xproto >= 7.0.22] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.1.99] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
789
790
791
# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
AC_SUBST(SDK_REQUIRED_MODULES)

792
793
dnl List of libraries that require a specific version
LIBAPPLEWM="applewm >= 1.4"
794
LIBDMX="dmx >= 1.0.99.1"
795
LIBDRI="dri >= 7.8.0"
796
797
LIBDRM="libdrm >= 2.3.0"
LIBGL="gl >= 7.1.0"
Peter Hutterer's avatar
Peter Hutterer committed
798
LIBXEXT="xext >= 1.0.99.4"
799
LIBXFONT="xfont >= 1.4.2"
800
LIBXI="xi >= 1.2.99.1"
801
LIBXTST="xtst >= 1.0.99.2"
802
LIBPCIACCESS="pciaccess >= 0.8.0"
803
LIBUDEV="libudev >= 143"
804
LIBSELINUX="libselinux >= 2.0.86"
805
LIBDBUS="dbus-1 >= 1.0"
806
LIBPIXMAN="pixman-1 >= 0.21.8"
807
808
809
810

dnl Pixman is always required, but we separate it out so we can link
dnl specific modules against it
PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
811
812
REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"

813
REQUIRED_MODULES="[fixesproto >= 5.0] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832

if test "x$CONFIG_UDEV" = xyes &&
 { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
fi

PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
	CONFIG_UDEV="$HAVE_LIBUDEV"
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
	CONFIG_DBUS_API=no
	CONFIG_HAL=no
	if ! test "x$HAVE_LIBUDEV" = xyes; then
		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
	fi
	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
fi
Peter Hutterer's avatar
Peter Hutterer committed
833

834
835
836
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
dnl API.
837
PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
838
839
if test "x$HAVE_DBUS" = xyes; then
	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
840
fi
841
842
843
844
845
846
847
848
849
850
851
AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])

if test "x$CONFIG_DBUS_API" = xauto; then
	CONFIG_DBUS_API="$HAVE_DBUS"
fi
if test "x$CONFIG_DBUS_API" = xyes; then
	if ! test "x$HAVE_DBUS" = xyes; then
		AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
	fi

	AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
852
	CONFIG_NEED_DBUS="yes"
853
fi
854
855
AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])

Daniel Stone's avatar
Daniel Stone committed
856
857
858
859
860
861
862
863
864
865
PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
if test "x$CONFIG_HAL" = xauto; then
	CONFIG_HAL="$HAVE_HAL"
fi
if test "x$CONFIG_HAL" = xyes; then
	if ! test "x$HAVE_HAL" = xyes; then
		AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
	fi

	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
866
	CONFIG_NEED_DBUS="yes"
Daniel Stone's avatar
Daniel Stone committed
867
868
869
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])

870
871
if test "x$CONFIG_NEED_DBUS" = xyes; then
        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
872
fi
873
AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
874

875
876
877
878
879
880
881
882
if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
else
	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
fi
AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
		   [Use SIGIO handlers for input device events by default])

883
884
885
886
887
888
889
890
891
AC_MSG_CHECKING([for glibc...])
AC_PREPROC_IFELSE([
#include <features.h>
#ifndef __GLIBC__
#error
#endif
], glibc=yes, glibc=no)
AC_MSG_RESULT([$glibc])

892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
               [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
                             [have_clock_gettime=no])])

AC_MSG_CHECKING([for a useful monotonic clock ...])

if ! test "x$have_clock_gettime" = xno; then
    if ! test "x$have_clock_gettime" = xyes; then
        CLOCK_LIBS="$have_clock_gettime"
    else
        CLOCK_LIBS=""
    fi

    LIBS_SAVE="$LIBS"
    LIBS="$CLOCK_LIBS"
907
908
909
    CPPFLAGS_SAVE="$CPPFLAGS"

    if test x"$glibc" = xyes; then
910
        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
911
    fi
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927

    AC_RUN_IFELSE([
#include <time.h>

int main(int argc, char *argv[[]]) {
    struct timespec tp;

    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
        return 0;
    else
        return 1;
}
    ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
       [MONOTONIC_CLOCK="cross compiling"])

    LIBS="$LIBS_SAVE"
928
    CPPFLAGS="$CPPFLAGS_SAVE"
929
930
931
932
933
934
935
936
937
938
939
else
    MONOTONIC_CLOCK=no
fi

AC_MSG_RESULT([$MONOTONIC_CLOCK])

if test "x$MONOTONIC_CLOCK" = xyes; then
    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
    LIBS="$LIBS $CLOCK_LIBS"
fi

940
941
942
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
943
	AC_DEFINE(XvExtension, 1, [Build Xv extension])
944
	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
945
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
946
947
948
949
950
951
952
else
	XVMC=no
fi

AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
if test "x$XVMC" = xyes; then
	AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
953
954
fi

955
956
957
958
AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
if test "x$XREGISTRY" = xyes; then
	AC_DEFINE(XREGISTRY, 1, [Build registry module])
fi
959

960
961
962
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
963
	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
964
965
	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
	COMPOSITE_INC='-I$(top_srcdir)/composite'
Daniel Stone's avatar
Daniel Stone committed
966
967
fi

968
969
970
971
AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
if test "x$MITSHM" = xyes; then
	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
	AC_DEFINE(HAS_SHM, 1, [Support SHM])
Daniel Stone's avatar
Daniel Stone committed
972
973
fi

974
975
976
AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
if test "x$RECORD" = xyes; then
	AC_DEFINE(XRECORD, 1, [Support Record extension])
977
	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
978
	RECORD_LIB='$(top_builddir)/record/librecord.la'
Daniel Stone's avatar
Daniel Stone committed
979
980
fi

981
982
983
AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
984
	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
Daniel Stone's avatar
Daniel Stone committed
985
fi
986
987

AM_CONDITIONAL(RES, [test "x$RES" = xyes])
988
if test "x$RES" = xyes; then
989
	AC_DEFINE(RES, 1, [Support X resource extension])
990
	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
Daniel Stone's avatar
Daniel Stone committed
991
fi
992

993
994
995
996
997
998
999
1000
1001
1002
1003
1004
# The XRes extension may support client ID tracking only if it has
# been specifically enabled. Client ID tracking is implicitly not
# supported if XRes extension is disabled.
AC_MSG_CHECKING([whether to track client ids])
if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then
	AC_DEFINE(CLIENTIDS, 1, [Support client ID tracking])
else
	CLIENTIDS=no
fi
AC_MSG_RESULT([$CLIENTIDS])
AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])

1005
if test "x$GLX" = xyes; then
1006
	PKG_CHECK_MODULES([XLIB], [x11])
1007
	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
1008
	AC_SUBST(XLIB_CFLAGS)
1009
	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
1010
	GLX_LIBS='$(top_builddir)/glx/libglx.la'
1011
	GLX_SYS_LIBS="$GLX_SYS_LIBS"
1012
1013
else
        GLX=no
Daniel Stone's avatar
Daniel Stone committed
1014
fi
1015
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
Daniel Stone's avatar
Daniel Stone committed
1016

1017
1018
1019
1020
1021
if test "x$GLX" = xno; then
        AIGLX=no
fi

if test "x$AIGLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then
1022
1023
	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
fi
1024
AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI" = xyes || test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)
1025

1026
if test "x$GLX_USE_TLS" = xyes ; then
1027
	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
1028
	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
1029
1030
1031
fi
AC_SUBST([GLX_DEFINES])

1032
1033
1034
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1035
	PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
1036
	PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
1037
	AC_SUBST(DRIPROTO_CFLAGS)
Daniel Stone's avatar
Daniel Stone committed
1038
1039
fi

1040
PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1041
1042
1043
1044
1045
1046
1047
1048
                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
case "$DRI2,$HAVE_DRI2PROTO" in
	yes,no)
		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
		;;
	yes,yes | auto,yes)
		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
		DRI2=yes
1049
		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1050
1051
		;;
esac
1052
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1053

1054
if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
1055
1056
1057
1058
	if test "x$DRM" = xyes; then
		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
	fi
1059
1060
fi

1061
1062
if test "x$DRI2" = xyes; then
	save_CFLAGS=$CFLAGS
1063
	CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
	AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#ifndef __DRI_DRI2
#error DRI2 extension not available.
#endif]])],
			  [HAVE_DRI2EXTENSION=yes],
			  [HAVE_DRI2EXTENSION=no])
	CFLAGS=$save_CFLAGS
	if test "x$HAVE_DRI2EXTENSION" = xyes; then
		AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
		DRI2_AIGLX=yes
	else
		AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
		DRI2_AIGLX=no
	fi
fi
1080
AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
1081
1082


1083
1084
1085
1086
AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
if test "x$XINERAMA" = xyes; then
	AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
	AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
1087
	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1088
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
Daniel Stone's avatar
Daniel Stone committed
1089
fi
1090

Alan Coopersmith's avatar
Alan Coopersmith committed
1091
1092
1093
1094
1095
AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
if test "x$XACE" = xyes; then
	AC_DEFINE(XACE, 1, [Build X-ACE extension])
fi

1096
1097
1098
1099
1100
1101
AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
if test "x$XSELINUX" = xyes; then
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
	fi
	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
1102
	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1103
	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1104
	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1105
1106
1107
	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
fi

1108
1109
AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then
Alan Coopersmith's avatar
Alan Coopersmith committed
1110
1111
1112
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build Security extension without X-ACE])
	fi
1113
	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
Daniel Stone's avatar
Daniel Stone committed
1114
fi
1115

1116
1117
1118
1119
1120
1121
AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
if test "x$DBE" = xyes; then
	AC_DEFINE(DBE, 1, [Support DBE extension])
	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
fi

1122
1123