summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 36153f0f1c7f8aca7637abbdba65b1361a5b38e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
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
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
dnl
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.

AC_PREREQ(2.53)
dnl we aren't intelligent about padding the version, so it always has to be four
dnl digits.  ho hum.
AC_INIT([xorg-server], 6.9.99.0, [daniel@freedesktop.org], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
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/xorg-config.h)
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/dix-config.h)

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

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

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_PID_T

# Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long])
AC_FUNC_ALLOCA

# Find the math libary
AC_CHECK_LIB(m, sqrt)

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

# VM86 headers
AC_CHECK_HEADERS([sys/vm86.h sys/io.h])

# AGPGART headers
AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h])

# APM header
AC_CHECK_HEADERS([linux/apm_bios.h])

# fbdev header
AC_CHECK_HEADERS([linux/fb.h])

# MTRR header
AC_CHECK_HEADERS([asm/mtrr.h])

# Handhelds.org touchscreen driver
AC_CHECK_HEADERS([linux/h3600_ts.h])

# tslib touchscreen driver
AC_CHECK_HEADERS([tslib.h])

AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
		[AC_TRY_RUN([
#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])])
if test "$ac_cv_sysv_ipc" = yes; then
	AC_DEFINE(HAVE_SYSV_IPC,1, [Define to 1 if SYSV IPC is available])
fi

case $host_cpu in
  sparc*)
  	xorg_bus_sbus="yes"
        DEFAULT_INT10=x86emu
	;;
  i*86)
        DEFAULT_INT10=vm86
        ;;
  *)
        DEFAULT_INT10=x86emu
        ;;
esac

REQUIRED_MODULES="randrproto renderproto fixesproto damageproto xextproto xfont xproto xtrans xau xf86dgaproto xf86miscproto xf86rushproto xf86vidmodeproto xf86bigfontproto"

DEFAULT_VENDOR_STRING="X.Org"
DEFAULT_VENDOR_RELEASE="$PACKAGE_VERSION"
# e.g. 6.9.99.1 -> 6,9,99,1,0
VERSION_STRING="${DEFAULT_VENDOR_RELEASE//./,},0"
DEFAULT_VENDOR_WEB="http://wiki.x.org"
EXTENSION_LIBS='$(top_builddir)/Xext/libXext.la'
DMX_EXTENSIONS='$(top_builddir)/Xext/libXext.la'" "'$(top_builddir)/render/librender.la'
CORE_INCS='-I$(top_srcdir)/include'
EXTENSION_INCS='-I$(top_srcdir)/Xext'
AC_DEFINE(XORG_SERVER, 1, [Build X.Org X server])

AC_ARG_ENABLE(werror,        [  --enable-werror ],[WERROR=$enableval],[WERROR=no])
AC_ARG_ENABLE(composite,     [  --enable-composite ],[COMPOSITE=$enableval],[COMPOSITE=no])
AC_ARG_ENABLE(mitshm,        [  --disable-shm ],[MITSHM=$enableval],[MITSHM=yes])
AC_ARG_ENABLE(xres,          [  --disable-xres ],[RES=$enableval],[RES=yes])
AC_ARG_ENABLE(xtrap,         [  --enable-xtrap ],[XTRAP=$enableval],[XTRAP=no])
AC_ARG_ENABLE(record,        [  --enable-record ],[RECORD=$enableval],[RECORD=no])
AC_ARG_ENABLE(screensaver,   [  --disable-screensaver ],[SCREENSAVER=$enableval],[SCREENSAVER=yes])
AC_ARG_ENABLE(xdmcp,         [  --disable-xdmcp ],[XDMCP=$enableval],[XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1,    [  --disable-xdm-auth-1 ],[XDMAUTH=$enableval],[XDMAUTH=auto])
AC_ARG_ENABLE(glx,           [  --enable-glx ],[GLX=$enableval],[GLX=no])
AC_ARG_ENABLE(dri,           [  --enable-dri ],[DRI=$enableval],[DRI=no])
AC_ARG_ENABLE(xinerama,	     [  --disable-xinerama ],[XINERAMA=$enableval],[XINERAMA=yes])
AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity],[Build Security extension (default: disabled)]),[XCSECURITY=$enableval],[XCSECURITY=no])
AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx],[Build DMX server (default: disabled)]),[DMX=$enableval],[DMX=no])
AC_ARG_ENABLE(xevie,          AS_HELP_STRING([--enable-xevie],[Build XEvIE extension (default: disabled)]), [XEVIE=$enableval],[XEVIE=no])

# Transport selection
AC_ARG_ENABLE(unix-transport,[  --disable-unix-transport ], [UNIXCONN=$enableval], [UNIXCONN=yes])
AC_ARG_ENABLE(tcp-transport, [  --disable-tcp-transport ], [TCPCONN=$enableval], [TCPCONN=yes])
AC_ARG_ENABLE(ipv6,          [  --disable-ipv6 ], [IPV6CONN=$enableval], [IPV6CONN=yes])

AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND],[int10 backend: vm86, x86emu or stub]),
				[INT10="$withval"],
				[INT10="$DEFAULT_INT10"])
AC_ARG_WITH(vendor-string,   [  --with-vendor-string=VENDOR ],
			     	[ VENDOR_STRING="$withval" ],
			     	[ VENDOR_STRING="$DEFAULT_VENDOR_STRING" ])
AC_ARG_WITH(vendor-release,  [  --with-vendor-release=RELEASE ],
				[ VENDOR_RELEASE="$withval" ],
				[ VENDOR_RELEASE="$DEFAULT_VENDOR_RELEASE" ])
AC_ARG_WITH(vendor-web,      [  --with-vendor-web=URL ],
				[ VENDOR_WEB="$withval" ],
				[ VENDOR_WEB="$DEFAULT_VENDOR_WEB" ])
AC_ARG_WITH(module-dir,      [  --with-module-dir=DIR ],
				[ moduledir="$withval" ],
				[ moduledir="$libdir/xorg/modules" ])
AC_ARG_WITH(builder-addr,    [  --with-builder-addr=ADDRESS ],
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])

AM_CONDITIONAL(INT10_VM86, [test x$INT10 = xvm86])
AM_CONDITIONAL(INT10_X86EMU, [test x$INT10 = xx86emu])
AM_CONDITIONAL(INT10_STUB, [test x$INT10 = xstub])

driverdir="$moduledir/drivers"
AC_SUBST([moduledir])
AC_SUBST([driverdir])
sdkdir="$includedir/xorg"
extdir="$includedir/X11/extensions"
AC_SUBST([sdkdir])
AC_SUBST([extdir])

AC_DEFINE(SHAPE,1,[Support SHAPE extension])

AM_CONDITIONAL(XV, [test x$XV = xyes])
if test "$XV" = yes; then
	AC_DEFINE(XV,1,[Support Xv Extension])
fi

AM_CONDITIONAL(DMX, [test x$DMX = xyes])
if test "$DMX" = yes; then
	PKG_CHECK_MODULES([DMXMODULES],[xmuu xextproto x11 xrender xfont])
	if test "$GLX" = yes; then
	    PKG_CHECK_MODULES(GL,gl)
	fi
fi

AM_CONDITIONAL(COMPOSITE, [test x$COMPOSITE = xyes])
if test "$COMPOSITE" = yes; then
	AC_DEFINE(COMPOSITE,1,[Support Composite Extension])
	REQUIRED_MODULES="$REQUIRED_MODULES compositeproto"
fi

AM_CONDITIONAL(MITSHM, [test x$MITSHM = xyes])
if test "$MITSHM" = yes; then
	AC_DEFINE(MITSHM,1,[Support MIT-SHM Extension])
	AC_DEFINE(HAS_SHM,1,[Support SHM])
fi

if test "$UNIXCONN" = "yes"; then
	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
fi
if test "$TCPCONN" = "yes"; then
	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
fi
if test "$IPV6CONN" = "yes"; then
	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
fi

AC_DEFINE(XKB,1,[Build XKB])
AC_DEFINE(XKB_IN_SERVER,1,[Build XKB server])
AC_DEFINE(XKB_DFLT_DISABLED,0,[Enable XKB per default])
AC_DEFINE(XINPUT,,[Build XInput])

AC_SUBST([XKB])

AM_CONDITIONAL(XTRAP, [test x$XTRAP = xyes])
if test "$XTRAP" = yes; then
	AC_DEFINE(XTRAP,1,[Support XTrap extension])
	DMX_EXTENSIONS="$DMX_EXTENSIONS "'$(top_builddir)/XTrap/libxtrap.la'
fi
AM_CONDITIONAL(RECORD, [test x$RECORD = xyes])
if test "$RECORD" = yes; then
	AC_DEFINE(RECORD,1,[Support Record extension])
	REQUIRED_MODULES="$REQUIRED_MODULES recordproto"
fi

AM_CONDITIONAL(SCREENSAVER, [test x$SCREENSAVER = xyes])
if test "$SCREENSAVER" = yes; then
	AC_DEFINE(SCREENSAVER,1,[Support MIT-SCREEN-SAVER extension])
fi
AM_CONDITIONAL(RES, [test x$RES = xyes])
if test "$RES" = yes; then
	AC_DEFINE(RES,1,[Support X resource extension])
	REQUIRED_MODULES="$REQUIRED_MODULES resourceproto"
fi
AM_CONDITIONAL(XCSECURITY, [test x$XCSECURITY = xyes])
if test "$XCSECURITY" = yes; then
	AC_DEFINE(XCSECURITY,1,[Build Security extension])
fi

AM_CONDITIONAL(GLX, test x$GLX = xyes)
if test "$GLX" = yes; then
	AC_DEFINE(GLXEXT,1,[Build GLX extension])
#	EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libglcore.la'
	dnl EXTENSION_INCS="$EXTENSION_INCS "'-I$(top_srcdir)/glx'
fi
AC_SUBST([MESA_SOURCE])

AM_CONDITIONAL(DRI, test x$DRI = xyes)
if test "$DRI" = yes; then
	AC_DEFINE(XORGDRI,1,[Build DRI extension])
	AC_DEFINE(_XORGDRI_SERVER_,1,[XORGDRI internal define])
fi
AC_DEFINE(XINPUT,1,[Support X Input extension])
EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/Xi/libXi.la'

AM_CONDITIONAL(XINERAMA, [test x$XINERAMA = xyes])
if test "$XINERAMA" = yes; then
	AC_DEFINE(XINERAMA,1,[Support Xinerama extension])
	AC_DEFINE(PANORAMIX,1,[Internal define for Xinerama])
	REQUIRED_MODULES="$REQUIRED_MODULES panoramixproto"
fi
AM_CONDITIONAL(XCSECURITY, [test x$XCSECURITY = xyes])
if test "$XCSECURITY" = yes; then
	AC_DEFINE(XCSECURITY,1,[Build Security extension])
fi
AM_CONDITIONAL(XEVIE, [test x$XEVIE = xyes])
if test "$XEVIE" = yes; then
	AC_DEFINE(XEVIE,1,[Build XEvIE extension])
fi

AM_CONDITIONAL(XLOADABLE, [test x$XLOADABLE = xyes])
if test "$XLOADABLE" = yes; then
	AC_DEFINE(XLOADABLE,1,[Support loadable input and output drivers])
fi

PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])

if test "$have_libxdmcp" = yes; then
	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
fi


if test x$XDMCP = xauto; then
	if test $have_libxdmcp = yes; then
		XDMCP=yes
	else
		XDMCP=no
	fi
fi
if test x$XDMAUTH = xauto; then
	if test $have_libxdmcp = yes -a x$have_xdmcpwrap = xyes; then
		XDMAUTH=yes
	else
		XDMAUTH=no
	fi
fi

AM_CONDITIONAL(XDMCP, [test x$XDMCP = xyes])
if test "$XDMCP" = yes; then
	AC_DEFINE(XDMCP,1,[Support Xdmcp])
	REQUIRED_MODULES="$REQUIRED_MODULES xdmcp"
fi

AM_CONDITIONAL(XDMAUTH, [test x$XDMAUTH = xyes])
if test "$XDMAUTH" = yes; then
	AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
	if test "x$XDMCP" != yes; then
		REQUIRED_MODULES="$REQUIRED_MODULES xdmcp"
	fi
fi

if test "$ac_cv_header_tslib_h" = yes; then
	AC_DEFINE(TSLIB, 1, [Include tslib touchscreen driver])
	TSLIB=yes
else
	TSLIB=no
fi

AM_CONDITIONAL(TSLIB, [test x$TSLIB = xyes])
if test "$TSLIB" = yes; then
	AC_DEFINE(TSLIB,1,[Support tslib touchscreen abstraction library])
else

dnl Make sure tslib and ipaq ts dont *both* get enabled.  

	if test "$ac_cv_header_linux_h3600_ts_h" = yes; then
	   AC_DEFINE(H3600_TS, 1, [Include handhelds.org h3600 touchscreen driver])
	   H3600_TS=yes
	else
	   H3600_TS=no
fi

fi

AM_CONDITIONAL(H3600_TS, [test "$H3600_TS" = yes])
if test "$TSLIB" = yes -o "$H3600_TS" = yes; then
	AC_DEFINE(TOUCHSCREEN,1,[Enable touchscreen support])
fi

AM_CONDITIONAL(USE_RGB_BUILTIN, [test x$USE_RGB_BUILTIN = xyes])
if test "$USE_RGB_BUILTIN" = yes; then
	AC_DEFINE(USE_RGB_BUILTIN,1,[Use builtin rgb color database])
fi

# yes, this is redundant.  bite me.
PKG_CHECK_MODULES(XFONT, xfont)
#AC_CHECK_LIB(Xfont, fs_register_fpe_functions, [have_xfont_fc="yes"], [have_xfont_fc="no"], [$XFONT_LIBS])
#if test "$have_xfont_fc" = no; then
#	AC_MSG_ERROR([Your version of libXfont was not compiled with
#	              --enable-fc.  Please recompile libXfont with
#	              --enable-fc.])
#fi

AC_DEFINE_UNQUOTED(COMPILEDDEFAULTFONTPATH, ["$FONTPATH"], [Default font path])
AC_DEFINE_UNQUOTED(XVENDORNAME,["$VENDOR_STRING"], [Vendor name])
AC_DEFINE_UNQUOTED(XORG_RELEASE, ["$VENDOR_RELEASE"], [Vendor release])
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])

dnl
dnl A bunch of configuration values which shouldn't be optional
dnl
AC_DEFINE(RENDER,1,[Support RENDER extension])
EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/render/librender.la'
EXTENSION_INCS="$EXTENSION_INCS "'-I$(top_srcdir)/render'

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

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])
AC_DEFINE(NDEBUG,1,[Disable some debugging code])
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])
AC_DEFINE(XFIXES,1,[Support XFixes extension])
AC_DEFINE(XF86VIDMODE,1,[Support XFree86 Video Mode extension])
AC_DEFINE(XF86MISC,1,[Support XFree86 miscellaneous extensions])
# must come first as it uses stuff in Shape -d
EXTENSION_LIBS='$(top_builddir)/xfixes/libxfixes.la'" $EXTENSION_LIBS"
EXTENSION_INCS="$EXTENSION_INCS "'-I$(top_srcdir)/xfixes'

AC_DEFINE(DAMAGE,1,[Support Damage extension])
EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/damageext/libdamageext.la'
EXTENSION_INCS="$EXTENSION_INCS "'-I$(top_srcdir)/damageext'

if test "$COMPOSITE" = yes; then
	EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/composite/libcomposite.la'" "'$(top_builddir)/miext/cw/libcw.la'
	EXTENSION_INCS="$EXTENSION_INCS "'-I$(top_srcdir)/composite'
fi

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'
FB_INC='-I$(top_srcdir)/fb'
DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
DAMAGE_INC='-I$(top_srcdir)/miext/damage'
SHADOW_INC='-I$(top_srcdir)/miext/shadow'
LAYER_LIB='$(top_builddir)/miext/layer/liblayer.la'
XPSTUBS_LIB='$(top_builddir)/dix/libxpstubs.la'
XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'

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

XORG_CORE_LIBS="$DIX_LIB"
XORG_LIBS="$FB_LIB $MI_LIB $XI_LIB $XKB_LIB $COMPOSITE_LIB $DAMAGE_LIB $LAYER_LIB $EXTENSION_LIBS $XPSTUBS_LIB $OS_LIB $SHADOW_LIB"
XDMX_LIBS="$OS_LIB $DAMAGE_LIB $MINIMI_LIB $XKB_LIB $XI_LIB $DMX_EXTENSIONS"
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"
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $EXTENSION_INCS $MI_INC $DAMAGE_INC $SHADOW_INC $FB_INC $XI_INC"
if test "$WORDS_BIGENDIAN" = yes; then
	ENDIAN="X_BIG_ENDIAN"
else
	ENDIAN="X_LITTLE_ENDIAN"
fi
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
XORG_CFLAGS="$XORGSERVER_CFLAGS $XORG_INCS"
case $host_os in
  linux-gnu*)
  	# support: yea
  	XORG_OS="linux"
	XORG_OS_SUBDIR="linux"
	;;
  freebsd*)
  	# support: nay
  	XORG_OS="freebsd"
	XORG_OS_SUBDIR="bsd"
	;;
  netbsd*)
  	# support: nay
  	XORG_OS="netbsd"
	XORG_OS_SUBDIR="bsd"
	;;
  openbsd*)
 	# support: nay
  	XORG_OS="openbsd"
	XORG_OS_SUBDIR="bsd"
	;;
  solaris*)
  	# support: nay
  	XORG_OS="solaris"
	XORG_OS_SUBDIR="solaris"
	;;
  *)
  	XORG_OS="unknown"
	XORG_OS_SUBDIR="unknown"
	AC_MSG_ERROR([Your OS is unknown. Xorg currently only supports Linux, \
	Free/Open/NetBSD, and Solaris. If you are interested in porting Xorg \
	to your platform, please email xorg@lists.freedesktop.org.])
	;;
esac
AC_SUBST([XORG_CORE_LIBS])
AC_SUBST([XORG_LIBS])
AC_SUBST([EXTENSION_LIBS])
AC_SUBST([XDMX_LIBS])
AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS])
AC_SUBST([XORG_OS_SUBDIR])
AM_CONDITIONAL([XORG_BUS_SBUS], [test "x$xorg_bus_sbus" = xyes])

dnl these only go in xorg-config.h
CONFIGFILE="$sysconfdir/xorg.conf"
LOGPREFIX="$localstatedir/log/Xorg."
XKBDIR="$datadir/X11/xkb"
AC_DEFINE(XFree86Server,1,[Building XFree86 server])
AC_DEFINE(XORGSERVER,,[Building Xorg 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])
AC_DEFINE(__XKBDEFRULES__,"xorg",[Default XKB rules])
AC_DEFINE(DLOPEN_SUPPORT,1,[Use libdl-based loader])
AC_DEFINE(DRIVERS,{},[Built-in output drivers])
AC_DEFINE(IDRIVERS,{},[Built-in input drivers])
AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE,[Location of configuration file])
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_DIR(XKB_BASE_DIRECTORY, XKBDIR, [Path to XKB data])
AC_DEFINE(XORGSERVER,,[Build Xorg server])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])

dnl and the rest of these are generic, so they're in config.h
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])
AC_DEFINE(_POSIX_SOURCE,500,[POSIX-compliant source])
AC_DEFINE(_XOPEN_SOURCE,1,[X/Open-compliant source])
AC_DEFINE(_BSD_SOURCE,1,[BSD-compliant source])

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

AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
AC_SUBST([XORG_CFLAGS])

CFLAGS="$XSERVER_CFLAGS $CFLAGS"
AC_SUBST([CFLAGS])

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

AC_MSG_CHECKING(if unaligned word accesses behave as expected)
AC_TRY_RUN([
#include <stdio.h>

int main()
{
        char j[8]={1,2,3,4,5,6,7,8};
        int k= *(int *)(j+1);
        if(k==0x02030405 || k==0x05040302)
                return 0;
        return 1;
}
],
 [AC_DEFINE(WORKING_UNALIGNED_INT, 1, [unaligned word accesses behave as expected])
  AC_MSG_RESULT(yes)], 
 AC_MSG_RESULT(no),
 AC_MSG_RESULT(assuming not on target machine))

AC_SUBST([libdir exec_prefix prefix])

AC_OUTPUT([
Makefile
include/Makefile
afb/Makefile
composite/Makefile
damageext/Makefile
dix/Makefile
fb/Makefile
record/Makefile
XTrap/Makefile
mfb/Makefile
cfb/Makefile
cfb16/Makefile
cfb24/Makefile
cfb32/Makefile
mi/Makefile
miext/Makefile
miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/layer/Makefile
os/Makefile
randr/Makefile
render/Makefile
xkb/Makefile
Xext/Makefile
Xext/extmod/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
hw/xfree86/dummylib/Makefile
hw/xfree86/fbdevhw/Makefile
hw/xfree86/i2c/Makefile
hw/xfree86/int10/Makefile
hw/xfree86/loader/Makefile
hw/xfree86/os-support/Makefile
hw/xfree86/os-support/bus/Makefile
hw/xfree86/os-support/misc/Makefile
hw/xfree86/os-support/linux/Makefile
hw/xfree86/os-support/linux/drm/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/rac/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/scanpci/Makefile
hw/xfree86/shadowfb/Makefile
hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
hw/xfree86/xaa/Makefile
hw/xfree86/xf1bpp/Makefile
hw/xfree86/xf4bpp/Makefile
hw/xfree86/xf8_16bpp/Makefile
hw/xfree86/xf8_32wid/Makefile
hw/dmx/input/Makefile
hw/dmx/glxProxy/Makefile
hw/dmx/Makefile
xorg-server.pc
])