configure.ac 91.9 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.60)
Adam Jackson's avatar
Adam Jackson committed
29
30
31
AC_INIT([xorg-server], 1.19.99.904, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2018-04-10"
RELEASE_NAME="Stuffed Morel"
Daniel Stone's avatar
Daniel Stone committed
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)

Daniel Stone's avatar
Daniel Stone committed
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)
Jeremy Huddleston's avatar
Jeremy Huddleston committed
68
69
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-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
AM_PROG_AS
AC_PROG_LN_S
76
77
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
Daniel Stone's avatar
Daniel Stone committed
78
PKG_PROG_PKG_CONFIG
79
80
AC_PROG_LEX
AC_PROG_YACC
81
AC_SYS_LARGEFILE
82
XORG_PROG_RAWCPP
Daniel Stone's avatar
Daniel Stone committed
83

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

88
89
90
91
92
93
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

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

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

Daniel Stone's avatar
Daniel Stone committed
132
133
AC_HEADER_DIRENT
AC_HEADER_STDC
134
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \
135
 fnmatch.h sys/mkdev.h sys/sysmacros.h sys/utsname.h])
Daniel Stone's avatar
Daniel Stone committed
136

137
dnl Checks for typedefs, structures, and compiler characteristics.
Daniel Stone's avatar
Daniel Stone committed
138
AC_C_CONST
139
AC_C_TYPEOF
140
141
AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]),
               AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order]))
142
143
144
145
146

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
147

Daniel Stone's avatar
Daniel Stone committed
148
149
AC_TYPE_PID_T

150
151
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.
152
153
AC_CHECK_FUNC([dlopen], [],
	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
154
AC_SUBST(DLOPEN_LIBS)
155

156
dnl Checks for library functions.
Adam Jackson's avatar
Adam Jackson committed
157
AC_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \
158
	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
159
	mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
160
	walkcontext setitimer poll epoll_create1 mkostemp])
161
AC_CONFIG_LIBOBJ_DIR([os])
162
163
AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
	timingsafe_memcmp])
164
AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
165

166
AC_CHECK_LIB([bsd], [arc4random_buf])
167
AC_CHECK_FUNCS([arc4random_buf])
168

169
170
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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

189
dnl Find the math libary, then check for cbrt function in it.
Daniel Stone's avatar
Daniel Stone committed
190
AC_CHECK_LIB(m, sqrt)
191
AC_CHECK_FUNCS([cbrt])
Daniel Stone's avatar
Daniel Stone committed
192

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

197
dnl fbdev header
198
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
199
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
Daniel Stone's avatar
Daniel Stone committed
200

201
dnl FreeBSD kldload support (sys/linker.h)
202
AC_CHECK_HEADERS([sys/linker.h],
203
	[ac_cv_sys_linker_h=yes],
204
205
	[ac_cv_sys_linker_h=no],
	[#include <sys/param.h>])
Donnie Berkholz's avatar
Donnie Berkholz committed
206
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
207

Daniel Stone's avatar
Daniel Stone committed
208
209
AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
210
               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Matthieu Herrb's avatar
Matthieu Herrb committed
211
212
#include <sys/types.h>
#include <sys/ipc.h>
Daniel Stone's avatar
Daniel Stone committed
213
#include <sys/shm.h>
214
#include <sys/stat.h>
215
]],[[
216
{ 
Daniel Stone's avatar
Daniel Stone committed
217
    int id;
218
    id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
Daniel Stone's avatar
Daniel Stone committed
219
220
    if (id < 0) return -1;
    return shmctl(id, IPC_RMID, 0);
221
222
223
}]])],
       [ac_cv_sysv_ipc=yes],
       [ac_cv_sysv_ipc=no])])
224
225
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
226
227
fi

228
229
230
231
232
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
233
234
235
236
237
238
239
240
241
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])
	
Peter Hutterer's avatar
Peter Hutterer committed
242
dnl glibc backtrace support check
243
244
245
AC_CHECK_HEADER([execinfo.h],[
    AC_CHECK_LIB(c, backtrace, [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
246
        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
247
    ])]
248
249
)

250
251
252
253
dnl ---------------------------------------------------------------------------
dnl Bus options and CPU capabilities.  Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
254
255
DEFAULT_INT10="x86emu"

256
dnl Override defaults as needed for specific platforms:
257

Daniel Stone's avatar
Daniel Stone committed
258
case $host_cpu in
259
260
261
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
262
	        *freebsd*)	SYS_LIBS=-lio ;;
263
264
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
265
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
266
267
268
	;;
  arm*)
	ARM_VIDEO=yes
269
	DEFAULT_INT10="stub"
Daniel Stone's avatar
Daniel Stone committed
270
271
	;;
  i*86)
272
	I386_VIDEO=yes
273
	case $host_os in
274
		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
275
		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
276
277
278
		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
				SYS_LIBS=-li386
				;;
279
280
281
		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
				SYS_LIBS=-li386
				;;
282
	esac
Daniel Stone's avatar
Daniel Stone committed
283
        ;;
284
285
286
287
288
289
290
291
292
  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"
293
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
294
295
296
297
298
	;;
  x86_64*|amd64*)
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
299
		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
300
301
302
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
				SYS_LIBS=-lx86_64
				;;
303
304
305
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
				SYS_LIBS=-lamd64
				;;
306
	esac
307
308
309
310
311
312
313
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  ia64*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  s390*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
314
315
	;;
esac
316
AC_SUBST(GLX_ARCH_DEFINES)
317
318

dnl BSD *_video.c selection
Donnie Berkholz's avatar
Donnie Berkholz committed
319
320
321
322
323
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])
324

325
DRI=no
326
327
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
328
  *freebsd* | *dragonfly*)
329
330
331
332
	case $host_os in
		kfreebsd*-gnu) ;;
		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
	esac
333
334
335
	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])
336
	DRI=yes
337
338
339
340
	;;
  *netbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
341
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
342
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
343
	DRI=yes
344
345
346
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
347
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
348
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
349
	;;
350
351
352
  *linux*)
	DRI=yes
	;;
353
  *solaris*)
354
	DRI=yes
355
	;;
Jeremy Huddleston's avatar
Jeremy Huddleston committed
356
357
358
  darwin*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	;;
Yaakov Selkowitz's avatar
Yaakov Selkowitz committed
359
  cygwin*|mingw*)
360
	CFLAGS="$CFLAGS -DFD_SETSIZE=512"
361
	;;
Daniel Stone's avatar
Daniel Stone committed
362
363
esac

364
365
366
dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
dnl major number
PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
367
PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
368
369
370
371
372
373
374
375
376
377
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
378

379
dnl Build options.
380
AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
381
382
383
		  [Obsolete - use --enable-strict-compilation instead]),
  AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))

384
385
386
AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
				  [Enable debugging (default: disabled)]),
			        [DEBUGGING=$enableval], [DEBUGGING=no])
387
AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
Daniel Stone's avatar
Daniel Stone committed
388
389
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
390
AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
391
				  [Vendor string reported by the server]),
392
				[ VENDOR_NAME="$withval" ], [])
393
AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
394
				  [Short version of vendor string reported by the server]),
395
				[ VENDOR_NAME_SHORT="$withval" ], [])
396
397
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
398
				[ VENDOR_WEB="$withval" ], [])
399
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
400
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
Daniel Stone's avatar
Daniel Stone committed
401
				[ moduledir="$withval" ],
402
				[ moduledir="${libdir}/xorg/modules" ])
403
404
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
405
406
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
407
408
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
409
410
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
411
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
412
				[ OSNAME="$withval" ],
413
				[ OSNAME=`uname -srm` ])
414
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
415
416
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
417
418
419
AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
				[ BUILDERSTRING="$withval" ]
				[ ])
420
421
422
423
424
425
426
427
428
429
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])
430

431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
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 ])

450
451
452
453
454
455
456
457
458
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)

459
460
461
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"
462
DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
463
464
465
466
case $host_os in
    darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
esac

467
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
468
				[ FONTPATH="$withval" ],
469
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
470

471
472
473
AC_MSG_CHECKING([for default font path])
AC_MSG_RESULT([$FONTPATH])

474
AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: auto)]),
475
				[ XKBPATH="$withval" ],
476
				[ XKBPATH="auto" ])
477
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
478
				[ XKBOUTPUT="$withval" ],
479
				[ XKBOUTPUT="compiled" ])
480
481
AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                   [Keyboard ruleset (default: base/evdev)]),
482
483
                                [ XKB_DFLT_RULES="$withval" ],
                                [ XKB_DFLT_RULES="" ])
484
AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
485
                                   [Keyboard model (default: pc105)]),
486
                                [ XKB_DFLT_MODEL="$withval" ],
487
                                [ XKB_DFLT_MODEL="pc105" ])
488
489
AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                   [Keyboard layout (default: us)]),
490
491
                                [ XKB_DFLT_LAYOUT="$withval" ],
                                [ XKB_DFLT_LAYOUT="us" ])
492
493
AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
                                   [Keyboard variant (default: (none))]),
494
495
                                [ XKB_DFLT_VARIANT="$withval" ],
                                [ XKB_DFLT_VARIANT="" ])
496
497
AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
                                   [Keyboard layout options (default: (none))]),
498
499
                                [ XKB_DFLT_OPTIONS="$withval" ],
                                [ XKB_DFLT_OPTIONS="" ])
500
501
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
502
				[ SERVERCONFIG="$withval" ],
503
				[ SERVERCONFIG="${libdir}/xorg" ])
504
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
505
				[ APPLE_APPLICATIONS_DIR="${withval}" ],
506
				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
507
AC_SUBST([APPLE_APPLICATIONS_DIR])
508
509
510
511
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])
512
AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREFIX], [Prefix to use for bundle identifiers (default: org.x)]),
513
                               [ BUNDLE_ID_PREFIX="${withval}" ])
514
515
AC_SUBST([BUNDLE_ID_PREFIX])
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
516
m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | cut -f1-3 -d. | tr -d '\n']))
517
518
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}" ],
519
                               [ BUNDLE_VERSION="DEFAULT_BUNDLE_VERSION" ])
520
521
522
523
524
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])
525
526
527
528
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])
529
530
531
532
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])
533
AC_ARG_ENABLE(visibility,     AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
534
535
				[SYMBOL_VISIBILITY=$enableval],
				[SYMBOL_VISIBILITY=auto])
536

537
dnl GLX build options
538
539
540
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])
541

542
dnl Extensions.
543
AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
544
AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
545
AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
546
AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
547
AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
548
AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
549
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
550
551
552
553
554
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])
555
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
556
AC_ARG_ENABLE(dri3,           AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto])
Keith Packard's avatar
Keith Packard committed
557
AC_ARG_ENABLE(present,	      AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes])
558
AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
559
AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
560
AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
561
562
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])
563
AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
564
AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
565
AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
566
AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
567
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
568
AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
569
AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
570
AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
571
AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
572
AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
573
AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
574
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
575
AC_ARG_ENABLE(windowsdri,     AS_HELP_STRING([--enable-windowsdri], [Build XWin with WindowsDRI extension (default: auto)]), [WINDOWSDRI=$enableval], [WINDOWSDRI=auto])
576
AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
577
AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
578
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
579
580
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])
581
582
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])
583
584
585

dnl DDXes.
AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
586
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
587
AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
588
AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
589
AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
590
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
591
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
592
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
593
AC_ARG_ENABLE(glamor,         AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=auto])
594
dnl kdrive and its subsystems
595
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
596
AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
597
dnl kdrive options
598
AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
599
AC_ARG_ENABLE(xshmfence,      AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="auto"])
600

601

602
603
604
605
606
607
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])
608
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
609
610
if test "x$SETUID" = "xauto" ; then
	case $host_os in
611
	    cygwin*)		SETUID="no"  ;;
612
	    mingw*)		SETUID="no"  ;;
613
614
615
616
617
618
619
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
620
621
622
623
624
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
625
fi
626
AC_MSG_RESULT([$SETUID])
627
628
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

629
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
Daniel Stone's avatar
Daniel Stone committed
630
dnl was not expanded, since xorg-server with no transport types is rather useless.
631
632
633
634
635
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"
636
m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
637
638
639

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

641
642
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
643
AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
644

645
646
647
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
648

649
650
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
651
case $host_os in
652
	cygwin* | mingw*)
653
654
		CONFIG_HAL=no
		CONFIG_UDEV=no
655
		CONFIG_UDEV_KMS=no
656
		DGA=no
657
		DRM=no
658
		DRI2=no
Keith Packard's avatar
Keith Packard committed
659
		DRI3=no
660
661
662
663
664
		INT10MODULE=no
		PCI=no
		VGAHW=no
		VBE=no
		XF86UTILS=no
665
666
		XF86VIDMODE=no
		XSELINUX=no
667
		SYMBOL_VISIBILITY=no
668
		;;
669
	darwin*)
670
671
672
673
674
		PCI=no
		INT10MODULE=no
		VGAHW=no
		VBE=no
		DRM=no
Jeremy Huddleston's avatar
Jeremy Huddleston committed
675
		DRI2=no
Keith Packard's avatar
Keith Packard committed
676
		DRI3=no
Jeremy Huddleston's avatar
Jeremy Huddleston committed
677

678
679
680
681
		if test x$XQUARTZ = xauto; then
			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
		 		save_LDFLAGS=$LDFLAGS
				LDFLAGS="$LDFLAGS -framework Carbon"
682
				AC_LINK_IFELSE([AC_LANG_SOURCE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}])],
683
684
685
				               [xorg_cv_Carbon_framework=yes],
				               [xorg_cv_Carbon_framework=no])
			        LDFLAGS=$save_LDFLAGS])
686
687
688
689
690
691
692
693
                
			if test "X$xorg_cv_Carbon_framework" = Xyes; then
				XQUARTZ=yes
			else
				XQUARTZ=no
			fi
		fi

694
695
696
697
		AC_CHECK_FUNC(dispatch_async,
		              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
		              [])

698
699
700
701
		if test "x$XQUARTZ" = xyes ; then
			XQUARTZ=yes
			XVFB=no
			XNEST=no
Kristian Høgsberg's avatar
Kristian Høgsberg committed
702
			XWAYLAND=no
703
704
705
706
707
708
709

			COMPOSITE=no
			DGA=no
			DPMSExtension=no
			XF86VIDMODE=no
		fi
		;;
Samuel Thibault's avatar
Samuel Thibault committed
710
711
712
713
714
	gnu*)
		DRM=no
		DRI2=no
		DRI3=no
		;;
715
	*) XQUARTZ=no ;;
716
717
esac

718
719
720
721
722
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
723

724
725
726
727
728
dnl Optional modules
VIDEOPROTO="videoproto"
COMPOSITEPROTO="compositeproto >= 0.4"
RECORDPROTO="recordproto >= 1.13.99.1"
SCRNSAVERPROTO="scrnsaverproto >= 1.1"
729
RESOURCEPROTO="resourceproto >= 1.2.0"
730
DRIPROTO="xf86driproto >= 2.1.0"
Dave Airlie's avatar
Dave Airlie committed
731
DRI2PROTO="dri2proto >= 2.8"
732
DRI3PROTO="dri3proto >= 1.2"
733
734
735
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
736
GLPROTO="glproto >= 1.4.17"
Peter Hutterer's avatar
Peter Hutterer committed
737
DMXPROTO="dmxproto >= 2.2.99.1"
738
739
740
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
APPLEWMPROTO="applewmproto >= 1.4"
741
LIBXSHMFENCE="xshmfence >= 1.1"
742

743
dnl Required modules
Keith Packard's avatar
Keith Packard committed
744
XPROTO="xproto >= 7.0.31"
745
RANDRPROTO="randrproto >= 1.6.0"
746
RENDERPROTO="renderproto >= 0.11"
747
XEXTPROTO="xextproto >= 7.2.99.901"
748
INPUTPROTO="inputproto >= 2.3"
749
KBPROTO="kbproto >= 1.0.3"
750
FONTSPROTO="fontsproto >= 2.1.3"
751
752
753
754
FIXESPROTO="fixesproto >= 5.0"
DAMAGEPROTO="damageproto >= 1.1"
XCMISCPROTO="xcmiscproto >= 1.2.0"
BIGREQSPROTO="bigreqsproto >= 1.1.0"
Keith Packard's avatar
Keith Packard committed
755
XTRANS="xtrans >= 1.3.5"
756
PRESENTPROTO="presentproto >= 1.1"
757

758
759
dnl List of libraries that require a specific version
LIBAPPLEWM="applewm >= 1.4"
760
LIBDMX="dmx >= 1.0.99.1"
761
LIBDRI="dri >= 7.8.0"
762
LIBDRM="libdrm >= 2.4.89"
Emma Anholt's avatar
Emma Anholt committed
763
LIBEGL="egl"
764
LIBGBM="gbm >= 10.2.0"
765
LIBGL="gl >= 7.1.0"
Peter Hutterer's avatar
Peter Hutterer committed
766
LIBXEXT="xext >= 1.0.99.4"
767
LIBXFONT="xfont2 >= 2.0.0"
768
LIBXI="xi >= 1.2.99.1"
769
LIBXTST="xtst >= 1.0.99.2"
Adam Jackson's avatar
Adam Jackson committed
770
LIBPCIACCESS="pciaccess >= 0.12.901"
771
LIBUDEV="libudev >= 143"
772
LIBSELINUX="libselinux >= 2.0.86"
773
LIBDBUS="dbus-1 >= 1.0"
774
LIBPIXMAN="pixman-1 >= 0.27.2"
775
776
777
778

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

781
dnl Core modules for most extensions, et al.
782
SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $KBPROTO $FONTSPROTO $LIBPIXMAN"
783
784
785
# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
AC_SUBST(SDK_REQUIRED_MODULES)

786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
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])
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822

    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"
823
824
fi

825
REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
826

827
828
dnl systemd socket activation
dnl activate the code in libxtrans that grabs systemd's socket fds
829
830
dnl libsystemd-daemon was moved into libsystemd in version 209
LIBSYSTEMD="libsystemd >= 209"
831
832
833
834
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])
835
836
837
838
839
840
841
842
843
844
845
846
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
847
848
849
850
851
		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"])

Peter Hutterer's avatar
Peter Hutterer committed
852
853
if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then
	AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
854
855
856
857
858
fi

PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
	CONFIG_UDEV="$HAVE_LIBUDEV"
859
	AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
860
861
862
863
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
	CONFIG_HAL=no
864
865
866
	if test "x$CONFIG_UDEV_KMS" = xauto; then
		CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
	fi
867
868
869
870
	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])
871
872
873
	if test "x$CONFIG_UDEV_KMS" = xyes; then
		AC_DEFINE(CONFIG_UDEV_KMS, 1, [Use libudev for kms enumeration])
	fi
874
875
	SAVE_LIBS=$LIBS
	SAVE_CFLAGS=$CFLAGS
876
	CFLAGS="$CFLAGS $UDEV_CFLAGS"
877
878
879
880
881
	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
882
fi
883
AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])
Peter Hutterer's avatar
Peter Hutterer committed
884

885
PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
886
887
if test "x$HAVE_DBUS" = xyes; then
	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
888
fi
889
890
AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])

Daniel Stone's avatar
Daniel Stone committed
891
892
893
894
895
896
897
898
899
900
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])
901
	NEED_DBUS="yes"
Daniel Stone's avatar
Daniel Stone committed
902
903
904
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])

905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
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])

Hans de Goede's avatar
Hans de Goede committed
925
926
927
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
928
        AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install the Xorg binary and Xorg.wrap])
Hans de Goede's avatar
Hans de Goede committed
929
930
931
932
        SETUID="no"
fi
AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes])

933
934
if test "x$NEED_DBUS" = xyes; then
        AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
935
fi
936
AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes])
937

938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
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

953

954
AC_MSG_CHECKING([for glibc...])
955
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
956
957
958
959
#include <features.h>
#ifndef __GLIBC__
#error
#endif
960
])], glibc=yes, glibc=no)
961
962
AC_MSG_RESULT([$glibc])

963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
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"
978
979
980
    CPPFLAGS_SAVE="$CPPFLAGS"

    if test x"$glibc" = xyes; then
981
        CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
982
    fi
983

984
    AC_RUN_IFELSE([AC_LANG_SOURCE([
985
986
987
988
989
990
991
992
993
994
#include <time.h>

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

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

998
999
1000
1001
    if test "$MONOTONIC_CLOCK" = "cross compiling"; then
        AC_CHECK_DECL([CLOCK_MONOTONIC],[MONOTONIC_CLOCK="guessing yes"],[MONOTONIC_CLOCK=no],[#include <time.h>])
    fi

1002
    LIBS="$LIBS_SAVE"
1003
    CPPFLAGS="$CPPFLAGS_SAVE"
1004
1005
1006
1007
1008
else
    MONOTONIC_CLOCK=no
fi

AC_MSG_RESULT([$MONOTONIC_CLOCK])
1009
1010
1011
if test "$MONOTONIC_CLOCK" = "guessing yes"; then
	MONOTONIC_CLOCK=yes
fi
1012
1013
1014
1015
1016
1017

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

1018
1019
1020
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
1021
	AC_DEFINE(XvExtension, 1, [Build Xv extension])
1022
	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
1023
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
1024
1025
1026
1027
1028
1029
1030
else
	XVMC=no
fi

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

1033
1034
1035
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
1036
	REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
1037
1038
	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
	COMPOSITE_INC='-I$(top_srcdir)/composite'
Daniel Stone's avatar
Daniel Stone committed
1039
1040
fi

1041
1042
1043
if test "x$MITSHM" = xauto; then
	MITSHM="$ac_cv_sysv_ipc"
fi
1044
1045
1046
1047
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
1048
1049
fi

1050
1051
1052
AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
if test "x$RECORD" = xyes; then
	AC_DEFINE(XRECORD, 1, [Support Record extension])
1053
	REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
1054
	RECORD_LIB='$(top_builddir)/record/librecord.la'
Daniel Stone's avatar
Daniel Stone committed
1055
1056
fi

1057
1058
1059
AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
1060
	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
1061
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $SCRNSAVERPROTO"
Daniel Stone's avatar
Daniel Stone committed
1062
fi
1063
1064

AM_CONDITIONAL(RES, [test "x$RES" = xyes])
1065
if test "x$RES" = xyes; then
1066
	AC_DEFINE(RES, 1, [Support X resource extension])
1067
	REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
1068
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
Daniel Stone's avatar
Daniel Stone committed
1069
fi