git.infertux.com SDL-1.2.7 / master .#configure.in.1.70
master

Tree @master (Download .tar.gz)

.#configure.in.1.70 @masterraw · history · blame

   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
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)

dnl Set various version strings - taken gratefully from the GTk sources
#
# Making releases:
# Edit include/SDL/SDL_version.h and change the version, then:
#   SDL_MICRO_VERSION += 1;
#   SDL_INTERFACE_AGE += 1;
#   SDL_BINARY_AGE += 1;
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
#
SDL_MAJOR_VERSION=1
SDL_MINOR_VERSION=2
SDL_MICRO_VERSION=5
SDL_INTERFACE_AGE=5
SDL_BINARY_AGE=5
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

AC_SUBST(SDL_MAJOR_VERSION)
AC_SUBST(SDL_MINOR_VERSION)
AC_SUBST(SDL_MICRO_VERSION)
AC_SUBST(SDL_INTERFACE_AGE)
AC_SUBST(SDL_BINARY_AGE)
AC_SUBST(SDL_VERSION)

# libtool versioning
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
LT_REVISION=$SDL_INTERFACE_AGE
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`

AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Setup for automake
AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)

dnl Check for tools

AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_CC
AC_C_INLINE
AC_C_CONST
AC_PROG_CXX
AC_PROG_INSTALL
AC_FUNC_ALLOCA
ASFLAGS=""
AC_SUBST(ASFLAGS)

dnl The alpha architecture needs special flags for binary portability
case "$target" in
    alpha*-*-linux*)
        if test x$ac_cv_prog_gcc = xyes; then
            CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
        fi
        ;;
esac

dnl Add compiler-specific optimization flags

dnl See if the user wants aggressive optimizations of the code
AC_ARG_ENABLE(debug,
[  --enable-debug          Disable aggressive optimizations [default=yes]],
              , enable_debug=yes)
if test x$enable_debug != xyes; then
    if test x$ac_cv_prog_gcc = xyes; then
        CFLAGS="$CFLAGS -fexpensive-optimizations"
        # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
        # CFLAGS="$CFLAGS -fomit-frame-pointer"
    fi
    case "$target" in
        i486-*-*)
            if test x$ac_cv_prog_gcc = xyes; then
                CFLAGS="$CFLAGS -march=486"
            fi
            ;;
        i?86-*-*)
            if test x$ac_cv_prog_gcc = xyes; then
                CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
            fi
            ;;
        *-*-osf*)
            if test x$ac_cv_prog_gcc != xyes; then
                CFLAGS="-g3 -fast -arch host"
            fi
            ;;
    esac
fi

dnl Add verbose warnings by default, and allow ANSI compliance checking
AC_ARG_ENABLE(strict-ansi,
[  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
              , enable_strict_ansi=no)
if test x$ac_cv_prog_gcc = xyes; then
    CFLAGS="$CFLAGS -Wall"
    if test x$enable_strict_ansi = xyes; then
        CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
    fi
fi

dnl Initialize the compiler and linker flags for SDL applications

SDL_CFLAGS=""
SDL_LIBS="-lSDL"

dnl Add the math library for the new gamma correction support

case "$target" in
    *-*-cygwin* | *-*-mingw32*)
        MATHLIB=""
        ;;
    *-*-beos*)
        MATHLIB=""
        ;;
    *-*-darwin*)
        MATHLIB=""
        ;;
    *)
        MATHLIB="-lm"
        ;;
esac
SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"

dnl Enable/disable various subsystems of the SDL library

AC_ARG_ENABLE(audio,
[  --enable-audio          Enable the audio subsystem [default=yes]],
              , enable_audio=yes)
if test x$enable_audio = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
    SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
else
    CFLAGS="$CFLAGS -DDISABLE_AUDIO"
fi
AC_ARG_ENABLE(video,
[  --enable-video          Enable the video subsystem [default=yes]],
              , enable_video=yes)
if test x$enable_video = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS video"
    SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
else
    CFLAGS="$CFLAGS -DDISABLE_VIDEO"
fi
AC_ARG_ENABLE(events,
[  --enable-events         Enable the events subsystem [default=yes]],
              , enable_events=yes)
if test x$enable_video = xyes -a x$enable_events = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS events"
    SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
else
    CFLAGS="$CFLAGS -DDISABLE_EVENTS"
fi
AC_ARG_ENABLE(joystick,
[  --enable-joystick       Enable the joystick subsystem [default=yes]],
              , enable_joystick=yes)
if test x$enable_joystick = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
    SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
else
    CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
fi
AC_ARG_ENABLE(cdrom,
[  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
              , enable_cdrom=yes)
if test x$enable_cdrom = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
    SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
else
    CFLAGS="$CFLAGS -DDISABLE_CDROM"
fi
AC_ARG_ENABLE(threads,
[  --enable-threads        Enable the threading subsystem [default=yes]],
              , enable_threads=yes)
SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
if test x$enable_threads != xyes; then
    CFLAGS="$CFLAGS -DDISABLE_THREADS"
    COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
    COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
    COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
    COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
    COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
    COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
fi
AC_ARG_ENABLE(timers,
[  --enable-timers         Enable the timer subsystem [default=yes]],
              , enable_timers=yes)
if test x$enable_timers = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
    SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
else
    CFLAGS="$CFLAGS -DDISABLE_TIMERS"
fi
AC_ARG_ENABLE(endian,
[  --enable-endian         Enable the endian subsystem [default=yes]],
              , enable_endian=yes)
if test x$enable_endian = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
    SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
else
    CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
fi
AC_ARG_ENABLE(file,
[  --enable-file           Enable the file subsystem [default=yes]],
              , enable_file=yes)
if test x$enable_file = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS file"
    SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
else
    CFLAGS="$CFLAGS -DDISABLE_FILE"
fi

dnl See if the OSS audio interface is supported
CheckOSS()
{
    AC_ARG_ENABLE(oss,
[  --enable-oss            support the OSS audio API [default=yes]],
                  , enable_oss=yes)
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
        AC_MSG_CHECKING(for OSS audio support)
        have_oss=no
        if test x$have_oss != xyes; then
            AC_TRY_COMPILE([
              #include <sys/soundcard.h>
            ],[
              int arg = SNDCTL_DSP_SETFRAGMENT;
            ],[
            have_oss=yes
            ])
        fi
        if test x$have_oss != xyes; then
            AC_TRY_COMPILE([
              #include <soundcard.h>
            ],[
              int arg = SNDCTL_DSP_SETFRAGMENT;
            ],[
            have_oss=yes
            CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
            ])
        fi
        AC_MSG_RESULT($have_oss)
        if test x$have_oss = xyes; then
            CFLAGS="$CFLAGS -DOSS_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
            AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
            AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
        fi
    fi
}

dnl See if the ALSA audio interface is supported
CheckALSA()
{
    AC_ARG_ENABLE(alsa,
[  --enable-alsa           support the ALSA audio API [default=yes]],
                  , enable_alsa=yes)
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
        AC_MSG_CHECKING(for ALSA audio support)
        have_alsa=no
        AC_TRY_COMPILE([
          #include <alsa/asoundlib.h>
        ],[
          #if SND_LIB_VERSION < ((0<<16)|(9<<8)|0)
          #error Your version of ALSA is too old
          #endif
          snd_pcm_t *pcm_handle;
        ],[
        AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes)
        ])
        if test x$have_alsa = xyes; then
            CFLAGS="$CFLAGS -DALSA_SUPPORT"
            SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
            AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
        else
            AC_MSG_RESULT($have_alsa)
        fi
    fi
}

dnl Check whether we want to use IRIX 6.5+ native audio or not
CheckDMEDIA()
{
    if test x$enable_audio = xyes; then
        AC_MSG_CHECKING(for dmedia audio support)
        have_dmedia=no
        AC_TRY_COMPILE([
          #include <dmedia/audio.h>
        ],[
          ALport audio_port;
        ],[
        have_dmedia=yes
        ])
        # Set up files for the audio library
        if test x$have_dmedia = xyes; then
            CFLAGS="$CFLAGS -DDMEDIA_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
            AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
            SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
        fi
    fi
}

dnl Find the ESD includes and libraries
CheckESD()
{
    AC_ARG_ENABLE(esd,
[  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
                  , enable_esd=yes)
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
        use_esd=no
        AM_PATH_ESD(0.2.8, use_esd=yes)
        if test x$use_esd = xyes; then
            AC_ARG_ENABLE(esd-shared,
[  --enable-esd-shared     dynamically load ESD audio support [default=no]],
                          , enable_esd_shared=no)
            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
            esd_lib=`ls $esd_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
            echo "-- $esd_lib_spec -> $esd_lib"
            if test x$enable_dlopen != xyes && \
               test x$enable_esd_shared = xyes; then
                AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
            fi
            if test x$enable_dlopen = xyes && \
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
                CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
                AC_SUBST(esd_lib)
            else
                CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
                SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
            fi
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
            AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
        fi
    fi
}

CheckARTSC()
{
    AC_ARG_ENABLE(arts,
[  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
                  , enable_arts=yes)
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
        AC_PATH_PROG(ARTSCCONFIG, artsc-config)
        if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
            : # arts isn't installed
        else
            ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
            ARTSC_LIBS=`$ARTSCCONFIG --libs`
            AC_MSG_CHECKING(for aRts development environment)
            audio_arts=no
            save_CFLAGS="$CFLAGS"
            CFLAGS="$CFLAGS $ARTSC_CFLAGS"
            AC_TRY_COMPILE([
             #include <artsc.h>
            ],[
             arts_stream_t stream;
            ],[
            audio_arts=yes
            ])
            CFLAGS="$save_CFLAGS"
            AC_MSG_RESULT($audio_arts)
            if test x$audio_arts = xyes; then
                AC_ARG_ENABLE(arts-shared,
[  --enable-arts-shared     dynamically load aRts audio support [default=no]],
                              , enable_arts_shared=no)
                arts_lib_spec=`echo $ARTSC_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libartsc.so.*/'`
                arts_lib=`ls $arts_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
                echo "-- $arts_lib_spec -> $arts_lib"
                if test x$enable_dlopen != xyes && \
                   test x$enable_arts_shared = xyes; then
                    AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
                fi
                if test x$enable_dlopen = xyes && \
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
                    CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
                    AC_SUBST(arts_lib)
                else
                    CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
                    SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
                fi
                AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
                AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
            fi
        fi
    fi
}

dnl See if the NAS audio interface is supported
CheckNAS()
{
    AC_ARG_ENABLE(nas,
[  --enable-nas                  support the NAS audio API [default=yes]],
                  , enable_nas=yes)
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
        AC_MSG_CHECKING(for NAS audio support)
        have_nas=no
        if test -r /usr/X11R6/include/audio/audiolib.h; then
            have_nas=yes
        fi
        AC_MSG_RESULT($have_nas)
        if test x$have_nas = xyes; then
            CFLAGS="$CFLAGS -DNAS_SUPPORT"
            SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
            AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
        fi
    fi
}

dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
    AC_ARG_ENABLE(diskaudio,
[  --enable-diskaudio            support the disk writer audio driver [default=yes]],
                  , enable_diskaudio=yes)
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
        CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
        AUDIO_SUBDIRS="$AUDIO_SUBDIRS disk"
        AUDIO_DRIVERS="$AUDIO_DRIVERS disk/libaudio_disk.la"
    fi
}

dnl See if we can use x86 assembly blitters
# NASM is available from: http://nasm.octium.net/
CheckNASM()
{
    dnl Make sure we are running on an x86 platform
    case $target in
        i?86*)
            ;;
        *)
        # Nope, bail early.
            return
            ;;
    esac
    dnl Check for NASM (for assembly blit routines)
    AC_ARG_ENABLE(nasm,
[  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
                  , enable_nasm=yes)
    if test x$enable_video = xyes -a x$enable_nasm = xyes; then
        AC_PATH_PROG(NASM, nasm)
        if test x$NASM = x -o x$NASM = x'"$NASM"'; then
            : # nasm isn't installed
        else
            CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
            case $ARCH in
              win32)
                  NASMFLAGS="-f win32"
                  ;;
              openbsd)
                  NASMFLAGS="-f aoutb"
                  ;;
              *)
                  NASMFLAGS="-f elf"
                  ;;
            esac
            AC_SUBST(NASMFLAGS)
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
            SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
            SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
        fi
    fi
}

dnl Find the nanox include and library directories
CheckNANOX()
{
    AC_ARG_ENABLE(video-nanox,
        [  --enable-video-nanox use nanox video driver [default=no]],
        , enable_video_nanox=no)
    AC_ARG_ENABLE(nanox-debug,  
        [  --enable-nanox-debug print debug messages [default=no]],
        , enable_nanox_debug=no)
    AC_ARG_ENABLE(nanox-share-memory,  
        [  --enable-nanox-share-memory use share memory [default=no]],
        , enable_nanox_share_memory=no)

    AC_ARG_WITH(nanox_pixel_type, 
        [  --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])

    if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
        if test x$enable_nanox_debug = xyes; then
            CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
        fi

        if test x$enable_nanox_share_memory = xyes; then
            CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
        fi

        case "$with_nanox_pixel_type" in
             rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
            0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
             888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888"  ;;
             565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565"  ;;
             555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555"  ;;
             332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332"  ;;
             pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL"  ;;
               *) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
        esac

        CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
        SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
        VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
    fi
}

dnl Find the X11 include and library directories
CheckX11()
{
    AC_ARG_ENABLE(video-x11,
[  --enable-video-x11      use X11 video driver [default=yes]],
                  , enable_video_x11=yes)
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
        AC_PATH_X
        AC_PATH_XTRA
        if test x$have_x = xyes; then
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -Iinclude -Isrc/video"
            if test x$ac_cv_func_shmat != xyes; then
                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
            fi
            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"

            AC_ARG_ENABLE(video-x11-vm,
[  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
                          , enable_video_x11_vm=yes)
            if test x$enable_video_x11_vm = xyes; then
                AC_MSG_CHECKING(for XFree86 VidMode 1.0 support)
                video_x11_vm=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <XFree86/extensions/xf86vmode.h>
                ],[
                ],[
                video_x11_vm=yes
                ])
                AC_MSG_RESULT($video_x11_vm)
                if test x$video_x11_vm = xyes; then
                    CFLAGS="$CFLAGS -DXFREE86_VM"
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
                    AC_MSG_CHECKING(for XFree86 VidMode gamma support)
                    video_x11_vmgamma=no
                    AC_TRY_COMPILE([
                     #include <X11/Xlib.h>
                     #include <XFree86/extensions/xf86vmode.h>
                    ],[
                     SDL_NAME(XF86VidModeGamma) gamma;
                    ],[
                    video_x11_vmgamma=yes
                    ])
                    AC_MSG_RESULT($video_x11_vmgamma)
                    if test x$video_x11_vmgamma = xyes; then
                        CFLAGS="$CFLAGS -DXFREE86_VMGAMMA"
                    fi
                fi
            fi
            AC_ARG_ENABLE(dga,
[  --enable-dga            allow use of X11 DGA code [default=yes]],
                          , enable_dga=yes)
            AC_ARG_ENABLE(video-x11-dgamouse,
[  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
                          , enable_video_x11_dgamouse=yes)
            if test x$enable_dga = xyes; then
                AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
                video_x11_dga=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <XFree86/extensions/xf86dga.h>
                ],[
                ],[
                video_x11_dga=yes
                ])
                AC_MSG_RESULT($video_x11_dga)
                if test x$video_x11_dga = xyes; then
                    CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE"
                    if test x$enable_video_x11_dgamouse = xyes; then
                        CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
                    fi
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
                fi
            fi
            AC_ARG_ENABLE(video-x11-xv,
[  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
                          , enable_video_x11_xv=yes)
            if test x$enable_video_x11_xv = xyes; then
                AC_MSG_CHECKING(for XFree86 XvImage support)
                video_x11_xv=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <sys/ipc.h>
                 #include <sys/shm.h>
                 #include <X11/extensions/XShm.h>
                 #include <XFree86/extensions/Xvlib.h>
                ],[
                 SDL_NAME(XvImage) *image;
                ],[
                video_x11_xv=yes
                ])
                AC_MSG_RESULT($video_x11_xv)
                if test x$video_x11_xv = xyes; then
                    CFLAGS="$CFLAGS -DXFREE86_XV"
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
                fi
            fi
            AC_ARG_ENABLE(video-x11-xinerama,
[  --enable-video-x11-xinerama   enable X11 Xinerama support [default=yes]],
                            , enable_video_x11_xinerama=yes)
            if test x$enable_video_x11_xinerama = xyes; then
                AC_MSG_CHECKING(for X11 Xinerama support)
                video_x11_xinerama=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <XFree86/extensions/Xinerama.h>
                ],[
                 SDL_NAME(XineramaScreenInfo) *xinerama;
                ],[
                video_x11_xinerama=yes
                ])
                AC_MSG_RESULT($video_x11_xinerama)
                if test x$video_x11_xinerama = xyes; then
                    CFLAGS="$CFLAGS -DHAVE_XINERAMA"
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
                fi
            fi
            AC_ARG_ENABLE(video-x11-xme,
[  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen [default=yes]],
                            , enable_video_x11_xme=yes)
            if test x$enable_video_x11_xme = xyes; then
                AC_MSG_CHECKING(for Xi Graphics XiGMiscExtension support)
                video_x11_xme=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <X11/extensions/xme.h>
                ],[
                 XiGMiscResolutionInfo *resolutions;
                ],[
                video_x11_xme=yes
                ])
                AC_MSG_RESULT($video_x11_xme)
                if test x$video_x11_xme = xyes; then
                    CFLAGS="$CFLAGS -DHAVE_XIGXME"
                    SYSTEM_LIBS="$SYSTEM_LIBS -lxme"
                fi
            fi
        fi
    fi
}

dnl Find the X11 DGA 2.0 include and library directories
CheckDGA()
{
    AC_ARG_ENABLE(video-dga,
[  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
                  , enable_video_dga=yes)
    if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
        save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
        AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
        video_x11_dga2=no
        AC_TRY_COMPILE([
         #include <X11/Xlib.h>
         #include <XFree86/extensions/xf86dga.h>
        ],[
         SDL_NAME(XDGAEvent) xevent;
        ],[
        video_x11_dga2=yes
        ])
        AC_MSG_RESULT($video_x11_dga2)
        if test x$video_x11_dga2 = xyes; then
            CFLAGS="$CFLAGS -DENABLE_DGA"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
            VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
        fi
    fi
}

CheckPHOTON()
{
    AC_ARG_ENABLE(video-photon,
[  --enable-video-photon   use QNX Photon video driver [default=yes]],
                  , enable_video_photon=yes)
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
        AC_MSG_CHECKING(for QNX Photon support)
        video_photon=no
        AC_TRY_COMPILE([
          #include <Ph.h>
          #include <Pt.h>
          #include <photon/Pg.h>
          #include <photon/PdDirect.h>
        ],[
         PgDisplaySettings_t *visual;
        ],[
        video_photon=yes
        ])
        AC_MSG_RESULT($video_photon)
        if test x$video_photon = xyes; then
            CFLAGS="$CFLAGS -DENABLE_PHOTON"
            SYSTEM_LIBS="$SYSTEM_LIBS -lph"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
            VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
            CheckOpenGLQNX
        fi
    fi
}

dnl Find the framebuffer console includes
CheckFBCON()
{
    AC_ARG_ENABLE(video-fbcon,
[  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
                  , enable_video_fbcon=yes)
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
        AC_MSG_CHECKING(for framebuffer console support)
        video_fbcon=no
        AC_TRY_COMPILE([
         #include <linux/fb.h>
         #include <linux/kd.h>
         #include <linux/keyboard.h>
        ],[
        ],[
        video_fbcon=yes
        ])
        AC_MSG_RESULT($video_fbcon)
        if test x$video_fbcon = xyes; then
            CFLAGS="$CFLAGS -DENABLE_FBCON"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
            VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
        fi
    fi
}

dnl Find DirectFB
CheckDirectFB()
{
    AC_ARG_ENABLE(video-directfb,
[  --enable-video-directfb    use DirectFB video driver [default=yes]],
                  , enable_video_directfb=yes)
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
        video_directfb=no

        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
        if test x$PKG_CONFIG = xno ; then
            AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
        else
            AC_MSG_CHECKING(for DirectFB support)

            if ! $PKG_CONFIG --atleast-pkgconfig-version 0.5 ; then
                AC_MSG_ERROR([*** pkg-config too old; version 0.5 or better required.])
            fi

            DIRECTFB_REQUIRED_VERSION=0.9.9

            if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
                DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
                DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
                video_directfb=yes
            fi
        fi

        AC_MSG_RESULT($video_directfb)
        if test x$video_directfb = xyes; then
            CFLAGS="$CFLAGS -DENABLE_DIRECTFB"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS directfb"
            VIDEO_DRIVERS="$VIDEO_DRIVERS directfb/libvideo_directfb.la"

            AC_SUBST(DIRECTFB_CFLAGS)
            AC_SUBST(DIRECTFB_LIBS)
        fi
    fi
}

dnl See if we're running on PlayStation 2 hardware
CheckPS2GS()
{
    AC_ARG_ENABLE(video-ps2gs,
[  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]],
                  , enable_video_ps2gs=yes)
    if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
        AC_MSG_CHECKING(for PlayStation 2 GS support)
        video_ps2gs=no
        AC_TRY_COMPILE([
         #include <linux/ps2/dev.h>
         #include <linux/ps2/gs.h>
        ],[
        ],[
        video_ps2gs=yes
        ])
        AC_MSG_RESULT($video_ps2gs)
        if test x$video_ps2gs = xyes; then
            CFLAGS="$CFLAGS -DENABLE_PS2GS"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ps2gs"
            VIDEO_DRIVERS="$VIDEO_DRIVERS ps2gs/libvideo_ps2gs.la"
        fi
    fi
}

dnl Find the GGI includes
CheckGGI()
{
    AC_ARG_ENABLE(video-ggi,
[  --enable-video-ggi      use GGI video driver [default=no]],
                  , enable_video_ggi=no)
    if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
        AC_MSG_CHECKING(for GGI support)
        video_ggi=no
        AC_TRY_COMPILE([
         #include <ggi/ggi.h>
         #include <ggi/gii.h>
        ],[
        ],[
        video_ggi=yes
        ])
        AC_MSG_RESULT($video_ggi)
        if test x$video_ggi = xyes; then
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
            SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
            VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
        fi
    fi
}

dnl Find the SVGAlib includes and libraries
CheckSVGA()
{
    AC_ARG_ENABLE(video-svga,
[  --enable-video-svga     use SVGAlib video driver [default=no]],
                  , enable_video_svga=no)
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
        video_svga=no
        AC_TRY_COMPILE([
         #include <vga.h>
         #include <vgamouse.h>
         #include <vgakeyboard.h>
        ],[
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
             exit(0);
         }
        ],[
        video_svga=yes
        ])
        AC_MSG_RESULT($video_svga)
        if test x$video_svga = xyes; then
            CFLAGS="$CFLAGS -DENABLE_SVGALIB"
            SYSTEM_LIBS="$SYSTEM_LIBS -lvga"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
            VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
        fi
    fi
}

dnl Find the VGL includes and libraries
CheckVGL()
{
    AC_ARG_ENABLE(video-vgl,
[  --enable-video-vgl     use VGL video driver [default=no]],
                  , enable_video_vgl=no)
    if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
        AC_MSG_CHECKING(for libVGL support)
        video_vgl=no
        AC_TRY_COMPILE([
         #include <sys/fbio.h>
         #include <sys/consio.h>
         #include <sys/kbio.h>
         #include <vgl.h>
        ],[
         VGLBitmap bitmap;
         exit(bitmap.Bitmap);
        ],[
        video_vgl=yes
        ])
        AC_MSG_RESULT($video_vgl)
        if test x$video_vgl = xyes; then
            CFLAGS="$CFLAGS -DENABLE_VGL"
            SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
            VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
        fi
    fi
}

dnl Find the AAlib includes
CheckAAlib()
{
    AC_ARG_ENABLE(video-aalib,
[  --enable-video-aalib    use AAlib video driver [default=no]],
                  , enable_video_aalib=no)
    if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
        AC_MSG_CHECKING(for AAlib support)
        video_aalib=no
        AC_TRY_COMPILE([
         #include <aalib.h>
        ],[
        ],[
        video_aalib=yes
        ])
        AC_MSG_RESULT($video_aalib)
        if test x$video_aalib = xyes; then
            CFLAGS="$CFLAGS -DENABLE_AALIB"
            SYSTEM_LIBS="$SYSTEM_LIBS -laa"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
            VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
        fi
    fi
}

dnl Set up the Atari Xbios driver
CheckAtariXbiosVideo()
{
    AC_ARG_ENABLE(xbios,
[  --enable-video-xbios    use Atari Xbios video driver [default=yes]],
                  , enable_video_xbios=yes)
    video_xbios=no
    if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
        video_xbios=yes
        CFLAGS="$CFLAGS -DENABLE_XBIOS"
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS xbios"
        VIDEO_DRIVERS="$VIDEO_DRIVERS xbios/libvideo_xbios.la"
    fi
}

dnl Set up the Atari Gem driver
CheckAtariGemVideo()
{
    AC_ARG_ENABLE(gem,
[  --enable-video-gem      use Atari Gem video driver [default=yes]],
                  , enable_video_gem=yes)
    if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
        video_gem=no
        AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
        AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
        if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
            video_gem=yes
            CFLAGS="$CFLAGS -DENABLE_GEM"
            SYSTEM_LIBS="$SYSTEM_LIBS -lgem"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS gem"
            VIDEO_DRIVERS="$VIDEO_DRIVERS gem/libvideo_gem.la"
        fi
    fi
}

dnl Set up the Atari Bios keyboard driver
CheckAtariBiosEvent()
{
    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/ataricommon"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS ataricommon"
    VIDEO_DRIVERS="$VIDEO_DRIVERS ataricommon/libvideo_ataricommon.la"
}

dnl rcg04172001 Set up the Null video driver.
CheckDummyVideo()
{
    AC_ARG_ENABLE(video-dummy,
[  --enable-video-dummy    use dummy video driver [default=yes]],
                  , enable_video_dummy=yes)
    if test x$enable_video_dummy = xyes; then
      CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
      VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
      VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
    fi
}

dnl Check to see if OpenGL support is desired
AC_ARG_ENABLE(video-opengl,
[  --enable-video-opengl   include OpenGL context creation [default=yes]],
              , enable_video_opengl=yes)

dnl Find OpenGL
CheckOpenGL()
{
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
        AC_MSG_CHECKING(for OpenGL (GLX) support)
        video_opengl=no
        AC_TRY_COMPILE([
         #include <GL/gl.h>
         #include <GL/glx.h>
         #include <dlfcn.h> /* For loading extensions */
        ],[
        ],[
        video_opengl=yes
        ])
        AC_MSG_RESULT($video_opengl)
        if test x$video_opengl = xyes; then
            CFLAGS="$CFLAGS -DHAVE_OPENGL"
            if test x$use_dlopen != xyes; then
                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
            fi
        fi
    fi
}

dnl Find QNX RtP OpenGL
CheckOpenGLQNX()
{
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
        AC_MSG_CHECKING(for OpenGL (Photon) support)
        video_opengl=no
        AC_TRY_COMPILE([
         #include <GL/gl.h>
        ],[
        ],[
        video_opengl=yes
        ])
        AC_MSG_RESULT($video_opengl)
        if test x$video_opengl = xyes; then
            CFLAGS="$CFLAGS -DHAVE_OPENGL"
            SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
        fi
    fi
}

dnl Check for BeOS OpenGL
CheckBeGL()
{
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
        CFLAGS="$CFLAGS -DHAVE_OPENGL"
        SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
    fi
}

dnl Check for MacOS OpenGL
CheckMacGL()
{
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
        CFLAGS="$CFLAGS -DHAVE_OPENGL"
        case "$target" in
            *-*-darwin*)
                SDL_LIBS="$SDL_LIBS -framework OpenGL -framework AGL"
        esac
    fi
}

dnl See if we can use the new unified event interface in Linux 2.4
CheckInputEvents()
{
    dnl Check for Linux 2.4 unified input event interface support
    AC_ARG_ENABLE(input-events,
[  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
                  , enable_input_events=yes)
    if test x$enable_input_events = xyes; then
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
        use_input_events=no
        AC_TRY_COMPILE([
          #include <linux/input.h>
        ],[
          #ifndef EVIOCGNAME
          #error EVIOCGNAME() ioctl not available
          #endif
        ],[
        use_input_events=yes
        ])
        AC_MSG_RESULT($use_input_events)
        if test x$use_input_events = xyes; then
            CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
        fi
    fi
}

dnl See what type of thread model to use on Linux and Solaris
CheckPTHREAD()
{
    dnl Check for pthread support
    AC_ARG_ENABLE(pthreads,
[  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
                  , enable_pthreads=yes)
    dnl This is used on Linux for glibc binary compatibility (Doh!)
    AC_ARG_ENABLE(pthread-sem,
[  --enable-pthread-sem    use pthread semaphores [default=yes]],
                  , enable_pthread_sem=yes)
    ac_save_libs="$LIBS"
    case "$target" in
        *-*-bsdi*)
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
            pthread_lib=""
            ;;
        *-*-darwin*)
            pthread_cflags="-D_THREAD_SAFE"
# causes Carbon.p complaints?
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
            ;;
        *-*-freebsd*)
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
            pthread_lib="-pthread"
            ;;
        *-*-netbsd*)
            pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
            pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
            ;;
        *-*-openbsd*)
            pthread_cflags="-D_REENTRANT"
            pthread_lib="-pthread"
            ;;
        *-*-solaris*)
            pthread_cflags="-D_REENTRANT"
            pthread_lib="-lpthread -lposix4"
            ;;
        *-*-sysv5*)
            pthread_cflags="-D_REENTRANT -Kthread"
            pthread_lib=""
            ;;
        *-*-irix*)
            pthread_cflags="-D_SGI_MP_SOURCE"
            pthread_lib="-lpthread"
            ;;
        *-*-aix*)
            pthread_cflags="-D_REENTRANT -mthreads"
            pthread_lib="-lpthread"
            ;;
        *-*-qnx*)
            pthread_cflags=""
            pthread_lib=""
            ;;
        *)
            pthread_cflags="-D_REENTRANT"
            pthread_lib="-lpthread"
            ;;
    esac
    LIBS="$LIBS $pthread_lib"
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
        AC_MSG_CHECKING(for pthreads)
        use_pthreads=no
        AC_TRY_LINK([
         #include <pthread.h>
        ],[
         pthread_attr_t type;
         pthread_attr_init(&type);
        ],[
        use_pthreads=yes
        ])
        AC_MSG_RESULT($use_pthreads)
        if test x$use_pthreads = xyes; then
            CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
            SDL_LIBS="$SDL_LIBS $pthread_lib"

            # Check to see if recursive mutexes are available
            AC_MSG_CHECKING(for recursive mutexes)
            has_recursive_mutexes=no
            AC_TRY_LINK([
              #include <pthread.h>
            ],[
              pthread_mutexattr_t attr;
              #if defined(linux) && !(defined(__arm__) && defined(QWS))
              pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
              #else
              pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
              #endif
            ],[
            has_recursive_mutexes=yes
            ])
            # Some systems have broken recursive mutex implementations
            case "$target" in
                *-*-solaris*)
                    has_recursive_mutexes=no
                    ;;
            esac
            AC_MSG_RESULT($has_recursive_mutexes)
            if test x$has_recursive_mutexes != xyes; then
                CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
            fi

            # Check to see if pthread semaphore support is missing
            if test x$enable_pthread_sem = xyes; then
                AC_MSG_CHECKING(for pthread semaphores)
                have_pthread_sem=no
                AC_TRY_COMPILE([
                  #include <pthread.h>
                  #include <semaphore.h>
                ],[
                ],[
                have_pthread_sem=yes
                ])
                AC_MSG_RESULT($have_pthread_sem)
            fi

            # Check to see if this is broken glibc 2.0 pthreads
            case "$target" in
                *-*-linux*)
                    AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
                    glibc20_pthreads=no
                    AC_TRY_COMPILE([
                      #include <features.h>
                      #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
                      #warning Working around a bug in glibc 2.0 pthreads
                      #else
                      #error pthread implementation okay
                      #endif /* glibc 2.0 */
                    ],[
                    ],[
                    glibc20_pthreads=yes
                    ])
                    AC_MSG_RESULT($glibc20_pthreads)
            esac
        fi
    fi
    LIBS="$ac_save_libs"

    AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
    have_semun=no
    AC_TRY_COMPILE([
      #include <sys/types.h>
      #include <sys/sem.h>
    ],[
      union semun t;
    ],[
    have_semun=yes
    ])
    AC_MSG_RESULT($have_semun)
    if test x$have_semun = xyes; then
        CFLAGS="$CFLAGS -DHAVE_SEMUN"
    fi

    # See if we can use clone() on Linux directly
    use_clone=no
    if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
        case "$target" in
            *-*-linux*)
                use_clone=yes
                ;;
            *)
                CFLAGS="$CFLAGS -DFORK_HACK"
                ;;
        esac
    fi
    AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
}

dnl See if we can use GNU pth library for threads
CheckPTH()
{
    dnl Check for pth support
    AC_ARG_ENABLE(pth,
[  --enable-pth            use GNU pth library for multi-threading [default=yes]],
                  , enable_pth=yes)
    if test x$enable_threads = xyes -a x$enable_pth = xyes; then
        AC_PATH_PROG(PTH_CONFIG, pth-config, no)
        if test "$PTH_CONFIG" = "no"; then
            use_pth=no
        else
            PTH_CFLAGS=`$PTH_CONFIG --cflags`
            PTH_LIBS=`$PTH_CONFIG --libs --all`
            SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
            SDL_LIBS="$SDL_LIBS $PTH_LIBS"
            CFLAGS="$CFLAGS -DENABLE_PTH"
            use_pth=yes
        fi
        AC_MSG_CHECKING(pth)
        if test "x$use_pth" = xyes; then
            AC_MSG_RESULT(yes)
        else
            AC_MSG_RESULT(no)
        fi
    fi
}

dnl Determine whether the compiler can produce Win32 executables
CheckWIN32()
{
    AC_MSG_CHECKING(Win32 compiler)
    have_win32_gcc=no
    AC_TRY_COMPILE([
     #include <windows.h>
    ],[
    ],[
    have_win32_gcc=yes
    ])
    AC_MSG_RESULT($have_win32_gcc)
    if test x$have_win32_gcc != xyes; then
       AC_MSG_ERROR([
*** Your compiler ($CC) does not produce Win32 executables!
       ])
    fi

    dnl See if the user wants to redirect standard output to files
    AC_ARG_ENABLE(stdio-redirect,
[  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
                  , enable_stdio_redirect=yes)
    if test x$enable_stdio_redirect != xyes; then
        CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
    fi
}

dnl Find the DirectX includes and libraries
CheckDIRECTX()
{
    AC_ARG_ENABLE(directx,
[  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
                  , enable_directx=yes)
    if test x$enable_directx = xyes; then
        AC_MSG_CHECKING(for DirectX headers and libraries)
        use_directx=no
        AC_TRY_COMPILE([
         #include "src/video/windx5/directx.h"
        ],[
        ],[
        use_directx=yes
        ])
        AC_MSG_RESULT($use_directx)
    fi
    AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)

    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
    SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
    VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
    # Enable the DIB driver
    CFLAGS="$CFLAGS -DENABLE_WINDIB"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
    VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
    # See if we should enable the DirectX driver
    if test x$use_directx = xyes; then
        CFLAGS="$CFLAGS -DENABLE_DIRECTX"
        SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
        VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
    fi
}

dnl Set up the BWindow video driver on BeOS
CheckBWINDOW()
{
    CFLAGS="$CFLAGS -DENABLE_BWINDOW"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
    VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
}

dnl Set up the QTopia video driver if enabled
CheckQtopia()
{
    AC_ARG_ENABLE(video-qtopia,
[  --enable-video-qtopia   use Qtopia video driver [default=no]],
                  , enable_video_qtopia=no)
    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
        AC_MSG_CHECKING(for Qtopia support)
        video_qtopia=no
        AC_LANG_CPLUSPLUS
        OLD_CXX="$CXXFLAGS"
        CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
        AC_TRY_COMPILE([
         #include <qpe/qpeapplication.h>
        ],[
        ],[
        video_qtopia=yes
        ])
        CXXFLAGS="$OLD_CXX"
        AC_MSG_RESULT($video_qtopia)
        if test x$video_qtopia = xyes; then
            CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
            SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
            VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
        fi
        AC_LANG_C
    fi
}

dnl Set up the Mac toolbox video driver for Mac OS 7-9
CheckTOOLBOX()
{
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
}

dnl Set up the Mac toolbox video driver for Mac OS X
CheckCARBON()
{
    # "MACOSX" is not an official definition, but it's commonly
    # accepted as a way to differentiate between what runs on X
    # and what runs on older Macs - while in theory "Carbon" defns
    # are consistent between the two, in practice Carbon is still
    # changing. -sts Aug 2000
    mac_autoconf_target_workaround="MAC"
    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
      -fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
}

dnl Set up the Mac toolbox video driver for Mac OS X
CheckQUARTZ()
{
    # "MACOSX" is not an official definition, but it's commonly
    # accepted as a way to differentiate between what runs on X
    # and what runs on older Macs - while in theory "Carbon" defns
    # are consistent between the two, in practice Carbon is still
    # changing. -sts Aug 2000
    mac_autoconf_target_workaround="MAC"
    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
      -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
    VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
}

dnl Check for the dlfcn.h interface for dynamically loading objects
CheckDLOPEN()
{
    AC_ARG_ENABLE(dlopen,
[  --enable-dlopen         use dlopen for shared object loading [default=no]],
                  , enable_dlopen=no)
    if test x$enable_dlopen = xyes; then
        AC_MSG_CHECKING(for dlopen)
        use_dlopen=no
        AC_TRY_COMPILE([
         #include <dlfcn.h>
        ],[
        ],[
        use_dlopen=yes
        ])
        AC_MSG_RESULT($use_dlopen)

        if test x$use_dlopen = xyes; then
            CFLAGS="$CFLAGS -DUSE_DLOPEN"
            AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
        fi
    fi
}

case "$target" in
    *-*-linux*)
        ARCH=linux
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckALSA
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckNANOX
        CheckDGA
        CheckFBCON
        CheckDirectFB
        CheckPS2GS
        CheckGGI
        CheckSVGA
        CheckAAlib
        CheckQtopia
        CheckOpenGL
        CheckInputEvents
        CheckPTHREAD
        # Set up files for the main() stub
        if test "x$video_qtopia" = "xyes"; then
          COPY_ARCH_SRC(src/main, linux, SDL_Qtopia_main.cc)
          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
          SDL_LIBS="-lSDLmain $SDL_LIBS"
        else
          COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        fi
        # Set up files for the audio library
        # We use the OSS and ALSA API's, not the Sun audio API
        #if test x$enable_audio = xyes; then
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        #fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
            CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            if test x$use_pthreads != xyes; then
                COPY_ARCH_SRC(src/thread, linux, clone.S)
            fi
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            if test x$glibc20_pthreads = xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
                if test x$has_recursive_mutexes != xyes; then
                    COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
                else
                    COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
                fi
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
            fi
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-bsdi*)
        ARCH=bsdi
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckDGA
        CheckSVGA
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        # We use the OSS and ALSA API's, not the Sun audio API
        #if test x$enable_audio = xyes; then
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        #fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
            CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-freebsd*)
        ARCH=freebsd
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckVGL
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckDGA
        CheckSVGA
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        # We use the OSS and ALSA API's, not the Sun audio API
        #if test x$enable_audio = xyes; then
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        #fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
            CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-netbsd*)
        ARCH=netbsd
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        # NetBSD does not define "unix"
        CFLAGS="$CFLAGS -Dunix -D_POSIX_THREAD_SYSCALL_SOFT=1"
        ;;
    *-*-openbsd*)
        ARCH=openbsd
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
            AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
        fi
        # OpenBSD needs linking with ossaudio emulation library
        if test x$have_oss = xyes; then
            SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
            SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        # OpenBSD does not define "unix"
        CFLAGS="$CFLAGS -Dunix"
        ;;
    *-*-sysv5*)
        ARCH=sysv5
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-solaris*)
        ARCH=solaris
        CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNASM
        CheckOSS
        CheckARTSC
        CheckESD
        CheckNAS
        CheckX11
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
            CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-irix*)
        ARCH=irix
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckDMEDIA
        CheckESD
        CheckNAS
        CheckX11
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # We use the dmedia audio API, not the Sun audio API
        #if test x$enable_audio = xyes; then
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        #fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        # (No CD-ROM support yet)
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            if test x$use_pthreads = xyes; then
                COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
                COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
                if test x$have_pthread_sem != xyes; then
                    COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
                else
                    COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
                fi
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
                COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
            else
                COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
                COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
            fi
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-hpux*)
        ARCH=hpux
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckOSS
        CheckNAS
        CheckX11
        CheckGGI
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        # (No CD-ROM support yet)
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-aix*)
        ARCH=aix
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckOSS
        CheckNAS
        CheckX11
        CheckGGI
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
            AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
        fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
            CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-osf*)
        ARCH=osf
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNAS
        CheckX11
        CheckGGI
        CheckAAlib
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        # (No joystick support yet)
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        # (No cdrom support yet)
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-qnx*)
        ARCH=qnx
        CheckDummyVideo
        CheckDiskAudio
        CheckDLOPEN
        CheckNAS
        CheckPHOTON
        CheckX11
        CheckOpenGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            CFLAGS="$CFLAGS -DALSA_SUPPORT"
            SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
            AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
        # (No joystick support yet)
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
            CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        ;;
    *-*-cygwin* | *-*-mingw32*)
        ARCH=win32
        if test "$build" != "$target"; then # cross-compiling
            # Default cross-compile location
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
        else
            # Look for the location of the tools and install there
            if [ "$BUILD_PREFIX" != "" ]; then
                ac_default_prefix=$BUILD_PREFIX
            fi
        fi
        CheckDummyVideo
        CheckDiskAudio
        CheckWIN32
        CheckDIRECTX
        CheckNASM
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, win32, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
            AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
            if test x$use_directx = xyes; then
                AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
                AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
            fi
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
            CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
        fi
        # The Win32 platform requires special setup
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
        case "$target" in
            *-*-cygwin*)
                CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
                SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
                LIBS="$LIBS -mno-cygwin"
                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
                ;;
            *-*-mingw32*)
                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
                ;;
        esac
        ;;
    *-*-beos*)
        ARCH=beos
        ac_default_prefix=/boot/develop/tools/gnupro
        CheckDummyVideo
        CheckDiskAudio
        CheckNASM
        CheckBWINDOW
        CheckBeGL
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc)
        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
            AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
            CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
        fi
        # The BeOS platform requires special libraries
        SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe"
        ;;
    *-*-macos*)
        # This would be used if cross-compiling to MacOS 9.  No way to
        # use it at present, but Apple is working on a X-to-9 compiler
        # for which this case would be handy.
        ARCH=macos
        CheckDummyVideo
        CheckDiskAudio
        CheckTOOLBOX
        CheckMacGL
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, macos, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
            CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
            COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
        fi
        # The MacOS platform requires special setup
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
        SDL_LIBS="-lSDLmain $SDL_LIBS"
        ;;
    *-*-darwin* )
        # Strictly speaking, we want "Mac OS X", not "Darwin", which is
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
        # But config.guess comes back with "darwin", so go with the flow.
        ARCH=macosx
        CheckDummyVideo
        CheckDiskAudio
        CheckQUARTZ
        CheckMacGL
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, macosx, SDLMain.m)
        COPY_ARCH_SRC(src/main, macosx, SDLMain.h)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
            SDL_LIBS="$SDL_LIBS -framework IOKit"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
            if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            else
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
        fi
        # The MacOS X platform requires special setup
        SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework -F/System/Library/Frameworks/Cocoa.framework"
        SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon -framework Cocoa"
        ;;
    *-*-mint*)
        ARCH=mint
        CheckDummyVideo
        CheckDiskAudio
        CheckAtariBiosEvent
        CheckAtariXbiosVideo
        CheckAtariGemVideo
        CheckPTH
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
        fi
        # Set up files for the joystick library
        if test x$enable_joystick = xyes; then
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            if test x$enable_pth = xyes; then
                COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
                COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
                COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
                COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
                COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
            else
                COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
                COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
            fi
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
            COPY_ARCH_SRC(src/timer, mint, SDL_vbltimer.S)
            COPY_ARCH_SRC(src/timer, mint, SDL_vbltimer_s.h)
        fi
        # MiNT does not define "unix"
        CFLAGS="$CFLAGS -Dunix"
        ;;
    *)
        AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
        ;;
esac
AC_SUBST(ARCH)

# Set the conditional variables for this target
AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)

# Set conditional variables for shared and static library selection.
# These are not used in any Makefile.am but in sdl-config.in.
AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])

# Set runtime shared library paths as needed

if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
fi
if test $ARCH = solaris; then
  SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
fi
if test $ARCH = openbsd -o $ARCH = bsdi; then
    SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
else
    SHARED_SYSTEM_LIBS=""
fi
STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"

dnl Output the video drivers we use
if test x$enable_video = xtrue; then
    if test "$VIDEO_SUBDIRS" = ""; then
        AC_MSG_ERROR(*** No video drivers are enabled!)
    fi
fi
AC_SUBST(AUDIO_SUBDIRS)
AC_SUBST(AUDIO_DRIVERS)
AC_SUBST(VIDEO_SUBDIRS)
AC_SUBST(VIDEO_DRIVERS)
AC_SUBST(JOYSTICK_SUBDIRS)
AC_SUBST(JOYSTICK_DRIVERS)
AC_SUBST(CDROM_SUBDIRS)
AC_SUBST(CDROM_DRIVERS)
AC_SUBST(SDL_EXTRADIRS)
AC_SUBST(SDL_EXTRALIBS)

dnl Expand the cflags and libraries needed by apps using SDL
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_RLD_FLAGS)

dnl Expand the libraries needed for static and dynamic linking
AC_SUBST(STATIC_SYSTEM_LIBS)
AC_SUBST(SHARED_SYSTEM_LIBS)
AC_SUBST(SYSTEM_LIBS)

dnl Expand the include directories for building SDL
CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
CXXFLAGS="$CFLAGS"


# Check for darwin at the very end and set up the Objective C compiler
# We do this here so that we get the full CFLAGS into OBJCFLAGS
case "$target" in
    *-*-darwin*)
        OBJC="cc"
        OBJCFLAGS="$CFLAGS"
        OBJCDEPMODE="$CCDEPMODE"
        AC_SUBST(OBJC)
        AC_SUBST(OBJCFLAGS)
        AC_SUBST(OBJCDEPMODE)
        ;;
esac

# Finally create all the generated files
dnl Important: Any directory that you want to be in the distcheck should
dnl            have a file listed here, so that configure generates the
dnl            subdirectories on the build target.
AC_OUTPUT([
Makefile
docs/Makefile
docs/html/Makefile
docs/man3/Makefile
include/Makefile
src/Makefile
src/main/Makefile
src/main/macosx/Makefile
src/main/macosx/Info.plist
src/audio/Makefile
src/audio/alsa/Makefile
src/audio/arts/Makefile
src/audio/baudio/Makefile
src/audio/dma/Makefile
src/audio/dmedia/Makefile
src/audio/dsp/Makefile
src/audio/esd/Makefile
src/audio/macrom/Makefile
src/audio/nas/Makefile
src/audio/nto/Makefile
src/audio/openbsd/Makefile
src/audio/paudio/Makefile
src/audio/sun/Makefile
src/audio/ums/Makefile
src/audio/windib/Makefile
src/audio/windx5/Makefile
src/audio/disk/Makefile
src/video/Makefile
src/video/XFree86/Makefile
src/video/XFree86/extensions/Makefile
src/video/XFree86/Xinerama/Makefile
src/video/XFree86/Xv/Makefile
src/video/XFree86/Xxf86dga/Makefile
src/video/XFree86/Xxf86vm/Makefile
src/video/cybergfx/Makefile
src/video/x11/Makefile
src/video/dga/Makefile
src/video/nanox/Makefile
src/video/fbcon/Makefile
src/video/directfb/Makefile
src/video/ps2gs/Makefile
src/video/ggi/Makefile
src/video/maccommon/Makefile
src/video/macdsp/Makefile
src/video/macrom/Makefile
src/video/quartz/Makefile
src/video/svga/Makefile
src/video/vgl/Makefile
src/video/aalib/Makefile
src/video/wincommon/Makefile
src/video/windib/Makefile
src/video/windx5/Makefile
src/video/bwindow/Makefile
src/video/photon/Makefile
src/video/epoc/Makefile
src/video/dummy/Makefile
src/video/ataricommon/Makefile
src/video/xbios/Makefile
src/video/gem/Makefile
src/video/qtopia/Makefile
src/events/Makefile
src/joystick/Makefile
src/joystick/amigaos/Makefile
src/joystick/beos/Makefile
src/joystick/bsd/Makefile
src/joystick/darwin/Makefile
src/joystick/dummy/Makefile
src/joystick/linux/Makefile
src/joystick/macos/Makefile
src/joystick/mint/Makefile
src/joystick/win32/Makefile
src/cdrom/Makefile
src/cdrom/aix/Makefile
src/cdrom/beos/Makefile
src/cdrom/dummy/Makefile
src/cdrom/bsdi/Makefile
src/cdrom/freebsd/Makefile
src/cdrom/linux/Makefile
src/cdrom/macos/Makefile
src/cdrom/openbsd/Makefile
src/cdrom/qnx/Makefile
src/cdrom/win32/Makefile
src/thread/Makefile
src/timer/Makefile
src/endian/Makefile
src/file/Makefile
src/hermes/Makefile
sdl-config
SDL.spec
], [chmod +x sdl-config])