configure.ac 47 KB
Newer Older
Daniel Stone's avatar
Daniel Stone committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
dnl $Id$
dnl
dnl Copyright © 2003-2005 Keith Packard, Daniel Stone
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
dnl copyright notice and this permission notice appear in supporting
dnl documentation, and that the names of Keith Packard and Daniel Stone not be
dnl used in advertising or publicity pertaining to distribution of the software
dnl without specific, written prior permission.  Keith Packard and Daniel Stone
dnl make no representations about the suitability of this software for any
dnl purpose.  It is provided "as is" without express or implied warranty.
dnl
dnl KEITH PACKARD AND DANIEL STONE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
dnl SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
dnl IN NO EVENT SHALL KEITH PACKARD OR DANIEL STONE BE LIABLE FOR ANY SPECIAL,
dnl INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dnl LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dnl OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.

25
AC_PREREQ(2.57)
26 27
dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird.
28
AC_INIT([xorg-server], 0.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
Daniel Stone's avatar
Daniel Stone committed
29
AC_CONFIG_SRCDIR([Makefile.am])
30
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
Daniel Stone's avatar
Daniel Stone committed
31
AM_MAINTAINER_MODE
32

Daniel Stone's avatar
Daniel Stone committed
33 34 35 36 37 38 39 40 41
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)
42 43
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
Kevin E Martin's avatar
Kevin E Martin committed
44 45
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
AC_CONFIG_HEADERS(include/xkb-config.h)
46 47
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
Daniel Stone's avatar
Daniel Stone committed
48

49

Daniel Stone's avatar
Daniel Stone committed
50 51 52 53 54 55 56 57
AC_PROG_CC
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
58 59
AC_PROG_LEX
AC_PROG_YACC
60
XORG_PROG_RAWCPP
Daniel Stone's avatar
Daniel Stone committed
61 62 63 64 65

AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])

66
dnl Checks for typedefs, structures, and compiler characteristics.
Daniel Stone's avatar
Daniel Stone committed
67
AC_C_CONST
68 69 70 71 72 73
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
74

Daniel Stone's avatar
Daniel Stone committed
75 76
AC_TYPE_PID_T

77
dnl Checks for library functions.
Daniel Stone's avatar
Daniel Stone committed
78
AC_FUNC_VPRINTF
79 80
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
		strtol getopt getopt_long vsnprintf walkcontext backtrace])
Daniel Stone's avatar
Daniel Stone committed
81
AC_FUNC_ALLOCA
82 83 84 85 86 87 88 89 90
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
	AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the `getdtablesize' function.]))
AC_CHECK_FUNC([getifaddrs],
	AC_DEFINE(HAS_GETIFADDRS, 1, [Have the `getifaddrs' function.]))
AC_CHECK_FUNC([getpeereid],
	AC_DEFINE(HAS_GETPEEREID, 1, [Have the `getpeereid' function.]))
AC_CHECK_FUNC([getpeerucred],
	AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the `getpeerucred' function.]))
91 92
AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])	
Daniel Stone's avatar
Daniel Stone committed
93

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

96
dnl Find the math libary
Daniel Stone's avatar
Daniel Stone committed
97 98 99 100
AC_CHECK_LIB(m, sqrt)

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

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

105
dnl APM header
Daniel Stone's avatar
Daniel Stone committed
106 107
AC_CHECK_HEADERS([linux/apm_bios.h])

108
dnl fbdev header
109
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
110
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
Daniel Stone's avatar
Daniel Stone committed
111

112
dnl MTRR header
Daniel Stone's avatar
Daniel Stone committed
113 114
AC_CHECK_HEADERS([asm/mtrr.h])

115 116
dnl BSD MTRR header
AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
Donnie Berkholz's avatar
Donnie Berkholz committed
117
if test "x$ac_cv_memrange_h" = xyes; then
118 119 120 121 122 123
	AC_DEFINE(HAS_MTRR_SUPPORT, 1, [Define to 1 if BSD MTRR support is
		 available])
fi

dnl A NetBSD MTRR header
AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_mtrr_h=yes)
Donnie Berkholz's avatar
Donnie Berkholz committed
124
if test "x$ac_cv_mtrr_h" = xyes; then
125 126 127 128 129 130 131 132 133 134 135 136 137
	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)
AC_CACHE_CHECK([for sys/linker.h],
		ac_cv_sys_linker_h,
		[AC_TRY_RUN([
#include <sys/param.h>
#include <sys/linker.h>
],
	[ac_cv_sys_linker_h=yes],
	[ac_cv_sys_linker_h=no])])
Donnie Berkholz's avatar
Donnie Berkholz committed
138
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
139

Daniel Stone's avatar
Daniel Stone committed
140 141
AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
142
		[AC_TRY_LINK([
Daniel Stone's avatar
Daniel Stone committed
143 144 145 146 147 148 149 150 151
#include <sys/shm.h>
int main () { 
    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])])
152 153
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
154 155
fi

156 157 158 159
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])
160
    ])]
161 162
)

163 164 165 166
dnl ---------------------------------------------------------------------------
dnl Bus options and CPU capabilities.  Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
167
DEFAULT_INT10="x86emu"
168
xorg_bus_sparc="no"
169
xorg_bus_ix86pci="no"
170
use_x86_asm="no"
171

172
dnl Override defaults as needed for specific platforms:
173

Daniel Stone's avatar
Daniel Stone committed
174
case $host_cpu in
175 176 177 178 179 180 181 182
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
	;;
  arm*)
	ARM_VIDEO=yes
Daniel Stone's avatar
Daniel Stone committed
183 184
	;;
  i*86)
185
	xorg_bus_ix86pci="yes"
186
	use_x86_asm="yes"
187
	I386_VIDEO=yes
188
	case $host_os in
189
		*linux*)	DEFAULT_INT10=vm86 ;;
190 191 192 193 194 195
		*freebsd*)	xorg_bus_ix86pci="no"
				AC_DEFINE(USE_DEV_IO) ;;
		*netbsd*)	xorg_bus_ix86pci="no"
				AC_DEFINE(USE_I386_IOPL) ;;
		*openbsd*)	xorg_bus_ix86pci="no"
				AC_DEFINE(USE_I386_IOPL) ;;
196
	esac
Daniel Stone's avatar
Daniel Stone committed
197
        ;;
198 199 200 201 202 203 204 205 206 207 208 209 210
  powerpc*)
	PPC_VIDEO=yes
	case $host_os in
		*freebsd*)	DEFAULT_INT10=stub ;;
	esac
	;;
  sparc*)
	xorg_bus_sparc="yes"
	xorg_loader_sparcmuldiv="yes"
	SPARC64_VIDEO=yes
	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
	;;
  x86_64*|amd64*)
211
	xorg_bus_ix86pci="yes"
212 213 214 215 216 217 218 219 220 221 222 223
  	use_x86_asm="yes"
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl]) ;;
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl]) ;;
	esac
	;;
esac


dnl BSD *_video.c selection
Donnie Berkholz's avatar
Donnie Berkholz committed
224 225 226 227 228
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])
229

230
DRI=no
231 232 233 234 235 236 237
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
  *freebsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	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])
238
	DRI=yes
239 240 241 242 243
	;;
  *netbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
244
	DRI=yes
245 246 247 248 249
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
250
	;;
251 252 253
  *linux*)
	DRI=yes
	;;
Daniel Stone's avatar
Daniel Stone committed
254 255
esac

256 257 258
AC_MSG_CHECKING(for MMX capable platform)
if test "x$use_x86_asm" = xyes && test "x$GCC" = xyes ; then
	AC_PREPROC_IFELSE([
259
#if (!defined (__GNUC__) || __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
260 261 262 263 264 265 266
    #error Not supported
#endif
], mmx_capable=yes, mmx_capable=no)
fi
AC_MSG_RESULT([$mmx_capable])
AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes])

Daniel Stone's avatar
Daniel Stone committed
267

268 269 270 271
OSNAME=`uname -srm`
AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME", 
	[Define to OS Name string to display for build OS in Xorg log])

Daniel Stone's avatar
Daniel Stone committed
272 273
DEFAULT_VENDOR_STRING="X.Org"
DEFAULT_VENDOR_RELEASE="$PACKAGE_VERSION"
274
dnl e.g. 6.9.99.1 -> 6,9,99,1,0
275
VERSION_STRING="6,99,99,901,0"
Daniel Stone's avatar
Daniel Stone committed
276 277
DEFAULT_VENDOR_WEB="http://wiki.x.org"

278 279
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])

280
dnl Build options.
281 282 283 284 285 286
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])
287
AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
Daniel Stone's avatar
Daniel Stone committed
288 289
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
290 291
AC_ARG_WITH(vendor-string,   AS_HELP_STRING([--with-vendor-string=VENDOR],
				  [Vendor string reported by the server]),
Daniel Stone's avatar
Daniel Stone committed
292 293
			     	[ VENDOR_STRING="$withval" ],
			     	[ VENDOR_STRING="$DEFAULT_VENDOR_STRING" ])
294 295
AC_ARG_WITH(vendor-release,  AS_HELP_STRING([--with-vendor-release=RELEASE],
				  [Vendor release string reported by the server]),
Daniel Stone's avatar
Daniel Stone committed
296 297
				[ VENDOR_RELEASE="$withval" ],
				[ VENDOR_RELEASE="$DEFAULT_VENDOR_RELEASE" ])
298 299
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
Daniel Stone's avatar
Daniel Stone committed
300 301
				[ VENDOR_WEB="$withval" ],
				[ VENDOR_WEB="$DEFAULT_VENDOR_WEB" ])
302
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
303
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
Daniel Stone's avatar
Daniel Stone committed
304
				[ moduledir="$withval" ],
305
				[ moduledir="${libdir}/xorg/modules" ])
306 307
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
308 309
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
310 311
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
312 313
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
314
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: UNKNOWN)]),
315 316
				[ OSNAME="$withval" ],
				[ OSNAME="UNKNOWN" ])
317
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
318 319
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
320
AC_ARG_WITH(mesa-source,     AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
321 322
                                [ MESA_SOURCE="$withval" ],
                                [ MESA_SOURCE="" ])
323 324
FONTDIR="${libdir}/X11/fonts"
DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/CID/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
325
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
326
				[ FONTPATH="$withval" ],
327
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
328
AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
329 330
				[ XKBPATH="$withval" ],
				[ XKBPATH="${datadir}/X11/xkb" ])
331
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
332
				[ XKBOUTPUT="$withval" ],
333
				[ XKBOUTPUT="compiled" ])
334
AC_ARG_WITH(rgb-path,         AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]),
Daniel Stone's avatar
Daniel Stone committed
335 336
				[ RGBPATH="$withval" ],
				[ RGBPATH="${datadir}/X11/rgb" ])
337
AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
338 339
                                [BUILDDOCS=$enableval],
                                [BUILDDOCS=no])
340 341

dnl Extensions.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
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])
AC_ARG_ENABLE(xtrap,          AS_HELP_STRING([--enable-xtrap], [Build XTrap extension (default: disabled)]), [XTRAP=$enableval], [XTRAP=no])
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])
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--enable-dga], [Build DGA extension (default: disabled)]), [DGA=$enableval], [DGA=no])
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])
AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
AC_ARG_ENABLE(xf86misc,       AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
358
AC_ARG_ENABLE(xevie,          AS_HELP_STRING([--enable-xevie], [Build XEvIE extension (default: disabled)]), [XEVIE=$enableval], [XEVIE=no])
359 360 361 362 363 364
AC_ARG_ENABLE(lbx,            AS_HELP_STRING([--enable-lbx], [Build LBX extension (default: no)]), [LBX=$enableval], [LBX=no])
AC_ARG_ENABLE(appgroup,       AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: yes)]), [APPGROUP=$enableval], [APPGROUP=yes])
AC_ARG_ENABLE(cup,            AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: yes)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi,            AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: yes)]), [EVI=$enableval], [EVI=yes])
AC_ARG_ENABLE(multibuffer,    AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: no)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(fontcache,      AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: no)]), [FONTCACHE=$enableval], [FONTCACHE=no])
365 366 367 368 369 370 371 372 373

dnl DDXes.
AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
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])
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(xprint,         AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: auto)]), [XPRINT=$enableval], [XPRINT=auto])

374 375 376 377 378 379
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])
380
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
381 382 383 384 385 386 387 388 389
if test "x$SETUID" = "xauto" ; then
	case $host_os in
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
390 391 392 393 394
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
395
fi
396
AC_MSG_RESULT([$SETUID])
397 398
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

399 400 401 402 403 404 405 406 407 408 409
dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
dnl was not expanded, since libX11 with no transport types is rather useless.
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
410

411 412
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
413

414 415 416 417 418 419
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
420 421
fi

422 423 424 425 426 427 428 429
dnl Handle building documentation
AM_CONDITIONAL(BUILDDOCS, test "x$BUILDDOCS" = xyes)
if test "x$BUILDDOCS" = xyes; then
	dnl Only build sgml docs when linuxdoc is available
	AC_PATH_PROG(LINUXDOC, linuxdoc)
fi
AM_CONDITIONAL(BUILDSGMLDOCS, test "x$LINUXDOC" != x)

430 431 432 433 434
dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
435

436
dnl Core modules for most extensions, et al.
437
REQUIRED_MODULES="randrproto renderproto fixesproto damageproto xcmiscproto xextproto xfont xproto xtrans xau xf86miscproto xf86vidmodeproto xf86bigfontproto scrnsaverproto bigreqsproto resourceproto fontenc fontsproto inputproto xf86dgaproto"
438

439 440 441
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
442
	REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
443 444
fi

445 446 447 448 449
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
if test "x$DGA" = xyes; then
	AC_DEFINE(DGA, 1, [Support DGA extension])
fi

450 451 452
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
	AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
Daniel Stone's avatar
Daniel Stone committed
453
	REQUIRED_MODULES="$REQUIRED_MODULES compositeproto"
454 455
	COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
	COMPOSITE_INC='-I$(top_srcdir)/composite'
Daniel Stone's avatar
Daniel Stone committed
456 457
fi

458 459 460 461
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
462 463
fi

464 465 466
AM_CONDITIONAL(XTRAP, [test "x$XTRAP" = xyes])
if test "x$XTRAP" = xyes; then
	AC_DEFINE(XTRAP, 1, [Support XTrap extension])
467
	REQUIRED_MODULES="$REQUIRED_MODULES trapproto"
468
	XTRAP_LIB='$(top_builddir)/XTrap/libxtrap.la'
Daniel Stone's avatar
Daniel Stone committed
469 470
fi

471 472 473
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
474
	REQUIRED_MODULES="$REQUIRED_MODULES recordproto"
475
	RECORD_LIB='$(top_builddir)/record/librecord.la'
Daniel Stone's avatar
Daniel Stone committed
476 477
fi

478 479 480
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
481
fi
482 483

AM_CONDITIONAL(RES, [test "x$RES" = xyes])
484
if test "x$RES" = xyes; then
485
	AC_DEFINE(RES, 1, [Support X resource extension])
Daniel Stone's avatar
Daniel Stone committed
486 487
	REQUIRED_MODULES="$REQUIRED_MODULES resourceproto"
fi
488 489 490

if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
491
	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
492
	test -d GL || mkdir GL
493
        $srcdir/GL/symlink-mesa.sh $MESA_SOURCE GL/
494 495
else
        GLX=no
Daniel Stone's avatar
Daniel Stone committed
496
fi
497
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
Daniel Stone's avatar
Daniel Stone committed
498 499
AC_SUBST([MESA_SOURCE])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
500 501 502 503 504 505 506 507
AM_CONDITIONAL(LBX, [test "x$LBX" = xyes])
if test "x$LBX" = xyes; then
	AC_DEFINE(LBX, 1, [Support LBX extension])
	PKG_CHECK_MODULES([LBXUTIL], [lbxutil])
	LBX_LIB='$(top_builddir)/lbx/liblbx.la'" $LBXUTIL_LIBS"
	LBX_INC='-I$(top_srcdir)/lbx'" $LBXUTIL_CFLAGS"
fi

508 509 510
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
511
	PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
512
	PKG_CHECK_MODULES([LIBDRM], [libdrm])
513
	PKG_CHECK_MODULES([GL], [glproto >= 1.4.1])
514
	AC_SUBST(DRIPROTO_CFLAGS)
515
	AC_SUBST(LIBDRM_CFLAGS)
516
	AC_SUBST(GL_CFLAGS)
Daniel Stone's avatar
Daniel Stone committed
517 518
fi

519 520 521 522
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])
523
	REQUIRED_MODULES="$REQUIRED_MODULES xineramaproto"
Daniel Stone's avatar
Daniel Stone committed
524
fi
525 526 527 528

AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then
	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
Daniel Stone's avatar
Daniel Stone committed
529
fi
530 531 532 533

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

537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
if test "x$APPGROUP" = xyes && test "x$XCSECURITY" != xyes; then
	AC_MSG_NOTICE([Disabling APPGROUP extension])
	APPGROUP=no
fi
AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes])
if test "x$APPGROUP" = xyes; then
	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

570 571
if test "x$XF86VIDMODE" = xyes; then
	AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
Daniel Stone's avatar
Daniel Stone committed
572 573
fi

574 575 576
if test "x$XF86MISC" = xyes; then
	AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
Daniel Stone's avatar
Daniel Stone committed
577

578 579 580 581 582 583 584 585 586
if test "x$XPRINT" = xauto; then
	PKG_CHECK_MODULES([XPRINT], [printproto], [XPRINT=yes], [XPRINT=no])
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

587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
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'
dnl damage (may) need the composite wrapper when composite is enabled
if test "$COMPOSITE" = yes; then
	MIEXT_DAMAGE_LIB="$MIEXT_DAMAGE_LIB "'$(top_builddir)/miext/cw/libcw.la'
Daniel Stone's avatar
Daniel Stone committed
606
fi
607 608 609 610 611 612 613 614 615 616 617 618 619 620
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'

AC_DEFINE(XINPUT, 1, [Support X Input extension])
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'

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
621 622


623 624 625 626 627 628
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
629 630 631 632 633
		XDMCP=yes
	else
		XDMCP=no
	fi
fi
634 635
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
636 637 638 639 640 641
		XDMAUTH=yes
	else
		XDMAUTH=no
	fi
fi

642 643 644
AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
if test "x$XDMCP" = xyes; then
	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
Daniel Stone's avatar
Daniel Stone committed
645
	REQUIRED_MODULES="$REQUIRED_MODULES xdmcp"
646
	XDMCP_MODULES="xdmcp"
Daniel Stone's avatar
Daniel Stone committed
647 648
fi

649 650
AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
if test "x$XDMAUTH" = xyes; then
Daniel Stone's avatar
Daniel Stone committed
651
	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
652
	if ! test "x$XDMCP" = xyes; then
Daniel Stone's avatar
Daniel Stone committed
653
		REQUIRED_MODULES="$REQUIRED_MODULES xdmcp"
654
		XDMCP_MODULES="xdmcp"
Daniel Stone's avatar
Daniel Stone committed
655 656 657
	fi
fi

658 659 660
AM_CONDITIONAL(USE_RGB_BUILTIN, [test "x$USE_RGB_BUILTIN" = xyes])
if test "x$USE_RGB_BUILTIN" = xyes; then
	AC_DEFINE(USE_RGB_BUILTIN, 1, [Use built-in RGB color database])
Daniel Stone's avatar
Daniel Stone committed
661 662
fi

Daniel Stone's avatar
Daniel Stone committed
663
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
664
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
665
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
Daniel Stone's avatar
Daniel Stone committed
666 667
AC_DEFINE_UNQUOTED(XORG_RELEASE, ["$VENDOR_RELEASE"], [Vendor release])
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
668 669
AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
670 671
AC_SUBST([VENDOR_STRING])
AC_SUBST([VENDOR_RELEASE])
Daniel Stone's avatar
Daniel Stone committed
672

673 674 675
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])
Daniel Stone's avatar
Daniel Stone committed
676
AM_CONDITIONAL(DEBUG, test "x$DEBUGGING" = xyes)
Daniel Stone's avatar
Daniel Stone committed
677

678 679
if ! test "x$DEBUGGING" = xyes; then
  AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
Daniel Stone's avatar
Daniel Stone committed
680 681
fi

682 683 684 685 686 687 688 689
AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly])
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])

Daniel Stone's avatar
Daniel Stone committed
690 691 692 693 694 695
DIX_LIB='$(top_builddir)/dix/libdix.la'
OS_LIB='$(top_builddir)/os/libos.la'
MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi'
696
FB_LIB='$(top_builddir)/fb/libfb.la'
Daniel Stone's avatar
Daniel Stone committed
697
FB_INC='-I$(top_srcdir)/fb'
698 699 700
MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
MIEXT_LAYER_LIB='$(top_builddir)/miext/layer/liblayer.la'
Daniel Stone's avatar
Daniel Stone committed
701
XPSTUBS_LIB='$(top_builddir)/dix/libxpstubs.la'
Daniel Stone's avatar
Daniel Stone committed
702
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
Daniel Stone's avatar
Daniel Stone committed
703 704 705 706

PKG_CHECK_MODULES([XSERVER], [$REQUIRED_MODULES])
XSERVER_LIBS="${XSERVER_LIBS} -lm -lz"

707

708 709
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
710 711 712 713 714 715 716 717 718
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]))

Kristian Høgsberg's avatar
Kristian Høgsberg committed
719
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 $LBX_INC"
720 721 722 723 724 725 726 727 728 729
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])

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


dnl DMX DDX

AC_MSG_CHECKING([whether to build Xdmx DDX])
730
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
731 732 733 734 735 736 737 738 739 740 741 742
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"
Kristian Høgsberg's avatar
Kristian Høgsberg committed
743
	XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $LBX_LIB $OS_LIB $MIEXT_SHADOW_LIB"
744
	AC_SUBST([XDMX_LIBS])
745 746

dnl USB sources in DMX require <linux/input.h>
747 748
	AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
			DMX_BUILD_USB="no")
749
dnl Linux sources in DMX require <linux/keyboard.h>
750 751
	AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
			DMX_BUILD_LNX="no")
752 753 754
	if test "x$GLX" = xyes; then
		PKG_CHECK_MODULES([GL], [glproto])
	fi
755
	PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11])
756
	AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
757 758 759 760 761 762 763 764 765 766 767 768 769
	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)
770
fi
771 772
AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
773 774 775 776 777 778 779 780 781


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
Kristian Høgsberg's avatar
Kristian Høgsberg committed
782
	XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_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 $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
783 784 785 786 787 788 789
	AC_SUBST([XVFB_LIBS])
fi


dnl Xnest DDX

AC_MSG_CHECKING([whether to build Xnest DDX])
790
PKG_CHECK_MODULES(XNESTMODULES, [xfont xext x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
791
if test "x$XNEST" = xauto; then
792
	XNEST="$have_xnest"
793 794 795 796 797
fi
AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])

if test "x$XNEST" = xyes; then
Kristian Høgsberg's avatar
Kristian Høgsberg committed
798
	XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_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 $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820
	AC_SUBST([XNEST_LIBS])
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" ;;
		darwin*) XORG="no" ;;
	esac
fi
AC_MSG_RESULT([$XORG])

if test "x$XORG" = xyes; then
	XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
	XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
	XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
	XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
	XORG_CORE_LIBS="$DIX_LIB"
Kristian Høgsberg's avatar
Kristian Høgsberg committed
821
	XORG_LIBS="$MI_LIB $FIXES_LIB $XEXT_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 $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
822 823 824

	AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl")

825 826 827 828 829 830 831 832 833
	case $host_os in
	  linux*)
	  	XORG_OS="linux"
		XORG_OS_SUBDIR="linux"
		XORG_OS_KBD="Lnx"
		case $host_cpu in
		  ia64*)
			linux_ia64=yes
			;;
834 835 836 837
		  alpha*)
		  	linux_alpha=yes
			XORG_OS_PCI="axp"
			;;
838 839 840
		  *)
			;;
		esac
841
		;;
842 843 844 845
	  freebsd*)
	  	XORG_OS="freebsd"
		XORG_OS_SUBDIR="bsd"
		XORG_OS_KBD="BSD"
846
		;;
847 848 849 850
	  netbsd*)
	  	XORG_OS="netbsd"
		XORG_OS_SUBDIR="bsd"
		XORG_OS_KBD="BSD"
851
		;;
852 853 854 855
	  openbsd*)
	  	XORG_OS="openbsd"
		XORG_OS_SUBDIR="bsd"
		XORG_OS_KBD="BSD"
856
		;;
857 858 859 860 861 862 863 864 865 866
	  solaris*)
	  	XORG_OS="solaris"
		XORG_OS_SUBDIR="solaris"
		# This really should be tests for specific features, but the #ifdef's
		# were done as a simple version check in XFree86 4.x and haven't been 
		# fixed yet
		AC_MSG_CHECKING([Solaris version])
	        OS_MINOR=`echo ${host_os}|sed -e 's/^.*solaris2\.//' -e s'/\..*$//'`
		if test "${OS_MINOR}" -ge 7 ; then
	        	AC_MSG_RESULT(Solaris ${OS_MINOR})
867
		else
868
			AC_MSG_RESULT(Solaris `echo ${host_os}|sed -e 's/^.*solaris//`)
869
		fi
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
		if test "${OS_MINOR}" -ge 8 ; then
			AC_DEFINE(__SOL8__,1,[Solaris 8 or later])
		fi
		AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
		if test "x$SUNCC" = "xyes"; then
			solaris_asm_inline="yes"
		fi
		AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
			
		case $host_cpu in
		  sparc*)	
			XORG_OS_PCI="sparc"
			SOLARIS_INOUT_ARCH="sparcv8plus"
			;;
		  i*86)	
			XORG_OS_PCI="ix86"
			if test x$SOLARIS_64 = xyes ; then
				SOLARIS_INOUT_ARCH="amd64"
			else
				SOLARIS_INOUT_ARCH="ia32"
			fi
			if test "${OS_MINOR}" -lt 8 ; then
				solaris_usl_console="yes"
			fi
			;;
		  *)
			AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
			are supported on Solaris in this release.   If you are \
			interested in porting Xorg to your platform, please email \
			xorg@lists.freedesktop.org.]) ;;
		esac
		AC_SUBST([SOLARIS_INOUT_ARCH])
		if test x$solaris_asm_inline = xyes ; then
			XORG_CFLAGS="${XORG_CFLAGS} "'$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-${SOLARIS_INOUT_ARCH}.il'
904 905
		fi
		;;
906
	  *)
907 908 909 910 911 912
	  	XORG_OS="unknown"
		XORG_OS_SUBDIR="unknown"
		AC_MSG_ERROR([Your OS is unknown. Xorg currently only supports Linux, \
		Free/Open/NetBSD, Solaris, and OS X. If you are interested in porting \
	        Xorg to your platform, please email xorg@lists.freedesktop.org.])
		;;
913
	esac
914 915
	if test "x$XORG_OS_PCI" = x ; then
		XORG_OS_PCI=$XORG_OS
916
	fi
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
	AC_SUBST([XORG_CORE_LIBS])
	AC_SUBST([XORG_LIBS])
	AC_SUBST([XORG_INCS])
	AC_SUBST([XORG_OS])
	AC_SUBST([XORG_OS_SUBDIR])
	AC_SUBST([XORG_OS_KBD])
	AC_SUBST([XORG_OS_PCI])

	dnl only used in hw/xfree86/scanpci, TTBOMK
	AC_PATH_PROG(PERL, perl, no)
	dnl unlikely as this may be ...
	if test "x$PERL" = xno; then
		AC_MSG_ERROR([Perl is required to build the XFree86/Xorg DDX.])
	fi
	AC_SUBST(PERL)

	# 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
	AC_SUBST([XORG_CFLAGS])
	AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])

	dnl these only go in xorg-config.h
952 953
	XF86CONFIGFILE="xorg.conf"
	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
954
	LOGPREFIX="$logdir/Xorg."
955 956 957 958 959 960 961 962 963 964
	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
	AC_DEFINE(XFree86LOADER, 1, [Building XFree86 loader])
	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [XF86_VERSION_NUMERIC($VERSION_STRING)], [Current Xorg version])
	AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
	AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
	AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
	# XXX HACK!  if anyone cares about elfloader in 7.0 you need to
	# XXX do something smarter here.
965
	AC_DEFINE(DLOPEN_HACK, 1, [Prefer dlloader modules to elfloader])
966
	AC_DEFINE(DLOPEN_SUPPORT, 1, [Use libdl-based loader])
967
	AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
968 969
	AC_DEFINE(DRIVERS, {}, [Built-in output drivers (none)])
	AC_DEFINE(IDRIVERS, {}, [Built-in input drivers (none)])
970
	AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
971 972 973 974 975 976 977 978 979 980 981 982
	AC_DEFINE_DIR(XF86CONFIGFILE, CONFIGFILE, [Path to Xorg configuration file])
	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])

	driverdir="$moduledir/drivers"
	AC_SUBST([moduledir])
	AC_SUBST([driverdir])
	sdkdir="$includedir/xorg"
	extdir="$includedir/X11/extensions"
	AC_SUBST([sdkdir])
	AC_SUBST([extdir])
983
	AC_SUBST([logdir])
984 985
fi
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
986
AM_CONDITIONAL([XORG_BUS_IX86PCI], [test "x$xorg_bus_ix86pci" = xyes])
987
AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
988
AM_CONDITIONAL([XORG_LOADER_SPARC], [test "x$xorg_loader_sparcmuldiv" = xyes])
989
AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
990
AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
991 992
AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes])
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
993 994 995 996 997 998 999 1000 1001 1002 1003
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])


dnl Xprint DDX

AC_MSG_CHECKING([whether to build Xprint DDX])
AC_MSG_RESULT([$XPRINT])

if test "x$XPRINT" = xyes; then
1004
	PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1005 1006
	XPRINT_EXTENSIONS="$XEXT_LIB $XTRAP_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $LBX_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
	XPRINT_INCLUDES="$XEXT_INC $RENDER_INC $COMPOSITE_INC $RANDR_INC $XI_INC $FIXES_INC $DAMAGE_INC $XI_INC $GLX_INC $LBX_INC"
1007
	XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $OS_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $GLX_INC"
1008
	AC_SUBST([XPRINT_LIBS])
1009 1010 1011

	xpconfigdir=$libdir/X11/xserver
	AC_SUBST([xpconfigdir])
1012 1013 1014

	AC_PATH_PROG(MKFONTSCALE, mkfontscale)
	AC_PATH_PROG(MKFONTDIR, mkfontdir)
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
fi


dnl XWin DDX

AC_MSG_CHECKING([whether to build XWin DDX])
if test "x$XWIN" = xauto; then
	case $host_os in
		cygwin*) XWIN="yes" ;;
		mingw*) XWIN="yes" ;;
		*) XWIN="no" ;;
	esac
	XWIN_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $LAYER_LIB $XPSTUBS_LIB $OS_LIB $SHADOW_LIB"
	AC_SUBST([XWIN_LIBS])
fi
AC_MSG_RESULT([$XWIN])

if test "x$XWIN" = xyes; then
	XWIN_SERVER_NAME=XWin
	case $host_os in
		cygwin*)
			PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
			AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
			AC_DEFINE(ROOTLESS,1,[Build Rootless code])
			CFLAGS="$CFLAGS -DFD_SETSIZE=256"
			;;
		mingw*)
			PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
			XWIN_SERVER_NAME=Xming
			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
			XWIN_SYSTEM_LIBS=-lwinsock2
			;;
	esac
	AC_SUBST(XWIN_SERVER_NAME)
	AC_SUBST(XWIN_SYSTEM_LIBS)

	if test "x$DEBUGGING" = xyes; then
		AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
		AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
		AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
	fi

	AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
	AC_DEFINE(DDXTIME, 1, [Use GetTimeInMillis])
	AC_DEFINE(DDXOSFATALERROR, 1, [Use OsVendorFatalError])
	AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
	AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
	if test "x$XF86VIDMODE" = xyes; then
		AC_MSG_NOTICE([Disabling XF86VidMode extension])
		XF86VIDMODE = no
	fi
	if test "x$XF86MISC" = xyes; then
		AC_MSG_NOTICE([Disabling XF86Misc extension])
		XF86MISC = no
	fi
	if test "x$COMPOSITE" = xyes; then
		AC_MSG_NOTICE([Disabling Composite extension])
		COMPOSITE = no
	fi
fi
AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])

Daniel Stone's avatar
Daniel Stone committed
1086

Kevin E Martin's avatar
Kevin E Martin committed
1087
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
1088 1089
AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
1090
AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
Søren Sandmann Pedersen's avatar
Søren Sandmann Pedersen committed
1091 1092 1093 1094 1095 1096 1097 1098 1099

# Make sure XKM_OUTPUT_DIR is an absolute path

XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`

if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
fi

1100
AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
1101

Søren Sandmann Pedersen's avatar
Søren Sandmann Pedersen committed
1102 1103
AC_SUBST(XKM_OUTPUT_DIR)

Daniel Stone's avatar
Daniel Stone committed
1104
dnl and the rest of these are generic, so they're in config.h
1105 1106 1107 1108 1109
AC_DEFINE(XFree86XDGA, 1, [Build XDGA support])
AC_DEFINE(XF86BIGFONT, 1, [Build XFree86 BigFont extension])
AC_DEFINE(XResExtension, 1, [Build XRes extension])
AC_DEFINE(DPMSExtension, 1, [Build DPMS extension])

1110
dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined
1111 1112
dnl _*_SOURCE on Solaris restricts to the standards, and removes non-standard
dnl functions which X uses
1113 1114
case $host_os in
	cygwin*) ;;
Adam Jackson's avatar
Adam Jackson committed
1115
	solaris*) ;;
1116
        darwin*) ;;
1117
	*bsd*) ;;
1118
	*) 
1119 1120 1121
		AC_DEFINE(_POSIX_SOURCE, 1, [POSIX-compliant source])
		AC_DEFINE(_XOPEN_SOURCE, 500, [X/Open-compliant source])
		AC_DEFINE(_BSD_SOURCE, 1, [BSD-compliant source])
1122 1123
		;;
esac
Daniel Stone's avatar
Daniel Stone committed
1124 1125 1126

AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])

1127 1128 1129 1130
dnl xorgconfig CLI configuration utility
PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile])

dnl xorgcfg GUI configuration utility
1131
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], 
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
	[Build xorgcfg GUI configuration utility (default: yes)]),
	[XORGCFG=$enableval],[XORGCFG=yes])
if test x$XORGCFG = xyes ; then
	PKG_CHECK_MODULES([XORGCFG_DEP], 
	    [xkbui xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm x11])
	AC_CHECK_LIB([curses],[waddstr],
	    [XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lcurses"; CURSES=yes],
	    AC_CHECK_LIB([ncurses],[waddstr],
		[XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lncurses" ; CURSES=yes],
		[CURSES=no]))
1142 1143
	AC_SUBST(XORGCFG_DEP_CFLAGS)
	AC_SUBST(XORGCFG_DEP_LIBS)
1144 1145 1146 1147
fi
AM_CONDITIONAL(BUILD_XORGCFG, [test x$XORGCFG = xyes])
AM_CONDITIONAL(USE_CURSES, [test x$CURSES = xyes])

1148
AC_ARG_ENABLE(kbd_mode, AS_HELP_STRING([--enable-kbd_mode],
Alan Coopersmith's avatar
Alan Coopersmith committed
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170
	[Build kbd_mode utility (default: auto)]),
	[BUILD_KBD_MODE=$enable_val], [BUILD_KBD_MODE="auto"])
if test x$BUILD_KBD_MODE != xno ; then
	case $host_os in
	  *bsd*)
		KBD_MODE_TYPE="bsd"
#		BUILD_KBD_MODE="yes"  # need to test on BSD before enabling
				      # by default
		;;
	  solaris*)
		KBD_MODE_TYPE="sun"
		BUILD_KBD_MODE="yes"  # enabled by default
		;;
	  *)
		BUILD_KBD_MODE="no"   # disabled by default
		;;
	esac
fi
AM_CONDITIONAL(BUILD_KBD_MODE, [test x$BUILD_KBD_MODE = xyes])
AM_CONDITIONAL(BSD_KBD_MODE, [test x$KBD_MODE_TYPE = xbsd])
AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD_MODE_TYPE = xsun])

Daniel Stone's avatar
Daniel Stone committed
1171 1172 1173 1174 1175 1176
CFLAGS="$XSERVER_CFLAGS $CFLAGS"
AC_SUBST([CFLAGS])

BUILD_DATE="$(date +'%Y%m%d')"
AC_SUBST([BUILD_DATE])

1177 1178 1179
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H"
AC_SUBST([DIX_CFLAGS])

Daniel Stone's avatar
Daniel Stone committed
1180 1181
AC_SUBST([libdir exec_prefix prefix])

1182 1183 1184
# Man page sections - used in config utils & generating man pages
XORG_MANPAGE_SECTIONS

1185
# XORG in this case refers to the roll-up releases, not the Xorg DDX.
1186 1187
XORG_RELEASE_VERSION

Daniel Stone's avatar
Daniel Stone committed
1188 1189
AC_OUTPUT([
Makefile
1190
GL/Makefile
1191
GL/glx/Makefile
1192 1193
GL/include/Makefile
GL/include/GL/Makefile
1194 1195
GL/mesa/Makefile
GL/mesa/array_cache/Makefile
1196
GL/mesa/glapi/Makefile
1197 1198 1199
GL/mesa/main/Makefile
GL/mesa/math/Makefile
GL/mesa/shader/Makefile
1200 1201
GL/mesa/shader/grammar/Makefile
GL/mesa/shader/slang/Makefile
1202 1203 1204 1205
GL/mesa/swrast/Makefile
GL/mesa/swrast_setup/Makefile
GL/mesa/tnl/Makefile
GL/mesa/X/Makefile
Daniel Stone's avatar
Daniel Stone committed
1206 1207 1208 1209
include/Makefile
afb/Makefile
composite/Makefile
damageext/Makefile
Adam Jackson's avatar
Adam Jackson committed
1210
dbe/Makefile
Daniel Stone's avatar
Daniel Stone committed
1211
dix/Makefile
1212
doc/Makefile
Daniel Stone's avatar
Daniel Stone committed
1213 1214 1215
fb/Makefile
record/Makefile
XTrap/Makefile
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1216
lbx/Makefile
Daniel Stone's avatar
Daniel Stone committed
1217 1218 1219 1220 1221
mfb/Makefile
cfb/Makefile
cfb16/Makefile
cfb24/Makefile
cfb32/Makefile
1222 1223
ilbm/Makefile
iplan2p4/Makefile
Daniel Stone's avatar
Daniel Stone committed
1224 1225 1226 1227 1228 1229
mi/Makefile
miext/Makefile
miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/layer/Makefile
1230
miext/rootless/Makefile
Daniel Stone's avatar
Daniel Stone committed
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243
os/Makefile
randr/Makefile
render/Makefile
xkb/Makefile
Xext/Makefile
Xi/Makefile
xfixes/Makefile
hw/Makefile
hw/xfree86/Makefile
hw/xfree86/common/Makefile
hw/xfree86/common/xf86Build.h
hw/xfree86/ddc/Makefile
hw/xfree86/dixmods/Makefile
Adam Jackson's avatar
Adam Jackson committed
1244
hw/xfree86/dixmods/extmod/Makefile
1245
hw/xfree86/doc/Makefile
1246 1247
hw/xfree86/doc/devel/Makefile
hw/xfree86/doc/man/Makefile
1248
hw/xfree86/doc/sgml/Makefile
1249
hw/xfree86/dri/Makefile
Daniel Stone's avatar
Daniel Stone committed
1250
hw/xfree86/dummylib/Makefile
Chris Lee's avatar
Chris Lee committed
1251
hw/xfree86/exa/Makefile
Daniel Stone's avatar
Daniel Stone committed
1252
hw/xfree86/fbdevhw/Makefile
Alan Coopersmith's avatar
Alan Coopersmith committed
1253
hw/xfree86/getconfig/Makefile
Daniel Stone's avatar
Daniel Stone committed
1254 1255 1256 1257
hw/xfree86/i2c/Makefile
hw/xfree86/int10/Makefile
hw/xfree86/loader/Makefile
hw/xfree86/os-support/Makefile
1258
hw/xfree86/os-support/bsd/Makefile
Daniel Stone's avatar
Daniel Stone committed