Source

Coin / configure.ac

Full commit
   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
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
# **************************************************************************

# FIXME: try to fix all problems with spaces in directory names;
# whether it's the src dir, the install/build dir or directories with
# dependent libraries. Alternatively, we should at least detect and
# warn/exit. Ditto goes for all our other software modules aswell, of
# course. 20020519 mortene.

# FIXME: need to figure out when libstdc++ is necessary to link. GCC
# 3.2 on Solaris seems to demand it, or we'll get unresolved symbols.
# 20021128 mortene.

# **************************************************************************

# release version number info
m4_define([COIN_MAJOR], [4])
m4_define([COIN_MINOR], [0])
m4_define([COIN_MICRO], [0])
m4_define([COIN_BETA], [a])

# This is probably a more correct setup, but will be harder to keep if
# we want major and minor to grow slowly (but is that any point?)
# 20010807 larsa
m4_define([COIN_ABI_CURRENT], [m4_eval((COIN_MAJOR*20)+COIN_MINOR)])
m4_define([COIN_ABI_REVISION], [COIN_MICRO])
m4_define([COIN_ABI_AGE], [COIN_MINOR])

# only used on Linux for debian packages
m4_define([SO_NUMBER], [m4_eval(COIN_MAJOR*20)])

# For Mac OS X Compiler Frameworks:
m4_define([MAC_FRAMEWORK_NAME_DEFAULT], [Inventor])
m4_define([MAC_FRAMEWORK_PREFIX_DEFAULT], [/Library/Frameworks])
m4_define([MAC_FRAMEWORK_VERSION_DEFAULT], [C])

# **************************************************************************

AC_PREREQ(2.50)

AC_INIT([Coin], [COIN_MAJOR.COIN_MINOR.COIN_MICRO[]COIN_BETA],
  [coin-support@coin3d.org])

AC_CONFIG_AUX_DIR(cfg)
AC_CONFIG_SRCDIR(src/misc/SoDB.cpp)

# FIXME: detect and exit upon this problem (as seen reported on
# coin-bugs): the install prefix is set to the same directory as the
# build directory (or also as the srccode dir). 20020129 mortene.


AH_TOP([
#ifndef COIN_INTERNAL
#error this is a private header file
#endif

#include <unconfig.h>
#include <setup.h>
])

AC_CANONICAL_SYSTEM

# For include/Inventor/system/inttypes.h.
AC_DEFINE_UNQUOTED(COIN_CONFIGURE_BUILD, SIM_AS_TR_CPP([$build]), [Build system.])
AC_DEFINE_UNQUOTED(COIN_CONFIGURE_HOST, SIM_AS_TR_CPP([$host]), [Build host system.])
AC_DEFINE_UNQUOTED(COIN_CONFIGURE_TARGET, SIM_AS_TR_CPP([$target]), [Build target system.])

# date used by debian setup
SIM_AC_DATE_RFC822([RFC822_DATE])
AC_SUBST([RFC822_DATE])

# date used by redhat setup
SIM_AC_ISO8601_DATE([coin_configure_date])
AC_SUBST([coin_configure_date])

SIM_AC_MSVC_DSP_ENABLE_OPTION

# If the Microsoft Visual C++ cl.exe compiler is available, set us up for
# compiling with it and to generate an MSWindows .dll file.

SIM_AC_SETUP_MSVCPP_IFELSE

# **************************************************************************
# Mac OS X: gcc

# old-compat
AC_ARG_WITH([framework],
  [  --without-framework     (deprecated: use --disable-framework)],
  [case "$withval" in
  no | false ) enable_framework=false ;;
  * ) ;;
  esac])

sim_ac_framework_name="MAC_FRAMEWORK_NAME_DEFAULT"
AC_ARG_ENABLE([framework],
  [AC_HELP_STRING([--disable-framework], 
                  [Do 'UNIX-style' installation on Mac OS X])],
  [case $enableval in
  no | false ) sim_ac_framework=false ;;
  * ) sim_ac_framework=true ;;
  esac],
  [case $host_os in
  darwin* ) sim_ac_framework=true ;;
  * ) sim_ac_framework=false ;;
  esac])

AC_ARG_WITH([framework-prefix],
  [  --with-framework-prefix=<path>  (default: "MAC_FRAMEWORK_PREFIX_DEFAULT")],
  [sim_ac_framework_prefix="$withval"
  if test x"$sim_ac_framework_prefix" = x""; then
    sim_ac_framework_prefix=\${prefix}
  fi],
  [sim_ac_framework_prefix="MAC_FRAMEWORK_PREFIX_DEFAULT"])

sim_ac_framework_version="MAC_FRAMEWORK_VERSION_DEFAULT"

AC_SUBST([MAC_FRAMEWORK], [$sim_ac_framework])
AC_SUBST([MAC_FRAMEWORK_NAME], [$sim_ac_framework_name])
AC_SUBST([MAC_FRAMEWORK_PREFIX], [$sim_ac_framework_prefix])
AC_SUBST([MAC_FRAMEWORK_VERSION], [$sim_ac_framework_version])

AC_SUBST([nop], [])

frameworkdir=
if $sim_ac_framework; then
  frameworkdir="${sim_ac_framework_prefix}/${sim_ac_framework_name}.framework"
  includedir="$frameworkdir/Resources/include"
fi

ivincludedir=$includedir

AC_SUBST([ivincludedir])
AC_SUBST([frameworkdir])

# **************************************************************************

ac_build_year=$(date +%Y)


AC_SUBST([COIN_BUILD_YEAR], $ac_build_year)
AC_SUBST([COIN_MAJOR_VERSION], [COIN_MAJOR])
AC_SUBST([COIN_MINOR_VERSION], [COIN_MINOR])
AC_SUBST([COIN_MICRO_VERSION], [COIN_MICRO])
AC_SUBST([COIN_BETA_VERSION], [COIN_BETA])
AC_SUBST([COIN_VERSION], [$COIN_MAJOR_VERSION.$COIN_MINOR_VERSION.$COIN_MICRO_VERSION$COIN_BETA_VERSION])
VERSION=$COIN_VERSION

SIM_AC_CONFIGURATION_SETTING([Library version], [$COIN_VERSION])

# Libtool versioning
AC_SUBST([LT_CURRENT], [COIN_ABI_CURRENT])
AC_SUBST([LT_REVISION], [COIN_ABI_REVISION])
AC_SUBST([LT_AGE], [COIN_ABI_AGE])

AC_SUBST([COIN_SO_VERSION], [SO_NUMBER])

#  These are for include/Inventor/C/basic.h.

AC_DEFINE_UNQUOTED([COIN_MAJOR_VERSION], [$COIN_MAJOR_VERSION],
  [define this to the libCoin major version number])
AC_DEFINE_UNQUOTED([COIN_MINOR_VERSION], [$COIN_MINOR_VERSION],
  [define this to the libCoin minor version number])
AC_DEFINE_UNQUOTED([COIN_MICRO_VERSION], [$COIN_MICRO_VERSION],
  [define this to the libCoin release version number])
AC_DEFINE_UNQUOTED([COIN_VERSION], ["$COIN_VERSION"],
  [define this to the full libCoin major.minor.micro version number])
if test x"$COIN_BETA_VERSION" = x""; then :; else
  AC_DEFINE_UNQUOTED([COIN_BETA_VERSION], [$COIN_BETA_VERSION],
    [define this to the libCoin beta version letter])
fi

# *******************************************************************
# Miscellaneous options and initializations.

coin_build_dir=`pwd`
coin_src_dir=`cd "$srcdir"; pwd`
coin_w32_build_dir=`cygpath -w "$coin_build_dir" 2>/dev/null || echo "$coin_build_dir"`
coin_w32_src_dir=`cygpath -w "$coin_src_dir" 2>/dev/null || echo "$coin_src_dir"`

SIM_AC_RELATIVE_SRC_DIR

# *******************************************************************
# set up configure options for "make distcheck" mode - we want to
# ensure that all options that can be turned on works...

AC_MSG_CHECKING([for distcheck mode])
case "$prefix:$coin_build_dir" in
*/=inst:*/=build )
  enable_threads=yes
  enable_threadsafe=yes
  enable_html=yes
  enable_man=yes
  enable_3ds_import=yes
  enable_debug=no
  AC_MSG_RESULT([yes])
  ;;
* )
  AC_MSG_RESULT([no])
  ;;
esac

# **************************************************************************
#  Locate C++ compiler and set C++ as the default language to use
#  in tests. The configure script will automatically terminate if
#  it doesn't find a C++ compiler.
AC_PROG_CC

# AC_OBJEXT
# AC_EXEEXT

# **************************************************************************
# NOTE: if we touch CFLAGS/CXXFLAGS before AC_PROG_CC is invoked, the -g
# flag will be lost  20020104 larsa

if $BUILD_WITH_MSVC; then
  SIM_AC_SETUP_MSVCRT([
    CPPFLAGS="$CPPFLAGS $sim_ac_msvcrt_CPPFLAGS"
    CFLAGS="$CFLAGS $sim_ac_msvcrt_CFLAGS"
    CXXFLAGS="$CXXFLAGS $sim_ac_msvcrt_CXXFLAGS"
    LDFLAGS="$LDFLAGS $sim_ac_msvcrt_LDFLAGS"
    LIBS="$LIBS $sim_ac_msvcrt_LIBS"
    # sim_ac_msvcrt_LIBLIBS is set up at the end
    # sim_ac_msvcrt_LIBLDFLAGS is set up at the end
  ])
fi

AC_SUBST([COIN_MSVC_LIBC], [$sim_ac_msvcrt])
AC_SUBST([BUILD_WITH_MSVC])

# **************************************************************************
# Universal Binary support (Mac OS X)

SIM_AC_UNIVERSAL_BINARIES

# **************************************************************************

AM_INIT_AUTOMAKE(Coin, $VERSION)

#  Default to not building a static library.
#  Can be overridden by the user with --enable-static.
AM_DISABLE_STATIC

#  Turn off default maintainer make-rules -- use ./bootstrap instead.
AM_MAINTAINER_MODE

if $BUILD_WITH_MSVC; then
  RANLIB=:
  export RANLIB
fi

# **************************************************************************
#  Locate C++ compiler and set C++ as the default language to use
#  in tests. The configure script will automatically terminate if
#  it doesn't find a C++ compiler.
#
#  Note that due to bugs in the libtool.m4 set of checks (of libtool v1.4.2)
#  that makes AC_PROG_LIBTOOL dependent on the current compiler being a C
#  compiler, we don't activate the C++ compiler until _after_ running
#  AC_PROG_LIBTOOL.
# 
#  (The specific checks we know not to work are the checks for "-c -o"
#  compatibility, where only CFLAGS is set up (and not CXXFLAGS) before the
#  check is run).

AC_PROG_CXX
AC_PROG_CXXCPP

# Since the plan is to not compile pure C anymore, we can simplify by always
# setting C++ mode in Coin's configure script.
AC_LANG([C++])

if $BUILD_WITH_MSVC; then
  SIM_AC_MSC_VERSION

  case "$sim_ac_msc_major_version" in
  8 | 9) CPPFLAGS="$CPPFLAGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS" ;;
  *)
  esac
fi

SIM_AC_STRIP_EXIT_DECLARATION

# **************************************************************************

SIM_AC_MACOS10_DEPLOYMENT_TARGET

if test x"$sim_ac_macos10_deployment_target_major_version" = x"10"; then
  # AC_DEFINE() COIN_MACOS_10_# as needed here...
  sim_ac_macosx=true
  sim_ac_macosx_10_2ff=false
  sim_ac_macosx_10_3ff=false
  AC_DEFINE([COIN_MACOS_10], 1, [Define for Mac OS X builds])
  if test 1 -le $sim_ac_macos10_deployment_target_minor_version; then
    AC_DEFINE([COIN_MACOS_10_1], 1, [Define for Mac OS 10.1 builds])
    sim_ac_macosx_10_2ff=false
    sim_ac_macosx_10_3ff=false
  fi
  if test 2 -le $sim_ac_macos10_deployment_target_minor_version; then
    AC_DEFINE([COIN_MACOS_10_2], 1, [Define for Mac OS 10.2 builds])
    sim_ac_macosx_10_2ff=true
    sim_ac_macosx_10_3ff=false
    sim_ac_macosx_name="Jaguar"
  fi
  if test 3 -le $sim_ac_macos10_deployment_target_minor_version; then
    #AC_DEFINE([COIN_MACOS_10_3], 1, [Define for Mac OS 10.3 builds])
    sim_ac_macosx_10_2ff=true
    sim_ac_macosx_10_3ff=true
    sim_ac_macosx_name="Panther"
  fi
  if test 4 -le $sim_ac_macos10_deployment_target_minor_version; then
    #AC_DEFINE([COIN_MACOS_10_4], 1, [Define for Mac OS 10.4 builds])
    sim_ac_macosx_10_2ff=true
    sim_ac_macosx_10_3ff=true
    sim_ac_macosx_name="Tiger"
  fi
  if test 5 -le $sim_ac_macos10_deployment_target_minor_version; then
    #AC_DEFINE([COIN_MACOS_10_5], 1, [Define for Mac OS 10.5 builds])
    sim_ac_macosx_10_2ff=true
    sim_ac_macosx_10_3ff=true
    sim_ac_macosx_name="Leopard"
  fi
else
  sim_ac_macosx=false
  sim_ac_macosx_10_2ff=false
  sim_ac_macosx_10_3ff=false
  sim_ac_macosx_name=""
fi

AM_CONDITIONAL([MAC_FRAMEWORK], [$sim_ac_framework])
if $sim_ac_framework; then
  AC_DEFINE([COIN_MACOSX_FRAMEWORK], 1, [Define when building Mac OS X framework])
fi

AM_CONDITIONAL([MACOSX_10_2FF], [$sim_ac_macosx_10_2ff])
AM_CONDITIONAL([MACOSX_10_3FF], [$sim_ac_macosx_10_3ff])
AM_CONDITIONAL([MACOSX], [$sim_ac_macosx])
AC_SUBST([MACOSX_10_2FF], [$sim_ac_macosx_10_2ff])
AC_SUBST([MACOSX_NAME], [$sim_ac_macosx_name])

# **************************************************************************
#  Initialize libtool
#
# FIXME: this must be done even when we're not using libtool (as when
# building with MSVC++), because that's where at least the enable_static
# and enable_shared flags are set up. 20030324 mortene.
AC_PROG_LIBTOOL

# **************************************************************************
#  These are used for constructing the coin-config file.
AC_SUBST([COIN_EXTRA_CPPFLAGS], [$CPPFLAGS])
AC_SUBST([COIN_EXTRA_CFLAGS], [$CFLAGS])
AC_SUBST([COIN_EXTRA_CXXFLAGS], [$CXXFLAGS])
AC_SUBST([COIN_EXTRA_LDFLAGS], [$LDFLAGS])
AC_SUBST([COIN_EXTRA_LIBS], [$LIBS])

# *******************************************************************
# Compiler checking.

## Make it possible for the user to turn off optimization flags for
## the compiler before running the fatal error checks below.
SIM_AC_COMPILER_OPTIMIZATION

## Smoke out some known defunct compilers.
SIM_AC_COMPILER_CPLUSPLUS_FATAL_ERRORS

## See which way the compiler knows the name of the current function. ####
SIM_AC_CHECK_VAR_FUNCTIONNAME

SIM_AC_MAC_CPP_ADJUSTMENTS

if test x"$prefix" = x"NONE"; then
  prefix=/usr/local
fi
#
# *******************************************************************
# Enable/disable separate Coin modules

sim_ac_enable_java_wrapper=false
AC_ARG_ENABLE(
  [java-wrapper],
  AC_HELP_STRING([--enable-java-wrapper], [enable building java wrapper]), [
  case $enableval in
    yes | true) sim_ac_enable_java_wrapper=true ;;
    no | false) sim_ac_enable_java_wrapper=false ;;
    *) ;;
  esac])

AM_CONDITIONAL([BUILD_JAVA_WRAPPER], [$sim_ac_enable_java_wrapper])

if $sim_ac_enable_java_wrapper; then
  AC_DEFINE([HAVE_JAVA_WRAPPER], 1, [Define this if you build the Java wrapper])
  SIM_AC_CONFIGURATION_SETTING([Generate Java wrapper], [Yes (not really)])
else
  SIM_AC_CONFIGURATION_SETTING([Generate Java wrapper], [No (default)])
fi

# *******************************************************************
# See if we should build with 3ds import capabilities.

sim_ac_enable_3ds_import=false
AC_ARG_ENABLE(
  [3ds-import],
  AC_HELP_STRING([--enable-3ds-import], [enable 3ds import capabilities]), [
  case $enableval in
    yes | true) sim_ac_enable_3ds_import=true ;;
    no | false) sim_ac_enable_3ds_import=false ;;
    *) ;;
  esac])

HAVE_3DS_IMPORT_CAPABILITIES=1

if $sim_ac_enable_3ds_import ; then
  AC_DEFINE([HAVE_3DS_IMPORT_CAPABILITIES],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([3ds import capabilities], [Yes (warning: experimental)])
else
  HAVE_3DS_IMPORT_CAPABILITIES=0
  SIM_AC_CONFIGURATION_SETTING([3ds import capabilities], [No  (enable with --enable-3ds-import)])
fi
AC_SUBST(HAVE_3DS_IMPORT_CAPABILITIES)

AM_CONDITIONAL([BUILD_3DS_CAPABILITIES], [$sim_ac_enable_3ds_import])


# *******************************************************************
# Enable/disable system expat

sim_ac_enable_system_expat=false
AC_ARG_ENABLE(
  [system-expat],
  AC_HELP_STRING([--enable-system-expat], [enable use of system-expat]), [
  case $enableval in
    yes | true) sim_ac_enable_system_expat=true ;;
    no | false) sim_ac_enable_system_expat=false ;;
    *) ;;
  esac])

AM_CONDITIONAL([USE_SYSTEM_EXPAT], [$sim_ac_enable_system_expat])

if $sim_ac_enable_system_expat; then
  AC_DEFINE([HAVE_SYSTEM_EXPAT], 1, [Define this if you want to use a system installation of expat])
  SIM_AC_CONFIGURATION_SETTING([Use system expat], [Yes])
else
  SIM_AC_CONFIGURATION_SETTING([Use system expat], [No (default)])
fi

# *******************************************************************
# See if we should build with javascript capabilities.

sim_ac_enable_javascript=true
AC_ARG_ENABLE(
  [javascript-api],
  AC_HELP_STRING([--disable-javascript-api], [disable javascript capabilities]), [
  case $enableval in
    yes | true) sim_ac_enable_javascript=true ;;
    no | false) sim_ac_enable_javascript=false ;;
    *) ;;
  esac])

HAVE_JAVASCRIPT=1

if $sim_ac_enable_javascript ; then
  AC_DEFINE([COIN_HAVE_JAVASCRIPT],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([javascript capabilities], [Yes])
else
  HAVE_JAVASCRIPT=0
  SIM_AC_CONFIGURATION_SETTING([javascript capabilities], [No (enable with --enable-javascript-api)])
fi
AC_SUBST(HAVE_JAVASCRIPT)

# *******************************************************************
# Query enabling/disabling various subsystems

sim_ac_enable_nodekits=true

AC_ARG_ENABLE(
  [nodekits],
  AC_HELP_STRING([--disable-nodekits], [disable nodekit support]), [
  case $enableval in
    yes | true) sim_ac_enable_nodekits=true ;;
    no | false) sim_ac_enable_nodekits=false ;;
    *) ;;
  esac])

sim_ac_enable_draggers=true

AC_ARG_ENABLE(
  [draggers],
  AC_HELP_STRING([--disable-draggers], [disable dragger support]), [
  case $enableval in
    yes | true) sim_ac_enable_draggers=true ;;
    no | false) sim_ac_enable_draggers=false ;;
    *) ;;
  esac])

sim_ac_enable_manipulators=true

AC_ARG_ENABLE(
  [manipulators],
  AC_HELP_STRING([--disable-manipulators], [disable manipulator support]), [
  case $enableval in
    yes | true) sim_ac_enable_manipulators=true ;;
    no | false) sim_ac_enable_manipulators=false ;;
    *) ;;
  esac])

HAVE_NODEKITS=1
HAVE_DRAGGERS=1
HAVE_MANIPULATORS=1

if $sim_ac_enable_nodekits; then
  AC_DEFINE([HAVE_NODEKITS],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([nodekit support], [Yes])
else
  HAVE_NODEKITS=0
  HAVE_DRAGGERS=0
  HAVE_MANIPULATORS=0
  SIM_AC_CONFIGURATION_SETTING([nodekit support], [No  (this severely cripples Coin)])
fi

if $sim_ac_enable_draggers && test x"$HAVE_NODEKITS" = x"1"; then
  AC_DEFINE([HAVE_DRAGGERS],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([dragger support], [Yes])
else
  HAVE_DRAGGERS=0
  HAVE_MANIPULATORS=0
  SIM_AC_CONFIGURATION_SETTING([dragger support], [No  (this severely cripples Coin)])
fi

if $sim_ac_enable_manipulators && test x"$HAVE_DRAGGERS" = x"1"; then
  AC_DEFINE([HAVE_MANIPULATORS],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([manipulator support], [Yes])
else
  HAVE_MANIPULATORS=0
  SIM_AC_CONFIGURATION_SETTING([manipulator support], [No  (this severely cripples Coin)])
fi

AC_SUBST(HAVE_NODEKITS)
AC_SUBST(HAVE_DRAGGERS)
AC_SUBST(HAVE_MANIPULATORS)

# *******************************************************************

sim_ac_enable_vrml97=true

AC_ARG_ENABLE(
  [vrml97],
  AC_HELP_STRING([--disable-vrml97], [disable VRML97 support]), [
  case $enableval in
    yes | true) sim_ac_enable_vrml97=true ;;
    no | false) sim_ac_enable_vrml97=false ;;
    *) ;;
  esac])

HAVE_VRML97=1

if $sim_ac_enable_vrml97 ; then
  AC_DEFINE([HAVE_VRML97],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([VRML97 support], [Yes])
else
  HAVE_VRML97=0
  SIM_AC_CONFIGURATION_SETTING([VRML97 support], [No  (enable with --enable-vrml97)])
fi
AC_SUBST(HAVE_VRML97)

# *******************************************************************
# Search for the "local GLU" extension

enable_superglu=false

if test -x ${srcdir}/src/extensions/superglu/configure; then
  enable_superglu=true
  AC_DEFINE(HAVE_SUPERGLU,1, [*EXPERIMENTAL* to use the GLU we've "appropriated" from SGI])
  HAVE_SUPERGLU=1
  AC_CONFIG_SUBDIRS([src/extensions/superglu])
  CPPFLAGS="-I$coin_build_dir/src/extensions/superglu/include -I$coin_src_dir/src/extensions/superglu/include $CPPFLAGS"
else
  enable_superglu=false
  HAVE_SUPERGLU=0
fi
AC_SUBST([HAVE_SUPERGLU])

AC_SUBST([SUPERGLUPREFIX], [Super])
export SUPERGLUPREFIX

AM_CONDITIONAL(BUILD_WITH_SUPERGLU, $enable_superglu)

# *******************************************************************

AC_ARG_ENABLE([threads],
  [AC_HELP_STRING([--disable-threads], [disable platform-independent multithreading abstraction classes])],
  [case $enableval in
  yes | true ) sim_ac_enable_threads=true ;;
  no | false ) sim_ac_enable_threads=false ;;
  *) AC_MSG_ERROR([invalid arg "$enableval" for --enable-threads option]) ;;
  esac],
  [sim_ac_enable_threads=true])

HAVE_THREADS=0

if $sim_ac_enable_threads; then

  sim_ac_threads_api="none"

  # Make it possible to explicitly turn off Win32 threads, to for instance
  # use POSIX threads instead under Win32.
  AC_ARG_ENABLE([w32threads],
    [AC_HELP_STRING([--disable-w32threads], [never use Win32 threads, even when available])],
    [case $enableval in
    yes | true ) sim_ac_w32_enable_threads=true ;;
    no | false ) sim_ac_w32_enable_threads=false ;;
    *) AC_MSG_ERROR([invalid arg "$enableval" for --disable-w32threads option]) ;;
    esac],
    [sim_ac_w32_enable_threads=true])

  sim_ac_win32_threads_available=false

  # Check for platform-native Win32 thread API first.
  if $sim_ac_w32_enable_threads; then
    AC_MSG_CHECKING([for Win32 threads])
    AC_TRY_LINK(
     [#include <windows.h>],
     [HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
      (void)SetThreadPriority(h, 0);
      ExitThread(0);],
     [sim_ac_win32_threads_available=true
      sim_ac_threads_api="native Win32"
      AC_DEFINE([USE_W32THREAD], , [define to use the Win32 threads API])
      AC_DEFINE([COIN_THREADID_TYPE], DWORD, [System dependant thread ID type])])
      # (we just ignore failure, as we fall through to POSIX threads)
    AC_MSG_RESULT($sim_ac_win32_threads_available)
  fi

  if ! $sim_ac_win32_threads_available; then
    SIM_AC_CHECK_PTHREAD([
      AC_DEFINE([USE_PTHREAD], , [define to use the POSIX threads API])
      AC_DEFINE([COIN_THREADID_TYPE], pthread_t, [System dependent thread ID type])
      sim_ac_threads_api="POSIX"
      COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_pthread_cppflags"
      COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_pthread_ldflags"
      COIN_EXTRA_LIBS="$sim_ac_pthread_libs $COIN_EXTRA_LIBS"
    ])
  fi

  if test "$sim_ac_threads_api" = "none"; then
    AC_MSG_ERROR([Could not find any usable native thread-handling API/library/devkit!  (If you do not want to enable the platform-independent thread-handling classes in Coin, specify the "--disable-threads" option to the configure script.)])
  fi

  HAVE_THREADS=1
  AC_DEFINE([HAVE_THREADS],, [to use the platform-independent thread-handling abstractions])
else
  sim_ac_threads_api="Disabled  (enable with --enable-threads)"
fi

AC_SUBST([HAVE_THREADS])
SIM_AC_CONFIGURATION_SETTING([System threads API], [$sim_ac_threads_api])

AM_CONDITIONAL([BUILD_WITH_THREADS], [$sim_ac_enable_threads])

# *******************************************************************
# Thread safe library

AC_ARG_ENABLE([threadsafe],
  AC_HELP_STRING([--enable-threadsafe], [enable thread safe traversals]),
  [case $enableval in
  yes | true ) sim_ac_enable_threadsafe=true ;;
  no | false ) sim_ac_enable_threadsafe=false ;;
  *) AC_MSG_ERROR([invalid arg "$enableval" for --enable-threadsafe option]) ;;
  esac],
  [sim_ac_enable_threadsafe=false])

HAVE_THREADSAFE=0

if $sim_ac_enable_threadsafe; then
  if test "$HAVE_THREADS" = "0"; then
    AC_MSG_ERROR([You can not enable thread safe action traversals while at the same time disabling the portable thread-handling abstractions. You must use "--enable-threadsafe" with "--enable-threads".])
  fi

  HAVE_THREADSAFE=1
  AC_DEFINE([COIN_THREADSAFE], 1, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([Thread safe traversals], [Yes  (in development)])
else
  SIM_AC_CONFIGURATION_SETTING([Thread safe traversals], [No  (enable with --enable-threadsafe)])
fi

# for coin.cfg
AC_SUBST([HAVE_THREADSAFE])

# *******************************************************************
# Headers we might want to use

# We expect these to include their dependencies.
#
# A non-empty last argument indicates to Autoconf that we would like to heed
# the result from compilation, not just pre-processing. (A space is enough
# to indicate non-emptiness.)
AC_CHECK_HEADERS(
  [unistd.h sys/types.h inttypes.h stdint.h sys/param.h sys/time.h sys/timeb.h time.h io.h windows.h libgen.h direct.h strings.h ieeefp.h],
  [], [], [])

AC_MSG_CHECKING([for flex file adjustments])
if test x"$ac_cv_header_unistd_h" != x"yes"; then
  AC_MSG_RESULT([-DYY_NO_UNISTD_H])
  CPPFLAGS="$CPPFLAGS -DYY_NO_UNISTD_H"
else
  AC_MSG_RESULT([none])
fi

SIM_AC_CHECK_HEADER_TLHELP32_H
SIM_AC_CHECK_FUNC__SPLITPATH

SIM_AC_CHECK_WIN32_API

# Various systems (like MKS NuTCracker) needs explicit gdi32 linkage.
if $sim_ac_have_win32_api; then
  LIBS="$LIBS -lgdi32"
  COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS -lgdi32"
fi

# A non-empty last argument indicates to Autoconf that we would like to heed
# the result from compilation, not just pre-processing. (A space is enough
# to indicate non-emptiness.)
AC_CHECK_HEADERS(
  [sys/unistd.h],
  [sim_ac_have_sys_unistd_h=true],
  [sim_ac_have_sys_unistd_h=false],
  [ ])

if $sim_ac_have_sys_unistd_h; then
  AC_MSG_CHECKING([for IN_PATH define conflict])
  AC_TRY_COMPILE(
   [#include <sys/unistd.h>],
   [void * v; v = (void*) IN_PATH;],
   [sim_ac_in_path_defined=true],
   [sim_ac_in_path_defined=false])
  if $sim_ac_in_path_defined; then
    AC_MSG_RESULT([yes])
    AC_DEFINE([COIN_UNDEF_IN_PATH_HACK],1,
     [define to "remove" conflicting IN_PATH define from <sys/unistd.h>])
  else
    AC_MSG_RESULT([no])
  fi
fi
    
# According to Coin user Ralf Corsepius, at least SunOS4 needs
# to include sys/types.h before netinet/in.h. There have also
# been a problem report for FreeBSD which seems to indicate
# the same dependency on that platform aswell.
#
# FIXME: should we make this into a general macro
# SIM_AC_CHECK_DEPENDENT_HEADER(HEADER, DEPENDONHEADERS..)? 20001025 mortene.
#
# FIXME2: is this really necessary? AC _CHECK_HEADER(S) tests by using the
# preprocessor, not by doing a compile, so we could probably just
# include netinet/in.h in the above list to AC _CHECK_HEADERS. We wouldn't
# catch problems quiet so early on, though. 20001025 mortene.

AC_CACHE_CHECK([for netinet/in.h], sim_cv_netinet_in_h, [
  AC_TRY_CPP([
    #ifdef HAVE_SYS_TYPES_H
    #include <sys/types.h>
    #endif /* HAVE_SYS_TYPES_H */
    #include <netinet/in.h>],
    [sim_cv_netinet_in_h=true], [sim_cv_netinet_in_h=false])])

if $sim_cv_netinet_in_h; then
  AC_DEFINE_UNQUOTED([HAVE_NETINET_IN_H], [1],
    [Define if you have the <netinet/in.h> header file.])
fi

# For Inventor/system/inttypes.h.in.
#
# Note: this assumes AC_CHECK_HEADERS(sys/types.h stdint.h) has been done.
#
# FIXME: the header file checking should be AC_REQUIREd, if possible.
# 20010711 mortene.

SIM_AC_DEFINE_BYTESIZE_TYPES

# *******************************************************************

AC_MSG_CHECKING([for fstat() function])
AC_TRY_LINK(
 [#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif],
 [struct stat sb;
  int result = fstat(0, &sb);],
 [AC_DEFINE(HAVE_FSTAT, 1, [define if fstat() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

# *******************************************************************
# We want to use BSD 4.3's isinf(), isnan(), finite() if they are
# available.

AC_MSG_CHECKING([for BSD 4.3 isinf() function])
AC_TRY_LINK(
 [#include <math.h>],
 [int result = isinf(42.0);],
 [AC_DEFINE(HAVE_ISINF, 1, [define if isinf() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

AC_MSG_CHECKING([for BSD 4.3 isnan() function])
AC_TRY_LINK(
 [#include <math.h>],
 [int result = isnan(42.0);],
 [AC_DEFINE(HAVE_ISNAN, 1, [whether or not isnan() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])

  AC_MSG_CHECKING([for _isnan() function])
  AC_TRY_LINK(
   [#include <math.h>],
   [int result = _isnan(42.0);],
   [AC_DEFINE(HAVE__ISNAN, 1, [whether or not _isnan() is available])
    AC_MSG_RESULT([available])],
   [AC_MSG_RESULT([not available])])
])

AC_MSG_CHECKING([for BSD 4.3 finite() function])
AC_TRY_LINK(
 [#include <math.h>],
 [int result = finite(42.0);],
 [AC_DEFINE(HAVE_FINITE, 1, [whether or not finite() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])

  AC_MSG_CHECKING([for _finite() function])
  AC_TRY_LINK(
   [#include <math.h>],
   [int result = _finite(42.0);],
   [AC_DEFINE(HAVE__FINITE, 1, [whether or not _finite() is available])
    AC_MSG_RESULT([available])],
   [AC_MSG_RESULT([not available])])
])

AC_MSG_CHECKING([for fpclass() function])
AC_TRY_LINK(
[#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif],
 [int result = fpclass(42.0);],
 [AC_DEFINE(HAVE_FPCLASS, 1, [whether or not fpclass() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

AC_MSG_CHECKING([for _fpclass() function])
AC_TRY_LINK(
 [#include <math.h>],
 [int result = _fpclass(42.0);],
 [AC_DEFINE(HAVE__FPCLASS, 1, [whether or not _fpclass() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

SIM_AC_CHECK_TYPEOF_STRUCT_MEMBER([
#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h> // struct timeval (Linux)
#endif // HAVE_TIME_H
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> // struct timeval (IRIX)
#endif // HAVE_SYS_TIME_H
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif // HAVE_WINDOWS_H
], [timeval], [tv_sec], [SIM_TIMEVAL_TV_SEC_T], [])

SIM_AC_CHECK_TYPEOF_STRUCT_MEMBER([
#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h> // struct timeval (Linux)
#endif // HAVE_TIME_H
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> // struct timeval (IRIX)
#endif // HAVE_SYS_TIME_H
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif // HAVE_WINDOWS_H
], [timeval], [tv_usec], [SIM_TIMEVAL_TV_USEC_T], [])

# *******************************************************************

sim_ac_build_library=true
AC_ARG_ENABLE(
  [build],
  [AC_HELP_STRING([--disable-build], [disable configuration for library build])],
  [case $enableval in
  no | false)
   sim_ac_build_library=false
   SIM_AC_CONFIGURATION_SETTING([Coin build type], [build disabled])
   ;;
  esac])

AM_CONDITIONAL(BUILD_LIBRARY, $sim_ac_build_library)

# *******************************************************************
# * Do we want to build the documentation?
# *******************************************************************

AC_ARG_ENABLE(html,
  AC_HELP_STRING([--enable-html], [build and install Coin HTML documentation]),
  [case $enableval in
    yes | true) want_html=yes ;;
    *)          want_html=no ;;
  esac],
  [want_html=no])

case $htmldir in
/*)
  # do nothing - absolute path
  ;;
*)
  # expand $docdir and append /html
  htmldir=`eval echo ${docdir}`/html
  ;;
esac

AC_SUBST(htmldir)

AC_ARG_ENABLE(man,
  AC_HELP_STRING([--enable-man], [build and install Coin man pages]),
  [case $enableval in
    yes | true) want_man=yes ;;
    *)          want_man=no ;;
  esac],
  [want_man=no])

# Used in the Doxygen parameter file.
AC_SUBST([COIN_DOC_HTML], [`echo $want_html | tr '[a-z]' '[A-Z]'`])
AC_SUBST([coin_html_dir], [`pwd`/html])
AC_SUBST([COIN_DOC_MAN], [`echo $want_man | tr '[a-z]' '[A-Z]'`])
AC_SUBST([coin_man_dir], [`pwd`/man])

AM_CONDITIONAL(BUILD_MANPAGES, test x"$want_man" = x"yes")
AM_CONDITIONAL(BUILD_HTMLPAGES, test x"$want_html" = x"yes")

if test x"$want_man" = x"yes"; then
  SIM_AC_CONFIGURATION_SETTING([manpage installation], [$mandir])
fi

if test x"$want_html" = x"yes"; then
  SIM_AC_CONFIGURATION_SETTING([HTML installation], [$htmldir])
fi

# Perl is used for the Doxygen-based doc generation, plus when making
# NSIS installation packages.
AC_PATH_PROG(sim_ac_perl_exe, perl, false, $PATH)

if test x"$want_html" != xno -o x"$want_man" != xno; then
  SIM_AC_DOXYGEN_TOOL([], [SIM_AC_ERROR([no-doxygen])])
  if test x"$sim_ac_perl_exe" = xfalse; then
    AC_MSG_ERROR([Could not find the Perl executable, which is needed for Doxygen doc generation.])
  fi
fi

# path_tag is used to identify paths in docs/coin.doxygen that needs to be
# transformed using cygpath under cygwin.

case $host in
*-cygwin) path_tag="<PATH>" ;;
*)        path_tag= ;;
esac

AC_SUBST(path_tag)

#Get all the doxygen source files
. ${coin_src_dir}/docs/coin_doxygenfiles.inc

#The AC_SUBST command will not accept multiline strings, so trick this
#into a singleline string
DOXYGEN_INPUT=$(echo ${DOXYGEN_INPUT})

AC_SUBST(DOXYGEN_INPUT)

sim_ac_makensis_exe=false
case $host in
*-cygwin)
  AC_PATH_PROG([sim_ac_makensis_exe], [makensis], [false], [$PATH])
  ;;
esac

AC_PATH_PROG([sim_ac_dpkg_buildpackage_exe],
  [dpkg-buildpackage], [false], [$PATH])

sim_ac_windows_packagable=true
if test x"$sim_ac_perl_exe" = xfalse || test x"$sim_ac_makensis_exe" = xfalse; then
  sim_ac_windows_packageable=false
fi

AM_CONDITIONAL([WIN_PACKAGEABLE], $sim_ac_windows_packageable)

sim_ac_debian_packageable=true
if test x"$sim_ac_dpkg_buildpackage_exe" = xfalse; then
  sim_ac_debian_packageable=false
fi

AM_CONDITIONAL([DEB_PACKAGEABLE], [$sim_ac_debian_packageable])

SIM_AC_PACKAGEMAKER_APP
AC_SUBST([sim_ac_packagemaker_app])
sim_ac_macosx_packageable=true
if test x"$sim_ac_packagemaker_app" = xfalse; then
  sim_ac_macosx_packageable=false
fi

AM_CONDITIONAL([MACOSX_PACKAGEABLE], [$sim_ac_macosx_packageable])

# *******************************************************************
# Configure an alternate installation?

AC_ARG_WITH(
  [alternate],
  [AC_HELP_STRING([--with-alternate=string],
                  [specify name of alternate configuration])],
  [CONFIG=$withval],
  [CONFIG=default])

AC_ARG_WITH(
  [suffix],
  [AC_HELP_STRING([--with-suffix=string],
                  [specify library name suffix (e.g. "_g")])],
  [SUFFIX=$withval],
  [SUFFIX=])

AC_SUBST(CONFIG)
AC_SUBST(SUFFIX)

# *******************************************************************
# * Check compiler features, bugs, etc.
# *******************************************************************

# FIXME: the extra strict warning settings for GCC below should be
# placed in a macro, so they can be easily used from other src-code
# modules aswell. 20021218 mortene.

SIM_AC_COMPILE_DEBUG([
  CPPFLAGS="$CPPFLAGS -DCOIN_DEBUG=1"
], [
  CPPFLAGS="$CPPFLAGS -DCOIN_DEBUG=0"
])

SIM_AC_DEBUGSYMBOLS
SIM_AC_RTTI_SUPPORT
SIM_AC_EXCEPTION_HANDLING
SIM_AC_PROFILING_SUPPORT
SIM_AC_COMPILER_WARNINGS
SIM_AC_DETECT_COMMON_COMPILER_FLAGS

# Disable bool type with MSVC.
#
# "/noBool" should not be part of the SIM_AC_DETECT_COMMON_COMPILER_FLAGS
# macro, because some projects will not compile properly with it.
# (Like at least SoQt, since the Qt headers defines the bool type, which
# will then cause a compiler error when q[whatever].h is included.)

# The setting of /noBool for MSVC has been disabled because of problems with
# using <limits> with Visual C++ 6.  2007-10-03 larsa
# SIM_AC_COMPILER_NOBOOL([
#   sim_ac_compiler_CXXFLAGS="$sim_ac_compiler_CXXFLAGS $sim_ac_nobool_CXXFLAGS"
# ])

#  Yep, this is important in case we want to add code to make
#  the API interface "Open Inventor strict", meaning the user must
#  use the exact same include files as under "real" Open Inventor.
#  We would then need to know that we are actually allowed to include
#  any file during internal build.
#
#  The COIN_INTERNAL define is also in use to detect
#  "inefficient including" internally.

CPPFLAGS="$CPPFLAGS -DCOIN_INTERNAL"

if $BUILD_WITH_MSVC; then
  case ${enable_static-no} in
  yes | true)  COIN_STATIC=true;
               enable_shared=no ;; # --enable-static-problem with autoconf 2.58
  *)           COIN_STATIC=false ;;
  esac
  case ${enable_shared-default} in
  default)     ;;
  yes | true)  COIN_STATIC=false ;;
  *)           COIN_STATIC=true ;;
  esac
fi

# **************************************************************************
# Check for various system specifics.

# Try to find snprintf() and vsnprintf() on the system.
SIM_AC_CHECK_NPRINTF

# C99 va_copy() available?
AC_MSG_CHECKING([for va_copy() stdarg macro])
AC_TRY_LINK([#include <stdarg.h>
             static void hepp(int dummy, ...) {
             va_list l, c;
             va_start(l, dummy); va_copy(c, l); va_end(c); va_end(l); }
            ],
            [hepp(0, 1, 2); ],
  [AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_VA_COPY_MACRO], 1, [Define to use va_copy() when available])],
  [AC_MSG_RESULT([no])])

# How to string quote.
SIM_AC_CHECK_MACRO_QUOTE([], [SIM_AC_ERROR([no-cpp-quoting])])
if test x"$sim_ac_quote_hash" = xyes; then
  AC_DEFINE([HAVE_HASH_QUOTING],1,
    [define if preprocessor can quote arguments with the hash symbol])
else
  if test x"$sim_ac_quote_apostrophes" = xyes; then
    AC_DEFINE([HAVE_APOSTROPHES_QUOTING],1,
      [define if preprocessor can quote arguments with apostophes])
  fi
fi

# *******************************************************************
# Instead of getenv() on most Win32 platforms (not Windows CE).

AC_MSG_CHECKING([for GetEnvironmentVariable() function])
AC_TRY_LINK([#include <windows.h>],
            [(void)GetEnvironmentVariable("FOOBAR", NULL, 0);],
  [AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_GETENVIRONMENTVARIABLE],1, [Define to use GetEnvironmentVariable() instead of getenv()])],
  [AC_MSG_RESULT([no])])

# *******************************************************************
#

sim_ac_save_LIBS=$LIBS
LIBS="$LIBS -lwinmm"
AC_MSG_CHECKING([for timeGetTime() function])
AC_TRY_LINK([
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
], [
  (void)timeGetTime();
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_TIMEGETTIME],, [Define to use timeGetTime()])
  COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS -lwinmm"
], [
  AC_MSG_RESULT([no])
  LIBS=$sim_ac_save_LIBS
])

# *******************************************************************
# The MessageBox() Win32 API call is used in SoDB.cpp to throw up
# an error message when multiple Coin-instances are detected in the
# same process image.

sim_ac_save_LIBS=$LIBS
LIBS="$LIBS -luser32"
AC_MSG_CHECKING([for MessageBox() function])
AC_TRY_LINK([
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
], [
  (void)MessageBox(NULL, NULL, NULL, 0);
], [
  AC_MSG_RESULT([yes])
  COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS -luser32"
], [
  AC_MSG_RESULT([no])
  LIBS=$sim_ac_save_LIBS
])

# *******************************************************************
# Test for misc functions to get systemtime with.

AC_MSG_CHECKING([for QueryPerformanceCounter() function])
AC_TRY_LINK([
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
], [
  LARGE_INTEGER l;
  (void)QueryPerformanceFrequency(&l);
  (void)QueryPerformanceCounter(&l);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_QUERYPERFORMANCECOUNTER],1, [Define to use Win32 QueryPerformanceCounter()])
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for _ftime() function])
AC_TRY_LINK([
#include <windows.h>
#include <sys/types.h>
#include <sys/timeb.h>
], [
  struct _timeb timebuffer;
  _ftime(&timebuffer);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE__FTIME],1, [Define to use Win32 _ftime()])
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for ftime() function])
AC_TRY_LINK([
#include <sys/timeb.h>
], [
  struct timeb timebuffer;
  ftime(&timebuffer);
], [
  # ftime() is not available in libSystem on Mac OS X < 10.4,
  # so don't use it when building the binary SDK.
  case ${MACOSX_DEPLOYMENT_TARGET} in
    10.[[0123]])
      AC_MSG_RESULT([yes (unused)])
      ;;
    *)
      AC_MSG_RESULT([yes])
      AC_DEFINE([HAVE_FTIME],1, [Define to use ftime()])
      ;;
  esac
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for _getcwd() function])
AC_TRY_LINK([
#include <direct.h>
], [
  char buf[512];
  _getcwd(buf, 512);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE__GETCWD],1, [Define to use Win32 _getcwd()])
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for getcwd() function])
AC_TRY_LINK([
#include <unistd.h>
], [
  char buf[512];
  getcwd(buf, 512);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_GETCWD],1, [Define to use getcwd()])
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for gettimeofday() function])
AC_TRY_LINK([
#ifdef HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_SYS_UNISTD_H
#include <sys/unistd.h>
#endif /* HAVE_SYS_UNISTD_H */
], [
  struct timeval tmp;
  (void)gettimeofday(&tmp, NULL);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_GETTIMEOFDAY],1, [Define to use SVr4 / BSD4.3 gettimeofday()])
], [
  AC_MSG_RESULT([no])
])

# *******************************************************************
# Test for misc functions, typically not part of neither ISO C or POSIX.

AC_MSG_CHECKING([for strncasecmp() function])
AC_TRY_LINK([
#include <string.h>
], [
  (void)strncasecmp(NULL, NULL, 0);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_STRNCASECMP],1, [Define to use BSD4.3 strncasecmp()])
], [
  AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for memmove() function])
AC_TRY_COMPILE(
 [#include <string.h>],
 [(void) memmove(0, 0, 0);],
 [AC_DEFINE(HAVE_MEMMOVE, 1, [define if memmove() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

AC_MSG_CHECKING([for bcopy() function])
AC_TRY_COMPILE(
 [#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif],
 [(void) bcopy(0, 0, 0);],
 [AC_DEFINE(HAVE_BCOPY, 1, [define if bcopy() is available])
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

AC_MSG_CHECKING([for _logb() function])
AC_TRY_LINK([
#include <math.h>
#include <float.h>
], [
  (void)_logb(1.0);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE__LOGB],1, [Define to use Win32 _logb()])
], [
  AC_MSG_RESULT([no])
])


# *******************************************************************
# * Test to see if dynamic linking through either the (Linux/IRIX/...)
# * dl library or the Win32 LoadLibrary() call is available.
# *******************************************************************

coin_can_do_runtime_linking=false

# On Mac OS X < 10.4, dlopen() is missing and has to be emulated; from
# 10.4 on, we can use dlopen() directly. Note that the latter does not 
# obsolete the dyld check, since we also use other dyld functionility.
SIM_AC_CHECK_DYLD([
  AC_DEFINE_UNQUOTED([HAVE_DYLD_RUNTIME_BINDING],1,
                     [define if the Mac OS X dyld can be used for runtime binding])
    coin_can_do_runtime_linking=true
])

case ${MACOSX_DEPLOYMENT_TARGET} in
  10.[[0123]])
    # Do *not* pick up dlopen() support when building on 10.4 for earlier
    # Mac OS X versions (< 10.4 did not support dlopen(), so we have to use 
    # our own implementation based on built-in dyld functions there).
    ;;
  *)
    SIM_AC_CHECK_DL([
      AC_DEFINE_UNQUOTED([HAVE_DL_LIB],1, [define if you have the dl library])
      COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_dl_cppflags"
      COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_dl_ldflags"
      COIN_EXTRA_LIBS="$sim_ac_dl_libs $COIN_EXTRA_LIBS"
      coin_can_do_runtime_linking=true
    ])
    ;;
esac

if ! $coin_can_do_runtime_linking; then
  SIM_AC_CHECK_LOADLIBRARY([
    AC_DEFINE_UNQUOTED([HAVE_WINDLL_RUNTIME_BINDING],1,
                       [define if the Win32 LoadLibrary method is available])
    coin_can_do_runtime_linking=true
  ])
fi

if ! $coin_can_do_runtime_linking; then
  SIM_AC_CHECK_DLD([
    AC_DEFINE_UNQUOTED([HAVE_DLD_LIB],1,
                       [define if the DLD shared library loader is available])
    COIN_EXTRA_LIBS="$sim_ac_dld_libs $COIN_EXTRA_LIBS"
    coin_can_do_runtime_linking=true
  ])
fi

if $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([HAVE_DYNAMIC_LINKING], 1,
                     [should be defined if there is some way of doing dynamic linking])
fi


# *******************************************************************
# * Set us up for using the simage library (if wanted, and if
# * available).
# *******************************************************************

AC_ARG_ENABLE([dl-simage],
  AC_HELP_STRING([--enable-dl-simage],
                 [use runtime dynamic linking for libsimage if possible [[default=yes]]]),
  [case "${enableval}" in
    yes | true) enable_dl_simage=true ;;
    no | false) enable_dl_simage=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-simage]) ;;
  esac],
  [enable_dl_simage=true])

if $enable_dl_simage && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([SIMAGE_RUNTIME_LINKING],1,
    [define for runtime linking with simage])
  SIM_AC_CONFIGURATION_SETTING([simage linkage], [run-time binding])
else
  SIM_AC_HAVE_SIMAGE_IFELSE([
    AC_DEFINE([HAVE_LIBSIMAGE],1,
      [define if you have the simage library])
    CPPFLAGS="$CPPFLAGS $sim_ac_simage_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_simage_ldflags"
    LIBS="$sim_ac_simage_libs $LIBS"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_simage_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_simage_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_simage_libs $COIN_EXTRA_LIBS"
    SIM_AC_CONFIGURATION_SETTING([simage linkage], [link-time binding])
  ], [
    if $sim_ac_simage_desired; then
      AC_MSG_WARN(simage development system not found);
    fi
    SIM_AC_CONFIGURATION_SETTING([simage linkage], [no simage support])
  ])
fi

# Check if sound is enabled

sim_ac_enable_sound=true

AC_ARG_ENABLE(
  [sound],
  AC_HELP_STRING([--disable-sound], [disable sound support]), [
  case $enableval in
    no | false) sim_ac_enable_sound=false ;;
    *) ;;
  esac])

#  Check for openal (required for sound)

AC_ARG_ENABLE([dl-openal],
  AC_HELP_STRING([--enable-dl-openal],
                 [use runtime dynamic linking for OpenAL if possible [[default=yes]]]),
  [case "${enableval}" in
    yes | true) enable_dl_openal=true ;;
    no | false) enable_dl_openal=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-openal]) ;;
  esac],
  [enable_dl_openal=true])

if $sim_ac_enable_sound && $enable_dl_openal && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([OPENAL_RUNTIME_LINKING],1,
    [define for runtime linking with OpenAL])
  SIM_AC_CONFIGURATION_SETTING([OpenAL support], [Yes, run-time binding])
else
SIM_AC_HAVE_OPENAL_IFELSE([
  CPPFLAGS="$CPPFLAGS $sim_ac_openal_cppflags"
  LDFLAGS="$LDFLAGS $sim_ac_openal_ldflags"
  LIBS="$LIBS $sim_ac_openal_libs"
  COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_openal_cppflags"
  COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_openal_ldflags"
  COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS $sim_ac_openal_libs"
  AC_DEFINE(HAVE_OPENAL, 1, [openal extensions available])
  SIM_AC_CONFIGURATION_SETTING([OpenAL support], [Yes, link-time binding])
], [
  if $sim_ac_enable_sound; then
    AC_MSG_WARN([openal is needed for sound])
    sim_ac_enable_sound=false
  fi
  SIM_AC_CONFIGURATION_SETTING([OpenAL support], [No])
])
fi

HAVE_SOUND=1

if $sim_ac_enable_sound ; then
  AC_DEFINE([HAVE_SOUND],, [for setup.h])
  SIM_AC_CONFIGURATION_SETTING([Sound support], [Yes])
else
  HAVE_SOUND=0
  SIM_AC_CONFIGURATION_SETTING([Sound support], [No  (enable with --enable-sound)])
fi
AC_SUBST(HAVE_SOUND)

AM_CONDITIONAL([BUILD_WITH_SOUND], [$sim_ac_enable_sound])

# ********************************************************************
# * Set us up for using the Fontconfig font library (if wanted, and if
# * available).
# ********************************************************************

AC_ARG_ENABLE([dl-fontconfig],
  AC_HELP_STRING([--disable-dl-fontconfig],
                 [disable runtime dynamic linking for fontconfig if possible [[default=--enable-dl-fontconfig]]]),
  [case "${enableval}" in
    yes | true) enable_dl_fontconfig=true ;;
    no | false) enable_dl_fontconfig=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-fontconfig]) ;;
  esac],
  [enable_dl_fontconfig=true])

sim_ac_have_fontconfig=false
if $enable_dl_fontconfig && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([FONTCONFIG_RUNTIME_LINKING], 1,
    [define for runtime linking with fontconfig])
  SIM_AC_CONFIGURATION_SETTING([Fontconfig support], [Yes, run-time binding])
else
  SIM_AC_HAVE_FONTCONFIG_IFELSE([
    AC_DEFINE(HAVE_FONTCONFIG, 1,
      [define if you have the fontconfig library])
    CPPFLAGS="$CPPFLAGS $sim_ac_fontconfig_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_fontconfig_ldflags"
    LIBS="$sim_ac_fontconfig_libs $LIBS"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_fontconfig_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_fontconfig_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_fontconfig_libs $COIN_EXTRA_LIBS"
    SIM_AC_CONFIGURATION_SETTING([Fontconfig support], [Yes, link-time binding])
  ], [
    if $sim_ac_fontconfig_desired; then
      SIM_AC_CONFIGURATION_SETTING([Fontconfig support], [No])
    fi
  ])
fi

AM_CONDITIONAL(HAVE_FONTCONFIG, $sim_ac_have_fontconfig)

# ********************************************************************
# * Set us up for using the SpiderMonkey javascript library (if wanted,
# * and if available).
# ********************************************************************

AC_ARG_ENABLE([dl-spidermonkey],
  AC_HELP_STRING([--disable-dl-spidermonkey],
                 [disable runtime dynamic linking for SpiderMonkey if possible [[default=--enable-dl-spidermonkey]]]),
  [case "${enableval}" in
    yes | true) enable_dl_spidermonkey=true ;;
    no | false) enable_dl_spidermonkey=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-spidermonkey]) ;;
  esac],
  [enable_dl_spidermonkey=true])

sim_ac_have_spidermonkey=false
if $enable_dl_spidermonkey && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([SPIDERMONKEY_RUNTIME_LINKING], 1,
    [define for runtime linking with SpiderMonkey])
  if $sim_ac_enable_javascript ; then     
    SIM_AC_CONFIGURATION_SETTING([SpiderMonkey support], [Yes, run-time binding])
  fi      
else
  SIM_AC_HAVE_SPIDERMONKEY_IFELSE([
    AC_DEFINE(HAVE_SPIDERMONKEY_VIA_LINKTIME_LINKING, 1,
      [define if you have the SpiderMonkey library])
    CPPFLAGS="$CPPFLAGS $sim_ac_spidermonkey_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_spidermonkey_ldflags"
    LIBS="$sim_ac_spidermonkey_libs $LIBS"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_spidermonkey_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_spidermonkey_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_spidermonkey_libs $COIN_EXTRA_LIBS"
    if $sim_ac_enable_javascript ; then
      SIM_AC_CONFIGURATION_SETTING([SpiderMonkey support], [Yes, link-time binding])
      sim_ac_have_spidermonkey=true
    fi
  ], [
    if $sim_ac_spidermonkey_desired; then
      SIM_AC_CONFIGURATION_SETTING([SpiderMonkey support], [No])
    fi
  ])
fi

AM_CONDITIONAL(HAVE_SPIDERMONKEY_VIA_LINKTIME_LINKING, $sim_ac_have_spidermonkey)


# **************************************************************************
# Set us up for using TrueType fonts. Through the FreeType library (if
# wanted, and if available), and / or the Win32 API.

if $sim_ac_have_win32_api; then
  SIM_AC_CONFIGURATION_SETTING([Win32 TrueType fonts], [Yes])
fi

AC_ARG_ENABLE([dl-freetype],
  AC_HELP_STRING([--disable-dl-freetype],
                 [disable runtime dynamic linking for freetype if possible [[default=--enable-dl-freetype]]]),
  [case "${enableval}" in
    yes | true) enable_dl_freetype=true ;;
    no | false) enable_dl_freetype=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-freetype]) ;;
  esac],
  [enable_dl_freetype=true])

sim_ac_have_freetype=false

if $enable_dl_freetype && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([FREETYPE_RUNTIME_LINKING], 1,
    [define for runtime linking with freetype])
  SIM_AC_CONFIGURATION_SETTING([FreeType library], [Yes, run-time binding])
else
  SIM_AC_HAVE_FREETYPE_IFELSE([
    AC_DEFINE(HAVE_FREETYPE, 1, [define if you have the freetype library])
    CPPFLAGS="$CPPFLAGS $sim_ac_freetype_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_freetype_ldflags"
    LIBS="$sim_ac_freetype_libs $LIBS"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_freetype_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_freetype_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_freetype_libs $COIN_EXTRA_LIBS"
    SIM_AC_CONFIGURATION_SETTING([FreeType library], [Yes, link-time binding])
  ], [
    if $sim_ac_freetype_desired; then
      SIM_AC_CONFIGURATION_SETTING([FreeType library], [No])
    fi
  ])
fi

AM_CONDITIONAL(HAVE_FREETYPE, $sim_ac_have_freetype)

# **************************************************************************
# Set us up for using TrueType fonts through the Core Text framework
# on the Mac.

#
# disabled until CoreText implementation is in place. 20100410 tamer.
#

#AC_ARG_ENABLE([coretext],
#  AC_HELP_STRING([--disable-coretext],
#                 [disable usage of the CoreText framework on OS X [[default=--enable-coretext]]]),
#  [case "${enableval}" in
#    yes | true) enable_coretext=true ;;
#    no | false) enable_coretext=false ;;
#    *) SIM_AC_ENABLE_ERROR([--enable-coretext]) ;;
#  esac],
#  [enable_coretext=true])
#
#if $enable_coretext; then
#  SIM_AC_HAVE_CORETEXT_IFELSE([
#    AC_DEFINE(HAVE_CORETEXT, 1, [define if you have the CoreText framework])
#    CPPFLAGS="$CPPFLAGS $sim_ac_coretext_cppflags"
#    LDFLAGS="$LDFLAGS $sim_ac_coretext_ldflags"
#    LIBS="$sim_ac_coretext_libs $LIBS"
#    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_coretext_cppflags"
#    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_coretext_ldflags"
#    COIN_EXTRA_LIBS="$sim_ac_coretext_libs $COIN_EXTRA_LIBS"
#    SIM_AC_CONFIGURATION_SETTING([Core Text framework], [Yes])
#  ], [
#    SIM_AC_CONFIGURATION_SETTING([Coretext framework], [No])
#  ])
#fi
#
#AM_CONDITIONAL(HAVE_CORETEXT, $sim_ac_have_coretext)

# *******************************************************************
# * Math library
# *******************************************************************

SIM_AC_CHECK_MATHLIB(
  [COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS $sim_ac_libm"],
  [SIM_AC_ERROR([no-math-library])])

# *******************************************************************
# * Check for ilogb() after mathlib test
# *******************************************************************
AC_MSG_CHECKING([for ilogb() function])
AC_TRY_LINK([
#include <math.h>
], [
  (void)ilogb(1.0);
], [
  AC_MSG_RESULT([yes])
  AC_DEFINE([HAVE_ILOGB],1, [Define to use ilogb()])
], [
  AC_MSG_RESULT([no])
])

# *******************************************************************
# * Handle the detection and inclusion of compression libraries
# *******************************************************************

AC_ARG_ENABLE([dl-zlib],
  AC_HELP_STRING([--disable-dl-zlib],
                 [disable runtime dynamic linking for libz if possible [[default=--enable-dl-zlib]]]),
  [case "${enableval}" in
    yes | true) enable_dl_zlib=true ;;
    no | false) enable_dl_zlib=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-zlib]) ;;
  esac],
  [enable_dl_zlib=true])

if $enable_dl_zlib && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([ZLIB_RUNTIME_LINKING],1,
    [define for runtime linking with zlib])
  SIM_AC_CONFIGURATION_SETTING([zlib support], [Yes, run-time binding])
else
  SIM_AC_HAVE_LIBZLIB_IFELSE([
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_libzlib_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_libzlib_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_libzlib_libs $COIN_EXTRA_LIBS"
    CPPFLAGS="$CPPFLAGS $sim_ac_libzlib_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_libzlib_ldflags"
    LIBS="$sim_ac_libzlib_libs $LIBS"
    SIM_AC_CONFIGURATION_SETTING([zlib support], [Yes, link-time binding])
    AC_DEFINE([HAVE_ZLIB], 1, [Define to use zlib])
  ],[
    SIM_AC_CONFIGURATION_SETTING([zlib support], [No])
  ])
fi

# Bug in gzdopen() on Mac OS X -> use gzopen() instead...
case $host_os in
  darwin* ) ;;
  * ) AC_DEFINE([HAVE_GZDOPEN], 1, [Define to use gzdopen()])
esac

# *******************************************************************

AC_ARG_ENABLE([dl-libbzip2],
  AC_HELP_STRING([--disable-dl-libbzip2],
                 [disable runtime dynamic linking for libz if possible [[default=--enable-dl-libbzip2]]]),
  [case "${enableval}" in
    yes | true) enable_dl_libbzip2=true ;;
    no | false) enable_dl_libbzip2=false ;;
    *) SIM_AC_ENABLE_ERROR([--enable-dl-libbzip2]) ;;
  esac],
  [enable_dl_libbzip2=true])

if $enable_dl_libbzip2 && $coin_can_do_runtime_linking; then
  AC_DEFINE_UNQUOTED([LIBBZIP2_RUNTIME_LINKING],1,
    [define for runtime linking with zlib])
  SIM_AC_CONFIGURATION_SETTING([bzip2 support], [Yes, run-time binding])
else
  SIM_AC_HAVE_LIBBZIP2_IFELSE([
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_libbzip2_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_libbzip2_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_libbzip2_libs $COIN_EXTRA_LIBS"
    CPPFLAGS="$CPPFLAGS $sim_ac_libbzip2_cppflags"
    LDFLAGS="$LDFLAGS $sim_ac_libbzip2_ldflags"
    LIBS="$sim_ac_libbzip2_libs $LIBS"
    SIM_AC_CONFIGURATION_SETTING([bzip2 support], [Yes, link-time binding])
    AC_DEFINE([HAVE_BZIP2], 1, [Define to use bzip2])
  ],[
    SIM_AC_CONFIGURATION_SETTING([bzip2 support], [No])
  ])
fi

# *******************************************************************
# * Handle the detection and inclusion of X11 libraries.
# *******************************************************************

  SIM_AC_CHECK_X11([
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_x11_cppflags"
    COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_x11_ldflags"
    COIN_EXTRA_LIBS="$sim_ac_x11_libs $COIN_EXTRA_LIBS"])

  if test x"$sim_ac_x11_avail" = xyes; then
    #  If the X11 shared memory extension is available, include it as
    #  the Mesa library has probably been linked against it.
    SIM_AC_CHECK_X11SHMEM(
      COIN_EXTRA_LIBS="$sim_ac_x11shmem_libs $COIN_EXTRA_LIBS"
    )
  fi

  ## We need this extra, final X11 check to set up the HAVE_X11_AVAILABLE
  ## define -- the X_DISPLAY_MISSING define provided by the built-in
  ## Autoconf X11 check is not strict enough.
  SIM_AC_CHECK_X11_READY([AC_DEFINE([HAVE_X11_AVAILABLE],1,
                         [define if it is possible to build against X11])])

# *******************************************************************
# * Test for installation of Mesa or OpenGL development system.
# *******************************************************************

SIM_AC_CHECK_OPENGL(
  [
  AC_DEFINE([HAVE_OPENGL],1, [define if you have OpenGL])

  COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_ogl_cppflags"
  COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_ogl_ldflags"
  COIN_EXTRA_LIBS="$sim_ac_ogl_libs $COIN_EXTRA_LIBS"

  SIM_AC_CHECK_HEADER_GLEXT([
    CPPFLAGS="$CPPFLAGS $sim_ac_glext_cppflags"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_glext_cppflags"
  ])

  # *******************************************************************
  # Check what OpenGL->windowsystem bindings are available.
  # 
  # If WGL is available, we don't want AGL nor GLX, as that has the
  # potential to cause harm: e.g. while we at one place in the code
  # might use WGL to create a context, other places we might use GLX to
  # make that same context current -- *kaboom*.
  #
  # (It is at least possible that both AGL and GLX are available at the
  # same time, or WGL and GLX, since X11 is a portable window system.)
  #
  # On Mac OS X/Darwin, we want to link either with GLX or AGL, 
  # depending on whether Coin is built against X11 or not. (X11 is 
  # only needed if you want to use SoXt, and must be enabled explicitly
  # by passing the --enable-darwin-x11 configure flag.)
  #
  # Else, the tests for WGL/GLX below are nested, so we're guaranteed 
  # that only one of HAVE_WGL and HAVE_GLX will be set:

  case $host_os in
    darwin* ) 
      if test x"$sim_ac_x11_avail" = xyes; then 
        SIM_AC_HAVE_GLX_IFELSE([
          AC_DEFINE([HAVE_GLX], 1, [define if you have GLX X11 OpenGL bindings])
          ], [SIM_AC_CONFIGURATION_WARNING([Could not find or compile or link against GLX (OpenGL on X11) but X linkage was specified. The SoOffscreenRenderer functionality will be disabled. ])])
      else
        AC_ARG_ENABLE([agl],
          AC_HELP_STRING([--enable-agl],
                         [enable AGL on Mac OS X [[default=--disable-agl]]]),
          [case "${enableval}" in
            yes | true) sim_ac_enable_agl=true ;;
            no | false) sim_ac_enable_agl=false ;;
            *) SIM_AC_ENABLE_ERROR([--enable-agl]) ;;
           esac],
          [sim_ac_enable_agl=false])
        if $sim_ac_enable_agl; then
          SIM_AC_HAVE_AGL_IFELSE([
            AC_DEFINE([HAVE_AGL], 1, [define if you have AGL OpenGL bindings])
            LDFLAGS="$LDFLAGS $sim_ac_agl_ldflags"
            # indirect linking is not supported in static libs
            if $COIN_STATIC; then
              COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_agl_ldflags"
            fi
            AC_CHECK_HEADERS(
              [OpenGL/CGLCurrent.h],
              [],
              [AC_MSG_ERROR([AGL is available but CGL is not? Dude. Something went very wrong here. Please get in touch with us at coin-support@sim.no.])], [ ]
            )
            SIM_AC_HAVE_AGL_PBUFFER([AC_DEFINE_UNQUOTED([HAVE_AGL_PBUFFER],1,[define if AGL pBuffers are available on the system])])
          ], [])
        fi
        SIM_AC_HAVE_CGL_IFELSE(
          [AC_DEFINE([HAVE_CGL], 1, [define if you have CGL OpenGL bindings])],
          [])
        if test x"$sim_cv_have_cgl" != x"true" && test x"$sim_cv_have_agl" != x"false" ; then
          SIM_AC_CONFIGURATION_WARNING([Could not find or compile or link against AGL or CGL. The SoOffscreenRenderer functionality will be disabled.])
        fi
      fi
    ;;
    * )  
    SIM_AC_HAVE_WGL_IFELSE([
      AC_DEFINE([HAVE_WGL], 1, [define if you have WGL Win32 OpenGL bindings])
      LIBS="$LIBS $sim_ac_wgl_libs"
      COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS $sim_ac_wgl_libs"
    ], [SIM_AC_HAVE_GLX_IFELSE([
          AC_DEFINE([HAVE_GLX], 1, [define if you have GLX X11 OpenGL bindings])
        ], [
          SIM_AC_CONFIGURATION_WARNING([Could not find or compile or link against any usable window-system OpenGL binding, neither GLX (OpenGL on X11), nor WGL (OpenGL on Win32) nor AGL (OpenGL on Mac OS). The SoOffscreenRenderer functionality will be disabled. Note: this might be a configure bug. Check the file config.log.])
        ])
      ])
    ;;
  esac

  # *******************************************************************

  if $enable_superglu; then
    SIM_AC_CONFIGURATION_SETTING([GLU linkage], [superglu])
  else
    # *******************************************************************
    # ** Check if GLU should be loaded and linked at runtime (to avoid
    # ** install dependency libCoin -> libGLU).
    # *******************************************************************
    AC_ARG_ENABLE([dl-glu],
      AC_HELP_STRING([--enable-dl-glu],
                     [use runtime dynamic linking for GLU if possible [[default=yes]]]),
      [case "${enableval}" in
        yes | true) enable_dl_glu=true ;;
        no | false) enable_dl_glu=false ;;
        *) SIM_AC_ENABLE_ERROR([--enable-dl-glu]) ;;
      esac],
      [enable_dl_glu=true])
  
    if $coin_can_do_runtime_linking && $enable_dl_glu; then
      # See if GLU is part of GL library (this is the case on Mac OS X 
      # and BeOS, for instance) before setting us up for runtime linking.
      SIM_AC_GLU_READY_IFELSE([
        AC_DEFINE([GLU_IS_PART_OF_GL],1, 
                  [define if GLU is part of the GL library])
        AC_DEFINE_UNQUOTED([GLU_RUNTIME_LINKING],1,
          [define for runtime linking with GLU])
        SIM_AC_CONFIGURATION_SETTING([GLU linkage], 
                  [run-time binding, part of GL library])
      ], [
        AC_DEFINE_UNQUOTED([GLU_RUNTIME_LINKING],1,
          [define for runtime linking with GLU])
        SIM_AC_CONFIGURATION_SETTING([GLU linkage], [run-time binding])
      ])
    else
      # *******************************************************************
      # ** Check if GLU headers and lib is available on build host.
      # *******************************************************************
      SIM_AC_CHECK_GLU([
        AC_DEFINE([HAVE_GLU],1, [define if you have GLU])
        COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_glu_cppflags"
        COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_glu_ldflags"
        COIN_EXTRA_LIBS="$sim_ac_glu_libs $COIN_EXTRA_LIBS"
        SIM_AC_CONFIGURATION_SETTING([GLU linkage], [link-time binding])
      ], [
        SIM_AC_CONFIGURATION_SETTING([GLU linkage], [no GLU support])
      ])
    fi
  fi
  ], # OpenGL-linkage ok, end of block
  [ # Couldn't link with OpenGL:
    SIM_AC_ERROR([no-opengl])
    # FIXME: should perhaps be able to handle systems where OpenGL is not
    # available,  as it would be handy for making e.g. import/export-only
    # versions of the library. 20000123 mortene.
  ]
)

# **************************************************************************
# Make name of dynamic GL library available to Coin source code (used in
# src/glue/dl.c, at least).

# Will set $sim_ac_shlibext. Note: there's a dependency on this later in
# the configure script aswell.
SIM_AC_DYNLIB_EXT

# **************************************************************************
# Cygwin has not got diffutils installed by default. Check if cmp is
# available.
AC_CHECK_PROG(cmp_avail,[cmp],[Yes])
if test x$cmp_avail = "x" ; then
    AC_MSG_ERROR([cmp must be available to complete the configure process.])
fi


AC_DEFINE_UNQUOTED([DYNAMIC_LIBRARY_EXTENSION], ["$sim_ac_shlibext"],
                   [define this to the dynamic library extension suffix on this system])

AC_SUBST([LIBEXT], [$sim_ac_shlibext])

sim_ac_opengl_dll_name=$sim_ac_ogl_lib
if test "$sim_ac_ogl_lib" = "opengl32"; then :; else
  sim_ac_opengl_dll_name="lib${sim_ac_opengl_dll_name}"
fi
sim_ac_opengl_dll_name="${sim_ac_opengl_dll_name}${sim_ac_shlibext}"

AC_DEFINE_UNQUOTED([OPENGL_SYSTEM_LIBRARY_NAME], ["$sim_ac_opengl_dll_name"],
                   [define this to the dynamic library name of OpenGL])

# *******************************************************************
# * Provide this nasty hack to help building Coin on platforms
# * where one can bump into the "Arg list too long" problem
# * (IBM AIX, SGI IRIX 6.2 and IRIX 6.5 with standard settings are
# * known to fail).
# *
# * This nasty hack also have a lot of positivie bieffects, such as
# * increasing optimization, and memory usage of the compiler, while
# * reducing the compile time for a release build.
# *******************************************************************

AC_ARG_ENABLE(compact,
  AC_HELP_STRING([--enable-compact], [enable hack for compact compilation. Has the bieffect of increased optimalization, and reduced compile-time, for increased memory usage for a release build. [[default=no]]]),
  [case "${enableval}" in
    yes | true)  enable_compact=yes ;;
    no | false)  enable_compact=no ;;
    *) SIM_AC_ENABLE_ERROR([--enable-compact]) ;;
  esac],
  enable_compact=no)

AM_CONDITIONAL(HACKING_COMPACT_BUILD, test x"$enable_compact" = x"yes")

# *******************************************************************
# * Enable/disable compilation with the "incremental linking through
# * the use of dynamic libraries"-hack.
# *******************************************************************

AC_ARG_ENABLE(hacking,
  AC_HELP_STRING([--enable-hacking],
                 [enable hacks for quick turn-around cycles during development [[default=no]]]),
  [case "${enableval}" in
    yes | true)  enable_hacking=yes ;;
    no | false)  enable_hacking=no ;;
    *) SIM_AC_ENABLE_ERROR([--enable-hacking]) ;;
  esac],
  enable_hacking=no)

AM_CONDITIONAL(HACKING_DYNAMIC_MODULES, test x"$enable_hacking" = x"yes")

# enable_hacking requires runtime symbol lookup, which is not available
# on Mac OS X < 10.3 and requires the deployment target to be >= 10.3.
sim_ac_macosx_use_dynamic_lookup=false

if test x"$enable_hacking" = x"yes"; then

  if test x"$sim_ac_macosx" = x"true"; then
    if test x"$sim_ac_macosx_10_3ff" = x"true"; then
      sim_ac_macosx_use_dynamic_lookup=true
      case ${MACOSX_DEPLOYMENT_TARGET} in
      10.[[345]])
        ;;
      *)
        SIM_AC_CONFIGURATION_WARNING([Using MACOSX_DEPLOYMENT_TARGET=10.3 (required by --enable-hacking)])
      ;;
      esac
      AC_SUBST([MACOSX_DEPLOYMENT_TARGET], [10.3])
    else 
      AC_MSG_ERROR([--enable-hacking requires Mac OS X version >= 10.3])
    fi
  fi 

  for dir in \
    base actions bundles caches details draggers elements \
    elements/GL:glelements engines errors events fields fonts glue io \
    manips misc lists nodekits navigation nodes rendering shapenodes projectors \
    sensors shaders upgraders hardcopy shadows geo foreignfiles collision \
    xml xml/expat:expat profiler 3ds:format3ds scxml soscxml; \
  do
    case $dir in
    *:* )
      lib=`echo $dir | cut -d: -f2`
      dir=`echo $dir | cut -d: -f1`
      ;;
    * )
      lib=$dir
      ;;
    esac
    HACKING_LIBDIRS="$HACKING_LIBDIRS -L${coin_build_dir}/src/$dir/.libs"
    EXTRA_LIBS="$EXTRA_LIBS -l$lib${SUFFIX}LINKHACK"                  
  done
  if $sim_ac_enable_vrml97; then
    HACKING_LIBDIRS="$HACKING_LIBDIRS -L${coin_build_dir}/src/vrml97/.libs"
    EXTRA_LIBS="$EXTRA_LIBS -lvrml97${SUFFIX}LINKHACK"
  fi
  if $enable_superglu; then
    HACKING_LIBDIRS="$HACKING_LIBDIRS -L${coin_build_dir}/src/extensions/superglu/.libs"
    EXTRA_LIBS="$EXTRA_LIBS -l${SUPERGLUPREFIX}GLU"
  fi
  if $sim_ac_enable_threads; then
    HACKING_LIBDIRS="$HACKING_LIBDIRS -L${coin_build_dir}/src/threads/.libs"
    EXTRA_LIBS="$EXTRA_LIBS -lthreads${SUFFIX}LINKHACK"
  fi
  COIN_HACKING_LIBDIRS="$HACKING_LIBDIRS"
  COIN_EXTRA_LIBS="$EXTRA_LIBS $COIN_EXTRA_LIBS"
fi

AC_SUBST(COIN_HACKING_LIBDIRS)

# linker flag -undefined dynamic_lookup, needed for --enable-hacking
AM_CONDITIONAL([MACOSX_USE_DYNAMIC_LOOKUP], 
               [test x$sim_ac_macosx_use_dynamic_lookup = xtrue])


# *******************************************************************
# * For exposing various build, src and installation paths to
# * misc configuration files under the $top_src_dir/build/ directory.
# *******************************************************************

AC_SUBST([coin_build_dir])
AC_SUBST([coin_w32_build_dir])
AC_SUBST([coin_src_dir])
AC_SUBST([coin_w32_src_dir])

# **************************************************************************
# Remove redundant options from certain option lists.

SIM_AC_UNIQIFY_OPTION_LIST(COIN_EXTRA_CPPFLAGS, -I$includedir -I$includedir/Inventor/annex $COIN_EXTRA_CPPFLAGS)
SIM_AC_UNIQIFY_OPTION_LIST(COIN_EXTRA_LDFLAGS, -L$libdir $COIN_EXTRA_LDFLAGS)
SIM_AC_UNIQIFY_OPTION_LIST(COIN_EXTRA_LIBS, $COIN_EXTRA_LIBS)
SIM_AC_UNIQIFY_OPTION_LIST(CPPFLAGS, $CPPFLAGS)
SIM_AC_UNIQIFY_OPTION_LIST(LDFLAGS, $LDFLAGS)
SIM_AC_UNIQIFY_OPTION_LIST(LIBS, $LIBS)

# **************************************************************************
# Remove gcc system directories includes from the CPPFLAGS.

CPP_AC_SEARCH_ORDER_FILTER(CPPFLAGS, $CPPFLAGS)
CPP_AC_SEARCH_ORDER_FILTER(COIN_EXTRA_CPPFLAGS, $COIN_EXTRA_CPPFLAGS)

AC_SUBST([LIBFLAGS], [])
AC_SUBST([COIN_TESTSUITE_EXTRA_CPPFLAGS], [])
AC_SUBST([COIN_TESTSUITE_EXTRA_LDFLAGS], [])

# **************************************************************************
# setup for <Inventor/system/gl.h>

# include windows.h?
if test x"$ac_cv_header_windows_h" = x"yes"; then
  sim_include_windows_h="#include <windows.h>"
else
  sim_include_windows_h="/* #include <windows.h> - not needed on system */"
fi

# how to include gl.h
if test x"$ac_cv_header_GL_gl_h" = x"yes"; then
  sim_include_gl_h="#include <GL/gl.h>"
else
  if test x"$ac_cv_header_OpenGL_gl_h" = x"yes"; then
    sim_include_gl_h="#include <OpenGL/gl.h>"
  else
    sim_include_gl_h="#error \"don't know how to include gl.h header\""
  fi
fi

if $enable_superglu; then
  sim_include_glu_h="/* #include <GL/glu.h> - not used, Coin linked with embedded SuperGLU */"
else
  if test x"$ac_cv_header_GL_glu_h" = x"yes"; then
    sim_include_glu_h="#include <GL/glu.h>"
  else
    if test x"$ac_cv_header_OpenGL_glu_h" = x"yes"; then
      sim_include_glu_h="#include <OpenGL/glu.h>"
    else
      sim_include_glu_h="/* #include <GL/glu.h> - not found on system */"
    fi
  fi
fi

if test x"$ac_cv_header_GL_glext_h" = x"yes"; then
  sim_include_glext_h="#include <GL/glext.h>"
else
  if test x"$ac_cv_header_OpenGL_glext_h" = x"yes"; then
    sim_include_glext_h="#include <OpenGL/glext.h>"
  else
    sim_include_glext_h="/* #include <GL/glext.h> - not found on system */"
  fi
fi

AC_SUBST([SIM_INCLUDE_WINDOWS_H], [$sim_include_windows_h])
AC_SUBST([SIM_INCLUDE_GL_H], [$sim_include_gl_h])
AC_SUBST([SIM_INCLUDE_GLU_H], [$sim_include_glu_h])
AC_SUBST([SIM_INCLUDE_GLEXT_H], [$sim_include_glext_h])

# **************************************************************************

# append compiler flags detected earlier, now that all configure tests
# are done...

CFLAGS="$CFLAGS $sim_ac_compiler_CFLAGS"
CXXFLAGS="$CXXFLAGS $sim_ac_compiler_CXXFLAGS"

# **************************************************************************
# Remaining setup based on platform.

# check if compiler/linker handles __declspec()
sim_ac_win32_declspec_available=false
AC_MSG_CHECKING([for __declspec() support])
AC_TRY_LINK(
 [],
 [__declspec(dllimport) int foo;],
 [sim_ac_win32_declspec_available=true
  AC_MSG_RESULT([available])],
 [AC_MSG_RESULT([not available])])

if $sim_ac_win32_declspec_available; then
  if $COIN_STATIC; then
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS -DCOIN_NOT_DLL"
    COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS $LIBS"
  else
    CPPFLAGS="-DCOIN_MAKE_DLL $CPPFLAGS"
    COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS -DCOIN_DLL"
  fi
fi

AM_CONDITIONAL(BUILD_WITH_MSVC, $BUILD_WITH_MSVC)

COIN_COMPILER="$CXX"

if $BUILD_WITH_MSVC; then
  COIN_TESTSUITE_EXTRA_CPPFLAGS="/Fdtestsuite.pdb /EHsc"
  COIN_TESTSUITE_EXTRA_LDFLAGS="/SUBSYSTEM:console /DEBUG"
  rm -f vc60.pdb
  LIBFLAGS="$LIBFLAGS $sim_ac_msvcrt_LIBLDFLAGS"
  LIBS="$LIBS $sim_ac_msvcrt_LIBLIBS"

  debugfile="`pwd`/src/coin${COIN_MAJOR_VERSION}${SUFFIX}.pdb"
  debugfile=`cygpath -w "$debugfile" | sed 's,\\\\,\\\\\\\\,g'`

  if $COIN_STATIC; then
    LIBS=
    LIBFLAGS="-LIB $LIBFLAGS"
    LIBFLAGS="$LIBFLAGS /OUT:coin$COIN_MAJOR_VERSION$SUFFIX.lib"
    case $enable_symbols in
    no | false)
      SIM_AC_CONFIGURATION_SETTING([Coin build type], [static .lib, no symbols])
      ;;
    *)
      SIM_AC_CONFIGURATION_SETTING([Coin build type], [static .lib, with symbols])
      CFLAGS="-g $CFLAGS"
      CXXFLAGS="-g $CXXFLAGS"
      ;;
    esac
  else
    LIBFLAGS="-DLL /INCREMENTAL:NO $LIBFLAGS"
    case $enable_debug in
    no | false)
      release_string=" (release)"
      debug_flag=" /DEBUG"
      ;;
    *)
      release_string=""
      debug_flag=" /DEBUG"
      ;;
    esac
    case $enable_symbols in
    no | false)
      SIM_AC_CONFIGURATION_SETTING([Coin build type],
                                   [dynamic .dll${release_string}])
      LIBFLAGS="$LIBFLAGS ${debug_flag}"
      ;;
    *)
      SIM_AC_CONFIGURATION_SETTING([Coin build type],
                                   [dynamic .dll${release_string} + .pdb])
      CFLAGS="-g $CFLAGS"
      CXXFLAGS="-g $CXXFLAGS"
      LIBFLAGS="$LIBFLAGS ${debug_flag} /PDB:coin$COIN_MAJOR_VERSION$SUFFIX.pdb"
      ;;
    esac
    LIBFLAGS="$LIBFLAGS /OUT:coin$COIN_MAJOR_VERSION$SUFFIX.dll"
  fi
  SIM_AC_CONFIGURATION_SETTING([C library version], [$sim_ac_msvcrt])

  # We use a version suffix on the .dll-file, so several incompatible
  # (major) versions can be installed on a system.
  #
  # BTW, when linking DLLs, the 3rd-party .lib files will be
  # linked into the .dll file. I believe it is still advisable to
  # list all libs used upon `coin-config --libs`, as we can then
  # also use them from "parent" code (remember that their interfaces
  # is not exposed from the DLL) without any fuss.
  sim_ac_coin_noextname="coin${COIN_MAJOR_VERSION}${SUFFIX}"
  if test -n "$COIN_EXTRA_LIBS"; then
    COIN_EXTRA_LIBS="-l${sim_ac_coin_noextname} $COIN_EXTRA_LIBS"
  else
    COIN_EXTRA_LIBS="-l${sim_ac_coin_noextname}"
  fi

  sim_ac_coin_dll_name="${sim_ac_coin_noextname}${sim_ac_shlibext}"

else
  COIN_EXTRA_LIBS="-lCoin${SUFFIX} $COIN_EXTRA_LIBS"
  sim_ac_coin_dll_name="libCoin${SUFFIX}${sim_ac_shlibext}"
fi

if $BUILD_WITH_MSVC; then
  # we'll use the installed wrapper when we use the coin-config script later
  # so we can remove the source code hierarchy
  COIN_COMPILER="wrapmsvc"
fi

AC_DEFINE_UNQUOTED([COIN_SYSTEM_LIBRARY_NAME], ["$sim_ac_coin_dll_name"],
                   [define this to the dynamic library name of Coin])

sim_ac_path_problem=true # until proven otherwise
eval "sim_ac_pb_prefix=${prefix}"
if test x"$sim_ac_pb_prefix" = x"NONE"; then sim_ac_pb_prefix=/usr/local; fi
eval "sim_ac_pb_exec_prefix=${exec_prefix}"
if test x"$sim_ac_pb_exec_prefix" = x"NONE"; then sim_ac_pb_exec_prefix="$prefix"; fi
eval "sim_ac_pb_bindir=${bindir}"
if test -d "${sim_ac_pb_bindir}"; then
  # search by inode id seems safer than strings because of noncanonical paths
  ( eval set dummy `ls -id "${sim_ac_pb_bindir}" 2>/dev/null`;
    findinode=$2;
    IFS=:; for dir in $PATH; do
      # inode=`ls -id "$dir" 2>/dev/null | sed 's/^\([ ]*\)\([0-9]*\).*/\2/g'`;
      eval set dummy `ls -id "$dir" 2>/dev/null`;
      inode=$2;
      test x"$inode" = x"$findinode" && exit 0;
    done; exit 1 ) && sim_ac_path_problem=false
fi
if $sim_ac_path_problem; then
  ( IFS=:; for dir in $PATH; do
      test x"$dir" = x"${sim_ac_pb_bindir}" && exit 0;
    done; exit 1 ) && sim_ac_path_problem=false
fi


# ***********************************************************
# Mac OS X tweaks
#

# We use CoreFoundation calls multiple places in Coin
[case $host_os in
darwin* ) LDFLAGS="$LDFLAGS -Wl,-framework,CoreFoundation" ;;
* ) ;;
esac]

# Disallow static libraries in framework (doesn't make sense)
if $sim_ac_framework; then
  if test x$enable_static = xyes; then
    AC_MSG_ERROR([Creation of static libraries requested, but this is incompatible with the Mac OS X framework setup. Use --without-framework to do UNIX-style build.])
  fi
fi 

if $sim_ac_framework; then
  SIM_AC_CONFIGURATION_SETTING([Coin build type], [Mac OS X framework])
elif $sim_ac_path_problem; then
  SIM_AC_CONFIGURATION_WARNING([Your \$PATH variable does not appear to include \"$prefix/bin\"])
fi

if $sim_ac_framework; then

  # set up the Coin-related flags
  COIN_EXTRA_CPPFLAGS=
  if test x"$sim_ac_framework_prefix" != x"MAC_FRAMEWORK_PREFIX_DEFAULT"; then
    COIN_EXTRA_CPPFLAGS="-F$sim_ac_framework_prefix"
  fi

  COIN_EXTRA_CFLAGS=
  COIN_EXTRA_CXXFLAGS=
  COIN_EXTRA_FP_LDFLAGS=
  if test x"$enable_hacking" = x"yes"; then
    COIN_EXTRA_LDFLAGS="-L$frameworkdir/Libraries"
  else 
    # we don't want -lCoin when doing framework build
    COIN_EXTRA_LIBS=
    COIN_EXTRA_LDFLAGS= 
    if test x"$sim_ac_framework_prefix" != x"MAC_FRAMEWORK_PREFIX_DEFAULT"; then
      COIN_EXTRA_FP_LDFLAGS="-Wl,-F$sim_ac_framework_prefix"
    fi
  fi 
  COIN_EXTRA_LDFLAGS="$COIN_EXTRA_FP_LDFLAGS -Wl,-framework,$MAC_FRAMEWORK_NAME $COIN_EXTRA_LDFLAGS"
  # adjust for OpenGL usage
  COIN_EXTRA_CPPFLAGS="$COIN_EXTRA_CPPFLAGS $sim_ac_ogl_cppflags"
  COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_ogl_ldflags"
  COIN_EXTRA_LIBS="$sim_ac_ogl_libs $COIN_EXTRA_LIBS"
  # adjust for simage usage
  COIN_EXTRA_LDFLAGS="$COIN_EXTRA_LDFLAGS $sim_ac_simage_ldflags"
  COIN_EXTRA_LIBS="$sim_ac_simage_libs $COIN_EXTRA_LIBS"
  # adjust for OpenAL usage
  COIN_EXTRA_LIBS="$COIN_EXTRA_LIBS $sim_ac_openal_libs"
fi

case "$sim_ac_framework:$sim_ac_make_dsp" in
true:* | *:true )
  ;;
* )
  SIM_AC_CONFIGURATION_SETTING([Installation prefix], [$prefix])
  ;;
esac

AC_SUBST([COIN_COMPILER])
AC_SUBST([ac_compiler_gnu])

SIM_AC_MSVC_DSP_SETUP([COIN], [Coin], [coin], [-I$coin_build_dir -I$coin_build_dir/include -I$coin_src_dir/include -I$coin_build_dir/src -I$coin_src_dir/src -I$coin_src_dir/include/Inventor/annex])

# **************************************************************************

AM_CONFIG_HEADER([src/discard.h src/config.h src/setup.h])
AC_CONFIG_FILES([src/Coin.rc])

# SIM_AC_COIN_CONFIG_H_CHECK

# **************************************************************************

AC_CONFIG_FILES([
        Makefile
        bin/Makefile
        include/Makefile
        include/Inventor/Makefile
        include/Inventor/C/Makefile
        include/Inventor/C/XML/Makefile
        include/Inventor/C/base/Makefile
        include/Inventor/C/errors/Makefile
        include/Inventor/C/glue/Makefile
        include/Inventor/C/threads/Makefile
        include/Inventor/VRMLnodes/Makefile
        include/Inventor/XML/Makefile
        include/Inventor/actions/Makefile
        include/Inventor/bundles/Makefile
        include/Inventor/caches/Makefile
        include/Inventor/collision/Makefile
        include/Inventor/details/Makefile
        include/Inventor/draggers/Makefile
        include/Inventor/elements/Makefile
        include/Inventor/engines/Makefile
        include/Inventor/errors/Makefile
        include/Inventor/events/Makefile
        include/Inventor/fields/Makefile
        include/Inventor/lists/Makefile
        include/Inventor/lock/Makefile
        include/Inventor/manips/Makefile
        include/Inventor/misc/Makefile
        include/Inventor/navigation/Makefile
        include/Inventor/nodekits/Makefile
        include/Inventor/nodes/Makefile
        include/Inventor/projectors/Makefile
        include/Inventor/sensors/Makefile
        include/Inventor/system/Makefile
        include/Inventor/threads/Makefile
        include/Inventor/tools/Makefile
        include/Inventor/scxml/Makefile
        include/Inventor/annex/Makefile
        include/Inventor/annex/HardCopy/Makefile
        include/Inventor/annex/ForeignFiles/Makefile
        include/Inventor/annex/FXViz/Makefile
        include/Inventor/annex/FXViz/elements/Makefile
        include/Inventor/annex/FXViz/nodes/Makefile
        include/Inventor/annex/Profiler/Makefile
        include/Inventor/annex/Profiler/elements/Makefile
        include/Inventor/annex/Profiler/engines/Makefile
        include/Inventor/annex/Profiler/nodes/Makefile
        include/Inventor/annex/Profiler/nodekits/Makefile
        include/Inventor/annex/Profiler/utils/Makefile
        data/Makefile
        data/draggerDefaults/Makefile
        data/shaders/Makefile
        data/shaders/lights/Makefile
        data/shaders/vsm/Makefile
        data/scxml/Makefile
        data/scxml/navigation/Makefile
        man/Makefile
        man/man1/Makefile
        man/man3/Makefile
        html/Makefile
        src/Makefile
        src/base/Makefile
        src/actions/Makefile
        src/bundles/Makefile
        src/caches/Makefile
        src/collision/Makefile
        src/details/Makefile
        src/draggers/Makefile
        src/elements/Makefile
        src/elements/GL/Makefile
        src/engines/Makefile
        src/errors/Makefile
        src/events/Makefile
        src/fields/Makefile
        src/fonts/Makefile
        src/glue/Makefile
        src/io/Makefile
        src/manips/Makefile
        src/misc/Makefile
        src/rendering/Makefile
        src/lists/Makefile
        src/navigation/Makefile
        src/nodekits/Makefile
        src/nodes/Makefile
        src/projectors/Makefile
        src/3ds/Makefile
        src/sensors/Makefile
        src/upgraders/Makefile
        src/shapenodes/Makefile
        src/threads/Makefile
        src/extensions/Makefile
        src/vrml97/Makefile
        src/hardcopy/Makefile
        src/shaders/Makefile
        src/shadows/Makefile
        src/geo/Makefile
        src/foreignfiles/Makefile
        src/xml/Makefile
        src/xml/expat/Makefile
        src/profiler/Makefile
        src/scxml/Makefile
        src/soscxml/Makefile
        src/doc/Makefile
        testsuite/Makefile
        cfg/gendsp.pl
])

AC_OUTPUT

if test -f cfg/gendsp.pl; then
  chmod +x cfg/gendsp.pl
fi

# in case someone has the old generated SbBasic.h lying about...
if test -f include/Inventor/SbBasic.h; then
  if cmp -s $srcdir/include/Inventor/SbBasic.h include/Inventor/SbBasic.h; then
    :
  else
    rm include/Inventor/SbBasic.h
  fi
fi

# *******************************************************************
# * Platform-specific stuff.
# *******************************************************************

if $sim_ac_build_library; then
  ac_coin_untested_platform=true
  ac_coin_not_sim_platform=true
else
  ac_coin_untested_platform=false
  ac_coin_not_sim_platform=false
fi

case "$host_os" in
  irix6.2)
    case $CXX in
    CC | */CC ) ac_coin_untested_platform=false ;;
    esac
    ;;
  irix6.5)
    case $CXX in
    CC | */CC )
      ac_coin_untested_platform=false
      ac_coin_not_sim_platform=false
      ;;
    esac
    ;;
  aix*)
    case $CXX in
    xlC | */xlC ) ac_coin_untested_platform=false ;;
    esac
    ;;
  solaris*)
    case $CXX in
    g++ ) ac_coin_untested_platform=false ;;
    CC )
      ac_coin_untested_platform=false
      ac_coin_not_sim_platform=false
      ;;
    esac
    ;;
  hpux10.20)
    case $CXX in
    aCC | */aCC ) ac_coin_untested_platform=false ;;
    esac
    ;;
  linux-gnu)
    case "$host_cpu" in
    i?86)
      ac_coin_untested_platform=false
      ac_coin_not_sim_platform=false
    ;;
    x86_64)
      ac_coin_untested_platform=false
      ac_coin_not_sim_platform=false
    ;;
    ia64)
      case "$CXX" in
      g++)
        ac_coin_untested_platform=false
        ;;
      esac
    ;;
    esac
    ;;
  cygwin*)
    case "$CXX" in
    *wrapmsvc* )
      ac_coin_untested_platform=false
      ac_coin_not_sim_platform=false
    ;;
    esac
    ;;
  darwin*)
    case "$CXX" in
      c++ | g++)
        ac_coin_untested_platform=false
        ac_coin_not_sim_platform=false
      ;;
    esac
    ;;
  beos)
    case "$host_cpu" in
      i?86)
        if test "$CXX" = c++; then ac_coin_untested_platform=false; fi
        ;;
    esac
    ;;
esac

case "$CXX" in
*gendsp* )
  ac_coin_untested_platform=false
  ac_coin_not_sim_platform=false
  ;;
esac

if $ac_coin_untested_platform; then
  echo
  echo "************************* WARNING ****************************"
  echo "*"
  echo "* We have not tested Coin on the $host_os $host_cpu"
  echo "* platform with the $CXX C++ compiler. Please report"
  echo "* back to us at <coin-support@coin3d.org> how it works out."
  echo "*"
  echo "**************************************************************"
  echo
else
  if $ac_coin_not_sim_platform; then
    echo
    echo "NOTE: This platform ($host_os $host_cpu with the $CXX C++ compiler)"
    echo "      is not among our internal development systems. Please let us"
    echo "      know at <coin-support@coin3d.org> if you run into any problems."
    echo
  fi
fi

if $sim_ac_build_library; then
  case "$host_os" in
  irix*)
    echo ""
    echo " Detected SGI IRIX. There are some hints regarding this platform"
    echo " in the file "
    echo ""
    echo "           ${srcdir}/README.UNIX"
    echo ""
    echo " Please take a look if this is your first time building on IRIX."
    echo ""
    ;;
  aix*)
    echo ""
    echo " Detected IBM AIX. There are some hints regarding this platform"
    echo " in the file "
    echo ""
    echo "           ${srcdir}/README.UNIX"
    echo ""
    echo " Please take a look if this is your first time building on AIX."
    echo ""
    ;;
  esac
fi

# FIXME: these would be nice to show, but they puck up the configuration
# summary formatting. 20030509 mortene.
#
#SIM_AC_CONFIGURATION_SETTING([CPPFLAGS], [$CPPFLAGS])
#SIM_AC_CONFIGURATION_SETTING([CFLAGS], [$CFLAGS])
#SIM_AC_CONFIGURATION_SETTING([CXXFLAGS], [$CXXFLAGS])
#SIM_AC_CONFIGURATION_SETTING([LDFLAGS], [$LDFLAGS])
#SIM_AC_CONFIGURATION_SETTING([LIBS], [$LIBS])

SIM_AC_CONFIGURATION_SUMMARY

echo ""