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

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

Daniel Stone's avatar
Daniel Stone committed
34
35
36
37
38
39
40
41
42
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/).
AC_CONFIG_HEADERS(include/dix-config.h)
43
44
dnl xgl-config.h covers the Xgl DDX.
AC_CONFIG_HEADERS(include/xgl-config.h)
45
46
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
Kevin E Martin's avatar
Kevin E Martin committed
47
48
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
AC_CONFIG_HEADERS(include/xkb-config.h)
49
50
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
51
52
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
Daniel Stone's avatar
Daniel Stone committed
53
54
55
56
57
58

AC_PROG_CC
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
59
AC_DISABLE_STATIC
Daniel Stone's avatar
Daniel Stone committed
60
61
62
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
63
64
AC_PROG_LEX
AC_PROG_YACC
65
AC_SYS_LARGEFILE
66
XORG_PROG_RAWCPP
Daniel Stone's avatar
Daniel Stone committed
67

68
69
70
71
dnl Check for dtrace program (needed to build Xserver dtrace probes)
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
	     [Enable dtrace probes (default: enabled if dtrace found)]),
	     [WDTRACE=$withval], [WDTRACE=auto])
72
73
74
75
76
77
dnl Darwin 9 has dtrace, but it doesn't support compilation into ELF...
if test "x$WDTRACE" = xauto; then
	case $host_os in
		darwin*) WDTRACE="no" ;;
	esac
fi
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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"
	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.])
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
92
93
94
95
96
97
98

# DTrace support uses XErrorDB to get request names
AC_ARG_WITH(xerrordb,
            AS_HELP_STRING([--with-xerrordb=PATH], [Path to XErrorDB file (default: ${datadir}/X11/XErrorDB)]),
	    [ XERRORDB_PATH="$withval" ],
	    [ XERRORDB_PATH="${datadir}/X11/XErrorDB" ])
AC_DEFINE_DIR(XERRORDB_PATH, XERRORDB_PATH, [Path to XErrorDB file])
99

Daniel Stone's avatar
Daniel Stone committed
100
101
102
103
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])

104
105
AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])

106
dnl Checks for typedefs, structures, and compiler characteristics.
Daniel Stone's avatar
Daniel Stone committed
107
AC_C_CONST
108
109
110
111
112
113
AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])

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

Daniel Stone's avatar
Daniel Stone committed
115
116
AC_TYPE_PID_T

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# 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([
#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])

141
	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
142
143
144
145
	AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/endian.h>
 ], [
int a = 1, b;
146
b = bswap16(a);
147
148
149
150
151
152
 ])
], [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
153
		BSWAP=bswap
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	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

175
176
177
AC_CHECK_FUNC([dlopen], [],
	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))

178
dnl Checks for library functions.
Daniel Stone's avatar
Daniel Stone committed
179
AC_FUNC_VPRINTF
180
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
181
		strtol getopt getopt_long vsnprintf walkcontext backtrace \
182
		getisax getzoneid shmctl64])
Daniel Stone's avatar
Daniel Stone committed
183
AC_FUNC_ALLOCA
184
185
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
186
	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
187
AC_CHECK_FUNC([getifaddrs],
188
	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
189
AC_CHECK_FUNC([getpeereid],
190
	AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
191
AC_CHECK_FUNC([getpeerucred],
192
	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
193
194
AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])	
195
AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
Daniel Stone's avatar
Daniel Stone committed
196

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

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

202
dnl Find the math libary
Daniel Stone's avatar
Daniel Stone committed
203
AC_CHECK_LIB(m, sqrt)
204
AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
Daniel Stone's avatar
Daniel Stone committed
205
206
207

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

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

212
dnl APM header
213
214
AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
Daniel Stone's avatar
Daniel Stone committed
215

216
dnl fbdev header
217
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
218
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
Daniel Stone's avatar
Daniel Stone committed
219

220
dnl MTRR header
221
222
223
224
AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
if test "x$ac_cv_asm_mtrr_h" = xyes; then
	HAVE_MTRR=yes
fi
Daniel Stone's avatar
Daniel Stone committed
225

226
227
dnl BSD MTRR header
AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
Donnie Berkholz's avatar
Donnie Berkholz committed
228
if test "x$ac_cv_memrange_h" = xyes; then
229
230
231
232
233
	HAVE_MTRR=yes
fi

if test "x$HAVE_MTRR" = xyes; then
	AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
234
235
236
fi

dnl A NetBSD MTRR header
237
238
AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
if test "x$ac_cv_machine_mtrr_h" = xyes; then
239
240
241
242
243
	AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
		support is available])
fi

dnl FreeBSD kldload support (sys/linker.h)
244
AC_CHECK_HEADERS([sys/linker.h],
245
	[ac_cv_sys_linker_h=yes],
246
247
	[ac_cv_sys_linker_h=no],
	[#include <sys/param.h>])
Donnie Berkholz's avatar
Donnie Berkholz committed
248
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
249

Daniel Stone's avatar
Daniel Stone committed
250
251
AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
252
		[AC_TRY_LINK([
Daniel Stone's avatar
Daniel Stone committed
253
#include <sys/shm.h>
254
],[
255
{ 
Daniel Stone's avatar
Daniel Stone committed
256
257
258
259
260
261
262
    int id;
    id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
    if (id < 0) return -1;
    return shmctl(id, IPC_RMID, 0);
}],
	[ac_cv_sysv_ipc=yes],
	[ac_cv_sysv_ipc=no])])
263
264
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
265
266
fi

267
268
269
270
271
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

272
273
274
275
dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
AC_CHECK_HEADER([execinfo.h],[
    AC_CHECK_LIB(c, backtrace, [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
276
        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
277
    ])]
278
279
)

280
281
282
283
dnl ---------------------------------------------------------------------------
dnl Bus options and CPU capabilities.  Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
284
DEFAULT_INT10="x86emu"
285
use_x86_asm="no"
286

287
dnl Override defaults as needed for specific platforms:
288

Daniel Stone's avatar
Daniel Stone committed
289
case $host_cpu in
290
291
292
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
293
	        *freebsd*)	SYS_LIBS=-lio ;;
294
295
296
297
298
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
	;;
  arm*)
	ARM_VIDEO=yes
Daniel Stone's avatar
Daniel Stone committed
299
300
	;;
  i*86)
301
	use_x86_asm="yes"
302
	I386_VIDEO=yes
303
	case $host_os in
304
	        darwin*)	use_x86_asm="no" ;;
305
		*linux*)	DEFAULT_INT10=vm86 ;;
306
		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
307
308
309
		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
				SYS_LIBS=-li386
				;;
310
311
312
		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
				SYS_LIBS=-li386
				;;
313
	esac
Daniel Stone's avatar
Daniel Stone committed
314
        ;;
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
  powerpc*)
	PPC_VIDEO=yes
	case $host_os in
		*freebsd*)	DEFAULT_INT10=stub ;;
	esac
	;;
  sparc*)
	xorg_loader_sparcmuldiv="yes"
	SPARC64_VIDEO=yes
	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
	;;
  x86_64*|amd64*)
  	use_x86_asm="yes"
	I386_VIDEO=yes
	case $host_os in
330
	        darwin*)	use_x86_asm="no" ;;
331
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
332
333
334
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
				SYS_LIBS=-lx86_64
				;;
335
336
337
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
				SYS_LIBS=-lamd64
				;;
338
339
340
341
342
	esac
	;;
esac

dnl BSD *_video.c selection
Donnie Berkholz's avatar
Donnie Berkholz committed
343
344
345
346
347
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])
348

349
DRI=no
350
KDRIVE_HW=no
351
352
353
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
  *freebsd*)
354
355
356
357
	case $host_os in
		kfreebsd*-gnu) ;;
		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
	esac
358
359
360
	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])
361
	DRI=yes
362
363
364
365
	;;
  *netbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
366
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
367
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
368
	DRI=yes
369
370
371
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
372
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
373
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
374
	;;
375
376
  *linux*)
	DRI=yes
377
	KDRIVE_HW=yes
378
	;;
379
380
381
  *solaris*)
	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
	;;
Daniel Stone's avatar
Daniel Stone committed
382
esac
383
AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes)
Daniel Stone's avatar
Daniel Stone committed
384

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
XORG_RELEASE_VERSION
dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
dnl major number
PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
PVS=`echo $PACKAGE_VERSION | cut -d . -f 4`
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"
RELEASE_DATE="5 September 2007"
VENDOR_WEB="http://wiki.x.org"
Daniel Stone's avatar
Daniel Stone committed
401

402
403
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])

404
dnl Build options.
405
406
407
408
409
410
AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
				  [Treat warnings as errors (default: disabled)]),
			        [WERROR=$enableval], [WERROR=no])
AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
				  [Enable debugging (default: disabled)]),
			        [DEBUGGING=$enableval], [DEBUGGING=no])
411
AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
Daniel Stone's avatar
Daniel Stone committed
412
413
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
414
AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
415
				  [Vendor string reported by the server]),
416
				[ VENDOR_NAME="$withval" ], [])
417
AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
418
				  [Short version of vendor string reported by the server]),
419
				[ VENDOR_NAME_SHORT="$withval" ], [])
420
421
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
422
				[ VENDOR_WEB="$withval" ], [])
423
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
424
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
Daniel Stone's avatar
Daniel Stone committed
425
				[ moduledir="$withval" ],
426
				[ moduledir="${libdir}/xorg/modules" ])
427
428
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
429
430
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
431
432
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
433
434
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
435
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
436
				[ OSNAME="$withval" ],
437
				[ OSNAME=`uname -srm` ])
438
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
439
440
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
441
442
443
AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
				[ BUILDERSTRING="$withval" ]
				[ ])
444
445
446
AC_ARG_WITH(fontdir,         AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
                                [ FONTDIR="$withval" ],
                                [ FONTDIR="${libdir}/X11/fonts" ])
Daniel Stone's avatar
Daniel Stone committed
447
DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
448
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
449
				[ FONTPATH="$withval" ],
450
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
451
AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
452
453
				[ XKBPATH="$withval" ],
				[ XKBPATH="${datadir}/X11/xkb" ])
454
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
455
				[ XKBOUTPUT="$withval" ],
456
				[ XKBOUTPUT="compiled" ])
457
458
459
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]),
				[ SERVERCONFIG="$withval" ],
				[ SERVERCONFIG="${libdir}/xserver" ])
460
461
462
463
APPLE_APPLICATIONS_DIR="${bindir}/Applications"
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
                               [ APPLE_APPLICATIONS_DIR="${withval}" ].
                               [ APPLE_APPLICATIONS_DIR="${bindir}/Applications" ])
464
465
466
467
AC_ARG_WITH(pci-txt-ids-dir, AS_HELP_STRING([--with-pci-txt-ids-dir=PATH],
[Path to pci id directory (default: ${datadir}/X11/pci)]),
				[ PCI_TXT_IDS_DIR="$withval" ],
				[ PCI_TXT_IDS_DIR="${datadir}/X11/pci" ])
468
AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
469
470
                                [BUILDDOCS=$enableval],
                                [BUILDDOCS=no])
471
472
473
474
475
AC_ARG_ENABLE(install-libxf86config,
				AS_HELP_STRING([--enable-install-libxf86config],
				[Install libxf86config (default: disabled)]),
				[INSTALL_LIBXF86CONFIG=$enableval],
				[INSTALL_LIBXF86CONFIG=no])
Daniel Stone's avatar
Daniel Stone committed
476
477
478
AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
                                [BUILTIN_FONTS=$enableval],
                                [BUILTIN_FONTS=no])
Daniel Stone's avatar
Daniel Stone committed
479
480
481
AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
                                 [NULL_ROOT_CURSOR=$enableval],
                                 [NULL_ROOT_CURSOR=no])
482

483
484
485
486
487
488
489
490
491
492
493
494
495
496
dnl GLX build options
AC_ARG_WITH(mesa-source,     AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
                                [ MESA_SOURCE="$withval" ],
                                [ MESA_SOURCE="" ])
AC_ARG_WITH(dri-driver-path,  AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
				[ DRI_DRIVER_PATH="$withval" ],
				[ DRI_DRIVER_PATH="${libdir}/dri" ])
AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
                                [AIGLX=$enableval],
                                [AIGLX=yes])
AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]),
                                [GLX_USE_TLS=$enableval],
                                [GLX_USE_TLS=no])

497
dnl Extensions.
498
499
500
AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
501
AC_ARG_ENABLE(xtrap,          AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
502
503
AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
504
AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
505
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
506
507
508
509
510
511
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])
AC_ARG_ENABLE(xinerama,	      AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
512
513
AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
AC_ARG_ENABLE(xf86misc,       AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
514
AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
Alan Coopersmith's avatar
Alan Coopersmith committed
515
AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=$XACE])
516
AC_ARG_ENABLE(appgroup,       AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
517
518
AC_ARG_ENABLE(xcalibrate,     AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
519
AC_ARG_ENABLE(xevie,          AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
520
521
522
523
524
AC_ARG_ENABLE(cup,            AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi,            AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
AC_ARG_ENABLE(multibuffer,    AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(fontcache,      AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: disabled)]), [FONTCACHE=$enableval], [FONTCACHE=no])
AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
525
AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=auto])
526
AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
527
AC_ARG_ENABLE(config-dbus,    AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
Daniel Stone's avatar
Daniel Stone committed
528
AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
529
AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
530
531
532

dnl DDXes.
AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
533
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
534
535
AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
Ben Byer's avatar
Ben Byer committed
536
AC_ARG_ENABLE(xdarwin, 	      AS_HELP_STRING([--enable-xdarwin], [Build XDarwin server (default: auto)]), [XDARWIN=$enableval], [XDARWIN=auto])
537
538
539
AC_ARG_ENABLE(xdarwinapp,     AS_HELP_STRING([--enable-xdarwinapp], [Build XDarwin.app server (default: no)]), [XDARWINAPP=$enableval], [XDARWINAPP=no])
AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--disable-xquartz], [Build Xquartz server on Darwin (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(x11app,         AS_HELP_STRING([--enable-x11app], [Build Apple's X11.app wrapper for Xquartz (default: no)]), [X11APP=$enableval], [X11APP=no])
540
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
541
AC_ARG_ENABLE(xprint,         AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: no)]), [XPRINT=$enableval], [XPRINT=no])
542
543
544
AC_ARG_ENABLE(xgl,            AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
AC_ARG_ENABLE(xglx,           AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl,           AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
545
546
547
548
dnl legacy fb support
AC_ARG_ENABLE(mfb,            AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
AC_ARG_ENABLE(cfb,            AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
AC_ARG_ENABLE(afb,            AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
549
dnl kdrive and its subsystems
550
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
551
552
AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
AC_ARG_ENABLE(xsdl,           AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
Daniel Stone's avatar
Daniel Stone committed
553
554
555
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])
AC_ARG_ENABLE(kdrive-vesa,    AS_HELP_STRING([--enable-kdrive-vesa], [Build the kdrive VESA-based servers (default: auto)]), [KDRIVEVESA=$enableval], [KDRIVEVESA=auto])
556
dnl xprint
557
AC_ARG_ENABLE(freetype,       AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no])
558
559
AC_ARG_WITH(freetype-config,  AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto)

560

561
562
563
564
565
566
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])
567
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
568
569
570
571
572
573
574
575
576
if test "x$SETUID" = "xauto" ; then
	case $host_os in
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
577
578
579
580
581
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
582
fi
583
AC_MSG_RESULT([$SETUID])
584
585
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

586
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
Daniel Stone's avatar
Daniel Stone committed
587
dnl was not expanded, since xorg-server with no transport types is rather useless.
588
589
590
591
592
593
594
595
596
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"
m4_pattern_forbid(XTRANS_CONNECTION_FLAGS)

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

598
599
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
600
AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
601

602
603
604
605
606
607
AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
if test "x$INT10" = xyes; then
	dnl VM86 headers
	AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
Kevin E Martin's avatar
Kevin E Martin committed
608
609
fi

610
611
dnl Handle building documentation
AM_CONDITIONAL(BUILDDOCS, test "x$BUILDDOCS" = xyes)
Kevin E Martin's avatar
Kevin E Martin committed
612
613
614
615

dnl Only build sgml docs when linuxdoc is available and
dnl def.ents has been installed
XORG_CHECK_LINUXDOC
616

617
618
619
dnl Handle installing libxf86config
AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])

620
621
622
623
624
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
625
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
626

627
dnl Core modules for most extensions, et al.
628
629
630
631
632
633
634
635
# Require updated renderproto for ABI sanity if we're 64-bit.
if test "$ac_cv_sizeof_unsigned_long" = 8; then
	RENDERPROTO="[renderproto >= 0.9.3]"
else
	RENDERPROTO="renderproto"
fi

REQUIRED_MODULES="[randrproto >= 1.2] $RENDERPROTO [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
636
REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]"
637

638
639
640
641
642
643
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
dnl API.
PKG_CHECK_MODULES(DBUS, dbus-1, [HAVE_DBUS=yes], [HAVE_DBUS=no])
if test "x$HAVE_DBUS" = xyes; then
	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
644
fi
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])

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

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

Daniel Stone's avatar
Daniel Stone committed
660
661
662
663
664
665
666
667
668
669
670
671
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])
        REQUIRED_LIBS="$REQUIRED_LIBS hal"
	NEED_DBUS="yes"
672
fi
Daniel Stone's avatar
Daniel Stone committed
673
674
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])

675
676
if test "x$NEED_DBUS" = xyes; then
	REQUIRED_LIBS="$REQUIRED_LIBS dbus-1"
677
678
679
fi
CONFIG_LIB='$(top_builddir)/config/libconfig.a'

680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
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"

    AC_RUN_IFELSE([
#define _POSIX_C_SOURCE 199309L
#include <time.h>

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

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

    LIBS="$LIBS_SAVE"
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

723
724
725
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
726
	AC_DEFINE(XvExtension, 1, [Build Xv extension])
727
	REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
Dodji Seketeli's avatar
Dodji Seketeli committed
728
        PKG_CHECK_MODULES(XV, [xv >= 0.22])
729
730
731
732
733
734
735
else
	XVMC=no
fi

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

738

739
740
741
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
742
	REQUIRED_MODULES="$REQUIRED_MODULES [compositeproto >= 0.4]"
743
744
	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
	COMPOSITE_INC='-I$(top_srcdir)/composite'
Daniel Stone's avatar
Daniel Stone committed
745
746
fi

747
748
749
750
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
751
752
fi

753
754
755
AM_CONDITIONAL(XTRAP, [test "x$XTRAP" = xyes])
if test "x$XTRAP" = xyes; then
	AC_DEFINE(XTRAP, 1, [Support XTrap extension])
756
	REQUIRED_MODULES="$REQUIRED_MODULES trapproto"
757
	XTRAP_LIB='$(top_builddir)/XTrap/libxtrap.la'
Daniel Stone's avatar
Daniel Stone committed
758
759
fi

760
761
762
AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
if test "x$RECORD" = xyes; then
	AC_DEFINE(XRECORD, 1, [Support Record extension])
Daniel Stone's avatar
Daniel Stone committed
763
	REQUIRED_MODULES="$REQUIRED_MODULES recordproto"
764
	RECORD_LIB='$(top_builddir)/record/librecord.la'
Daniel Stone's avatar
Daniel Stone committed
765
766
fi

767
768
769
AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
Daniel Stone's avatar
Daniel Stone committed
770
fi
771
772

AM_CONDITIONAL(RES, [test "x$RES" = xyes])
773
if test "x$RES" = xyes; then
774
	AC_DEFINE(RES, 1, [Support X resource extension])
Daniel Stone's avatar
Daniel Stone committed
775
776
	REQUIRED_MODULES="$REQUIRED_MODULES resourceproto"
fi
777
778

if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
779
	PKG_CHECK_MODULES([XLIB], [x11])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
780
	PKG_CHECK_MODULES([GL], [glproto >= 1.4.9])
781
	AC_SUBST(XLIB_CFLAGS)
782
	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
783
	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
784
	test -d GL || mkdir GL
785
786
787
788
789
790
	case $host_os in
	  solaris*) 	
		SYMLINK_MESA="/usr/bin/bash $srcdir/GL/symlink-mesa.sh"	;;
	  *)	SYMLINK_MESA=$srcdir/GL/symlink-mesa.sh ;;
	esac
	$SYMLINK_MESA $MESA_SOURCE GL/
791
792
793
	if test $? -ne 0; then
		AC_MSG_ERROR([Failed to link Mesa source tree.  Please specify a proper path to Mesa sources, or disable GLX.])
	fi
794
795
else
        GLX=no
Daniel Stone's avatar
Daniel Stone committed
796
fi
797
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
Daniel Stone's avatar
Daniel Stone committed
798
799
AC_SUBST([MESA_SOURCE])

800
801
802
803
804
805
806
if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
else
	AIGLX=no
fi
AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)

807
808
if test "x$GLX_USE_TLS" = xyes -a "x$AIGLX" = xyes; then
	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
809
	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
810
811
812
fi
AC_SUBST([GLX_DEFINES])

813
814
815
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
816
	PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
817
	PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
818
	PKG_CHECK_MODULES([GL], [glproto >= 1.4.1])
819
820
821
	PKG_CHECK_EXISTS(libdrm >= 2.2.0,
			 [AC_DEFINE([HAVE_LIBDRM_2_2], 1,
			 [Has version 2.2 (or newer) of the drm library])])
822
	AC_SUBST(DRIPROTO_CFLAGS)
823
	AC_SUBST(LIBDRM_CFLAGS)
824
	AC_SUBST(LIBDRM_LIBS)
825
	AC_SUBST(GL_CFLAGS)
Daniel Stone's avatar
Daniel Stone committed
826
827
fi

828
829
830
831
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])
832
	REQUIRED_MODULES="$REQUIRED_MODULES xineramaproto"
Daniel Stone's avatar
Daniel Stone committed
833
fi
834

Alan Coopersmith's avatar
Alan Coopersmith committed
835
836
837
838
839
AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
if test "x$XACE" = xyes; then
	AC_DEFINE(XACE, 1, [Build X-ACE extension])
fi

840
841
AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then
Alan Coopersmith's avatar
Alan Coopersmith committed
842
843
844
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build Security extension without X-ACE])
	fi
845
	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
Daniel Stone's avatar
Daniel Stone committed
846
fi
847
848
849
850

AM_CONDITIONAL(XEVIE, [test "x$XEVIE" = xyes])
if test "x$XEVIE" = xyes; then
	AC_DEFINE(XEVIE, 1, [Build XEvIE extension])
851
	REQUIRED_MODULES="$REQUIRED_MODULES evieproto"
Daniel Stone's avatar
Daniel Stone committed
852
853
fi

854
855
AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes])
if test "x$APPGROUP" = xyes; then
856
857
858
	if test "x$XACE" != xyes || test "x$XCSECURITY" != xyes; then
		AC_MSG_ERROR([cannot build APPGROUP extension without X-ACE and XC-SECURITY])
	fi
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
	AC_DEFINE(XAPPGROUP, 1, [Build APPGROUP extension])
fi

AM_CONDITIONAL(CUP, [test "x$CUP" = xyes])
if test "x$CUP" = xyes; then
	AC_DEFINE(TOGCUP, 1, [Build TOG-CUP extension])
	# Requires xextproto which is always required
fi

AM_CONDITIONAL(EVI, [test "x$EVI" = xyes])
if test "x$EVI" = xyes; then
	AC_DEFINE(EVI, 1, [Build Extended-Visual-Information extension])
	# Requires xextproto which is always required
fi

AM_CONDITIONAL(MULTIBUFFER, [test "x$MULTIBUFFER" = xyes])
if test "x$MULTIBUFFER" = xyes; then
	AC_DEFINE(MULTIBUFFER, 1, [Build Multibuffer extension])
	# Requires xextproto which is always required
fi

AM_CONDITIONAL(FONTCACHE, [test "x$FONTCACHE" = xyes])
if test "x$FONTCACHE" = xyes; then
	AC_DEFINE(FONTCACHE, 1, [Build FontCache extension])
	REQUIRED_MODULES="$REQUIRED_MODULES fontcacheproto"
fi

886
887
888
889
890
891
AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
if test "x$DBE" = xyes; then
	AC_DEFINE(DBE, 1, [Support DBE extension])
	DBE_LIB='$(top_builddir)/dbe/libdbe.la'
fi

892
893
894
895
896
897
898
899
900
901
AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
if test "x$XF86BIGFONT" = xyes; then
	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
fi

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

902
if test "x$XPRINT" = xauto; then
903
	PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no])
904
905
906
907
908
909
910
fi
AM_CONDITIONAL(XPRINT, [test "x$XPRINT" = xyes])
if test "x$XPRINT" = xyes; then
	AC_DEFINE(XPRINT, 1, [Build Print extension])
	REQUIRED_MODULES="$REQUIRED_MODULES printproto"
fi

Daniel Stone's avatar
Daniel Stone committed
911
912
913
if test "x$BUILTIN_FONTS" = xyes; then
       AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
       AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
Daniel Stone's avatar
Daniel Stone committed
914
       FONTPATH="built-ins"
Daniel Stone's avatar
Daniel Stone committed
915
916
fi

917
918
919
920
921
922
923
924
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
   AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
   REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
else
   XCALIBRATE=no
fi
AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])

925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
AC_DEFINE(RENDER, 1, [Support RENDER extension])
RENDER_LIB='$(top_builddir)/render/librender.la'
RENDER_INC='-I$(top_srcdir)/render'

AC_DEFINE(RANDR, 1, [Support RANDR extension])
RANDR_LIB='$(top_builddir)/randr/librandr.la'
RANDR_INC='-I$(top_srcdir)/randr'

AC_DEFINE(XFIXES,1,[Support XFixes extension])
FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
FIXES_INC='-I$(top_srcdir)/xfixes'

AC_DEFINE(DAMAGE,1,[Support Damage extension])
DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
DAMAGE_INC='-I$(top_srcdir)/damageext'
MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'

Daniel Stone's avatar
Daniel Stone committed
943
944
945
AC_DEFINE(XINPUT, 1, [Support X Input extension])
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'
946

947
948
AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)

949
950
951
952
953
954
955
956
AC_DEFINE(SHAPE, 1, [Support SHAPE extension])

AC_DEFINE(XKB, 1, [Build XKB])
AC_DEFINE(XKB_IN_SERVER, 1, [Build XKB server])
AC_DEFINE(XKB_DFLT_DISABLED, 0, [Disable XKB per default])
REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
Daniel Stone's avatar
Daniel Stone committed
957

958
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
959
                                        [Do not have 'strcasecmp'.]))
Daniel Stone's avatar
Daniel Stone committed
960

Daniel Stone's avatar
Daniel Stone committed
961
962
963
964
if test "x$NULL_ROOT_CURSOR" = xyes; then
        AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
fi

965
966
967
968
969
970
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then
	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
fi
if test "x$XDMCP" = xauto; then
	if test "x$have_libxdmcp" = xyes; then
Daniel Stone's avatar
Daniel Stone committed
971
972
973
974
975
		XDMCP=yes
	else
		XDMCP=no
	fi
fi
976
977
if test "x$XDMAUTH" = xauto; then
	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
Daniel Stone's avatar
Daniel Stone committed
978
979
980
981
982
983
		XDMAUTH=yes
	else
		XDMAUTH=no
	fi
fi

984
985
986
AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
if test "x$XDMCP" = xyes; then
	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
987
	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
988
	XDMCP_MODULES="xdmcp"
Daniel Stone's avatar
Daniel Stone committed
989
990
fi

991
992
AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
if test "x$XDMAUTH" = xyes; then
Daniel Stone's avatar
Daniel Stone committed
993
	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
994
	if ! test "x$XDMCP" = xyes; then
995
		REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
996
		XDMCP_MODULES="xdmcp"
Daniel Stone's avatar
Daniel Stone committed
997
998
999
	fi
fi

Daniel Stone's avatar
Daniel Stone committed
1000
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
1001
AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
1002
AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path])
1003
AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
1004
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
1005
1006
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
1007
AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
1008
AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
Daniel Stone's avatar
Daniel Stone committed
1009
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
1010
1011
1012
1013
1014

if test -z "$OSNAME"; then
    OSNAME="UNKNOWN"
fi

1015
1016
AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
1017
1018
AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])

1019
1020
AC_SUBST([VENDOR_NAME])
AC_SUBST([VENDOR_NAME_SHORT])
1021
AC_SUBST([VENDOR_RELEASE])
1022
AC_SUBST([VENDOR_MAN_VERSION])
Daniel Stone's avatar
Daniel Stone committed
1023

1024
1025
1026
AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
1027
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
Daniel Stone's avatar
Daniel Stone committed
1028

Daniel Stone's avatar
Daniel Stone committed
1029
1030
1031
1032
if test "x$DEBUGGING" = xyes; then
       AC_DEFINE(DEBUG, 1, [Enable debugging code])
else
       AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
Daniel Stone's avatar
Daniel Stone committed
1033
fi
Daniel Stone's avatar
Daniel Stone committed
1034
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
Daniel Stone's avatar
Daniel Stone committed
1035

1036
1037
1038
1039
1040
1041
1042
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
AC_DEFINE(XTEST, 1, [Support XTest extension])
AC_DEFINE(XSYNC, 1, [Support XSync extension])
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])

1043
1044
1045
1046
1047
1048
1049
if test "x$WDTRACE" != "xno" ; then
  DIX_LIB='$(top_builddir)/dix/dix.O'
  OS_LIB='$(top_builddir)/os/os.O'
else
  DIX_LIB='$(top_builddir)/dix/libdix.la'
  OS_LIB='$(top_builddir)/os/libos.la'
fi
1050
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
Daniel Stone's avatar
Daniel Stone committed
1051
1052
1053
MI_LIB='$(top_builddir)/mi/libmi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi'
1054
FB_LIB='$(top_builddir)/fb/libfb.la'
Daniel Stone's avatar
Daniel Stone committed
1055
FB_INC='-I$(top_srcdir)/fb'
1056
1057
MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
Daniel Stone's avatar
Daniel Stone committed
1058
XPSTUBS_LIB='$(top_builddir)/dix/libxpstubs.la'
Daniel Stone's avatar
Daniel Stone committed
1059
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
Daniel Stone's avatar
Daniel Stone committed
1060

1061
1062
1063
PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])

1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# Autotools has some unfortunate issues with library handling.  In order to
# get a server to rebuild when a dependency in the tree is changed, it must
# be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be
# listed there, or some versions of autotols will break (especially if a -L
# is required to find the library).  So, we keep two sets of libraries
# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
# will go into the _DEPENDENCIES and _LDADD of the server, and
# NAMESPACE_SYS_LIBS which will go into only the _LDADD.  The
# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
# NAMESPACE_SYS_LIBS.
#
# XSERVER_LIBS is the set of in-tree libraries which all servers require.
# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
# require.
#
1079
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
1080
XSERVER_LIBS="$DIX_LIB $CONFIG_LIB $MI_LIB $OS_LIB"
1081
XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} -lcrypto"
1082
1083
AC_SUBST([XSERVER_LIBS])
AC_SUBST([XSERVER_SYS_LIBS])
1084

Ben Byer's avatar
Ben Byer committed
1085
1086
1087
1088
if test "x$HAVE_LAUNCHD" = xyes; then
   XSERVER_CFLAGS="$XSERVER_CFLAGS -DHAVE_LAUNCHD"
fi

1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this.   gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
# here.
if test "x$GCC" = "xyes"; then
       GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
       GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
       GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
       GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
       if test "x$WERROR" = "xyes"; then
               GCC_WARNINGS="${GCC_WARNINGS} -Werror"
       fi
       XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"

       LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
1106
1107
1108
       darwin*)
       LD_EXPORT_SYMBOLS_FLAG=""
       ;;
1109
1110
1111
1112
1113
1114
       openbsd*)
       LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
       ;;
esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])

1115
1116
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed
1117
1118
1119
1120
1121
1122
1123
1124
1125
AC_MSG_CHECKING([if SVR4 needs to be defined])
AC_EGREP_CPP([I_AM_SVR4],[
#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
 I_AM_SVR4
#endif
],[
AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))

Daniel Stone's avatar
Daniel Stone committed
1126
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
AC_DEFINE_UNQUOTED(_X_BYTE_ORDER,[$ENDIAN],[Endian order])
AH_VERBATIM([X_BYTE_ORDER],[
/* Deal with multiple architecture compiles on Mac OS X */
#ifndef __APPLE_CC__
#define X_BYTE_ORDER _X_BYTE_ORDER
#else
#ifdef __BIG_ENDIAN__
#define X_BYTE_ORDER X_BIG_ENDIAN
#else
#define X_BYTE_ORDER X_LITTLE_ENDIAN
#endif
#endif
])
1140
1141
1142
1143
1144
1145
1146
1147

dnl ---------------------------------------------------------------------------
dnl DDX section.
dnl ---------------------------------------------------------------------------

dnl DMX DDX

AC_MSG_CHECKING([whether to build Xdmx DDX])
1148
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
if test "x$DMX" = xauto; then
	DMX="$have_dmx"
fi
AC_MSG_RESULT([$DMX])
AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])

if test "x$DMX" = xyes; then
	if test "x$have_dmx" = xno; then
		AC_MSG_ERROR([Xdmx build explicitly requested, but required
		              modules not found.])
	fi
	DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
1161
	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
Alan Hourihane's avatar
Alan Hourihane committed
1162
	XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB"
1163
1164
	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
	AC_SUBST([XDMX_CFLAGS])
1165
	AC_SUBST([XDMX_LIBS])
1166
	AC_SUBST([XDMX_SYS_LIBS])
1167
1168

dnl USB sources in DMX require <linux/input.h>
1169
1170
	AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
			DMX_BUILD_USB="no")
1171
dnl Linux sources in DMX require <linux/keyboard.h>
1172
1173
	AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
			DMX_BUILD_LNX="no")
1174
1175
1176
	if test "x$GLX" = xyes; then
		PKG_CHECK_MODULES([GL], [glproto])
	fi
1177
	PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11])
1178
	AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
	AC_SUBST(XDMXCONFIG_DEP_LIBS)
	PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11])
	AC_SUBST(DMXEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11])
	AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11])
	AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11])
	AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11])
	AC_SUBST(XRESEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11])
	AC_SUBST(X11EXAMPLES_DEP_LIBS)
1192
fi
1193
1194
AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
1195
1196
1197
1198
1199
1200
1201
1202
1203


dnl Xvfb DDX

AC_MSG_CHECKING([whether to build Xvfb DDX])
AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])

if test "x$XVFB" = xyes; then
1204
1205
	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB"
	XVFB_SYS_LIBS="$XVFBMODULES_LIBS"
1206
	AC_SUBST([XVFB_LIBS])
1207
	AC_SUBST([XVFB_SYS_LIBS])
1208
1209
1210
1211
1212
1213
fi


dnl Xnest DDX

AC_MSG_CHECKING([whether to build Xnest DDX])
1214
PKG_CHECK_MODULES(XNESTMODULES, [xfont xext x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
1215
if test "x$XNEST" = xauto; then
1216
	XNEST="$have_xnest"
1217
1218
1219
1220
1221
fi
AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])

if test "x$XNEST" = xyes; then
1222
1223
	XNEST_LIBS="$CONFIG_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB"
	XNEST_SYS_LIBS="$XNESTMODULES_LIBS"
1224
	AC_SUBST([XNEST_LIBS])
1225
	AC_SUBST([XNEST_SYS_LIBS])
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
fi


dnl Xorg DDX

AC_MSG_CHECKING([whether to build Xorg DDX])
if test "x$XORG" = xauto; then
	XORG="yes"
	case $host_os in
		cygwin*) XORG="no" ;;
1236
		darwin*) XORG="no" ;;
1237
1238
1239
1240
	esac
fi
AC_MSG_RESULT([$XORG])

1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
dnl Xgl DDX

AC_MSG_CHECKING([whether to build Xgl DDX])
if test "x$XGL" != xno; then
  PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XGL=yes], [XGL=no])
  AC_SUBST(XGLMODULES_CFLAGS)
fi
AC_MSG_RESULT([$XGL])
AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])

if test "x$XGL" = xyes; then
1252
1253
	XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB"
	XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
1254
	AC_SUBST([XGL_LIBS])
1255
	AC_SUBST([XGL_SYS_LIBS])