summaryrefslogtreecommitdiff
path: root/configure.ac
blob: eb90b1ae0f0316179fa5a8f7ceaf50d98cf3c0b0 (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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
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
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
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
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
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
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
dnl
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:
dnl
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.
dnl
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
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ(2.60)
AC_INIT([xorg-server], 1.14.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2013-10-31"
RELEASE_NAME="Bom Retiro"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AC_USE_SYSTEM_EXTENSIONS

# Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
m4_ifndef([XORG_MACROS_VERSION],
          [m4_fatal([must install xorg-macros 1.14 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.14)
XORG_DEFAULT_OPTIONS
XORG_WITH_DOXYGEN(1.6.1)
XORG_CHECK_SGML_DOCTOOLS(1.8)
XORG_ENABLE_DOCS
XORG_ENABLE_DEVEL_DOCS
XORG_WITH_XMLTO(0.0.20)
XORG_WITH_FOP
XORG_WITH_XSLTPROC
XORG_ENABLE_UNIT_TESTS
XORG_LD_WRAP([optional])

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

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)
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
AC_CONFIG_HEADERS(include/xkb-config.h)
dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
dnl version-config.h covers the version numbers so they can be bumped without
dnl forcing an entire recompile.x
AC_CONFIG_HEADERS(include/version-config.h)

AM_PROG_AS
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
AC_PROG_LEX
AC_PROG_YACC
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP

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

dnl Explicitly add -fno-strict-aliasing since this option should disappear
dnl from util-macros CWARNFLAGS
if  test "x$GCC" = xyes ; then
    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
fi

dnl Check for dtrace program (needed to build Xserver dtrace probes)
dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
dnl ISDN trace program named dtrace
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
	     [Enable dtrace probes (default: enabled if dtrace found)]),
	     [WDTRACE=$withval], [WDTRACE=auto])
if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
	AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
	if test "x$DTRACE" = "xnot_found" ; then
		if test "x$WDTRACE" = "xyes" ; then
			AC_MSG_FAILURE([dtrace requested but not found])
		fi
		WDTRACE="no"
	else
		AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
		if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
			WDTRACE="no"
		fi
	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.])

# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
# object files, and require linking with those as relocatable objects, not .a
# archives. MacOS X handles all this in the normal compiler toolchain, and on
# some releases (like Tiger), will error out on dtrace -G.  For now, other
# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
# ports appear to, based on my web searches, but have not yet been tested).
	case $host_os in
		darwin*)	SPECIAL_DTRACE_OBJECTS=no ;;
		*)		SPECIAL_DTRACE_OBJECTS=yes ;;
	esac
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])

AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_TYPEOF
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

AC_TYPE_PID_T

# 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/types.h>
#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])

	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
	AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/endian.h>
 ], [
int a = 1, b;
b = bswap16(a);
 ])
], [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
		BSWAP=bswap
	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

dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
	AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
AC_SUBST(DLOPEN_LIBS)

dnl Checks for library functions.
AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
	getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
	mmap seteuid shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])

dnl Find the math libary, then check for cbrt function in it.
AC_CHECK_LIB(m, sqrt)
AC_CHECK_FUNCS([cbrt])

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

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

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

dnl MTRR header
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

dnl BSD MTRR header
AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
if test "x$ac_cv_memrange_h" = xyes; then
	HAVE_MTRR=yes
fi

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

dnl A NetBSD MTRR header
AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
if test "x$ac_cv_machine_mtrr_h" = xyes; then
	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_CHECK_HEADERS([sys/linker.h],
	[ac_cv_sys_linker_h=yes],
	[ac_cv_sys_linker_h=no],
	[#include <sys/param.h>])
AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])

AC_CACHE_CHECK([for SYSV IPC],
		ac_cv_sysv_ipc,
		[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
],[
{ 
    int id;
    id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
    if (id < 0) return -1;
    return shmctl(id, IPC_RMID, 0);
}],
	[ac_cv_sysv_ipc=yes],
	[ac_cv_sysv_ipc=no])])
if test "x$ac_cv_sysv_ipc" = xyes; then
	AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
fi

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

dnl BSD APM support 
AC_CHECK_HEADER([machine/apmvar.h],[
	AC_CHECK_HEADER([sys/event.h],
		ac_cv_BSD_KQUEUE_APM=yes,
		ac_cv_BSD_APM=yes)])

AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
	
dnl glibc backtrace support check
AC_CHECK_HEADER([execinfo.h],[
    AC_CHECK_LIB(c, backtrace, [
        AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
        AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
    ])]
)

PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
if test "x$HAVE_LIBUNWIND" = xyes; then
	AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
fi
AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes])


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

dnl Override defaults as needed for specific platforms:

case $host_cpu in
  alpha*)
	ALPHA_VIDEO=yes
	case $host_os in
	        *freebsd*)	SYS_LIBS=-lio ;;
		*netbsd*)	AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
	esac
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
	;;
  arm*)
	ARM_VIDEO=yes
	;;
  i*86)
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
				SYS_LIBS=-li386
				;;
		*openbsd*)	AC_DEFINE(USE_I386_IOPL) 
				SYS_LIBS=-li386
				;;
	esac
        ;;
  powerpc*)
	PPC_VIDEO=yes
	case $host_os in
		*freebsd*)	DEFAULT_INT10=stub ;;
	esac
	;;
  sparc*)
	SPARC64_VIDEO=yes
	BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  x86_64*|amd64*)
	I386_VIDEO=yes
	case $host_os in
		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
				SYS_LIBS=-lx86_64
				;;
		*openbsd*)	AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
				SYS_LIBS=-lamd64
				;;
	esac
	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  ia64*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
  s390*)
  	GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
	;;
esac
AC_SUBST(GLX_ARCH_DEFINES)

dnl BSD *_video.c selection
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])

DRI=no
USE_SIGIO_BY_DEFAULT="yes"
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
  *freebsd* | *dragonfly*)
	case $host_os in
		kfreebsd*-gnu) ;;
		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
	esac
	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])
	DRI=yes
	;;
  *netbsd*)
	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(WSCONS_SUPPORT, 1, [System has wscons console])
	DRI=yes
	;;
  *openbsd*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
	;;
  *linux*)
	DRI=yes
	;;
  *solaris*)
	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
	# Disable use of SIGIO by default until some system bugs are
	# fixed - see Sun/OpenSolaris bug id 6879897
	USE_SIGIO_BY_DEFAULT="no"
	;;
  darwin*)
	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
	;;
  cygwin*|mingw*)
	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
	;;
esac

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 | cut -d - -f 1`
if test "x$PVS" = "x"; then
	PVS="0"
fi

VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"

VENDOR_NAME="The X.Org Foundation"
VENDOR_NAME_SHORT="X.Org"
VENDOR_WEB="http://wiki.x.org"

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

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

AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
				  [Enable debugging (default: disabled)]),
			        [DEBUGGING=$enableval], [DEBUGGING=no])
AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
  [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
                                [USE_SIGIO_BY_DEFAULT=$enableval], [])
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-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
				  [Vendor string reported by the server]),
				[ VENDOR_NAME="$withval" ], [])
AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
				  [Short version of vendor string reported by the server]),
				[ VENDOR_NAME_SHORT="$withval" ], [])
AC_ARG_WITH(vendor-web,      AS_HELP_STRING([--with-vendor-web=URL],
				  [Vendor web address reported by the server]),
				[ VENDOR_WEB="$withval" ], [])
AC_ARG_WITH(module-dir,      AS_HELP_STRING([--with-module-dir=DIR],
				  [Directory where modules are installed (default: $libdir/xorg/modules)]),
				[ moduledir="$withval" ],
				[ moduledir="${libdir}/xorg/modules" ])
AC_ARG_WITH(log-dir,         AS_HELP_STRING([--with-log-dir=DIR],
				  [Directory where log files are kept (default: $localstatedir/log)]),
				[ logdir="$withval" ],
				[ logdir="$localstatedir/log" ])
AC_ARG_WITH(builder-addr,    AS_HELP_STRING([--with-builder-addr=ADDRESS],
				  [Builder address (default: xorg@lists.freedesktop.org)]),
				[ BUILDERADDR="$withval" ],
				[ BUILDERADDR="xorg@lists.freedesktop.org" ])
AC_ARG_WITH(os-name,         AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
				[ OSNAME="$withval" ],
				[ OSNAME=`uname -srm` ])
AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
				[ OSVENDOR="$withval" ],
				[ OSVENDOR="" ])
AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
				[ BUILDERSTRING="$withval" ]
				[ ])

dnl Determine font path
XORG_FONTROOTDIR
XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)

dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
dnl compiling, assume default font path uses standard FONTROOTDIR directories.
DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
if test "$cross_compiling" != yes; then
	AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
		[DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
		[case $host_os in
			darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
		esac])
fi
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
				[ FONTPATH="$withval" ],
				[ FONTPATH="${DEFAULT_FONT_PATH}" ])

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

AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
				[ XKBPATH="$withval" ],
				[ XKBPATH="${datadir}/X11/xkb" ])
AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
				[ XKBOUTPUT="$withval" ],
				[ XKBOUTPUT="compiled" ])
AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                   [Keyboard ruleset (default: base/evdev)]),
                                [ XKB_DFLT_RULES="$withval" ],
                                [ XKB_DFLT_RULES="" ])
AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
                                   [Keyboard model (default: pc105)]),
                                [ XKB_DFLT_MODEL="$withval" ],
                                [ XKB_DFLT_MODEL="pc105" ])
AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                   [Keyboard layout (default: us)]),
                                [ XKB_DFLT_LAYOUT="$withval" ],
                                [ XKB_DFLT_LAYOUT="us" ])
AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
                                   [Keyboard variant (default: (none))]),
                                [ XKB_DFLT_VARIANT="$withval" ],
                                [ XKB_DFLT_VARIANT="" ])
AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
                                   [Keyboard layout options (default: (none))]),
                                [ XKB_DFLT_OPTIONS="$withval" ],
                                [ XKB_DFLT_OPTIONS="" ])
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
				   [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
				[ SERVERCONFIG="$withval" ],
				[ SERVERCONFIG="${libdir}/xorg" ])
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
				[ APPLE_APPLICATIONS_DIR="${withval}" ],
				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
AC_SUBST([APPLE_APPLICATIONS_DIR])
AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
				[ APPLE_APPLICATION_NAME="${withval}" ],
				[ APPLE_APPLICATION_NAME="X11" ])
AC_SUBST([APPLE_APPLICATION_NAME])
AC_ARG_WITH(launchd-id-prefix,  AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
                                [ BUNDLE_ID_PREFIX="${withval}" ],
                                [ BUNDLE_ID_PREFIX="org.x" ])
AC_ARG_WITH(bundle-id-prefix,  AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
                               [ BUNDLE_ID_PREFIX="${withval}" ])
AC_SUBST([BUNDLE_ID_PREFIX])
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
				[ XQUARTZ_SPARKLE="${enableval}" ],
				[ XQUARTZ_SPARKLE="no" ])
AC_SUBST([XQUARTZ_SPARKLE])
AC_ARG_ENABLE(install-libxf86config,
				AS_HELP_STRING([--enable-install-libxf86config],
				[Install libxf86config (default: disabled)]),
				[INSTALL_LIBXF86CONFIG=$enableval],
				[INSTALL_LIBXF86CONFIG=no])
AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
				[SYMBOL_VISIBILITY=$enableval],
				[SYMBOL_VISIBILITY=auto])

dnl GLX build options
AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
                                [AIGLX=$enableval],
                                [AIGLX=yes])
XORG_TLS
AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
                                [GLX_USE_TLS=$enableval
                                 if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
                                   AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.])
                                 fi],
                                [GLX_USE_TLS=no
                                 if test "${ac_cv_tls}" != "none" ; then
                                   GLX_USE_TLS=yes
                                 fi])
AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Path to Khronos OpenGL registry database files (default: auto)]),
				[KHRONOS_SPEC_DIR="${withval}"],
				[KHRONOS_SPEC_DIR=auto])

dnl Extensions.
AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
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-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
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(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
AC_ARG_ENABLE(dga,            AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
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(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
AC_ARG_ENABLE(dri3,           AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto])
AC_ARG_ENABLE(present,	      AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes])
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: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
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])
AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])

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(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
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])
dnl kdrive options
AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])


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])
AC_MSG_CHECKING([to see if we can install the Xorg server as root])
if test "x$SETUID" = "xauto" ; then
	case $host_os in
	    cygwin*)		SETUID="no"  ;;
	    mingw*)		SETUID="no"  ;;
	    darwin*)		SETUID="no"  ;;
	    *)
	   	case $host_cpu in
		    sparc)	SETUID="no"  ;;
		    *)		SETUID="yes" ;;
		esac
	esac
	if test "x$SETUID" = xyes; then
		touch testfile
		chown root testfile > /dev/null 2>&1 || SETUID="no"
		rm -f testfile
	fi
fi
AC_MSG_RESULT([$SETUID])
AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])

dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
dnl was not expanded, since xorg-server 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

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

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

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

dnl DDX Detection... Yes, it's ugly to have it here... but we need to
dnl handle this early on so that we don't require unsupported extensions
case $host_os in
	cygwin* | mingw*)
		CONFIG_DBUS_API=no
		CONFIG_HAL=no
		CONFIG_UDEV=no
		CONFIG_UDEV_KMS=no
		DGA=no
		DRI2=no
		DRI3=no
		INT10MODULE=no
		PCI=no
		VGAHW=no
		VBE=no
		XF86UTILS=no
		XF86VIDMODE=no
		XSELINUX=no
		XV=no
		SYMBOL_VISIBILITY=no
		;;
	darwin*)
		PCI=no
		INT10MODULE=no
		VGAHW=no
		VBE=no
		DRM=no
		DRI2=no
		DRI3=no

		if test x$XQUARTZ = xauto; then
			AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
		 		save_LDFLAGS=$LDFLAGS
				LDFLAGS="$LDFLAGS -framework Carbon"
				AC_LINK_IFELSE([AC_LANG_SOURCE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}])],
				               [xorg_cv_Carbon_framework=yes],
				               [xorg_cv_Carbon_framework=no])
			        LDFLAGS=$save_LDFLAGS])
                
			if test "X$xorg_cv_Carbon_framework" = Xyes; then
				XQUARTZ=yes
			else
				XQUARTZ=no
			fi
		fi

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

		if test "x$XQUARTZ" = xyes ; then
			XQUARTZ=yes
			XVFB=no
			XNEST=no

			COMPOSITE=no
			DGA=no
			DPMSExtension=no
			XF86VIDMODE=no
		fi
		;;
	*) XQUARTZ=no ;;
esac

dnl ---------------------------------------------------------------------------
dnl Extension section
dnl ---------------------------------------------------------------------------
XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'

dnl Optional modules
VIDEOPROTO="videoproto"
COMPOSITEPROTO="compositeproto >= 0.4"
RECORDPROTO="recordproto >= 1.13.99.1"
SCRNSAVERPROTO="scrnsaverproto >= 1.1"
RESOURCEPROTO="resourceproto >= 1.2.0"
DRIPROTO="xf86driproto >= 2.1.0"
DRI2PROTO="dri2proto >= 2.8"
DRI3PROTO="dri3proto >= 1.0"
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
GLPROTO="glproto >= 1.4.16"
DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
APPLEWMPROTO="applewmproto >= 1.4"
XSHMFENCE="xshmfence"

dnl Required modules
XPROTO="xproto >= 7.0.22"
RANDRPROTO="randrproto >= 1.4.0"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.2.99.901"
INPUTPROTO="inputproto >= 2.3"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto"
FIXESPROTO="fixesproto >= 5.0"
DAMAGEPROTO="damageproto >= 1.1"
XCMISCPROTO="xcmiscproto >= 1.2.0"
BIGREQSPROTO="bigreqsproto >= 1.1.0"
XTRANS="xtrans >= 1.3.2"
PRESENTPROTO="presentproto >= 1.0"

dnl List of libraries that require a specific version
LIBAPPLEWM="applewm >= 1.4"
LIBDMX="dmx >= 1.0.99.1"
LIBDRI="dri >= 7.8.0"
LIBDRM="libdrm >= 2.3.0"
LIBGL="gl >= 7.1.0"
LIBXEXT="xext >= 1.0.99.4"
LIBXFONT="xfont >= 1.4.2"
LIBXI="xi >= 1.2.99.1"
LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.12.901"
LIBUDEV="libudev >= 143"
LIBSELINUX="libselinux >= 2.0.86"
LIBDBUS="dbus-1 >= 1.0"
LIBPIXMAN="pixman-1 >= 0.27.2"

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

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

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

if test "x$CONFIG_UDEV" = xyes &&
 { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
fi

PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
	CONFIG_UDEV="$HAVE_LIBUDEV"
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
	CONFIG_DBUS_API=no
	CONFIG_HAL=no
	if test "x$CONFIG_UDEV_KMS" = xauto; then
		CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
	fi
	if ! test "x$HAVE_LIBUDEV" = xyes; then
		AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
	fi
	AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
	if test "x$CONFIG_UDEV_KMS" = xyes; then
		AC_DEFINE(CONFIG_UDEV_KMS, 1, [Use libudev for kms enumeration])
	fi
	SAVE_LIBS=$LIBS
	SAVE_CFLAGS=$CFLAGS
	CFLAGS=$UDEV_CFLAGS
	LIBS=$UDEV_LIBS
	AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag])
	AC_CHECK_FUNCS([udev_enumerate_add_match_tag])
	LIBS=$SAVE_LIBS
	CFLAGS=$SAVE_CFLAGS
fi
AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])

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, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
if test "x$HAVE_DBUS" = xyes; then
	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
fi
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])
	CONFIG_NEED_DBUS="yes"
fi
AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])

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])
	CONFIG_NEED_DBUS="yes"
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])

if test "x$CONFIG_NEED_DBUS" = xyes; then
        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
fi
AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])

if test "x$CONFIG_WSCONS" = xauto; then
	case $host_os in
		*openbsd*)
			CONFIG_WSCONS=yes;
			;;
		*)
			CONFIG_WSCONS=no;
			;;
	esac
fi
AM_CONDITIONAL(CONFIG_WSCONS, [test "x$CONFIG_WSCONS" = xyes])
if test "x$CONFIG_WSCONS" = xyes; then
	AC_DEFINE(CONFIG_WSCONS, 1, [Use wscons for input auto configuration])
fi

if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
else
	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
fi
AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
		   [Use SIGIO handlers for input device events by default])

AC_MSG_CHECKING([for glibc...])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#include <features.h>
#ifndef __GLIBC__
#error
#endif
])], glibc=yes, glibc=no)
AC_MSG_RESULT([$glibc])

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"
    CPPFLAGS_SAVE="$CPPFLAGS"

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

    AC_RUN_IFELSE([AC_LANG_SOURCE([
#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"
    CPPFLAGS="$CPPFLAGS_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

AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
	AC_DEFINE(XV, 1, [Support Xv extension])
	AC_DEFINE(XvExtension, 1, [Build Xv extension])
	REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
else
	XVMC=no
fi

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

AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
if test "x$XREGISTRY" = xyes; then
	AC_DEFINE(XREGISTRY, 1, [Build registry module])
fi

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

if test "x$MITSHM" = xauto; then
	MITSHM="$ac_cv_sysv_ipc"
fi
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])
fi

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

AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
	AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
	REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $SCRNSAVERPROTO"
fi

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

# The XRes extension may support client ID tracking only if it has
# been specifically enabled. Client ID tracking is implicitly not
# supported if XRes extension is disabled.
AC_MSG_CHECKING([whether to track client ids])
if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then
	AC_DEFINE(CLIENTIDS, 1, [Support client ID tracking])
else
	CLIENTIDS=no
fi
if test "x$CLIENTIDS" = xyes; then
	case $host_os in
	openbsd*)
		SYS_LIBS="$SYS_LIBS -lkvm"
	;;
	esac
fi
AC_MSG_RESULT([$CLIENTIDS])
AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])

AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
	REQUIRED_MODULES="$REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
fi

PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
                  [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
case "$DRI2,$HAVE_DRI2PROTO" in
	yes,no)
		AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
		;;
	yes,yes | auto,yes)
		AC_DEFINE(DRI2, 1, [Build DRI2 extension])
		DRI2=yes
		LIBGL="gl >= 9.2.0"
		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
		;;
esac
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)

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

case "x$XTRANS_SEND_FDS" in
xauto)
	case "$host_os" in
	linux*|solaris*)
		XTRANS_SEND_FDS=yes
		;;
	*)
		XTRANS_SEND_FDS=no
		;;
	esac
esac

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

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

PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
                  [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])

case "$DRI3,$HAVE_DRI3PROTO" in
	yes,yes | auto,yes)
		;;
	yes,no)
		AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
		DRI3=no
		;;
	no,*)
		;;
	*)
		AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
		DRI3=no
		;;
esac

AC_CHECK_FUNCS([sigaction])

BUSFAULT=no

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

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

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

PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
		  [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])

AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes)

case x"$HAVE_XSHMFENCE" in
	xyes)
		AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library])
		REQUIRED_LIBS="$REQUIRED_LIBS xshmfence"
		;;
esac


case "$DRI3,$HAVE_XSHMFENCE" in
	yes,yes | auto,yes)
		;;
	yes,no)
		AC_MSG_ERROR("DRI3 requested, but xshmfence not found.])
		DRI3=no
		;;
	no,*)
		;;
	*)
		AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
		DRI3=no
		;;
esac

case x"$DRI3" in
	xyes|xauto)
		DRI3=yes
		AC_DEFINE(DRI3, 1, [Build DRI3 extension])
		DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
		AC_MSG_NOTICE([DRI3 enabled]);
		;;
esac

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

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

if test "x$DRI2" = xyes; then
	save_CFLAGS=$CFLAGS
	CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
	AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#ifndef __DRI_DRI2
#error DRI2 extension not available.
#endif]])],
			  [HAVE_DRI2EXTENSION=yes],
			  [HAVE_DRI2EXTENSION=no])
	CFLAGS=$save_CFLAGS
	if test "x$HAVE_DRI2EXTENSION" = xyes; then
		AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
		DRI2_AIGLX=yes
	else
		AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
		DRI2_AIGLX=no
	fi
fi
AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)

if test "x$GLX" = xyes; then
	PKG_CHECK_MODULES([XLIB], [x11])
	PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
	AC_SUBST(XLIB_CFLAGS)
	AC_DEFINE(GLXEXT, 1, [Build GLX extension])
	GLX_LIBS='$(top_builddir)/glx/libglx.la'
	GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
else
        GLX=no
fi
AM_CONDITIONAL(GLX, test "x$GLX" = xyes)

if test "x$GLX" = xno; then
        AIGLX=no
fi

if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then
	AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
fi
AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)

if test "x$GLX_USE_TLS" = xyes ; then
	GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
	GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
fi
AC_SUBST([GLX_DEFINES])
AC_SUBST([GLX_SYS_LIBS])

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

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])
	REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
fi

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

AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
if test "x$XSELINUX" = xyes; then
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
	fi
	AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
	AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
	PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
	SELINUX_LIBS="$SELINUX_LIBS -laudit"
	AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
fi

AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then
	if test "x$XACE" != xyes; then
		AC_MSG_ERROR([cannot build Security extension without X-ACE])
	fi
	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
fi

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'
	DBE_INC='-I$(top_srcdir)/dbe'
fi

AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
if test "x$XF86BIGFONT" = xyes; then
	AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
	REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $BIGFONTPROTO"
fi

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

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'

# XINPUT extension is integral part of the server
AC_DEFINE(XINPUT, 1, [Support X Input extension])
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'

AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)

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

AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
AC_ARG_WITH(xkb-bin-directory,
				AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
				[XKB_BIN_DIRECTORY="$withval"],
				[XKB_BIN_DIRECTORY="$bindir"])

AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])

dnl Make sure XKM_OUTPUT_DIR is an absolute path
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
   XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
fi

dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused

XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
AC_SUBST(XKB_COMPILED_DIR)

if test "x$XKB_DFLT_RULES" = x; then
    case $host_os in
    linux*)
        dnl doesn't take AutoAddDevices into account, but whatever.
        XKB_DFLT_RULES="evdev"
        ;;
    *)
        XKB_DFLT_RULES="base"
        ;;
    esac
fi
AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
AC_SUBST([XKB_DFLT_RULES])
AC_SUBST([XKB_DFLT_MODEL])
AC_SUBST([XKB_DFLT_LAYOUT])
AC_SUBST([XKB_DFLT_VARIANT])
AC_SUBST([XKB_DFLT_OPTIONS])

XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"

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
		XDMCP=yes
	else
		XDMCP=no
	fi
fi
if test "x$XDMAUTH" = xauto; then
	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
		XDMAUTH=yes
	else
		XDMAUTH=no
	fi
fi

AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
if test "x$XDMCP" = xyes; then
	AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
	REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
	XDMCP_MODULES="xdmcp"
fi

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

AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])

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

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

AC_SUBST([VENDOR_NAME_SHORT])
AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])

AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])

if test "x$DEBUGGING" = xyes; then
       AC_DEFINE(DEBUG, 1, [Enable debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])

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])

if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
  DIX_LIB='$(top_builddir)/dix/dix.O'
  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
else
  DIX_LIB='$(top_builddir)/dix/libdix.la'
  OS_LIB='$(top_builddir)/os/libos.la'
fi
AC_SUBST([DIX_LIB])
AC_SUBST([OS_LIB])

MAIN_LIB='$(top_builddir)/dix/libmain.la'
AC_SUBST([MAIN_LIB])

MI_LIB='$(top_builddir)/mi/libmi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi'
FB_LIB='$(top_builddir)/fb/libfb.la'
FB_INC='-I$(top_srcdir)/fb'
MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
MIEXT_SYNC_INC='-I$(top_srcdir)/miext/sync'
MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.la'
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'

# SHA1 hashing
AC_ARG_WITH([sha1],
            [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
                            [choose SHA1 implementation])])
AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
	with_sha1=libc
fi
if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
	AC_MSG_ERROR([libc requested but not found])
fi
if test "x$with_sha1" = xlibc; then
	AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
		[Use libc SHA1 functions])
	SHA1_LIBS=""
fi
AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
	with_sha1=CommonCrypto
fi
if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
	AC_MSG_ERROR([CommonCrypto requested but not found])
fi
if test "x$with_sha1" = xCommonCrypto; then
	AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
		[Use CommonCrypto SHA1 functions])
	SHA1_LIBS=""
fi
dnl stdcall functions cannot be tested with AC_CHECK_LIB
AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
	with_sha1=CryptoAPI
fi
if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
	AC_MSG_ERROR([CryptoAPI requested but not found])
fi
if test "x$with_sha1" = xCryptoAPI; then
	AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
		[Use CryptoAPI SHA1 functions])
	SHA1_LIBS=""
fi
AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
	with_sha1=libmd
fi
if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
	AC_MSG_ERROR([libmd requested but not found])
fi
if test "x$with_sha1" = xlibmd; then
	AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
	          [Use libmd SHA1 functions])
	SHA1_LIBS=-lmd
fi
PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
   with_sha1=libsha1
fi
if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
	AC_MSG_ERROR([libsha1 requested but not found])
fi
if test "x$with_sha1" = xlibsha1; then
	AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
	          [Use libsha1 for SHA1])
	SHA1_LIBS=-lsha1
fi
AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
	with_sha1=libnettle
fi
if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
	AC_MSG_ERROR([libnettle requested but not found])
fi
if test "x$with_sha1" = xlibnettle; then
	AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
	          [Use libnettle SHA1 functions])
	SHA1_LIBS=-lnettle
fi
AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
	with_sha1=libgcrypt
fi
if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
	AC_MSG_ERROR([libgcrypt requested but not found])
fi
if test "x$with_sha1" = xlibgcrypt; then
	AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
	          [Use libgcrypt SHA1 functions])
	SHA1_LIBS=-lgcrypt
fi
# We don't need all of the OpenSSL libraries, just libcrypto
AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
                  [HAVE_OPENSSL_PKC=no])
if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
	if test "x$with_sha1" = x; then
		with_sha1=libcrypto
	fi
else
	if test "x$with_sha1" = xlibcrypto; then
		AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
	fi
fi
if test "x$with_sha1" = xlibcrypto; then
	if test "x$HAVE_LIBCRYPTO" = xyes; then
		SHA1_LIBS=-lcrypto
	else
		SHA1_LIBS="$OPENSSL_LIBS"
		SHA1_CFLAGS="$OPENSSL_CFLAGS"
	fi
fi
AC_MSG_CHECKING([for SHA1 implementation])
if test "x$with_sha1" = x; then
	AC_MSG_ERROR([No suitable SHA1 implementation found])
fi
AC_MSG_RESULT([$with_sha1])
AC_SUBST(SHA1_LIBS)
AC_SUBST(SHA1_CFLAGS)

PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])

# 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 autotools 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.
#
XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([XSERVER_SYS_LIBS])

UTILS_SYS_LIBS="${SYS_LIBS}"
AC_SUBST([UTILS_SYS_LIBS])

# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this.   libtool should set the
# necessary flags for each platform when -export-dynamic is passed to it.
LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
LD_NO_UNDEFINED_FLAG=
XORG_DRIVER_LIBS=
case "$host_os" in
    cygwin*)
	LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-all,--out-implib,lib\$@.a"
	LD_NO_UNDEFINED_FLAG="-no-undefined -Wl,\$(top_builddir)/hw/xfree86/libXorg.exe.a"
	XORG_DRIVER_LIBS="-lXorg.exe -L\${moduledir} -lshadow -lfb -no-undefined"
	CYGWIN=yes
	;;
    solaris*)
	# We use AC_LINK_IFELSE to generate a temporary program conftest$EXEEXT
	# that we can link against for testing if the system linker is new
	# enough to support -z parent=<program> for verifying loadable modules
	# are only calling functions defined in either the loading program or
	# the libraries they're linked with.
	AC_LINK_IFELSE(
	    [AC_LANG_SOURCE([int main(int argc, char **argv) { return 0; }])],
	    [mv conftest$EXEEXT conftest.parent
	     XORG_CHECK_LINKER_FLAGS([-Wl,-z,parent=conftest.parent -G],
		[LD_NO_UNDEFINED_FLAG="-Wl,-z,defs -Wl,-z,parent=\$(top_builddir)/hw/xfree86/Xorg"
# Not set yet, since this gets exported in xorg-server.pc to all the drivers,
# and they're not all fixed to build correctly with it yet.
#		 XORG_DRIVER_LIBS="-Wl,-z,defs -Wl,-z,parent=${bindir}/Xorg"
         ],[],
		[AC_LANG_SOURCE([extern int main(int argc, char **argv);
			int call_main(void) { return main(0, NULL); }])])
	     rm -f conftest.parent
	    ])
	;;
esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
AC_SUBST([LD_NO_UNDEFINED_FLAG])
AC_SUBST([XORG_DRIVER_LIBS])
AM_CONDITIONAL([CYGWIN], [test x"$CYGWIN" = xyes])
AM_CONDITIONAL([NO_UNDEFINED], [test x"$LD_NO_UNDEFINED_FLAG" != x])

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
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]))

XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC $PRESENT_INC"

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

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
	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
	XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
	AC_SUBST([XVFB_LIBS])
	AC_SUBST([XVFB_SYS_LIBS])
fi


dnl Xnest DDX

PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
AC_MSG_CHECKING([whether to build Xnest DDX])
if test "x$XNEST" = xauto; then
	XNEST="$have_xnest"
fi
AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])

if test "x$XNEST" = xyes; then
	if test "x$have_xnest" = xno; then
		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
	fi
	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
	AC_SUBST([XNEST_LIBS])
	AC_SUBST([XNEST_SYS_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" ;;
		mingw*)  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_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"

	dnl ==================================================================
	dnl symbol visibility
	symbol_visibility=
	have_visibility=disabled
	if test x$SYMBOL_VISIBILITY != xno; then
	    AC_MSG_CHECKING(for symbol visibility support)
	    if test x$GCC = xyes; then
		VISIBILITY_CFLAGS="-fvisibility=hidden"
	    else
		if test x$SUNCC = xyes; then
		    VISIBILITY_CFLAGS="-xldscope=hidden"
		else
		    have_visibility=no
		fi
	    fi
	    if test x$have_visibility != xno; then
		save_CFLAGS="$CFLAGS"
		proto_inc=`$PKG_CONFIG --cflags xproto`
		CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc"
		AC_TRY_COMPILE(
		    [#include <X11/Xfuncproto.h>
		     extern _X_HIDDEN int hidden_int;
		     extern _X_EXPORT int public_int;
		     extern _X_HIDDEN int hidden_int_func(void);
		     extern _X_EXPORT int public_int_func(void);],
		    [],
		    have_visibility=yes,
		    have_visibility=no)
		CFLAGS=$save_CFLAGS
	    fi
	    AC_MSG_RESULT([$have_visibility])
	    if test x$have_visibility != xno; then
		symbol_visibility=$VISIBILITY_CFLAGS
		XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
		XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
	    fi
	fi
	dnl added to xorg-server.pc
	AC_SUBST([symbol_visibility])
	dnl ===================================================================

	dnl ===================================================================
	dnl ================= beginning of PCI configuration ==================
	dnl ===================================================================
	xorg_bus_bsdpci=no
	xorg_bus_sparc=no

	AC_MSG_CHECKING([whether to build Xorg PCI functions])
	if test "x$PCI" = xyes; then

	PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS"
	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS"
	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS"

	AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
	AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
	case $host_os in
	  gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
		xorg_bus_bsdpci="yes"
		;;
	esac
	case $host_cpu in
	  sparc*)
		xorg_bus_sparc="yes"
		;;
	esac
	fi
	AC_MSG_RESULT([$PCI])

	if test "x$CONFIG_UDEV_KMS" = xyes; then
		AC_DEFINE(XSERVER_PLATFORM_BUS, 1, [X server supports platform device enumeration])
	fi
	AC_MSG_RESULT([$XSERVER_PLATFORM_BUS])
	dnl ===================================================================
	dnl ==================== end of PCI configuration =====================
	dnl ===================================================================

	case $host_os in
	  linux*)
		XORG_OS_SUBDIR="linux"
		linux_acpi="no"
		case $host_cpu in
		  alpha*)
		  	linux_alpha=yes
			;;
		  i*86|amd64*|x86_64*|ia64*)
			linux_acpi=$enable_linux_acpi
			;;
		  *)
			;;
		esac
		dnl APM header
		AC_CHECK_HEADERS([linux/apm_bios.h], [linux_apm=$enable_linux_apm])
		if test "x$linux_apm" = xyes -o "x$linux_acpi" = xyes; then
			AC_DEFINE(XF86PM, 1, [Support APM/ACPI power management in the server])
		fi
		;;
	  freebsd* | kfreebsd*-gnu | dragonfly*)
		XORG_OS_SUBDIR="bsd"
		;;
	  netbsd*)
		XORG_OS_SUBDIR="bsd"
		;;
	  openbsd*)
		if test "x$ac_cv_BSD_APM" = xyes \
			-o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
			XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
		fi
		XORG_OS_SUBDIR="bsd"
		;;
	  solaris*)
		XORG_OS_SUBDIR="solaris"
		XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
		AC_CHECK_HEADERS([sys/kd.h])
		AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
		# Check for minimum supported release
		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})
		else
			AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
		fi
		if test "${OS_MINOR}" -lt 8 ; then
			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
		fi
		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*)	
			SOLARIS_INOUT_ARCH="sparcv8plus"
			;;
		  i*86)	
			if test x$SOLARIS_64 = xyes ; then
				SOLARIS_INOUT_ARCH="amd64"
			else
				SOLARIS_INOUT_ARCH="ia32"
			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
			SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
			XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
		fi
		AC_SUBST([SOLARIS_ASM_CFLAGS])
		;;
	  gnu*)
		XORG_OS_SUBDIR="hurd"
		;;
	  *)
		XORG_OS_SUBDIR="stub"
		AC_MSG_NOTICE([m4_text_wrap(m4_join([ ],
		[Your OS is unknown. Xorg currently only supports Linux,],
		[Free/Open/Net/DragonFlyBSD, Solaris/OpenSolaris, & GNU Hurd.],
		[If you are interested in porting Xorg to your platform,],
		[please email xorg@lists.freedesktop.org.]))])
		;;
	esac

	case $host_cpu in
	  i*86)
		;;
	esac

	if test "x$DGA" = xauto; then
		PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
	fi
	if test "x$DGA" = xyes; then
		XORG_MODULES="$XORG_MODULES $DGAPROTO"
		PKG_CHECK_MODULES(DGA, $DGAPROTO)
		AC_DEFINE(DGA, 1, [Support DGA extension])
		AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
	fi

	if test "x$XF86VIDMODE" = xauto; then
		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
	fi
	if test "x$XF86VIDMODE" = xyes; then
		XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
		PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
		AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
	fi

	if test -n "$XORG_MODULES"; then
	        PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
	        XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
	        XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
	fi

	AC_SUBST([XORG_LIBS])
	AC_SUBST([XORG_SYS_LIBS])
	AC_SUBST([XORG_INCS])
	AC_SUBST([XORG_OS_SUBDIR])
	AC_SUBST([XORG_CFLAGS])

	dnl these only go in xorg-config.h
	XF86CONFIGFILE="xorg.conf"
	XF86CONFIGDIR="xorg.conf.d"
	AC_SUBST(XF86CONFIGDIR)
	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
	LOGPREFIX="$logdir/Xorg."
	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [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_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
	AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
	if test "x$VGAHW" = xyes; then
		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
	fi

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

	# stuff the ABI versions into the pc file too
	extract_abi() {
	    grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' '  .' | awk '{ print $4$5 }'
	}
	abi_ansic=`extract_abi ANSIC`
	abi_videodrv=`extract_abi VIDEODRV`
	abi_xinput=`extract_abi XINPUT`
	abi_extension=`extract_abi EXTENSION`
	AC_SUBST([abi_ansic])
	AC_SUBST([abi_videodrv])
	AC_SUBST([abi_xinput])
	AC_SUBST([abi_extension])
fi
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
AM_CONDITIONAL([XORG_BUS_PCI], [test "x$PCI" = xyes])
AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes])
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
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
fi
AC_MSG_RESULT([$XWIN])

if test "x$XWIN" = xyes; then
	AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
	AC_CHECK_TOOL(WINDRES, windres)

	PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau])

	if test "x$WINDOWSWM" = xauto; then
		PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
	fi
	if test "x$WINDOWSWM" = xyes ; then
		PKG_CHECK_MODULES(WINDOWSWM, $WINDOWSWMPROTO)
		XWINMODULES_CFLAGS="$XWINMODULES_CFLAGS $WINDOWSWM_CFLAGS"
		AC_DEFINE(ROOTLESS,1,[Build Rootless code])
	fi

	case $host_os in
		cygwin*)
			XWIN_SERVER_NAME=XWin
			AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
			;;
		mingw*)
			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_SYS_LIBS="-lpthread -lws2_32"
			;;
	esac

	XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
	XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS $GLX_SYS_LIBS"
	AC_SUBST(XWIN_LIBS)
	AC_SUBST(XWIN_SERVER_NAME)
	AC_SUBST(XWIN_SYS_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(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
	AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])

dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions
	if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then
           AC_CHECK_PROG(PYTHON, python, python)
           if test -z "$PYTHON"; then
                AC_MSG_ERROR([python not found])
           fi
           if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then
		PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry])
		KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir`
           fi
           AC_SUBST(KHRONOS_SPEC_DIR)
	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 && test "x$WINDOWSWM" = xyes])
AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$AIGLX" = xyes])
AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])

dnl Darwin / OS X DDX
if test "x$XQUARTZ" = xyes; then
	AC_DEFINE(XQUARTZ,1,[Have Quartz])
	AC_DEFINE(ROOTLESS,1,[Build Rootless code])

	XQUARTZ_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
	AC_SUBST([XQUARTZ_LIBS])

	AC_CHECK_LIB([Xplugin],[xp_init],[:])

	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA"

	PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)

        if test "x$XQUARTZ_SPARKLE" = xyes ; then
                AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
        fi

	if test "x$STANDALONE_XPBPROXY" = xyes ; then
		AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
	fi
fi

# Support for objc in autotools is minimal and not documented.
OBJC='$(CC)'
OBJCLD='$(CCLD)'
OBJCLINK='$(LINK)'
OBJCFLAGS='$(CFLAGS)'
AC_SUBST([OBJC])
AC_SUBST([OBJCCLD])
AC_SUBST([OBJCLINK])
AC_SUBST([OBJCFLAGS])
# internal, undocumented automake func follows :(
_AM_DEPENDENCIES([OBJC])
AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])

dnl DMX DDX
PKG_CHECK_MODULES(
	[DMXMODULES],
	[xmuu $LIBXEXT x11 >= 1.6 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
	[PKG_CHECK_MODULES(
		[XDMXCONFIG_DEP],
		[xaw7 xmu xt xpm x11],
		[have_dmx=yes],
		[have_dmx=no])],
	[have_dmx=no])
AC_MSG_CHECKING([whether to build Xdmx DDX])
if test "x$DMX" = xauto; then
	DMX="$have_dmx"
	case $host_os in
		cygwin*) DMX="no" ;;
		mingw*)  DMX="no" ;;
		darwin*) DMX="no" ;;
	esac
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 $RECORD_INC"
	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
	XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
	AC_SUBST([XDMX_CFLAGS])
	AC_SUBST([XDMX_LIBS])
	AC_SUBST([XDMX_SYS_LIBS])

dnl USB sources in DMX require <linux/input.h>
	AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
			DMX_BUILD_USB="no")
dnl Linux sources in DMX require <linux/keyboard.h>
	AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
			DMX_BUILD_LNX="no")
	AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
	AC_SUBST(XDMXCONFIG_DEP_LIBS)
	PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11])
	AC_SUBST(DMXEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11])
	AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11])
	AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11])
	AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11])
	AC_SUBST(XRESEXAMPLES_DEP_LIBS)
	PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11])
	AC_SUBST(X11EXAMPLES_DEP_LIBS)

fi
AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])

dnl kdrive DDX

XEPHYR_LIBS=
XEPHYR_INCS=

AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])

if test "$KDRIVE" = yes; then
    AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
    AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])

    AC_CHECK_HEADERS([linux/fb.h])
    if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
        XFBDEV=yes
    fi

    if test "x$XFBDEV" = xyes; then
        KDRIVEFBDEVLIB=yes
        AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
    fi


    PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
    if test "x$HAVE_TSLIB" = xno; then
        AC_CHECK_LIB(ts, ts_open, [
			HAVE_TSLIB="yes"
			TSLIB_LIBS="-lts"
		])
    fi

    if test "xTSLIB" = xauto; then
        TSLIB="$HAVE_TSLIB"
    fi

    if test "x$TSLIB" = xyes; then
        if ! test "x$HAVE_TSLIB" = xyes; then
            AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
        else
            AC_DEFINE(TSLIB, 1, [Have tslib support])
        fi
    fi

    if test "x$KDRIVE_KBD" = xyes; then
       AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
    fi
    if test "x$KDRIVE_EVDEV" = xyes; then
       AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
    fi
    if test "x$KDRIVE_MOUSE" = xyes; then
       AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
    fi

    XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms"
    if test "x$XV" = xyes; then
        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
    fi
    if test "x$DRI" = xyes && test "x$GLX" = xyes; then
        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri > 1.6"
    fi

    if test "x$XEPHYR" = xauto; then
        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"])
    elif test "x$XEPHYR" = xyes ; then
        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS)
    fi

    # Xephyr needs nanosleep() which is in librt on Solaris
    AC_CHECK_FUNC([nanosleep], [],
        AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
    
    # damage shadow extension glx (NOTYET) fb mi
    KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
    KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
    KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
    KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
    
    KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"

    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
    KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
    case $host_os in
	*linux*)
	    KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
            KDRIVELINUX=yes
	    if test "x$KDRIVE_EVDEV" = xauto; then
		KDRIVE_EVDEV=yes
	    fi
	    if test "x$KDRIVE_KBD" = xauto; then
		KDRIVE_KBD=yes
	    fi
	    if test "x$KDRIVE_MOUSE" = xauto; then
		KDRIVE_MOUSE=yes
	    fi
	    ;;
	*)
	    if test "x$KDRIVE_EVDEV" = xauto; then
		KDRIVE_EVDEV=no
	    fi
	    if test "x$KDRIVE_KBD" = xauto; then
		KDRIVE_KBD=no
	    fi
	    if test "x$KDRIVE_MOUSE" = xauto; then
		KDRIVE_MOUSE=no
	    fi
	    ;;
    esac
    KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
    KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
    KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"

    AC_SUBST([XEPHYR_LIBS])
    AC_SUBST([XEPHYR_INCS])
fi
AC_SUBST([KDRIVE_INCS])
AC_SUBST([KDRIVE_PURE_INCS])
AC_SUBST([KDRIVE_CFLAGS])
AC_SUBST([KDRIVE_PURE_LIBS])
AC_SUBST([KDRIVE_LOCAL_LIBS])
AC_SUBST([KDRIVE_LIBS])
AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
AM_CONDITIONAL(KDRIVE_KBD,   [test "x$KDRIVE_KBD" = xyes])
AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])

dnl and the rest of these are generic, so they're in config.h
dnl 
dnl though, thanks to the passing of some significant amount of time, the
dnl above is probably a complete fallacy, and you should not rely on it.
dnl but this is still actually better than imake, honest. -daniels

AC_TRY_COMPILE([
#include <features.h>
#ifndef __GLIBC__
#error not glibc
#endif
], [], [AC_DEFINE(_GNU_SOURCE, 1,
	[ Enable GNU and other extensions to the C environment for glibc])])

AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])

AC_SUBST([RELEASE_DATE])
BUILD_DATE="`date +'%Y%m%d'`"
AC_SUBST([BUILD_DATE])
BUILD_TIME="`date +'1%H%M%S'`"
AC_SUBST([BUILD_TIME])

DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"

AC_SUBST([DIX_CFLAGS])

AC_SUBST([libdir])
AC_SUBST([exec_prefix])
AC_SUBST([prefix])

AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep])

if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then
    AC_WARN([
             ***********************************************
             Neither HAL nor udev backend will be enabled.
             Input device hotplugging will not be available!
             ***********************************************])
fi

AC_CONFIG_FILES([
Makefile
glx/Makefile
include/Makefile
composite/Makefile
damageext/Makefile
dbe/Makefile
dix/Makefile
doc/Makefile
doc/dtrace/Makefile
man/Makefile
fb/Makefile
record/Makefile
config/Makefile
mi/Makefile
miext/Makefile
miext/sync/Makefile
miext/damage/Makefile
miext/shadow/Makefile
miext/rootless/Makefile
os/Makefile
pseudoramiX/Makefile
randr/Makefile
render/Makefile
xkb/Makefile
Xext/Makefile
Xi/Makefile
xfixes/Makefile
exa/Makefile
dri3/Makefile
present/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/doc/Makefile
hw/xfree86/dri/Makefile
hw/xfree86/dri2/Makefile
hw/xfree86/exa/Makefile
hw/xfree86/exa/man/Makefile
hw/xfree86/fbdevhw/Makefile
hw/xfree86/fbdevhw/man/Makefile
hw/xfree86/i2c/Makefile
hw/xfree86/int10/Makefile
hw/xfree86/loader/Makefile
hw/xfree86/man/Makefile
hw/xfree86/modes/Makefile
hw/xfree86/os-support/Makefile
hw/xfree86/os-support/bsd/Makefile
hw/xfree86/os-support/bus/Makefile
hw/xfree86/os-support/hurd/Makefile
hw/xfree86/os-support/misc/Makefile
hw/xfree86/os-support/linux/Makefile
hw/xfree86/os-support/solaris/Makefile
hw/xfree86/os-support/stub/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/shadowfb/Makefile
hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
hw/xfree86/x86emu/Makefile
hw/xfree86/utils/Makefile
hw/xfree86/utils/man/Makefile
hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile
hw/dmx/config/Makefile
hw/dmx/config/man/Makefile
hw/dmx/doc/Makefile
hw/dmx/doxygen/doxygen.conf
hw/dmx/doxygen/Makefile
hw/dmx/examples/Makefile
hw/dmx/input/Makefile
hw/dmx/glxProxy/Makefile
hw/dmx/Makefile
hw/dmx/man/Makefile
hw/vfb/Makefile
hw/vfb/man/Makefile
hw/xnest/Makefile
hw/xnest/man/Makefile
hw/xwin/Makefile
hw/xwin/glx/Makefile
hw/xwin/man/Makefile
hw/xquartz/Makefile
hw/xquartz/GL/Makefile
hw/xquartz/bundle/Makefile
hw/xquartz/man/Makefile
hw/xquartz/mach-startup/Makefile
hw/xquartz/pbproxy/Makefile
hw/xquartz/xpr/Makefile
hw/kdrive/Makefile
hw/kdrive/ephyr/Makefile
hw/kdrive/ephyr/man/Makefile
hw/kdrive/fake/Makefile
hw/kdrive/fbdev/Makefile
hw/kdrive/linux/Makefile
hw/kdrive/src/Makefile
test/Makefile
test/xi2/Makefile
xserver.ent
xorg-server.pc
])
AC_OUTPUT