configure.ac 96.5 KB
Newer Older
1
dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
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:
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.
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
25 26 27
dnl
dnl Process this file with autoconf to create configure.

28
AC_PREREQ(2.60)
Adam Jackson's avatar
Adam Jackson committed
29
AC_INIT([xorg-server], 1.19.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
Adam Jackson's avatar
Adam Jackson committed
30 31
RELEASE_DATE="2017-01-11"
RELEASE_NAME="Maeuntang"
32
AC_CONFIG_SRCDIR([Makefile.am])
33
AC_CONFIG_MACRO_DIR([m4])
34
AM_INIT_AUTOMAKE([foreign dist-bzip2])
35
AC_USE_SYSTEM_EXTENSIONS
36

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

52
m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install font-util 1.1 or later before running autoconf/autogen])])
53 54
XORG_FONT_MACROS_VERSION(1.1)

55 56 57 58 59 60 61 62
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/).
63
AC_CONFIG_HEADERS(include/dix-config.h)
64 65
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
Kevin E Martin's avatar
Kevin E Martin committed
66 67
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
AC_CONFIG_HEADERS(include/xkb-config.h)
68 69
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
70 71
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
72 73 74
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)
75

76 77
AM_PROG_AS
AC_PROG_LN_S
78 79
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
80
PKG_PROG_PKG_CONFIG
81 82
AC_PROG_LEX
AC_PROG_YACC
83
AC_SYS_LARGEFILE
84
XORG_PROG_RAWCPP
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 91 92 93 94 95
dnl Explicitly add -fno-strict-aliasing since this option should disappear
dnl from util-macros CWARNFLAGS
if  test "x$GCC" = xyes ; then
    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
fi

96
dnl Check for dtrace program (needed to build Xserver dtrace probes)
97 98
dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
dnl ISDN trace program named dtrace
99 100 101 102 103 104 105 106 107 108
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"
109 110 111 112 113
	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
114 115 116 117 118
	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.])
119 120 121 122 123 124 125 126 127 128 129

# 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
130 131
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
132
AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
133

134 135
AC_HEADER_DIRENT
AC_HEADER_STDC
136 137
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \
 fnmatch.h sys/mkdev.h sys/utsname.h])
138

139
dnl Checks for typedefs, structures, and compiler characteristics.
140
AC_C_CONST
141
AC_C_TYPEOF
142 143
AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]),
               AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order]))
144 145 146 147 148

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
149

150 151
AC_TYPE_PID_T

152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
# 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([
168
#include <sys/types.h>
169 170 171 172 173 174 175 176
#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])

177
	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
178
	AC_LINK_IFELSE([AC_LANG_PROGRAM([
179
#include <sys/types.h>
180 181 182
#include <sys/endian.h>
 ], [
int a = 1, b;
183
b = bswap16(a);
184 185 186 187 188 189
 ])
], [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
190
		BSWAP=bswap
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
	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

212 213
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.
214 215
AC_CHECK_FUNC([dlopen], [],
	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
216
AC_SUBST(DLOPEN_LIBS)
217

218
dnl Checks for library functions.
219
AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
220
	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
221
	mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
222
	walkcontext setitimer poll epoll_create1])
223
AC_CONFIG_LIBOBJ_DIR([os])
224 225
AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
	timingsafe_memcmp])
226
AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
227

228
AC_CHECK_LIB([bsd], [arc4random_buf])
229
AC_CHECK_FUNCS([arc4random_buf])
230

231 232
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])

233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
dnl Check for SO_PEERCRED #define
AC_CACHE_CHECK([for SO_PEERCRED in sys/socket.h],
	       [xorg_cv_sys_have_so_peercred],
	       [AC_EGREP_CPP(yes_have_so_peercred,[
#include <sys/types.h>
#include <sys/socket.h>
#ifdef SO_PEERCRED
yes_have_so_peercred
#endif
],
	       [xorg_cv_sys_have_so_peercred=yes],
	       [xorg_cv_sys_have_so_peercred=no])])

dnl define NO_LOCAL_CLIENT_CRED if no getpeereid, getpeerucred or SO_PEERCRED
if test "x$ac_cv_func_getpeereid" = xno && test "x$ac_cv_func_getpeerucred" = xno && test "x$xorg_cv_sys_have_so_peercred" = xno ; then
	AC_DEFINE([NO_LOCAL_CLIENT_CRED], 1, [Define to 1 if no local socket credentials interface exists])
fi

251
dnl Find the math libary, then check for cbrt function in it.
252
AC_CHECK_LIB(m, sqrt)
253
AC_CHECK_FUNCS([cbrt])
254 255 256

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

257
dnl AGPGART headers
258
AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
259
AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
260

261
dnl fbdev header
262
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
263
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
264

265
dnl FreeBSD kldload support (sys/linker.h)
266
AC_CHECK_HEADERS([sys/linker.h],
267
	[ac_cv_sys_linker_h=yes],
268 269
	[ac_cv_sys_linker_h=no],
	[#include <sys/param.h>])
270
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
271

272 273
AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
274
               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
275 276
#include <sys/types.h>
#include <sys/ipc.h>
277
#include <sys/shm.h>
278
#include <sys/stat.h>
279
]],[[
280
{ 
281
    int id;
282
    id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
283 284
    if (id < 0) return -1;
    return shmctl(id, IPC_RMID, 0);
285 286 287
}]])],
       [ac_cv_sysv_ipc=yes],
       [ac_cv_sysv_ipc=no])])
288 289
if test "x$ac_cv_sysv_ipc" = xyes; then
	AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
290 291
fi

292 293 294 295 296
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
297 298 299 300 301 302 303 304 305
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])
	
306
dnl glibc backtrace support check
307 308 309
AC_CHECK_HEADER([execinfo.h],[
    AC_CHECK_LIB(c, backtrace, [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
310
        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
311
    ])]
312 313
)

314 315 316 317
dnl ---------------------------------------------------------------------------
dnl Bus options and CPU capabilities.  Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
318 319
DEFAULT_INT10="x86emu"

320
dnl Override defaults as needed for specific platforms:
321

322
case $host_cpu in
323 324 325
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
326
	        *freebsd*)	SYS_LIBS=-lio ;;
327 328
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
329
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
330 331 332
	;;
  arm*)
	ARM_VIDEO=yes
333
	DEFAULT_INT10="stub"
334 335
	;;
  i*86)
336
	I386_VIDEO=yes
337
	case $host_os in
338
		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
339
		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
340 341 342
		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
				SYS_LIBS=-li386
				;;
343 344 345
		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
				SYS_LIBS=-li386
				;;
346
	esac
347
        ;;
348 349 350 351 352 353 354 355 356
  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"
357
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
358 359 360 361 362
	;;
  x86_64*|amd64*)
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
363
		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
364 365 366
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
				SYS_LIBS=-lx86_64
				;;
367 368 369
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
				SYS_LIBS=-lamd64
				;;
370
	esac
371 372 373 374 375 376 377
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  ia64*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  s390*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
378 379
	;;
esac
380
AC_SUBST(GLX_ARCH_DEFINES)
381 382

dnl BSD *_video.c selection
383 384 385 386 387
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])
388

389
DRI=no
390 391
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
392
  *freebsd* | *dragonfly*)
393 394 395 396
	case $host_os in
		kfreebsd*-gnu) ;;
		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
	esac
397 398 399
	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])
400
	DRI=yes
401 402 403 404
	;;
  *netbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
405
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
406
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
407
	DRI=yes
408 409 410
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
411
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
412
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
413
	;;
414 415 416
  *linux*)
	DRI=yes
	;;
417
  *solaris*)
418
	DRI=yes
419
	;;
420 421 422
  darwin*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	;;
423
  cygwin*|mingw*)
424
	CFLAGS="$CFLAGS -DFD_SETSIZE=512"
425
	;;
426 427
esac

428 429 430
dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
dnl major number
PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
431
PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
432 433 434 435 436 437 438 439 440 441
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"
442

443
dnl Build options.
444
AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
445 446 447
		  [Obsolete - use --enable-strict-compilation instead]),
  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))

448 449 450
AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
				  [Enable debugging (default: disabled)]),
			        [DEBUGGING=$enableval], [DEBUGGING=no])
451
AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
452 453
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
454
AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
455
				  [Vendor string reported by the server]),
456
				[ VENDOR_NAME="$withval" ], [])
457
AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
458
				  [Short version of vendor string reported by the server]),
459
				[ VENDOR_NAME_SHORT="$withval" ], [])
460 461
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
462
				[ VENDOR_WEB="$withval" ], [])
463
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
464
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
465
				[ moduledir="$withval" ],
466
				[ moduledir="${libdir}/xorg/modules" ])
467 468
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
469 470
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
471 472
AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
				  [Builder address (default: xorg@lists.freedesktop.org)]),
473 474
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
475
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
476
				[ OSNAME="$withval" ],
477
				[ OSNAME=`uname -srm` ])
478
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
479 480
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
481 482 483
AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
				[ BUILDERSTRING="$withval" ]
				[ ])
484 485 486 487 488 489 490 491 492 493
AC_ARG_ENABLE(listen-tcp,    AS_HELP_STRING([--enable-listen-tcp],
                                            [Listen on TCP by default (default:disabled)]),
                                [LISTEN_TCP=$enableval], [LISTEN_TCP=no])
AC_ARG_ENABLE(listen-unix,   AS_HELP_STRING([--disable-listen-unix],
                                            [Listen on Unix by default (default:enabled)]),
                                [LISTEN_UNIX=$enableval], [LISTEN_UNIX=yes])

AC_ARG_ENABLE(listen-local,  AS_HELP_STRING([--disable-listen-local],
                                            [Listen on local by default (default:enabled)]),
                                [LISTEN_LOCAL=$enableval], [LISTEN_LOCAL=yes])
494

495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
case $host_os in
    linux*)
        FALLBACK_INPUT_DRIVER="libinput"
        ;;
    *)
        FALLBACK_INPUT_DRIVER=""
        ;;
esac
AC_ARG_WITH(fallback-input-driver,
            AC_HELP_STRING([--with-fallback-input-driver=$FALLBACK_INPUT_DRIVER],
                           [Input driver fallback if the requested driver for a device is unavailable]),
                           [ FALLBACK_INPUT_DRIVER=$withval ], [])
if test "x$FALLBACK_INPUT_DRIVER" = "xno"; then
    FALLBACK_INPUT_DRIVER=""
fi
AC_MSG_CHECKING([for fallback input driver])
AC_MSG_RESULT([$FALLBACK_INPUT_DRIVER])
AC_DEFINE_UNQUOTED(FALLBACK_INPUT_DRIVER, ["$FALLBACK_INPUT_DRIVER"], [ Fallback input driver ])

514 515 516 517 518 519 520 521 522
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)

523 524 525
dnl Uses --with-default-font-path if set, otherwise uses standard
dnl subdirectories of FONTROOTDIR. Some distros set the default font path to
dnl "catalogue:/etc/X11/fontpath.d,built-ins"
526
DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
527 528 529 530
case $host_os in
    darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
esac

531
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
532
				[ FONTPATH="$withval" ],
533
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
534

535 536 537
AC_MSG_CHECKING([for default font path])
AC_MSG_RESULT([$FONTPATH])

538
AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
539 540
				[ XKBPATH="$withval" ],
				[ XKBPATH="${datadir}/X11/xkb" ])
541
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
542
				[ XKBOUTPUT="$withval" ],
543
				[ XKBOUTPUT="compiled" ])
544 545
AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                   [Keyboard ruleset (default: base/evdev)]),
546 547
                                [ XKB_DFLT_RULES="$withval" ],
                                [ XKB_DFLT_RULES="" ])
548
AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
549
                                   [Keyboard model (default: pc105)]),
550
                                [ XKB_DFLT_MODEL="$withval" ],
551
                                [ XKB_DFLT_MODEL="pc105" ])
552 553
AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                   [Keyboard layout (default: us)]),
554 555
                                [ XKB_DFLT_LAYOUT="$withval" ],
                                [ XKB_DFLT_LAYOUT="us" ])
556 557
AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
                                   [Keyboard variant (default: (none))]),
558 559
                                [ XKB_DFLT_VARIANT="$withval" ],
                                [ XKB_DFLT_VARIANT="" ])
560 561
AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
                                   [Keyboard layout options (default: (none))]),
562 563
                                [ XKB_DFLT_OPTIONS="$withval" ],
                                [ XKB_DFLT_OPTIONS="" ])
564 565
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
566
				[ SERVERCONFIG="$withval" ],
567
				[ SERVERCONFIG="${libdir}/xorg" ])
568
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
569
				[ APPLE_APPLICATIONS_DIR="${withval}" ],
570
				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
571
AC_SUBST([APPLE_APPLICATIONS_DIR])
572 573 574 575
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])
576
AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREFIX], [Prefix to use for bundle identifiers (default: org.x)]),
577
                               [ BUNDLE_ID_PREFIX="${withval}" ])
578 579
AC_SUBST([BUNDLE_ID_PREFIX])
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
580
m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | cut -f1-3 -d. | tr -d '\n']))
581 582
AC_ARG_WITH(bundle-version,    AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's CFBundleVersion (default: ]DEFAULT_BUNDLE_VERSION[)]),
                               [ BUNDLE_VERSION="${withval}" ],
583
                               [ BUNDLE_VERSION="DEFAULT_BUNDLE_VERSION" ])
584 585 586 587 588
AC_SUBST([BUNDLE_VERSION])
AC_ARG_WITH(bundle-version-string, AS_HELP_STRING([--with-bundle-version-string=VERSION], [Version to use for X11.app's CFBundleShortVersionString (default: ]AC_PACKAGE_VERSION[)]),
                               [ BUNDLE_VERSION_STRING="${withval}" ],
                               [ BUNDLE_VERSION_STRING="${PACKAGE_VERSION}" ])
AC_SUBST([BUNDLE_VERSION_STRING])
589 590 591 592
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])
593 594 595 596
AC_ARG_WITH(sparkle-feed-url,  AS_HELP_STRING([--with-sparkle-feed-url=URL], [URL for the Sparkle feed (default: https://www.xquartz.org/releases/sparkle/release.xml)]),
                               [ XQUARTZ_SPARKLE_FEED_URL="${withval}" ],
                               [ XQUARTZ_SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle/release.xml" ])
AC_SUBST([XQUARTZ_SPARKLE_FEED_URL])
597
AC_ARG_ENABLE(visibility,     AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
598 599
				[SYMBOL_VISIBILITY=$enableval],
				[SYMBOL_VISIBILITY=auto])
600

601
dnl GLX build options
602 603 604
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])
605

606
dnl Extensions.
607
AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
608
AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
609
AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
610
AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
611
AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
612
AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
613
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
614 615 616 617 618
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])
619
AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
Keith Packard's avatar
Keith Packard committed
620
AC_ARG_ENABLE(dri3,           AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto])
621
AC_ARG_ENABLE(present,	      AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes])
622
AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
623
AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
624
AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
625 626
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])
627
AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
628
AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
629
AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
630
AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
631
AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
632
AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
Daniel Stone's avatar
Daniel Stone committed
633
AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
634
AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=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(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
637
AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
638
AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
639
AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
Jon Turney's avatar
Jon Turney committed
640
AC_ARG_ENABLE(windowsdri,     AS_HELP_STRING([--enable-windowsdri], [Build XWin with WindowsDRI extension (default: auto)]), [WINDOWSDRI=$enableval], [WINDOWSDRI=auto])
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
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
644 645
AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
646 647
AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
648 649 650

dnl DDXes.
AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
651
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
652
AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
653
AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
654
AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
Kristian H. Kristensen's avatar
Kristian H. Kristensen committed
655
AC_ARG_ENABLE(xwayland,       AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto])
Adam Jackson's avatar
Adam Jackson committed
656
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])
657
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
658
AC_ARG_ENABLE(glamor,         AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=auto])
659
dnl kdrive and its subsystems
660
AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
661
AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
662 663
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])
664
dnl kdrive options
665
AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
666 667
AC_ARG_ENABLE(kdrive-mouse,   AS_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
AC_ARG_ENABLE(kdrive-evdev,   AS_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
668
AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
669
AC_ARG_ENABLE(xshmfence,      AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="auto"])
670

671

672 673 674 675 676 677
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])
678
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
679 680
if test "x$SETUID" = "xauto" ; then
	case $host_os in
681
	    cygwin*)		SETUID="no"  ;;
682
	    mingw*)		SETUID="no"  ;;
683 684 685 686 687 688 689
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
690 691 692 693 694
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
695
fi
696
AC_MSG_RESULT([$SETUID])
697 698
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

699
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
Daniel Stone's avatar
Daniel Stone committed
700
dnl was not expanded, since xorg-server with no transport types is rather useless.
701 702 703 704 705
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"
706
m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
707 708 709

# Transport selection macro from xtrans.m4
XTRANS_CONNECTION_FLAGS
710

711 712
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
713
AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
714

715 716 717
AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
Kevin E Martin's avatar
Kevin E Martin committed
718

719 720
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
721
case $host_os in
722
	cygwin* | mingw*)
723 724
		CONFIG_HAL=no
		CONFIG_UDEV=no
725
		CONFIG_UDEV_KMS=no
726
		DGA=no
727
		DRM=no
728
		DRI2=no
Keith Packard's avatar
Keith Packard committed
729
		DRI3=no
730 731 732 733 734
		INT10MODULE=no
		PCI=no
		VGAHW=no
		VBE=no
		XF86UTILS=no
735 736 737
		XF86VIDMODE=no
		XSELINUX=no
		XV=no
738
		SYMBOL_VISIBILITY=no
739
		;;
740
	darwin*)
741 742 743 744 745
		PCI=no
		INT10MODULE=no
		VGAHW=no
		VBE=no
		DRM=no
746
		DRI2=no
Keith Packard's avatar
Keith Packard committed
747
		DRI3=no
748

749 750 751 752
		if test x$XQUARTZ = xauto; then
			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
		 		save_LDFLAGS=$LDFLAGS
				LDFLAGS="$LDFLAGS -framework Carbon"
753
				AC_LINK_IFELSE([AC_LANG_SOURCE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}])],
754 755 756
				               [xorg_cv_Carbon_framework=yes],
				               [xorg_cv_Carbon_framework=no])
			        LDFLAGS=$save_LDFLAGS])
757 758 759 760 761 762 763 764
                
			if test "X$xorg_cv_Carbon_framework" = Xyes; then
				XQUARTZ=yes
			else
				XQUARTZ=no
			fi
		fi

765 766 767 768
		AC_CHECK_FUNC(dispatch_async,
		              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
		              [])

769 770 771 772
		if test "x$XQUARTZ" = xyes ; then
			XQUARTZ=yes
			XVFB=no
			XNEST=no
Kristian H. Kristensen's avatar
Kristian H. Kristensen committed
773
			XWAYLAND=no
774 775 776 777 778 779 780

			COMPOSITE=no
			DGA=no
			DPMSExtension=no
			XF86VIDMODE=no
		fi
		;;
781 782 783 784 785
	gnu*)
		DRM=no
		DRI2=no
		DRI3=no
		;;
786
	*) XQUARTZ=no ;;
787 788
esac

789 790 791 792 793
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
794

795 796 797 798 799
dnl Optional modules
VIDEOPROTO="videoproto"
COMPOSITEPROTO="compositeproto >= 0.4"
RECORDPROTO="recordproto >= 1.13.99.1"
SCRNSAVERPROTO="scrnsaverproto >= 1.1"
800
RESOURCEPROTO="resourceproto >= 1.2.0"
801
DRIPROTO="xf86driproto >= 2.1.0"
802
DRI2PROTO="dri2proto >= 2.8"
Keith Packard's avatar
Keith Packard committed
803
DRI3PROTO="dri3proto >= 1.0"
804 805 806
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
807
GLPROTO="glproto >= 1.4.17"
808
DMXPROTO="dmxproto >= 2.2.99.1"
809 810 811
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
APPLEWMPROTO="applewmproto >= 1.4"
812
LIBXSHMFENCE="xshmfence >= 1.1"
813

814
dnl Required modules
Keith Packard's avatar
Keith Packard committed
815
XPROTO="xproto >= 7.0.31"
816
RANDRPROTO="randrproto >= 1.5.0"
817
RENDERPROTO="renderproto >= 0.11"
818
XEXTPROTO="xextproto >= 7.2.99.901"
819
INPUTPROTO="inputproto >= 2.3"
820
KBPROTO="kbproto >= 1.0.3"
821
FONTSPROTO="fontsproto >= 2.1.3"
822 823 824 825
FIXESPROTO="fixesproto >= 5.0"
DAMAGEPROTO="damageproto >= 1.1"
XCMISCPROTO="xcmiscproto >= 1.2.0"
BIGREQSPROTO="bigreqsproto >= 1.1.0"
826
XTRANS="xtrans >= 1.3.5"
827
PRESENTPROTO="presentproto >= 1.0"
828

829 830
dnl List of libraries that require a specific version
LIBAPPLEWM="applewm >= 1.4"
831
LIBDMX="dmx >= 1.0.99.1"
832
LIBDRI="dri >= 7.8.0"
833
LIBDRM="libdrm >= 2.3.1"
834
LIBEGL="egl"
835
LIBGBM="gbm >= 10.2.0"
836
LIBGL="gl >= 7.1.0"
837
LIBXEXT="xext >= 1.0.99.4"
838
LIBXFONT="xfont2 >= 2.0.0"
839
LIBXI="xi >= 1.2.99.1"
840
LIBXTST="xtst >= 1.0.99.2"
841
LIBPCIACCESS="pciaccess >= 0.12.901"
842
LIBUDEV="libudev >= 143"
843
LIBSELINUX="libselinux >= 2.0.86"
844
LIBDBUS="dbus-1 >= 1.0"
845
LIBPIXMAN="pixman-1 >= 0.27.2"
846 847 848 849

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

852
dnl Core modules for most extensions, et al.
853
SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $KBPROTO $FONTSPROTO $LIBPIXMAN"
854 855 856
# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
AC_SUBST(SDK_REQUIRED_MODULES)

857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873
AC_CHECK_DECL([PTHREAD_MUTEX_RECURSIVE], [HAVE_RECURSIVE_MUTEX=yes], [HAVE_RECURSIVE_MUTEX=no], [[#include <pthread.h>]])

THREAD_DEFAULT=no

if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then
	THREAD_DEFAULT=yes
fi

AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread],
	     [Enable input threads]),
	     [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT])

if test "x$INPUTTHREAD" = "xyes" ; then
    AX_PTHREAD(,AC_MSG_ERROR([threaded input requested but no pthread support has been found]))
    SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS"
    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    AC_DEFINE(INPUTTHREAD, 1, [Use a separate input thread])
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893

    save_LIBS="$LIBS"
    LIBS="$LIBS $SYS_LIBS"
    dnl MacOS X 10.6 & higher
    AC_MSG_CHECKING(for pthread_setname_np(const char*))
    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
	                            [pthread_setname_np("example")])],
                   [AC_MSG_RESULT(yes)
		    AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
		              [Have function pthread_setname_np(const char*)])],
                   [AC_MSG_RESULT(no)])
    dnl GNU libc 2.12 & higher, Solaris 11.3 & higher
    AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
                             [pthread_setname_np(pthread_self(), "example")])],
                   [AC_MSG_RESULT(yes)
		    AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
	                      [Have function pthread_setname_np(pthread_t, const char*)])],
		   [AC_MSG_RESULT(no)])
    LIBS="$save_LIBS"
894 895
fi

896
REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
897

898 899
dnl systemd socket activation
dnl activate the code in libxtrans that grabs systemd's socket fds
900 901
dnl libsystemd-daemon was moved into libsystemd in version 209
LIBSYSTEMD="libsystemd >= 209"
902 903 904 905
AC_ARG_WITH([systemd-daemon],
	AS_HELP_STRING([--with-systemd-daemon],
		[support systemd socket activation (default: auto)]),
	[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
906 907 908 909 910 911 912 913 914 915 916 917
if test "x$WITH_SYSTEMD_DAEMON" = "xyes" -o "x$WITH_SYSTEMD_DAEMON" = "xauto" ; then
	PKG_CHECK_MODULES([SYSTEMD_DAEMON], [$LIBSYSTEMD],
			  [HAVE_SYSTEMD_DAEMON=yes;
			   LIBSYSTEMD_DAEMON="$LIBSYSTEMD"],
			  [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
					     [HAVE_SYSTEMD_DAEMON=yes;
					      LIBSYSTEMD_DAEMON=libsystemd-daemon],
					     [HAVE_SYSTEMD_DAEMON=no])])
	if test "x$HAVE_SYSTEMD_DAEMON" = xyes; then
		AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
		REQUIRED_LIBS="$REQUIRED_LIBS $LIBSYSTEMD_DAEMON"
	elif test "x$WITH_SYSTEMD_DAEMON" = xyes; then
918 919 920 921 922
		AC_MSG_ERROR([systemd support requested but no library has been found])
	fi
fi
AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])

923 924
if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then
	AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
925 926 927 928 929
fi

PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
	CONFIG_UDEV="$HAVE_LIBUDEV"
930
	AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
931 932 933 934
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
	CONFIG_HAL=no
935 936 937
	if test "x$CONFIG_UDEV_KMS" = xauto; then
		CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
	fi
938 939 940 941
	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])
942 943 944
	if test "x$CONFIG_UDEV_KMS" = xyes; then
		AC_DEFINE(CONFIG_UDEV_KMS, 1, [Use libudev for kms enumeration])
	fi
945 946
	SAVE_LIBS=$LIBS
	SAVE_CFLAGS=$CFLAGS
947
	CFLAGS="$CFLAGS $UDEV_CFLAGS"
948 949 950 951 952
	LIBS=$UDEV_LIBS
	AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag])
	AC_CHECK_FUNCS([udev_enumerate_add_match_tag])
	LIBS=$SAVE_LIBS
	CFLAGS=$SAVE_CFLAGS
953
fi
954
AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])
955

956
PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
957 958
if test "x$HAVE_DBUS" = xyes; then
	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
959
fi
960 961
AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])

Daniel Stone's avatar
Daniel Stone committed
962 963 964 965 966 967 968 969 970 971
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])
972
	NEED_DBUS="yes"
Daniel Stone's avatar
Daniel Stone committed
973 974 975
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])

976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
if test "x$SYSTEMD_LOGIND" = xauto; then
        if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
                SYSTEMD_LOGIND=yes
        else
                SYSTEMD_LOGIND=no
        fi
fi
if test "x$SYSTEMD_LOGIND" = xyes; then
        if ! test "x$HAVE_DBUS" = xyes; then
                AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.])
        fi
        if ! test "x$CONFIG_UDEV" = xyes ; then
                AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.])
        fi

        AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration])
        NEED_DBUS="yes"
fi
AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes])

996 997 998
if test "x$SUID_WRAPPER" = xyes; then
        dnl This is a define so that if some platforms want to put the wrapper
        dnl somewhere else this can be easily changed
999
        AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install the Xorg binary and Xorg.wrap])
1000 1001 1002 1003
        SETUID="no"
fi
AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes])

1004 1005
if test "x$NEED_DBUS" = xyes; then
        AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
1006
fi
1007
AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes])
1008

1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
if test "x$CONFIG_WSCONS" = xauto; then
	case $host_os in
		*openbsd*)
			CONFIG_WSCONS=yes;
			;;
		*)
			CONFIG_WSCONS=no;
			;;
	esac
fi
AM_CONDITIONAL(CONFIG_WSCONS, [test "x$CONFIG_WSCONS" = xyes])
if test "x$CONFIG_WSCONS" = xyes; then
	AC_DEFINE(CONFIG_WSCONS, 1, [Use wscons for input auto configuration])
fi

1024

1025
AC_MSG_CHECKING([for glibc...])
1026
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
1027 1028 1029 1030
#include <features.h>
#ifndef __GLIBC__
#error
#endif
1031
])], glibc=yes, glibc=no)
1032 1033
AC_MSG_RESULT([$glibc])

1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
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"
1049 1050 1051
    CPPFLAGS_SAVE="$CPPFLAGS"

    if test x"$glibc" = xyes; then
1052
        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
1053
    fi
1054

1055
    AC_RUN_IFELSE([AC_LANG_SOURCE([
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
#include <time.h>

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

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

    LIBS="$LIBS_SAVE"
1070
    CPPFLAGS="$CPPFLAGS_SAVE"
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081
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

1082 1083 1084
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
1085
	AC_DEFINE(XvExtension, 1, [Build Xv extension])
1086
	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
1087
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
1088 1089 1090 1091 1092 1093 1094
else
	XVMC=no
fi

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

1097 1098 1099
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
1100
	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
1101 1102
	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
	COMPOSITE_INC='-I$(top_srcdir)/composite'
1103 1104
fi

1105 1106 1107
if test "x$MITSHM" = xauto; then
	MITSHM="$ac_cv_sysv_ipc"
fi
1108 1109 1110 1111
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])
1112 1113
fi

1114 1115 1116
AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
if test "x$RECORD" = xyes; then
	AC_DEFINE(XRECORD, 1, [Support Record extension])
1117
	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
1118
	RECORD_LIB='$(top_builddir)/record/librecord.la'
1119 1120
fi

1121 1122 1123
AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
1124
	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
1125
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $SCRNSAVERPROTO"
1126
fi
1127 1128

AM_CONDITIONAL(RES, [test "x$RES" = xyes])
1129
if test "x$RES" = xyes; then
1130
	AC_DEFINE(RES, 1, [Support X resource extension])
1131
	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
1132
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
1133
fi
1134

1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
if test "x$LISTEN_TCP" = xyes; then
	AC_DEFINE(LISTEN_TCP, 1, [Listen on TCP socket])
fi
if test "x$LISTEN_UNIX" = xyes; then
	AC_DEFINE(LISTEN_UNIX, 1, [Listen on Unix socket])
fi
if test "x$LISTEN_LOCAL" = xyes; then
	AC_DEFINE(LISTEN_LOCAL, 1, [Listen on local socket])
fi

1145 1146 1147 1148 1149 1150 1151 1152 1153
# 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
1154 1155 1156 1157 1158 1159 1160
if test "x$CLIENTIDS" = xyes; then
	case $host_os in
	openbsd*)
		SYS_LIBS="$SYS_LIBS -lkvm"
	;;
	esac
fi
1161 1162 1163
AC_MSG_RESULT([$CLIENTIDS])
AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])

1164 1165 1166
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
1167 1168
	REQUIRED_MODULES="$REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
1169 1170
fi

1171
PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
1172 1173 1174 1175 1176 1177 1178 1179
                  [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
1180
		LIBGL="gl >= 9.2.0"
1181
		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
1182 1183
		;;
esac
1184
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1185

1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
dnl
dnl Locate a suitable tmp file system for creating shared memeory files
dnl

AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], [Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto)]),
[],
[with_shared_memory_dir=yes])

shmdirs="/run/shm /var/tmp /tmp"

case x"$with_shared_memory_dir" in
xyes)
	for dir in $shmdirs; do
		case x"$with_shared_memory_dir" in
		xyes)
			echo Checking temp dir "$dir"
			if test -d "$dir"; then
				with_shared_memory_dir="$dir"
			fi
			;;
		esac
	done
	;;
x/*)
	;;
xno)
	;;
*)
	AC_MSG_ERROR([Invalid directory specified for --with-shared-memory-dir: $with_shared_memory_dir])
	;;
esac

case x"$with_shared_memory_dir" in
xyes)
	AC_MSG_ERROR([No directory found for shared memory temp files.])
	;;
xno)
	;;
*)
	AC_DEFINE_UNQUOTED(SHMDIR, ["$with_shared_memory_dir"], [Directory for shared memory temp files])
	;;
esac

1229 1230 1231 1232 1233
AC_ARG_ENABLE(xtrans-send-fds,	AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])

case "x$XTRANS_SEND_FDS" in
xauto)
	case "$host_os" in
1234
	linux*|solaris*|freebsd*|dragonfly*|openbsd*)
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
		XTRANS_SEND_FDS=yes
		;;
	*)
		XTRANS_SEND_FDS=no
		;;
	esac
esac

case "x$XTRANS_SEND_FDS" in
xyes)
	AC_DEFINE(XTRANS_SEND_FDS, 1, [Enable xtrans fd passing support])
	;;
esac

case "$DRI3,$XTRANS_SEND_FDS" in
	yes,yes | auto,yes)
		;;
	yes,no)
		AC_MSG_ERROR([DRI3 requested, but xtrans fd passing support not found.])
		DRI3=no
		;;
	no,*)
		;;
	*)
		AC_MSG_NOTICE([DRI3 disabled because xtrans fd passing support not found.])
		DRI3=no
		;;
esac

Keith Packard's avatar
Keith Packard committed
1264 1265
PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
                  [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
1266

Keith Packard's avatar
Keith Packard committed
1267
case "$DRI3,$HAVE_DRI3PROTO" in
1268 1269
	yes,yes | auto,yes)
		;;
Keith Packard's avatar
Keith Packard committed
1270 1271
	yes,no)
		AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
1272 1273 1274 1275 1276 1277 1278
		DRI3=no
		;;
	no,*)
		;;
	*)
		AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
		DRI3=no
Keith Packard's avatar
Keith Packard committed
1279
		;;
1280 1281
esac

1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300
AC_CHECK_FUNCS([sigaction])

BUSFAULT=no

case x"$ac_cv_func_sigaction" in
	xyes)
		AC_DEFINE(HAVE_SIGACTION, 1, [Have sigaction function])
		BUSFAULT=yes
		;;
esac

case x"$BUSFAULT" in
	xyes)
		AC_DEFINE(BUSFAULT, 1, [Include busfault OS API])
		;;
esac

AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes)

1301

1302 1303 1304 1305
PKG_CHECK_MODULES([XSHMFENCE], $LIBXSHMFENCE, [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
if test "x$XSHMFENCE" = "xauto"; then
    XSHMFENCE="$HAVE_XSHMFENCE"
fi
1306

1307 1308 1309 1310 1311 1312 1313
if test "x$XSHMFENCE" = "xyes"; then
    if test "x$HAVE_XSHMFENCE" != "xyes"; then
        AC_MSG_ERROR([xshmfence requested but not installed.])
    fi
    AC_DEFINE(HAVE_XSHMFENCE, 1, [Have xshmfence support])
    REQUIRED_LIBS="$REQUIRED_LIBS $LIBXSHMFENCE"
fi
1314

1315
AM_CONDITIONAL(XSHMFENCE, [test "x$XSHMFENCE" = xyes])
1316

1317
case "$DRI3,$XSHMFENCE" in
Keith Packard's avatar
Keith Packard committed
1318
	yes,yes | auto,yes)
1319 1320
		;;
	yes,no)
1321
		AC_MSG_ERROR([DRI3 requested, but xshmfence not found.])
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333
		DRI3=no
		;;
	no,*)
		;;
	*)
		AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
		DRI3=no
		;;
esac

case x"$DRI3" in
	xyes|xauto)
Keith Packard's avatar
Keith Packard committed
1334
		DRI3=yes
1335
		AC_DEFINE(DRI3, 1, [Build DRI3 extension])
Keith Packard's avatar
Keith Packard committed
1336 1337
		DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
1338
		AC_MSG_NOTICE([DRI3 enabled]);
Keith Packard's avatar
Keith Packard committed
1339 1340
		;;
esac
1341

Keith Packard's avatar
Keith Packard committed
1342 1343 1344
AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)

if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then
1345 1346 1347 1348
	if test "x$DRM" = xyes; then
		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
	fi
1349 1350
fi

1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
if test "x$GLX" = xyes; then
	PKG_CHECK_MODULES([XLIB], [x11])
	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
	AC_SUBST(XLIB_CFLAGS)
	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
	GLX_LIBS='$(top_builddir)/glx/libglx.la'
	GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
else
        GLX=no
fi
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)

AC_SUBST([GLX_DEFINES])
AC_SUBST([GLX_SYS_LIBS])

1366 1367 1368 1369 1370 1371 1372 1373
AM_CONDITIONAL(PRESENT, [test "x$PRESENT" = xyes])
if test "x$PRESENT" = xyes; then
	AC_DEFINE(PRESENT, 1, [Support Present extension])
	REQUIRED_MODULES="$REQUIRED_MODULES $PRESENTPROTO"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $PRESENTPROTO"
	PRESENT_INC='-I$(top_srcdir)/present'
	PRESENT_LIB='$(top_builddir)/present/libpresent.la'
fi
1374

1375 1376 1377 1378
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])
1379
	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
1380
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
1381
fi
1382

1383 1384 1385 1386 1387
AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
if test "x$XACE" = xyes; then
	AC_DEFINE(XACE, 1, [Build X-ACE extension])
fi

1388 1389 1390 1391 1392 1393
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]))
1394
	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
1395
	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
1396
	SELINUX_LIBS="$SELINUX_LIBS -laudit"
1397 1398 1399
	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
fi

1400 1401
AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then
1402 1403 1404
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build Security extension without X-ACE])
	fi
1405
	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
1406
fi
1407

1408 1409 1410 1411
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'
1412
	DBE_INC='-I$(top_srcdir)/dbe'
1413 1414
fi

1415 1416 1417
AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
if test "x$XF86BIGFONT" = xyes; then
	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
1418
	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
1419
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $BIGFONTPROTO"
1420 1421 1422 1423 1424 1425 1426
fi

AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
if test "x$DPMSExtension" = xyes; then
	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
fi

1427 1428 1429