Project: Gnash
Code Location: git://git.savannah.gnu.org/gnash.gitmaster
Browse
/
Download File
configure.ac
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
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
dnl  
dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014
dnl  Free Software Foundation, Inc.
dnl  
dnl  This program is free software; you can redistribute it and/or modify
dnl  it under the terms of the GNU General Public License as published by
dnl  the Free Software Foundation; either version 3 of the License, or
dnl  (at your option) any later version.
dnl  
dnl  This program is distributed in the hope that it will be useful,
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl  GNU General Public License for more details.
dnl  You should have received a copy of the GNU General Public License
dnl  along with this program; if not, write to the Free Software
dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
dnl  

AC_PREREQ(2.59c)
AC_INIT(gnash, 0.8.11dev)
AC_CONFIG_SRCDIR([libcore/as_object.h])
AC_CONFIG_HEADERS([gnashconfig.h])
AC_CONFIG_MACRO_DIR([macros])

AC_CANONICAL_BUILD
AC_CANONICAL_HOST

dnl --------------------------------------------------------
dnl Figure out development tool stuff
dnl --------------------------------------------------------

AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_EXEEXT
AC_PROG_INSTALL

dnl Set the default values for Flash Version. These are converted into
dnl various strings to make JavaScript or ActionScript detectors
dnl recognize Gnash as a SWF Player.
DEFAULT_FLASH_MAJOR_VERSION="10"
DEFAULT_FLASH_MINOR_VERSION="1"
DEFAULT_FLASH_REV_NUMBER="999"
AC_SUBST(DEFAULT_FLASH_MAJOR_VERSION)
AC_SUBST(DEFAULT_FLASH_MINOR_VERSION)
AC_SUBST(DEFAULT_FLASH_REV_NUMBER)

AC_DEFINE_UNQUOTED([DEFAULT_FLASH_MAJOR_VERSION], ["${DEFAULT_FLASH_MAJOR_VERSION}"], [Default Flash major version])
AC_DEFINE_UNQUOTED([DEFAULT_FLASH_MINOR_VERSION], ["${DEFAULT_FLASH_MINOR_VERSION}"], [Default Flash minor version])
AC_DEFINE_UNQUOTED([DEFAULT_FLASH_REV_NUMBER], ["${DEFAULT_FLASH_REV_NUMBER}"], [Default Flash revision number])

dnl TODO: use host/build/target -- whatever is more appropriate
case "${host}" in
  *-apple-*)
    DEFAULT_FLASH_PLATFORM_ID="MAC"
    DEFAULT_FLASH_SYSTEM_OS="MacOS"
    ;;
  *-openbsd*)
    DEFAULT_FLASH_PLATFORM_ID="BSD"
    DEFAULT_FLASH_SYSTEM_OS="OpenBSD"
    ;;
  *-freebsd* | *-kfreebsd*)
    DEFAULT_FLASH_PLATFORM_ID="BSD"
    DEFAULT_FLASH_SYSTEM_OS="FreeBSD"
    ;;
  *-netbsd*)
    DEFAULT_FLASH_PLATFORM_ID="BSD"
    DEFAULT_FLASH_SYSTEM_OS="NetBSD"
    ;;
  *-android*)
    DEFAULT_FLASH_PLATFORM_ID="AND"
    DEFAULT_FLASH_SYSTEM_OS="Linux"
    ;;
  *-linux-gnu)
    DEFAULT_FLASH_PLATFORM_ID="LNX"
    DEFAULT_FLASH_SYSTEM_OS="GNU/Linux"
    ;;
  *-linux*)
    DEFAULT_FLASH_PLATFORM_ID="LNX"
    DEFAULT_FLASH_SYSTEM_OS="Linux"
    ;;
  *-cygwin* | *-mingw* | *-pw32*)
    DEFAULT_FLASH_PLATFORM_ID="WIN"
    DEFAULT_FLASH_SYSTEM_OS="Windows"
    ;;
  *-*solaris*)
    DEFAULT_FLASH_PLATFORM_ID="SUN"
    DEFAULT_FLASH_SYSTEM_OS="Solaris"
    ;;
  *-os2*)
    DEFAULT_FLASH_PLATFORM_ID="OS2"
    DEFAULT_FLASH_SYSTEM_OS="OS/2"
    ;;
  *-sco*)
    DEFAULT_FLASH_PLATFORM_ID="SCO"
    DEFAULT_FLASH_SYSTEM_OS="SCO/Unix"
    ;;
  *-irix*)
    DEFAULT_FLASH_PLATFORM_ID="IRX"
    DEFAULT_FLASH_SYSTEM_OS="IRIX"
    ;;
  *-hpux*)
    DEFAULT_FLASH_PLATFORM_ID="HPX"
    DEFAULT_FLASH_SYSTEM_OS="HPUX"
    ;;    
  *-amigaos*)
    DEFAULT_FLASH_PLATFORM_ID="OS4"
    DEFAULT_FLASH_SYSTEM_OS="AmigaOS4"
    ;;    
  *-haiku*)
    DEFAULT_FLASH_PLATFORM_ID="HAIKU"
    DEFAULT_FLASH_SYSTEM_OS="Haiku"
    ;;    
  *-gnu*)
    DEFAULT_FLASH_PLATFORM_ID="GNU"
    DEFAULT_FLASH_SYSTEM_OS="GNU/HURD"
    ;;    
  *)
    DEFAULT_FLASH_PLATFORM_ID="UNK"
    DEFAULT_FLASH_SYSTEM_OS="Unknown"
    ;;
esac

AC_DEFINE_UNQUOTED([DEFAULT_FLASH_PLATFORM_ID], ["${DEFAULT_FLASH_PLATFORM_ID}"], [Default 3-letter platform identifier for version string])
AC_DEFINE_UNQUOTED([DEFAULT_FLASH_SYSTEM_OS], ["${DEFAULT_FLASH_SYSTEM_OS}"], [Default value for System.capabilities.os])

AC_SUBST(DEFAULT_FLASH_PLATFORM_ID)
AC_SUBST(DEFAULT_FLASH_SYSTEM_OS)

DEFAULT_STREAMS_TIMEOUT=60
AC_SUBST(DEFAULT_STREAMS_TIMEOUT)
AC_DEFINE_UNQUOTED([DEFAULT_STREAMS_TIMEOUT], [${DEFAULT_STREAMS_TIMEOUT}], [Default streams timeout in seconds])

DEFAULT_SOL_SAFEDIR="~/.gnash/SharedObjects"
AC_SUBST(DEFAULT_SOL_SAFEDIR)
AC_DEFINE_UNQUOTED([DEFAULT_SOL_SAFEDIR], ["${DEFAULT_SOL_SAFEDIR}"], [Default SharedObject base directory])


dnl Some things you can only do by looking at the platform name.
case "${host}" in
  powerpc-apple-darwin*)
    AC_DEFINE([__powerpc64__], [1], [this is a 64 bit powerpc])
    darwin=yes
    AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform])
    ;;
  *-apple-darwin*)
    darwin=yes
    AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform])
    ;;
    dnl Unfortunately, all BSD distributions are not identical, so 
    dnl as tacky as it is to look for the distribution name, we don't
    dnl have much choice. The use of these should be avoid as much as possible.
  *-openbsd*)
    bsd=yes
    openbsd=yes
    AC_DEFINE([OPENBSD_HOST], [1], [this is an OpenBSD platform])
    ;;
  *-freebsd* | *-kfreebsd*)
    bsd=yes
    freebsd=yes
    AC_DEFINE([FREEBSD_HOST], [1], [this is a FreeBSD platform])
    ;;
  *-netbsd*)
    bsd=yes
    netbsd=yes
    AC_DEFINE([NETBSD_HOST], [1], [this is a NetBSD platform])
    ;;
  *-*solaris*)
    solaris=yes
    AC_DEFINE([SOLARIS_HOST], [1], [this is a Solaris platform])
    ;;
  *-android*)
    android=yes
    AC_DEFINE([ANDROID_HOST], [1], [this is an Android platform])
    ;;
  *-*linux*)
    linux=yes
    AC_DEFINE([LINUX_HOST], [1], [this is a Linux platform])
    ;;
  *-cygwin* | *-mingw* | *-pw32*)
    windows=yes
    AC_DEFINE([WIN32_HOST], [1], [this is a Win32 platform])
    ;;
  *64-*-*bsd*)
    bsd_os=bsd 
    AC_DEFINE([WORDSIZE], [64], [this is a 64 platform])
    ;;
  *-*amigaos*)
    amigaos4=yes
    AC_DEFINE([AMIGAOS4_HOST], [1], [this is an AmigaOS4 platform])
    ;;
  *-*haiku*)
    haiku=yes
    AC_DEFINE([HAIKU_HOST], [1], [this is a Haiku platform])
    ;;
  *-gnu*)
    gnu=yes
    AC_DEFINE([GNU_HOST], [1], [this is a GNU platform])
    ;;
  *-*wince)
    wince=yes
    AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform])
    ;;
  *-*winmo)
    wince=yes
    AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform])
    AC_DEFINE([WINCE6_HOST], [1], [this is a WINCE6 platform])
    ;;
esac


AM_CONDITIONAL(LINUX, test x$linux = xyes)
AM_CONDITIONAL(WIN32, test x$windows = xyes)
AM_CONDITIONAL(HAIKU, test x$haiku = xyes)
AM_CONDITIONAL(AMIGAOS4, test x$amigaos4 = xyes)

dnl Get build date for helping us debugging
BUILDDATE="`date +%Y%m%d`"
AC_SUBST(BUILDDATE)

dnl These are required by automake
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE
AC_PROG_MAKE_SET

AM_GNU_GETTEXT([external])
AM_CONDITIONAL(HAS_GETTEXT, test x$ac_cv_path_XGETTEXT != x)

dnl Many of the Gnash macros depend on gettext macros defining shlibext; recent
dnl gettext however does not.
if test x"${shlibext}" = x; then
  if test x"${acl_cv_shlibext}" = x; then
    echo "Gettext macros were supposed to define shared library extensions"
    exit 1;
  else
    shlibext="${acl_cv_shlibext}"
  fi
fi

dnl This is primarily used when compiling for a similar architecture,
dnl like pentium->geode, which can use the same compiler, but have
dnl different development libraries.

AC_ARG_WITH(sysroot,
  AC_HELP_STRING([--with-sysroot], [system root directory for cross compiling]),
  with_top_level=${withval};
  cross_compiling=yes)

if test x"${cross_compiling}" != x; then
  dnl Check if /usr isn't part of the specified path
  if test -d ${with_top_level}/usr; then
    with_top_level=${withval}/usr
  else 
    dnl Check if the specified path supplies /usr
    if test -d ${with_top_level}/include; then
      with_top_level=${withval}
    else
      AC_MSG_ERROR([Specified sysroot \"${with_top_level}/include\" doesn't exist!])
    fi
  fi
fi

dnl Android is a little different when using a standard cross toolchain,
dnl so we have to configure especially for it for now. Usually it's
dnl something like this:
dnl
dnl arm-linux-eabi-gcc -Wl,--dynamic-linker -Wl,/system/bin/linker
dnl -nostdlib -Wl,-rpath -Wl,/system/lib -Wl,-rpath
dnl -Wl,/opt/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib
dnl -L/opt/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib
dnl -lc -o hello
dnl  /opt/android-ndk-r3/build/platforms/android-3/arch-arm/usr/lib/crtbegin_dynamic.o
dnl Recent versions of G++ (I'm using 4.5 from source
android_ndk=no
AC_ARG_WITH([android],
  AC_HELP_STRING([--with-android], [directory where android NDK is installed]),
        android_ndk=${withval}
        if test x"${withval}" != x; then
          android_ndk=${withval}
        fi
)
CROSS_CXXFLAGS=
if test x"${android}" = xyes; then
  CROSS_CXXFLAGS='-fexceptions -frtti -I${prefix}/include'
  CROSS_LDFLAGS='-all-static -L${prefix}/lib'
  if test x"${with_top_level}" = x; then
    with_top_level=/usr/local/android-arm/sysroot/usr
    cross_compiling=yes
  fi
  ANDROID_NDK=${android_ndk}
  AC_DEFINE(ANDROID, [1], [This is an Android build])
  CXXFLAGS="${CXXFLAGS} ${CROSS_CXXFLAGS}"
else
  CROSS_CXXFLAGS=
  ANDROID_NDK=
fi
AC_SUBST(ANDROID_NDK)
AM_CONDITIONAL(ANDROID, [ test x"${android}" = xyes ])
AC_SUBST(CROSS_LDFLAGS)
AC_SUBST(CROSS_CXXFLAGS)

AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE

AC_PATH_PROG(DEJAGNU, runtest)

dnl These options are for Cygnal, which collects optional statistics
dnl on all the network traffic By default, we turn on statistics
dnl collecting for the incoming and outgoing queues, since those are
dnl required to be compatiable with FMS 3, and the ActionScript server
dnl management API. buffers are the lowest level data storage, this
dnl data is the time spent in the queue, and is primarily only used
dnl for tuning the queueing API in Gnash. Memoryis the same, it's only
dnl used by developers for tuning performance of memory allocations in
dnl Gnash.
buffers=no
que=no
memory=no
cache=yes
stat_proplookup=no
AC_ARG_WITH(statistics,
  AC_HELP_STRING([--with-statistics], [Specify which statistics features to enable]),
  if test -n ${withval}; then
    if test "x${withval}" != "xno"; then
      extlist="${withval}"
      withval=`echo ${withval} | tr '\054' ' ' `
    else
      extlist=""
      withval=""
    fi
  fi
  statistics_list=""
  nstatistics=0
  while test -n "${withval}" ; do
    val=`echo ${withval} | cut -d ' ' -f 1`
    [case "${val}" in
      buffers)
        buffers=yes
        nstatistics=$((nstatistics+1))
        ;;
      que)
        que=yes
        nstatistics=$((nstatistics+1))
        ;;
      memory)
        memory=yes
        nstatistics=$((nstatistics+1))
        ;;
      cache)
        cache=yes
        nstatistics=$((nstatistics+1))
        ;;
      proplookup)
        stat_proplookup=yes
        nstatistics=$((nstatistics+1))
        ;;
      all|ALL)
        buffers=yes
        memory=yes
        queu=yes
        cache=yes
        stat_proplookup=yes
        nstatistics=5           dnl this must be incremented if you add anything
        ;;
      *) AC_MSG_ERROR([invalid statistics feature specified: ${withval} given (accept: buffers|que|memory|cache|proplookup|all)])
        ;;
      esac]
    withval=`echo ${withval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$withval"; then
      break;
    fi
  done
)
if test x${buffers} = xyes; then
  statistics_list="${statistics_list} buffers"
  AC_DEFINE(USE_STATS_BUFFERS, [1], [Support statistics collecting for the queue buffers])
  AC_MSG_WARN([This option will effect your performance])
fi

if test x${memory} = xyes; then
  statistics_list="${statistics_list} memory"
  AC_DEFINE(USE_STATS_MEMORY, [1], [Support statistics collecting for all memory profiling])
  AC_MSG_WARN([This option will effect your performance])
fi

if test x${que} = xyes; then
  statistics_list="${statistics_list} queues"
  AC_DEFINE(USE_STATS_QUEUE, [1], [Support statistics collecting for the queues])
fi

if test x${cache} = xyes; then
  statistics_list="${statistics_list} cache"
  AC_DEFINE(USE_STATS_CACHE, [1], [Support statistics collecting for the cache])
fi

if test x${stat_proplookup} = xyes; then
  statistics_list="${statistics_list} proplookup"
  AC_DEFINE(GNASH_STATS_OBJECT_URI_NOCASE, [1], [Collecting and report stats about ObjectURI case lookups])
  AC_DEFINE(GNASH_STATS_PROPERTY_LOOKUPS, [1], [Collecting and report stats about property lookups])
  AC_DEFINE(GNASH_STATS_STRING_TABLE_NOCASE, [1], [Collecting and report stats about string_table::key case lookups])
fi

dnl this is just so Makefile can print the same list
STATISTICS_LIST="$statistics_list"
AC_SUBST(STATISTICS_LIST)

#
# These settings are compile time options for the security
# setting for anything that lets gnash exchange data with
# other applications. Currently this only supports Shared
# Objects and Local Connections. Shared Objects are like
# your web browsers cookies, and Local Connections use
# shared memory to execute methods remotely, and to
# exchange data.
#
# The default is to enable everything, and these can
# also be controlled dynamically by the $HOME/.gnashrc
# file.
#
solreadonly=no
localconnection=yes

AC_ARG_WITH(security,
  AC_HELP_STRING([--with-security], [Specify which security features to enable]),
  if test -n ${withval}; then
    if test "x${withval}" != "xno"; then
      extlist="${withval}"
      withval=`echo ${withval} | tr '\054' ' ' `
    else
      extlist=""
      withval=""
    fi
  fi
  security_list=""
  nsecurity=0
  while test -n "${withval}" ; do
    val=`echo ${withval} | cut -d ' ' -f 1`
    [case "${val}" in
      solreadonly)
        solreadonly=yes
        nsecurity=$((nsecurity+1))
        ;;
      lc)
        localconnection=yes
        nsecurity=$((nsecurity+1))
        ;;
      all|ALL)
        solreadonly=yes
        lc=yes
        nsecurity=3
        ;;
      *) AC_MSG_ERROR([invalid security feature specified: ${withval} given (accept: solreadonly|lc)])
        ;;
      esac]
    withval=`echo ${withval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$withval"; then
      break;
    fi
  done
)

if test x$localconnection = xyes; then
  security_list="${security_list} localconnection"
  AC_DEFINE(USE_LC, [1],
                 [Support LocalConnection])
  AC_MSG_NOTICE([This build supports LocalConnection])
fi
if test x$solreadonly = xyes; then
  security_list="${security_list} solreadonly"
  AC_DEFINE(USE_SOL_READONLY, [1],
                 [Shared Objects are read-only])
  AC_MSG_NOTICE([Shared Objects are read-only])
fi
SECURITY_LIST="$security_list"
AC_SUBST(SECURITY_LIST)

dnl For Haiku, we know the sysroot is in a non-standard place
dnl it is important that -lagg comes before -lbe
if test x"${haiku}" = xyes; then
  HAIKU_LIBS=-lbe
  AC_SUBST(HAIKU_LIBS)
fi

dnl Darwin uses libtool instead of ar to produce libraries. We determine which one
dnl we have here now. For some reason on Darwin, we don't get the
dnl count from grep via stdin correctly. Writing a temp file does the
dnl trick, so although it's ugly, that's what we gotta do...
AC_MSG_CHECKING([which type of library archiver we have])
rm -f .tmp
libtool > .tmp 2>&1
archiver=`grep -c dynamic .tmp 2>&1`
rm -f .tmp
dnl is there any good way to report what we found here?
AC_MSG_RESULT()
if test x"${archiver}" != x && test "${archiver}" -eq 1; then
   export MACOSX_DEPLOYMENT_TARGET="10.3"
   darwin=yes
else
   darwin=no
fi

dnl When cross compiling, limit the search directories cause otherwise
dnl we may get the host headers or libraries by accident. These values
dnl are exported, so all the other configure tests in macros/*.m4 use
dnl these same settings rather than duplicating them like we used to.
dnl To override thise, use the --with-*-incl= and --with-*-libs=
dnl options to configure.
if test x$cross_compiling = xyes; then
  AC_MSG_NOTICE([Configuring Gnash for cross compilation])
  export pkgroot="`$CXX -print-search-dirs | grep "install:" | sed -e 's/install: //' -e 's:/lib/gcc/.*::'`"
  dnl pkgroot only works correctly with builds of cross tools not in
  dnl /usr, ie... installed from the distribution packages, or just
  dnl plain installed in the system tools. This contaminates configure
  dnl when building for variations of the same basic architecture,
  dnl like i686-linux -> i586-mingw32.
  if test x"${pkgroot}" = x"/usr"; then
    export pkgroot=""
  fi
  export incllist="`eval echo ${with_top_level}/include ${pkgroot}/${host_alias}/include ${pkgroot}/include`"
  export libslist="`eval echo ${with_top_level}/lib ${pkgroot}/${host_alias}/lib ${pkgroot}/lib64 ${pkgroot}/lib32 ${pkgroot}/lib`"
  export pathlist="`eval echo ${pkgroot}/${host_alias}/bin:${pkgroot}/bin`"
  npapi=no
else
  AC_MSG_NOTICE([Configuring Gnash for native compilation])
  export incllist="`eval cat ${srcdir}/macros/incllist`"
  libslist="`cat ${srcdir}/macros/libslist`"
  if test -f /usr/bin/dpkg-architecture; then
    export DEB_HOST_MULTIARCH="`eval dpkg-architecture -qDEB_HOST_MULTIARCH`"
    export libslist="${libslist} /lib/${DEB_HOST_MULTIARCH} /usr/lib/${DEB_HOST_MULTIARCH}"
  fi
  export pathlist=$PATH
fi

if test x"${android_ndk}" != xno; then
   incllist="${android_ndk}/include ${incllist}"
fi

AM_CONDITIONAL(CROSS_COMPILING, [ test x$cross_compiling = xyes ])

for dir in ${incllist}; do
  test -d ${dir} && pruned_incllist="${pruned_incllist} ${dir}";
done

for dir in ${libslist}; do
  test -d ${dir} && pruned_libslist="${pruned_libslist} ${dir}";
done

libslist="${pruned_libslist}";
incllist="${pruned_incllist}";

dnl !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
dnl !! 
dnl !! IMPORTANT NOTICE 
dnl !!
dnl !!  Any call to GNASH_PATH_XXX must be be given *after* this snippet.
dnl !!  This is to ensure that PKG_CONFIG, cross_compiling and incllist are
dnl !!  properly set at the time of call.
dnl !!
dnl !!  Also GNASH_PKG_FIND has to be called later. Not sure
dnl !!  why but calling before breaks detection of CPP (see
dnl !!  gnash-dev mailing archives for June 12 2009
dnl !!  http://lists.gnu.org/archive/html/gnash-dev/2009-06/index.html
dnl !! 
dnl !! 
dnl !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

dnl Check for PKG_CONFIG before any GNASH_PATH call
PKG_PROG_PKG_CONFIG

dnl --------------------------------------------------------
dnl  GUI selection
dnl --------------------------------------------------------

build_haiku=no
build_aos4=no      dnl AmigaOS4 GUI
build_kde3=no      dnl WARNING: doesn't work (see https://savannah.gnu.org/bugs/index.php?31782)
build_qt4=no
build_qtopia3=no
build_qtopia4=no
build_gtk=no
build_fb=no                     dnl Raw framebuffer
build_fltk=no
build_sdl=no
build_aqua=no                   dnl Native MacOSX
build_dump=no
AC_ARG_ENABLE(gui,
  AC_HELP_STRING([--enable-gui], [Enable support for the specified GUI toolkits (default=gtk,qt4)]),
  [if test -n ${enableval}; then
    enableval=`echo ${enableval} | tr '\054' ' ' `
  fi
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    case "${val}" in
      gtk|GTK|gtk2|GTK2)
        build_gtk=yes
        ;;
      kde3|KDE3)
        build_kde3=yes
        ;;
      qt4|QT4|kde4|KDE4)
        build_qt4=yes
        ;;
      qtopia3|QTOPIA3)
        build_qtopia3=yes
        ;;
      qtopia4|QTOPIA4)
        build_qtopia4=yes
        ;;
      sdl|SDL)
        build_sdl=yes
        ;;
      aqua|AQUA|Aqua)
        build_aqua=yes
        ;;
      fltk|FLTK|fltk2|FLTK2)
        build_fltk=yes
        ;;
      fb|FB)
        build_fb=yes
        ;;
      aos4|AOS4)
        build_aos4=yes
        ;;
      haiku|HAIKU)
        build_haiku=yes
        ;;
      dump|DUMP)
        build_dump=yes
        ;;
      all|ALL)
        build_dump=yes
        dnl BSD doesn't have a framebuffer interface
        if test x${linux} = xyes; then
          build_fb=yes
        fi
        if test x${openbsd} != xyes; then
          build_qt4=yes
        fi
        build_sdl=yes
        build_gtk=yes
        ;;
      *) AC_MSG_ERROR([invalid gui ${enableval} given (accept: gtk|kde3|qt4|fltk|sdl|aqua|fb|qtopia3|qtopia4|dump|aos4|haiku)])
         ;;
      esac
    enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done],
  [ dnl Run the following code if no --enable-gui is given
  build_fb=auto
  build_sdl=auto
  if test x"${openbsd}" = xyes; then
    build_gtk=yes
    build_dump=auto
  else if test x"${haiku}" = xyes; then
    build_haiku=yes;
  else
    build_qt4=auto
    build_gtk=yes
    build_dump=auto
  fi
  fi
  ]
)

if test x"${build_haiku}" = xyes; then
  if test x"$haiku" != xyes; then
    echo "        ERROR: Can not build Haiku gui outside of Haiku
operating system." >&3
  fi
fi

dnl We can use Xephyr or fbe to create a fake framebuffer instead of real
dnl video memory. This lets us test on a desktop machine.
AC_ARG_WITH(fakefb,
AC_HELP_STRING([--with-fakefb],
 [specify a file to be mapped instead of a real framebuffer]),
 with_fakefb=${withval})

fakefb=
if test x"${with_fakefb}" = xyes; then
  dnl This is the default file name fbe uses.
  fakefb=/tmp/fbe_buffer
else
  if test x"${with_fakefb}" != x; then
    fakefb=${with_fakefb}
  fi
fi
FAKEFB=${fakefb}
AC_SUBST(FAKEFB)

if test x"${fakefb}" != x; then
    AC_DEFINE(ENABLE_FAKE_FRAMEBUFFER, [1], [Enable using a file instead of a real framebuffer])
fi

dnl This enable a small handful of tests that aren't designed to be
dnl run as part of "make check", as they are either incomplete, or
dnl can only be run interactively. These are all primarily oriented
dnl towards code development and debugging, instead of regression
dnl or unit testing.
AC_ARG_ENABLE(devtests, AC_HELP_STRING([--enable-devtests],
  [Developer only tests, not to be included in make check]),
[case "${enableval}" in
  yes) devtests=yes ;;
  no)  devtests=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for enable-devtests option]) ;;
esac], devtests=no)
AM_CONDITIONAL(ENABLE_DEVELOPER_TESTS, [test x${devtests} = xyes])

dnl --------------------------------------------------------
dnl  Sound handler selection
dnl --------------------------------------------------------
add_sound=
build_sound_none=no
build_sound_sdl=no
build_sound_ahi=no
build_sound_mkit=no
AC_ARG_ENABLE(sound,
  AC_HELP_STRING([--enable-sound=[[sdl|ahi|mkit]]], [Use the specified sound handler (default=sdl)]),
     [case "${enableval}" in
      sdl|SDL|Sdl)
        build_sound_sdl=yes
        add_sound="sdl"
        ;;
      none|NONE|None)
        build_sound_none=yes
        add_sound="none"
        ;;
      ahi|AHI|Ahi)
        build_sound_ahi=yes
        add_sound="ahi"
        ;;
      mkit|MKIT|Mkit)
        build_sound_mkit=yes
        add_sound="mkit"
        ;;
     esac],
  [if test x"${haiku}" = xyes; then
     build_sound_mkit=yes
     add_sound="mkit"
   else
     if test x${build_sound_none} = xno; then
       build_sound_sdl=yes
       add_sound=sdl
     fi
   fi]
)

AM_CONDITIONAL(BUILD_LIBSOUND, test x${build_sound_none} != xyes)
if test x${build_sound_none} != xyes; then
  AC_DEFINE(USE_SOUND, [1], [Build any sound code])
fi

dnl --------------------------------------------------------
dnl  Media handler selection
dnl --------------------------------------------------------
build_media_gst=no
build_media_ffmpeg=auto
build_media_none=no
AC_ARG_ENABLE(media,
  AC_HELP_STRING([--enable-media=handler],
    [Enable media handling support using the specified handlers: ffmpeg gst none(no sound) (default=auto) ]),
  
    if test -n ${enableval}; then
      enableval=`echo ${enableval} | tr '\054' ' ' `
    fi
    dnl When --enable-media is given, all media defaults to off
    dnl except the explicitly enabled ones
    build_media_ffmpeg=no
    build_media_gst=no
    while test -n "${enableval}"; do
      val=`echo ${enableval} | cut -d ' ' -f 1`
      [case "${val}" in
        GST|gst)
          build_media_gst=yes
          media_list="${media_list}gst "
          ;;
        FFMPEG|ffmpeg)
          build_media_ffmpeg=yes
          media_list="${media_list}ffmpeg "
          ;;
        no|NO|none)
          build_media_none=yes
          media_list="none"
          ;;
        *)
          AC_MSG_ERROR([bad value ${enableval} for --enable-media option])
          ;;
     
      esac]
      enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
      if test "x$val" = "x$enableval"; then
        break;
      fi
    done,
    [if test x"${build_haiku}" = xyes; then
        build_media_ffmpeg=yes
        build_media_haiku=yes
        media_list="ffmpeg haiku"
     else
        build_media_gst=yes
        media_list="gst"
    fi]
)

AM_CONDITIONAL(BUILD_LIBMEDIA, test x${build_media_none} != xyes)
if test x${build_media_none} != xyes; then
  AC_DEFINE(USE_MEDIA, [1], [Build any media code])
fi

dnl If no media is selected, and media handling isn't disabled, then enable gst
if test x${build_media_none} = xno -a x${build_media_gst} = xno -a x${build_media_ffmpeg} = xno; then
  build_media_gst=yes
fi

if test x"$build_media_ffmpeg" != x"no"; then # yes or auto
  GNASH_PATH_FFMPEG
  if test x"${build_media_ffmpeg}" = xauto; then
    dnl TODO: have GNASH_PATH_FFMPEG set ${has_ffmpeg}
    if test x"$FFMPEG_LIBS" != x; then
      build_media_ffmpeg=yes
      media_list="${media_list} ffmpeg"
    else
      build_ogl=no
    fi
  fi
fi

MEDIA_CONFIG="${media_list}"
AC_SUBST(MEDIA_CONFIG)

dnl Multiple input devices are supported. These can all work in
dnl varying combinations, so several may be listed. These are only
dnl required when using the Framebuffer, as without the X11 desktop,
dnl Gnash has to handle all these internally. This can get
dnl messy, as one might want to use a touchscreen with a normal mouse
dnl or keyboard attached. 
dnl By default, don't build any of these, as they are only for the 
dnl Framebuffer running without X11.
if test x"${build_fb}" = xyes -a x"${linux}" = xyes; then
  build_ps2mouse=no
  build_ps2keyboard=yes
  build_input_events=yes
  build_tslib=yes
  input_events="PS/2 Mouse, PS/2 Keyboard, Input Devices, Touchscreen via Tslib"
else
  build_ps2mouse=no
  build_ps2keyboard=no
  build_input_events=no
  build_tslib=no
  input_events=
fi
AC_ARG_ENABLE(input,
  AC_HELP_STRING([--enable-input], [Enable support for the specified input devices for the framebuffer GUI (default=ps2mouse|ps2keyboard|events|touchscreen)]),
  [if test -n ${enableval}; then
    enableval=`echo ${enableval} | tr '\054' ' ' `
  fi
  build_ps2mouse=no
  build_ps2keyboard=no
  build_input_events=no
  build_tslib=no
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    case "${val}" in
      ps2m*|PS2m*|m*|M*)        dnl a PS/2 style mouse
        build_ps2mouse=yes
        input_events="${input_events}, PS/2 Mouse"
        ;;
      ps2k*|PS2K*|k*|K*)        dnl a PS/2 style keyboard
        build_ps2keyboard=yes
        input_events="${input_events}, PS/2 Keyboard"
        ;;
      i*|I*|ev*|Ev*)    dnl use the new Input Event, which supports both
        input_events="${input_events}, Input Event Device"
        build_input_events=yes
        ;;
      t*|T*) dnl use a touchscreen with tslib, which works like a mouse
        build_tslib=yes
        input_events="${input_events}, Touchscreen"
        ;;
      a*) dnl all
        build_ps2mouse=yes
        build_ps2keyboard=yes
        build_tslib=yes
        if test x"${linux}" = xyes; then
          build_input_events=yes
          input_events="PS/2 Mouse, PS/2 Keyboard, Input Devices, Touchscreen via Tslib"                
        else
          build_input_events=no
          input_events="PS/2 Mouse, PS/2 Keyboard, Touchscreen via Tslib"                
        fi
        ;;
      *) AC_MSG_ERROR([invalid input device list! ${enableval} given (accept: ps2mouse|keyboard|events,touchscreen)])
         ;;
      esac
    enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done],
)

if test x$build_sdl != xno -o x$build_sound_sdl = xyes; then
  GNASH_PATH_SDL
fi
AM_CONDITIONAL(ENABLE_TSLIB, [test x${ac_cv_header_tslib_h} = xyes])


dnl -----------------------------------------------------
dnl Check for SDL and decide about auto gui accordingly.
dnl Need be done after build_sound_sdl and build_sdl are
dnl initialized and before they are checked for yes/no
dnl -----------------------------------------------------
if test x"${build_sdl}" = xauto; then
  if test xyes = x"${has_sdl}"; then
    build_sdl=yes
  else
    AC_MSG_NOTICE([sdl GUI will not be built (no sdl development files found)])
    build_sdl=no
  fi
fi

dnl -------------------------------
dnl Renderer Selection
dnl -------------------------------
input_events=
dnl By default, we want to to build all renderers
dnl DirectFB has both a device layer and a rendering layer, although
dnl currently the rendering part is incomplete. Configure support is
dnl included for development purposes.
build_directfb=no
dnl The OpenVG support works on both the desktop and embedded devices
dnl that don't run X11. It is supported by iPhone/iPad/Android
dnl devices, and the nouveau driver on the desktop.
build_ovg=no
dnl The OpenGLES1 renderer is a work in progress. It is originally
dnl based on a patch to Gnash 0.8.5, which of course not only didn't
dnl compile anymore, it was all hardcoded into the framebuffer
dnl code. This version compiles with the latest internal rendering
dnl API, and works properly with the glue code for the Gnash GUIs.
build_gles1=no
dnl OpenGL works, but suffers from performance and rendering quality
dnl problems. This should eventually be replacd by the OpenGLES1 and
dnl OpenVG renders.
build_ogl=no
dnl AGG is a software only renderer
build_agg=yes
build_cairo=yes
renderer_list="agg cairo"
AC_ARG_ENABLE(renderer,
  AC_HELP_STRING([--enable-renderer], [Enable support for the specified renderers (agg|cairo|opengl|openvg|all, default=all)]),
  if test -n ${enableval}; then
    if test "x${enableval}" != "xno" -o "x${enableval}" != "xnone" ; then
      renderer_list="none"
      enableval=`echo ${enableval} | tr '\054' ' ' `
    else
      renderer_list=""
      enableval=""
    fi
  fi
  renderer_list=""
  build_ovg=no
  build_ogl=no
  build_gles1=no
  build_gles2=no
  build_agg=no
  build_cairo=no
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    [case "${val}" in
      no*|NO*)
        renderer_list="none"
        build_ovg=no
        build_ogl=no
        build_gles1=no
        build_gles2=no
        build_agg=no
        build_cairo=no
        ;;
      all|ALL)
        renderer_list="agg cairo opengl openvg, opengles1"
        build_ogl=yes
        build_agg=yes
        build_cairo=yes
        build_ovg=no
        nrender=3
        ;;
      ogl|OGL|OpenGL|opengl)
        renderer_list="${renderer_list} opengl"
        build_ogl=yes
        ;;
      gles|GLES|gles1|GLES1)
        renderer_list="${renderer_list} opengles1"
        build_gles1=yes
        build_ogl=no
        nrender=$((nrender+1))
        ;;
      ovg|OVG|OpenVG|openvg)
        renderer_list="${renderer_list} openvg"
        build_ovg=yes
        nrender=$((nrender+1))
        ;;
      directfb|dfb)
        renderer_list="${renderer_list} DirectFB"
        build_directfb=yes
        nrender=$((nrender+1))
        ;;
      agg|AGG)
        renderer_list="${renderer_list} agg"
        build_agg=yes
        ;;
      cairo|CAIRO|Cairo*)
        renderer_list="${renderer_list} cairo"
        build_cairo=yes
        ;;
      *) AC_MSG_ERROR([invalid renderer specified: ${enableval} given (accept:  (opengl|openvg|cairo|agg|all)])
        ;;
      esac]
    enableval=`echo ${enableval} | cut -d ' ' -f 2-`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done
)

if test x"${build_ovg}" = xyes; then
  GNASH_PATH_OPENVG
  dnl If OpenVG isn't installed, disable it
  if test x"${has_openvg}" = xno; then
    AC_MSG_WARN([OpenVG specified but no development files found!])
    renderer_list=`echo ${renderer_list} | sed -e 's/ openvg//' `
    nrender=$((nrender-1))
  fi
fi

dnl VA API is used by default for all H.264 videos. HW requirements:
dnl     * AMD GPUs with UVD2 and xvba-video VA driver
dnl     * NVIDIA GPUs with vdpau-video VA driver
dnl     * All HW with a VA driver supporting the VA/GLX extensions or
dnl     vaPutSurface(Pixmap,...). This may include the Intel
dnl     Moorestown platform and future G45 VA driver.
dnl NOTE: it is possible to use Gnash/VAAPI on platforms with an Intel
dnl GMA500 but you currently will have to build the AGG renderer
dnl instead of the OGL (OpenGL) one. 
build_vaapi_device=no
build_openmax_device=no
dnl These renders always require EGL support
if test x${build_gles1} = xyes -o x${build_ovg} = xyes; then
  build_egl_device=yes
else
  build_egl_device=no
fi
build_x11_device=no
build_directfb_device=no
if test x"${build_fb}" = xyes -o x"${build_fb}" = xauto; then
  build_fb_agg=yes
fi
dnl AGG support for the framebuffer requires the rawfb device
if test x"${build_fb_agg}" = xyes -a x"${build_agg}" = xyes; then
  build_rawfb_device=yes
  device_list="RawFB"
  ndevice=1
else
  build_rawfb_device=no
  device_list=""
  ndevice=0
fi
AC_ARG_ENABLE(device,
  AC_HELP_STRING([--enable-device], [Specify which hardware abstraction to use to support to enable (none,egl,directfb,rawfb,x11,vaapi)]),
  enableval=`echo ${enableval} | tr '\054' ' ' `
  build_egl_device=no
  build_rawfb_device=no
  device_list=""
  ndevice=0
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    [case "${val}" in
      no*|NO*)
        device_list="none"
        build_vaapi_device=no
        build_openmax_device=no
        build_egl_device=no
        build_directfb_device=no
        build_x11_device=no
        ndevice=0
        ;;
      va*|VA*)
        device_list="${device_list} VAAPI"
        build_vaapi_device=yes
        ndevice=$((ndevice+1))
        ;;
      eg*|EG*)
        device_list="${device_list} EGL"
        build_egl_device=yes
        ndevice=$((ndevice+1))
        ;;
      x1*|X1*)
        device_list="${device_list} X11"
        build_x11_device=yes
        ndevice=$((ndevice+1))
        ;;
      di*|Di*|DI*|dfb)
        device_list="${device_list} DirectFB"
        build_directfb_device=yes
        ndevice=$((ndevice+1))
        ;;
      ra*|RAW*)
        device_list="${device_list} RawFB"
        build_rawfb_device=yes
        ndevice=$((ndevice+1))
        ;;
      all|ALL)
        device_list="EGL RawFB X11"
        build_openmax_device=no
        build_vaapi_device=no
        build_egl_device=yes
        build_rawfb_device=yes
        build_directfb_device=no
        build_x11_device=yes
        ndevice=3
        ;;
      op*|Op*|OP*)
        device_list="${device_list} OpenMAX"
        build_openmax_device=yes
        ndevice=$((ndevice+1))
        ;;
      *) AC_MSG_ERROR([invalid device feature specified: ${enableval} given (accept: none,vaapi)])
        ;;
      esac]
    enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done
)

if test x"${have_ffmpeg_vaapi}" = x"yes" -a x"${build_vaapi_device}" = x"yes"; then
  use_libva=no
  use_libva_x11=no
  use_libva_glx=no
  dnl if the version of FFmpeg is recent enough, (r20957, 52.45.0), then
  dnl look for VAAPI support so we can use use the VAAPI enabled FFmpeg.
  if test x"${have_ffmpeg_vaapi}" = xyes; then
    use_libva=yes
    GNASH_PKG_FIND([libva],
      [va/va.h],
      [Video Acceleration API],
      vaInitialize
    )
    use_libva_x11=yes
    GNASH_PKG_FIND([libva_x11],
      [va/va_x11.h],
      [VA API (X11 display)],
      vaGetDisplay,
      [], [-lva-x11]
    )

    if test x$build_ogl = xyes; then
      use_libva_glx=yes
      GNASH_PKG_FIND([libva_glx],
        [va/va_glx.h],
        [VA API (GLX display)],
        vaGetDisplayGLX,
        [], [-lva-glx]
      )
    fi
  fi
fi

if test x"${build_fb_agg}" = xyes -a x"${build_rawfb_device}" = xno; then
  AC_MSG_ERROR([Framebuffer GUI requires the rawfb device.])
fi

dnl libVA drivers. We declare conditional for both the option being
dnl selected, as well as whether or not it's found. This we can
dnl generate better error handling if it's not found.
AM_CONDITIONAL(USE_VAAPI, test x"${use_libva}" = xyes)

dnl Until the hwaccel patches in FFmpeg wind up in the ffmpeg-plugin,
dnl restrict using HW Accel to using FFmpeg directly.
dnl test xyes = xyes -a ( x != xyes -o x != xyes )
if test x"${build_vaapi}" = x"yes" -a x"${have_ffmpeg}" != x"yes"; then
  AC_MSG_ERROR(["Hardware acceleration currently not supported unless using FFmpeg."])
fi

AM_CONDITIONAL(HAVE_VAAPI, test x"${found_libva_incl}" = xyes)
AM_CONDITIONAL(HAVE_VAAPI_GLX, test x"${found_libva_glx_incl}" = xyes)
AM_CONDITIONAL(HAVE_VAAPI_X11, test x"${found_libva_x11_incl}" = xyes)

if test x"${build_egl_device}" = xyes; then
  GNASH_PKG_FIND(EGL, [EGL/egl.h], [EGL library], eglGetDisplay)
  if test xyes = x"${has_EGL}"; then
    AC_DEFINE(BUILD_EGL_DEVICE, [ 1 ],
          [Build the EGL device for OpenVG, OpenGLES1&2, and X11/Mesa])
  else
    AC_MSG_WARN(["EGL requested but development package not found!"])
    build_egl_device=no
  fi
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -Wall -Werror"
  native_window_type=none
  AC_MSG_CHECKING([For EGLNativeWindowType type])
  AC_TRY_COMPILE([#include <EGL/eglplatform.h>], [
    EGLNativeWindowType foo = 1;
    int bar = foo;
    bar++; ],
    native_window_type=int,
    native_window_type=void
  )
  CFLAGS="$save_CFLAGS"
  AC_MSG_RESULT([${native_window_type}])
  if test x"${native_window_type}" = x"int"; then
    AC_DEFINE([EGL_NATIVE_WINDOW_INT], [1], [EGLNativeWindowType type])
  fi
fi

if test ${ndevice} -eq 0; then
      device_list="none"
      ndevice=1
fi

AM_CONDITIONAL(BUILD_DEVICES, test ${ndevice} -gt 0)

dnl 16 bit: RGB555, RGB565
dnl 24 bit: RGB24, BGR24
dnl 32 bit: RGBA32, BGRA32
pixelformat=all
AC_ARG_WITH(pixelformat,
  AC_HELP_STRING([--with-pixelformat=], [Use the specified pixel format for AGG (default=all)]),
  [if test -n ${withval}; then
    pixelformat="${withval}"
    withval=`echo ${withval} | tr '\054' ' ' `
  fi
  while test -n "${withval}" ; do
    val=`echo ${withval} | cut -d ' ' -f 1`
    case "${val}" in
      all)
        # allow special value "all" set by user (handled below)
        ;; 
      argb32|ARGB32)
        AC_DEFINE(PIXELFORMAT_ARGB32, [1], [ARGB32])
        ;;
      abgr32|ABGR32)
        AC_DEFINE(PIXELFORMAT_ABGR32, [1], [ABGR32])
        ;;
      bgra32|BGRA32)
        AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32])
        ;;
      bgr24|BGR24)
        AC_DEFINE(PIXELFORMAT_BGR24, [1], [BGR24])
        ;;
      rgba32|RGBA32)
        AC_DEFINE(PIXELFORMAT_RGBA32, [1], [RGBA32])
        ;;
      rgb24|RGB24)
        AC_DEFINE(PIXELFORMAT_RGB24, [1], [RGB24])
        ;;
      rgb555|RGB555)
        AC_DEFINE(PIXELFORMAT_RGB555, [1], [RGB555])
        ;;
      rgb565|RGB565)
        AC_DEFINE(PIXELFORMAT_RGB565, [1], [RGB565])
        ;;
      *) AC_MSG_ERROR([invalid pixel format ${withval} given (accept: all|RGB555|RGB565|RGB24|BGR24|BGRA32|RGBA32|ARGB32|ABGR32)])
         ;;
      esac
    withval=`echo ${withval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$withval"; then
      break;
    fi
  done],
  [if test x$build_haiku = xyes -a x$build_sdl != xyes; then
	AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32])
        pixelformat=BGRA32
   fi]
)

if test x$pixelformat = xall; then
  if test x$build_agg = xyes; then
    ### The fact that we're building GTK doesn't mean we're not also
    ### building KDE or SDL, each needing its own pixel format !
    #if test x$build_gtk = xyes; then
    #  AC_DEFINE(PIXELFORMAT_RGB24, [1], [RGB24 pixel format])
    #  pixelformat="RGB24"
    #else
      AC_DEFINE(PIXELFORMAT_RGB555, [1], [RGB555 pixel format])
      AC_DEFINE(PIXELFORMAT_RGB565, [1], [RGB565 pixel format])
      AC_DEFINE(PIXELFORMAT_RGB24,  [1], [RGB24 pixel format])
      AC_DEFINE(PIXELFORMAT_BGR24,  [1], [BGR24 pixel format])
      AC_DEFINE(PIXELFORMAT_RGBA32, [1], [RGBA32 pixel format])
      AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32 pixel format])
      AC_DEFINE(PIXELFORMAT_ARGB32, [1], [ARGB32 pixel format])
      AC_DEFINE(PIXELFORMAT_ABGR32, [1], [ABGR32 pixel format])
    #fi
  fi
fi

if test x"${build_ogl}" != xno; then # yes or auto
  GNASH_PATH_OPENGL
  if test x"${build_ogl}" = xauto; then
    if test xyes = x"${has_opengl}"; then
      build_ogl=yes
      renderer_list="${renderer_list} opengl"
    else
      build_ogl=no
    fi
  fi
fi

AM_CONDITIONAL(BUILD_OVG_RENDERER,   [ test x${build_ovg} = xyes ])
AM_CONDITIONAL(BUILD_GLES1_RENDERER, [ test x${build_gles1} = xyes ])
AM_CONDITIONAL(BUILD_GLES2_RENDERER, [ test x${build_gles2} = xyes ])
AM_CONDITIONAL(BUILD_OGL_RENDERER,   [ test x${build_ogl} = xyes])
AM_CONDITIONAL(BUILD_AGG_RENDERER,   [ test x${build_agg} = xyes ])
AM_CONDITIONAL(BUILD_CAIRO_RENDERER, [ test x${build_cairo} = xyes ])

if test x"${has_openvg}" = xyes; then
   AC_DEFINE([RENDERER_OPENVG], [1], [Use OpenVG renderer])
fi

if test x"${build_ogl}" = xyes; then
   AC_DEFINE([RENDERER_OPENGL], [1], [Use OpenGL renderer])
fi

if test x"${build_agg}" = xyes; then
  AC_DEFINE([RENDERER_AGG], [1], [Use AntiGrain renderer])
fi

if test x"${build_cairo}" = xyes; then
  GNASH_PKG_FIND(cairo, [cairo.h], [cairo render library], cairo_status)
  AC_DEFINE([RENDERER_CAIRO], [1], [Use cairo renderer])
fi

if test x"${build_agg}" = xyes; then
   GNASH_PATH_AGG
fi

AC_PATH_PROG(PERL, perl)
AM_CONDITIONAL(HAVE_PERL, test x"$PERL" != x)

AC_PATH_PROG(CSOUND, csound)
AM_CONDITIONAL(HAVE_CSOUND, test x"$CSOUND" != x)

AC_PATH_PROG(GIT, git)
AC_SUBST(GIT)

dnl --------------------------------------------------------
dnl Extension selection
dnl --------------------------------------------------------
ext_dejagnu=no
ext_mysql=no
ext_fileio=no
ext_gtk=no
ext_lirc=no
ext_dbus=no
ext_all=no
extensions_list=
extensions_support=yes
nextensions=0
AC_ARG_ENABLE(extensions,
  AC_HELP_STRING([--enable-extensions=], [Specify which extensions to build (default: none)])
AC_HELP_STRING([--disable-extensions], [Disable support for extensions entirely]),
  if test -n ${enableval}; then
    if test "x${enableval}" != "xno"; then
      extlist="${enableval}"
      enableval=`echo ${enableval} | tr '\054' ' ' `
      AC_DEFINE([USE_EXTENSIONS], [1], [Specify that extension support is enabled.])
    else
      extlist=""
      enableval=""
      extensions_support=no
    fi
  fi
  nextensions=0
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    extensions_list="${extensions_list} ${val}"
    [case "${val}" in
      dejagnu|DEJAGNU|dj|DJ)
        AC_DEFINE(USE_DEJAGNU_EXT, [1], [Build the DejaGnu extension])
        AC_MSG_NOTICE([Adding DejaGnu extension])
        ext_dejagnu=yes
        nextensions=$((nextensions+1))
        ;;
      mysql|MYSQL|sql|SQL)
        AC_DEFINE(USE_MYSQL_EXT, [1], [Build the MySQL extension])
        AC_MSG_NOTICE([Adding MySql extension])
        ext_mysql=yes
        nextensions=$((nextensions+1))
        ;;
      fileio|FILEIO|io|IO)
        AC_DEFINE(USE_FILEIO_EXT, [1], [Build the FileIO extension])
        AC_MSG_NOTICE([Adding FileIO extension])
        ext_fileio=yes
        nextensions=$((nextensions+1))
        ;;
      gtk|GTK|gtk2|GTK2)
        AC_DEFINE(USE_GTK_EXT, [1], [Build the GTK extension])
        ext_gtk=yes
        nextensions=$((nextensions+1))
        ;;
      lirc|LIRC)
        AC_DEFINE(USE_LIRC_EXT, [1], [Build the LIRC extension])
        ext_lirc=yes
        nextensions=$((nextensions+1))
        ;;
      dbus|DBUS)
        AC_DEFINE(USE_DBUS_EXT, [1], [Build the DBUS extension])
        ext_dbus=yes
        nextensions=$((nextensions+1))
        ;;
      all|ALL)
        AC_DEFINE(USE_GTK_EXT, [1], [Build all the extensions])
        ext_dejagnu=yes
        ext_mysql=yes
        ext_fileio=yes
        ext_gtk=yes
        ext_lirc=yes
        ext_dbus=yes
        ext_all=yes
        nextensions=9
        ;;
      *) AC_MSG_ERROR([invalid extension specified: ${enableval} given (accept: MYSQL|DEJAGNU|FILEIO|GTK|LIRC|DBUS|METOME|ALL)])
         ;;
      esac]
    enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done
  EXTENSIONS_LIST="$extensions_list"
  AC_SUBST(EXTENSIONS_LIST)
)

if test x$ext_dbus = xyes; then
  GNASH_PATH_DBUS
fi

if test x$ext_mysql = xyes; then
  GNASH_PATH_MYSQL
fi

AM_CONDITIONAL(BUILD_DEJAGNU_EXT, [ test x$ext_dejagnu = xyes ])
AM_CONDITIONAL(BUILD_FILEIO_EXT, [ test x$ext_fileio = xyes ])
AM_CONDITIONAL(BUILD_MYSQL_EXT, [ test x$ext_mysql = xyes ])
AM_CONDITIONAL(BUILD_GTK_EXT, [ test x$ext_gtk = xyes ])
AM_CONDITIONAL(BUILD_LIRC_EXT, [ test x$ext_lirc = xyes ])
AM_CONDITIONAL(BUILD_DBUS_EXT, [ test x$ext_dbus = xyes ])
AM_CONDITIONAL(BUILD_EXTENSIONS, [ test -n "$extensions_list"])

AM_CONDITIONAL(ENABLE_EXTENSIONS, [ test "x${extensions_support}" != "xno" ])

dnl --------------------------------------------------------
dnl Libtool
dnl --------------------------------------------------------

AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
DLOPEN="-dlopen"
DLPREOPEN="-dlpreopen"
AC_SUBST(DLOPEN)
AC_SUBST(DLPREOPEN)

GNASH_PKG_FIND([ltdl], [ltdl.h], [libltdl library], [lt_dlinit])

if test x"$has_ltdl" = x"yes";then
  AC_DEFINE(HAVE_LTDL, [1], [Libtool 2.x defines this, but libtool 1.5 does not])
fi

dnl --------------------------------------------------------
dnl SOL dir
dnl --------------------------------------------------------
soldir=/tmp
AC_ARG_WITH(soldir,
 AC_HELP_STRING([--with-soldir],
 [directory for .sol files]),
 with_soldir=${withval})
if test x${with_soldir} != x; then
  soldir=${with_soldir}
fi
SOLDIR=${soldir}
AC_SUBST(SOLDIR)

dnl --------------------------------------------------------
dnl AVM2
dnl --------------------------------------------------------
dnl AC_ARG_ENABLE(avm2,
dnl   AC_HELP_STRING([--enable-avm2], [Enable support for AS3]),
dnl   [case "${enableval}" in
dnl     yes) avm2=yes ;;
dnl     no)  avm2=no ;;
dnl     *)   AC_MSG_ERROR([bad value ${enableval} for enable-avm2 option]) ;;
dnl   esac], avm2=no
dnl )
dnl AM_CONDITIONAL(ENABLE_AVM2, [test x"$avm2" = xyes])
dnl if test x$avm2 = xyes; then
dnl     AC_DEFINE(ENABLE_AVM2, [1], [Enable AVM2 code])
dnl fi
AM_CONDITIONAL(ENABLE_AVM2, false)

dnl This option is only used if you want Gnash to interwork with 
dnl the Adobe player using the LocalConnection class.
dnl lckey=0xdd3adabd
AC_ARG_WITH(lckey,
 AC_HELP_STRING([--with-lckey],
 [shared memory key for your system]),
 with_lckey=${withval})

if test x${with_lckey} != x; then
  lckey=${with_lckey}
else
  lckey=0xcbc384f8
fi
LC_KEY=${lckey}
AC_SUBST(LC_KEY)

AC_ARG_ENABLE(python,
  AC_HELP_STRING([--enable-python],[Enable python for the python wrapper]),
[case "${enableval}" in
  yes) python=yes ;;
  no)  python=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-python option]) ;;
esac],python=no)

dnl Look for python, which is optional. If enabled, a python loadable
dnl module of Gnash is created.
GNASH_PATH_PYTHON
AM_CONDITIONAL([USE_PYTHON], test x"$python" = xyes)
AM_CONDITIONAL([HAS_PYTHON], test x"$has_python" = xyes)

dnl By default debug logging is enabled. For better performance, it can
dnl be disabled, as when running as a plugin, nobody sees the debug messages
dnl anyway. Debug logging is primarily for developers, so we can turn it off
dnl for package builds.
AC_ARG_ENABLE(log,
  AC_HELP_STRING([--enable-log],[Enable debug logging]),
[case "${enableval}" in
  yes) debuglog=yes ;;
  no)  debuglog=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-log option]) ;;
esac],debuglog=yes)

if test x"${debuglog}" = x"yes"; then
  AC_DEFINE([DEBUG_LOGGING], [1], [Enable debug logging])
fi

# Maybe use jemalloc, which handles memory fragmentation for
# ECAMscript languages better than the regular system malloc.
# This seems like a good idea, as both the other player and
# Mozilla/Firefox both recently switched to using jemalloc.
AC_ARG_ENABLE(jemalloc,
  AC_HELP_STRING([--enable-jemalloc],[Enable jemalloc instead of system malloc])
AC_HELP_STRING([--disable-jemalloc],[Disable jemalloc]),
[case "${enableval}" in
  yes) jemalloc=yes ;;
  no)  jemalloc=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-jemalloc option]) ;;
esac],jemalloc=yes)

dnl We can search libs for mallinfo to decide whether we have it or not.
dnl This is added to the linker flags when it's found. Usually it's -lc, but
dnl on OpenSolaris it's -lmalloc, so this fixes the build.
AC_SEARCH_LIBS([mallinfo], [c malloc],
               AC_DEFINE(HAVE_MALLINFO, [1], [Has mallinfo()])
               mallinfo=yes
               )

AM_CONDITIONAL([HAVE_MALLINFO], test x$mallinfo = xyes)
 
if test x"${jemalloc}" = x"yes"; then
  GNASH_PKG_FIND(jemalloc, [jemalloc.h], [jemalloc memory management], mallctl)
fi

AM_CONDITIONAL(JEMALLOC, test x"${has_jemalloc}" = xyes)

AC_SEARCH_LIBS([getaddrinfo], [c])

AC_ARG_ENABLE(fps-debug,
  AC_HELP_STRING([--enable-fps-debug],[Enable FPS debugging code]),
[case "${enableval}" in
  yes) AC_DEFINE([GNASH_FPS_DEBUG], [1], [Enable FPS debugging code])
esac])

dnl IPC_INFO isn't portable, and doesn't exist on BSD
AC_TRY_COMPILE([#include <sys/ipc.h> #include <sys/shm.h>], [
  int flag = IPC_INFO; ],
  AC_DEFINE([HAVE_IPC_INFO], [1], [Use ipc_info])
)

dnl --------------------------------------------------------
dnl Disable menus
dnl --------------------------------------------------------
dnl Don't add the GUI menu. Some educational systems think this adds
dnl clutter and confusion, like on the OLPC.
AC_ARG_ENABLE(menus,
  AC_HELP_STRING([--disable-menus],[Disable the GUI menus]),
[case "${enableval}" in
  yes) menus=yes ;;
  no)  menus=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-menus option]) ;;
esac],menus=yes)

if test x"$menus" = x"yes"; then
  AC_DEFINE([USE_MENUS], [], [GUI Menu support])
fi
AM_CONDITIONAL(MENUS, test x$menus = xyes)

dnl --------------------------------------------------------
dnl Disable SWF information
dnl --------------------------------------------------------
dnl Don't gather SWF information in tree form. This takes
dnl resources and memory that can be saved if there's no
dnl need to examine SWF internals.
AC_ARG_ENABLE(swftree,
  AC_HELP_STRING([--disable-swftree],[Disable showing SWF properties]),
[case "${enableval}" in
  yes) swftree=yes ;;
  no)  swftree=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-swf-properties option]) ;;
esac],swftree=yes)

if test x"$swftree" = x"yes"; then
  AC_DEFINE([USE_SWFTREE], [], [View SWF information])
fi
AM_CONDITIONAL(SWFTREE, test x$swftree = xyes)

dnl --------------------------------------------------------
dnl Disable testsuite
dnl --------------------------------------------------------
dnl Disable running any tests for "make check". This may sound stupid, but
dnl this option is designed to solely be used by maintainers in the 
dnl DISTCHECK_CONFIGURE_FLAGS when building packages. Gnash's testing infrastructure
dnl is complex, and often the the testsuites will work, but due to some obscure reason,
dnl make distcheck fails.
AC_ARG_ENABLE(testsuite,
  AC_HELP_STRING([--disable-testsuite],[Disable the testsuite, maintainers option only]),
[case "${enableval}" in
  yes) testsuite=yes ;;
  no)  testsuite=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-testsuite option]) ;;
esac],testsuite=yes)

if test x"$testsuite" = x"yes"; then
  AC_DEFINE([USE_TESTSUITE], [], [Testsuite support, maintainers option only])
fi
AM_CONDITIONAL(TESTSUITE, test x$testsuite = xyes)

dnl --------------------------------------------------------
dnl Write the file to disk in the plugin
dnl --------------------------------------------------------
AC_ARG_ENABLE(write,
  AC_HELP_STRING([--enable-write], [Makes the Mozilla plugin write the currently playing SWF movie to /tmp.]),
[case "${enableval}" in
  yes) write=yes ;;
  no)  write=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-write option]) ;;
esac],write=no)

if test x"$write" = x"yes"; then
  AC_DEFINE([WRITE_FILE], [], [Write files while streaming])
fi

dnl --------------------------------------------------------
dnl Write a standalone gnash launcher to disk from the plugin
dnl --------------------------------------------------------
AC_ARG_ENABLE(sa-launcher,
  AC_HELP_STRING([--disable-sa-launcher], [Drops support for the NPAPI plugin writing of standalone executable launcher scripts for the currently playing SWF movie to /tmp.]),
[case "${enableval}" in
  yes) sa_launcher=yes ;;
  no)  sa_launcher=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-sa-launcher option]) ;;
esac],sa_launcher=yes)

if test x"$sa_launcher" = x"yes"; then
  AC_DEFINE([CREATE_STANDALONE_GNASH_LAUNCHER], [], [Add support for writing a standalone executable launcher for movies embedded in web pages])
fi

dnl --------------------------------------------------------
dnl Build the cygnal server if specified.
dnl --------------------------------------------------------
AC_ARG_ENABLE(cygnal,
  AC_HELP_STRING([--enable-cygnal], [Enable building of the Cygnal server]),
[case "${enableval}" in
  yes) cygnal=yes ;;
  no)  cygnal=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for enable-cygnal option]) ;;
esac],cygnal=no)
AM_CONDITIONAL(CYGNAL, test x$cygnal = xyes)

dnl --------------------------------------------------------
dnl Build the cgibins server if specified.
dnl --------------------------------------------------------
AC_ARG_ENABLE(cgibins,
  AC_HELP_STRING([--enable-cgibins], [Enable building of the CGIs for Cygnal]),
[case "${enableval}" in
  yes) cgibin=yes ;;
  no)  cgibin=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for enable-cgibins option]) ;;
esac],cgibin=yes)
AM_CONDITIONAL(USE_CGI, test x$cgibin = xyes)
if test x"${cgibin}" = x"yes"; then
  AC_DEFINE([USE_CGIBIN], [1], [Enable cgi-bin processes for Cygnal])
fi

dnl --------------------------------------------------------
dnl  Double buffer
dnl --------------------------------------------------------
dnl Add an option for double buffering when rendering, currently only used by
dnl the frmaebuffer GUI.
dnl If defined, an internal software-buffer is used for rendering and is then
dnl copied to the video RAM. This avoids flicker and is faster for complex 
dnl graphics, as video RAM access is usually slower. (strongly suggested)
AC_ARG_ENABLE(doublebuf,
  AC_HELP_STRING([--disable-doublebuf], [Disble support for double buffering when rendering with AGG]),
  [case "${enableval}" in
    yes) doublebuf=yes ;;
    no)  doublebuf=no ;;
    *)   AC_MSG_ERROR([bad value ${enableval} for enable-doublebuf option]) ;;
  esac], doublebuf=yes
)
AM_CONDITIONAL(ENABLE_DBUF, [test x"$doublebuf" = xyes])
if test x$doublebuf = xyes; then
    AC_DEFINE(ENABLE_DOUBLE_BUFFERING, [1], [Disable double buffering for AGG])
fi

dnl --------------------------------------------------------
dnl  Offscreen buffer
dnl --------------------------------------------------------
dnl This enables rendering to an offscreen buffer, instead of directly to window
AC_ARG_ENABLE(offscreen,
  AC_HELP_STRING([--enable-offscreen], [Enable support for rendering offscreen]),
  [case "${enableval}" in
    yes) offscreen=yes ;;
    no)  offscreen=no ;;
    *)   AC_MSG_ERROR([bad value ${enableval} for enable-offscreen option]) ;;
  esac], offscreen=no
)


dnl --------------------------------------------------------
dnl  SSH support selection
dnl --------------------------------------------------------
dnl Enable using libssh with libnet
AC_ARG_ENABLE(ssh,
  AC_HELP_STRING([--enable-ssh], [Enable using SSH for network authentication]),
[case "${enableval}" in
  yes) build_ssh=yes ;;
  no)  build_ssh=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-ssh option]) ;;
esac], build_ssh=no)

AM_CONDITIONAL(BUILD_SSH, test x"${build_ssh}" = xyes)
if test x"${build_ssh}" = xyes; then
  GNASH_PKG_FIND(ssh, [libssh/libssh.h], [libssh library], ssh_socket_init)
dnl  GNASH_PKG_FIND(poppler, [popt.h], [Poppler library], poppler_init)
fi
if test x"${has_ssh}" = x"yes"; then
  AC_DEFINE([USE_SSH], [1], [Use SSH for authentication])
fi

dnl --------------------------------------------------------
dnl  SSL support selection
dnl --------------------------------------------------------

dnl Enable using OpenSSL with libnet.
AC_ARG_ENABLE(ssl,
  AC_HELP_STRING([--enable-ssl], [Enable using OpenSSL directly]),
[case "${enableval}" in
  yes) build_ssl=yes ;;
  no)  build_ssl=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-ssl option]) ;;
esac], build_ssl=no)

with_cert=
with_pem=
AM_CONDITIONAL(BUILD_SSL, test x"${build_ssl}" = xyes)
AC_ARG_WITH(cert,
  AC_HELP_STRING([--with-cert],
  [cert file for SSL]),
  with_cert=${withval})
AC_ARG_WITH(pem,
  AC_HELP_STRING([--with-pe],
  [pem file for SSL]),
  with_pem=${withval})

if test x"${build_ssl}" = xyes; then
  GNASH_PKG_FIND(ssl, [openssl/ssl.h], [OpenSSL library], SSL_library_init)
fi
if test x"${has_ssl}" = x"yes"; then
  AC_DEFINE([USE_SSL], [1], [Use SSL for authentication])
fi

dnl -----------------------------------------------------------
dnl Set the general plugins install policy here
dnl (NOTE: before GNASH_PATH_FIREFOX and GNASH_PATH_KDE*)
dnl -----------------------------------------------------------

AC_ARG_WITH(plugins-install,
  AC_HELP_STRING([--with-plugins-install=system|user|prefix], [Policy for plugins install. Default: user.]),
	[case "${withval}" in
	  user) PLUGINS_INSTALL_POLICY=user ;;
	  system) PLUGINS_INSTALL_POLICY=system ;;
	  prefix) PLUGINS_INSTALL_POLICY=prefix ;;
	  *)  AC_MSG_ERROR([bad value ${withval} for --with-plugins-install]) ;;
	 esac 
	], PLUGINS_INSTALL_POLICY=user) 

dnl -----------------------------------------------------------
dnl   Verify dependencies for requested GUIs are met, and
dnl   disable build of the GUIS for which deps are NOT met
dnl ------------------------------------------------------------

if test x$build_gtk = xyes; then
   GNASH_PATH_GTK2
   GNASH_PATH_PANGO
   GNASH_PKG_FIND(atk, [atk/atk.h], [atk library], atk_focus_tracker_init, [1.0])
   if test x"${build_ogl}" = xyes; then
      GNASH_PATH_GLEXT
   fi
   if test x"${build_cairo}" = xyes; then
      GNASH_PKG_FIND(cairo, [cairo.h], [cairo render library], cairo_status)
   fi
fi

if test x"${build_qt4}" != xno; then
 GNASH_PATH_QT4
fi

if test x"${build_qt4}" = xauto; then
  if test x"${has_qt4}" = xyes; then
     build_qt4=yes
  else
     build_qt4=no
  fi
fi

if test x"${build_kde3}" != xno -o x"${build_qtopia3}" != xno; then
 GNASH_PATH_QT3
fi

if test x"${build_kde3}" != xno; then
  GNASH_PATH_KDE3
fi


if test x"${build_kde3}" = xauto; then
  if test x"${has_qt3}" = xyes -a x"${has_kde3}" = xyes; then
     build_kde3=yes
  else
     build_kde3=no
  fi
fi

dnl Check possibility to build DUMP gui, if requested
if test x"${build_dump}" != xno; then
  if test x"${build_agg}" = xyes; then
    build_dump=yes
  else
    if test x"${build_dump}" = xyes; then
      dnl SHOULD we just check at the end of file instead ?
      AC_MSG_ERROR(dump GUI cannot be built without AGG renderer);
    fi
    build_dump=no
  fi
fi

dnl Check possibility to build FB gui, if requested
dnl FB dependency is a linux system (linux/fb.h)
if test x"${build_fb}" != xno; then
  if test x"${linux}" = xyes -o x"${android}" = xyes; then
      build_fb=yes
  else
    if test x"${build_fb}" = xyes; then
      dnl SHOULD we just check at the end of file instead ?
      AC_MSG_ERROR(framebuffer GUI cannot be built on non-linux platforms);
    fi
    AC_MSG_NOTICE([framebuffer GUI won't be built (non-linux platform)])
    build_fb=no
  fi
fi

dnl TODO: add checks for all other GUIs

dnl -------------------------------
dnl Input Device selection
dnl -------------------------------

dnl Multiple input devices are supported. These can all work in
dnl varying combinations, so several may be listed. These are only
dnl required when using the Framebuffer, as without the X11 desktop,
dnl Gnash has to handle all these internally. This can get
dnl messy, as one might want to use a touchscreen with a normal mouse
dnl or keyboard attached. 
dnl By default, don't build any of these, as they are only for the Framebuffer
dnl running without X11.
if test x"${build_fb}" = xyes; then
  build_ps2mouse=no
  build_ps2keyboard=yes
  build_input_events=yes
  build_tslib=yes
  input_events="Input Devices, Touchscreen via Tslib"
else
  build_ps2mouse=no
  build_ps2keyboard=no
  build_input_events=no
  build_tslib=no
  input_events=
fi
AC_ARG_ENABLE(input,
  AC_HELP_STRING([--enable-input], [Enable support for the specified input devices for the framebuffer GUI (default=ps2mouse|ps2keyboard|events|touchscreen)]),
  [if test -n ${enableval}; then
    enableval=`echo ${enableval} | tr '\054' ' ' `
  fi
  while test -n "${enableval}" ; do
    val=`echo ${enableval} | cut -d ' ' -f 1`
    case "${val}" in
      ps2m*|PS2m*|m*|M*)        dnl a PS/2 style mouse
        build_ps2mouse=yes
        input_events="${input_events}, PS/2 Mouse"
        ;;
      ps2k*|PS2K*|k*|K*)        dnl a PS/2 style keyboard
        build_ps2keyboard=yes
        input_events="${input_events}, PS/2 Keyboard"
        ;;
      i*|I*|ev*|Ev*)    dnl use the new Input Event, which supports both
        input_events="${input_events}, Input Event Device"
        build_input_events=yes
        ;;
      t*|T*) dnl use a touchscreen with tslib, which works like a mouse
        build_tslib=yes
        input_events="${input_events}, Touchscreen"
        ;;
      *) AC_MSG_ERROR([invalid input device list! ${enableval} given (accept: ps2mouse|keyboard|events,touchscreen)])
         ;;
      esac
    enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
    if test "x$val" = "x$enableval"; then
      break;
    fi
  done],
)

if test x"${build_tslib}" = xyes; then
  AC_DEFINE(USE_TSLIB, [1], [Use a tslib supported touchscreen])
  GNASH_PKG_FIND(ts, [tslib.h], [Touchscreen library], ts_config)
fi
AM_CONDITIONAL(ENABLE_TSLIB, [test x${ac_cv_header_tslib_h} != xno])

if test x"${build_ps2mouse}" = xyes; then
  AC_DEFINE(USE_MOUSE_PS2, [1], [Add support for a directly using a PS/2 Mouse])
fi
AM_CONDITIONAL(ENABLE_MOUSE, [test x"${build_ps2mouse}" = xyes])

if test x"${build_ps2keyboard}" = xyes; then
  AC_DEFINE(USE_KEYBOARD_PS2, [1], [Add support for directly using a PS/2 Keyboard])
fi
if test x"${build_input_events}" = xyes; then
  AC_DEFINE(USE_INPUT_EVENTS, [1], [Add support for a directly using Linux Input Event Devices])
fi
AM_CONDITIONAL(ENABLE_INPUT_EVENTS, [test x"${build_input_events}" = xyes])
dnl this is enabled if we have any input devices at all
AM_CONDITIONAL(ENABLE_INPUT_DEVICES, [test x"${input_events}" != x])


dnl -----------------------------------------------------------
dnl Try to ignore stupid dependencies
dnl -----------------------------------------------------------

AC_MSG_CHECKING(linker --as-needed support)
gcc_cv_ld_as_needed=no
# Check if linker supports --as-needed and --no-as-needed options
if $LD --help 2>/dev/null | grep as-needed > /dev/null; then
  gcc_cv_ld_as_needed=yes
fi
if test x"$gcc_cv_ld_as_needed" = xyes; then
  LDFLAGS="$LDFLAGS -Wl,--as-needed"
fi
AC_MSG_RESULT($gcc_cv_ld_as_needed)

AC_DEFINE(USE_GIF, [1], [Use the GIF library])
AC_DEFINE(USE_PNG, [1], [Use the PNG library])
AM_CONDITIONAL(USE_GIF, true)
AM_CONDITIONAL(USE_PNG, true)

AC_PATH_TOOL([AUTOTRACE], [autotrace])
AC_HEADER_DIRENT

dnl -----------------------------------------------------------------
dnl PLUGIN RELATED STUFF
dnl -----------------------------------------------------------------

dnl !! This has been moved here to make --enable-npapi work
dnl !! All of plugin-related macro calls could be moved into
dnl !! a specialized macros/plugin.m4

dnl ----------------------------------------------------
dnl Add KPARTS support, if specified or KDE gui is built
dnl ----------------------------------------------------

AC_ARG_ENABLE(kparts3,
  AC_HELP_STRING([--disable-kparts3], [Disable support for Konqueror 3.x plugin (default: enabled if kde3 gui is)]),
[case "${enableval}" in
  yes) build_kparts3=yes ;;
  no)  build_kparts3=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kparts3 option]) ;;
esac],build_kparts3=$build_kde3)

dnl --------------------------------------------------------
dnl Add KPARTS 4.x support, if specified or KDE gui is built
dnl --------------------------------------------------------

AC_ARG_ENABLE(kparts4,
  AC_HELP_STRING([--disable-kparts4], [Disable support for Konqueror 4.x plugin (default: enabled if Qt4 gui is)]),
[case "${enableval}" in
  yes) build_kparts4=yes ;;
  no)  build_kparts4=no ;;
  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kparts4 option]) ;;
esac],build_kparts4=$build_qt4)

if test x"${build_kparts4}" != xno; then
  GNASH_PATH_KDE4
fi

dnl -----------------------------------------------------------
dnl Add NPAPI support, if specified or GTK or Qt4 gui is built
dnl -----------------------------------------------------------

AC_ARG_ENABLE(npapi,
  AC_HELP_STRING([--disable-npapi], [Disable NPAPI plugin build (default: enabled if gtk or Qt4 gui is)]),
  [case "${enableval}" in
    yes) npapi=yes ;;
    no)  npapi=no ;;
    *)   AC_MSG_ERROR([bad value ${enableval} for disable-npapi option]) ;;
  esac],
  if test x$build_gtk = xyes -o x$build_qt4 = xyes; then
    npapi=yes
  fi
)

if test x"$npapi" = x"yes"; then
  GNASH_PATH_NPAPI
fi

dnl -----------------------------------------------------------------
dnl Enable us to disable building all browser plugins in one command.
dnl -----------------------------------------------------------------

AC_ARG_ENABLE(plugins,
  AC_HELP_STRING([--disable-plugins], [Disable all browser plugins from building (default=no)]),
  [case "${enableval}" in
    yes) plugins=yes ;;
    no)  plugins=no ;;
    *)   AC_MSG_ERROR([bad value ${enableval} for disable-plugins option]) ;;
  esac],
  plugins=yes
)
if test x$plugins = xno; then
  npapi=no
  build_kparts3=no
  build_kparts4=no
fi


GNASH_PATH_FIREFOX

dnl 
dnl New versions of the NPAPI require const for this prototype, which currently
dnl seems to only be wit Ubuntu Oneiric.
AC_MSG_CHECKING([for const needed for NPP_GetMIMEDescription() prototype])
npapi_flags="`echo "${NPAPI_CFLAGS}" | sed -e 's/-I//' -e 's/-DXP_UNIX//' | tr -d ' '`/npapi.h"
const_test="`grep NPP_GetMIMEDescription ${npapi_flags} | grep -c const`"
if test ${const_test} -eq 1; then
  AC_DEFINE(NPAPI_CONST, [1], [Newer versions use const in prototypes])
  AC_MSG_RESULT([yes])
else
  AC_MSG_RESULT([no])
fi

AC_TRY_COMPILE([#include <linux/input.h>], [
  struct input_absinfo abs;
  abs.resolution = 0;; ],
 AC_DEFINE([ABSINFO_RESOLUTION], [1], [ABS Resolution field])
)

dnl -----------------------------------------------------------------
dnl END OF PLUGIN RELATED STUFF
dnl -----------------------------------------------------------------

AM_CONDITIONAL(LIRC, [test x$lirc_ext = xyes])

AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(libgen.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(linux/uinput.h, [uinput=yes], [uinput=no])
AC_CHECK_LIB(bz2, BZ2_bzopen, [AC_SUBST(BZ2_LIBS, -lbz2)])
AC_CHECK_LIB(c, getpwnam, AC_DEFINE(HAVE_GETPWNAM, 1, [Has getpwnam] ))

AM_CONDITIONAL(HAS_UINPUT, [test x$uinput = xyes])

dnl X11 is needed for fltk (at least),
dnl and probably for many other guis too ...
dnl if ! test x$build_fb = xyes; then # <--- this is wrong as build_x is non-exclusive
dnl AC_PATH_XTRA
dnl AC_CHECK_LIB(Xmu, XmuCvtStringToOrientation)
dnl AC_CHECK_LIB(gmp, _gmp_get_memory_functions)
GNASH_PATH_X11
dnl fi
AM_CONDITIONAL(HAVE_X11, [test x${has_x11} = xyes])
if test x${build_x11_device} = xyes -a  x${has_x11} = xyes; then
  AC_DEFINE(BUILD_X11_DEVICE, [1], [Build the X11 device])
fi

dnl See if ipc_perm structure has the ipc_perm.key field, and if so,
dnl which variant of the name is used.
ipc_key=no
AC_TRY_COMPILE([
  #include <sys/ipc.h>
  #include <sys/shm.h>], [
 struct shmid_ds shmseg;      
 key_t x = shmseg.shm_perm.key;],
 ipc_key=yes
 AC_DEFINE(IPC_PERM_KEY, [key], [Has the key field in ipc_perm])
)

if test x$ipc_key = xno; then
  AC_TRY_COMPILE([
    #include <sys/ipc.h>
    #include <sys/shm.h>], [
    struct shmid_ds shmseg;      
    key_t x = shmseg.shm_perm.__key;],
    AC_DEFINE(IPC_PERM_KEY, [__key], [Has the key field in ipc_perm])
    ipc_key=yes
  )
fi

dnl If sysv semaphores functs are stubs (e.g. on Hurd),
dnl disable LocalConnection tests
AC_CHECK_FUNCS(semget, semget=yes)
AM_CONDITIONAL(HAVE_SEMGET, test x${semget} = xyes)

AC_CACHE_CHECK([for finite], ac_cv_finite,
 [AC_TRY_COMPILE([
   #include <math.h>
   #ifdef HAVE_IEEEFP_H
   #include <ieeefp.h>
   #endif],
 [double x; int y; y = finite(x);],
 ac_cv_finite=yes,
 ac_cv_finite=no
)])
if test x"$ac_cv_finite" = x"yes"; then
  AC_SEARCH_LIBS(finite, m,
    [AC_DEFINE(HAVE_FINITE, [1], [Has finite])]
  )
fi

AC_LANG_PUSH(C++)
AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
 [AC_TRY_COMPILE([#include <cmath>],
 [using namespace std; double x; int y; y = isfinite(x);],
 ac_cv_isfinite=yes,
 ac_cv_isfinite=no
)])
AC_LANG_POP(C++)
if test x"$ac_cv_isfinite" = x"yes"; then
  dnl Don't give up if isfinite is not found in -lm
  dnl isfinite is defined as a macro in C99.
  AC_SEARCH_LIBS(isfinite, m)
  AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
fi

AC_LANG_PUSH(C++)
AC_CACHE_CHECK([whether $CXX implements __PRETTY_FUNCTION__], ac_cv_implements___PRETTY_FUNCTION__, [
  AC_TRY_LINK([#include <cstdio>
], 
    [ std::printf("%s", __PRETTY_FUNCTION__); ], 
    [ ac_cv_implements___PRETTY_FUNCTION__="yes" ],
    [ ac_cv_implements___PRETTY_FUNCTION__="no" ]
  )
])
if test "x$ac_cv_implements___PRETTY_FUNCTION__" = "xyes" ; then
  AC_DEFINE(HAVE_PRETTY_FUNCTION, [1], [__PRETTY_FUNCTION__ is defined])
fi

AC_CACHE_CHECK([whether $CXX implements __FUNCTION__], ac_cv_implements___FUNCTION__, [
  AC_TRY_LINK([#include <cstdio>
], 
    [ std::printf("%s", __FUNCTION__); ], 
    [ ac_cv_implements___FUNCTION__="yes" ],
    [ ac_cv_implements___FUNCTION__="no" ]
  )
])
if test "x$ac_cv_implements___FUNCTION__" = "xyes" ; then
  AC_DEFINE(HAVE_FUNCTION, [1], [__FUNCTION__ is defined])
fi

AC_CACHE_CHECK([whether $CXX implements __func__], ac_cv_implements___func__, [
  AC_TRY_LINK([#include <cstdio>
], 
    [ std::printf("%s", __func__); ], 
    [ ac_cv_implements___func__="yes" ],
    [ ac_cv_implements___func__="no" ]
  )
])
if test "x$ac_cv_implements___func__" = "xyes" ; then
  AC_DEFINE(HAVE_func, [1], [__func__ is defined])
fi
AC_LANG_POP(C++)
AC_REPLACE_FUNCS(getopt)

dnl Date portability stuff, used in server/asobj/Date.cpp
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_FUNCS(ftime)
AC_CHECK_FUNCS(tzset)
AC_CHECK_FUNCS(localtime_r)

AC_CACHE_CHECK([whether struct tm has tm_gmtoff], ac_cv_tm_gmtoff, [
        AC_TRY_LINK([
/* ctime(1) says "The glibc version of struct tm has additional fields
 * defined  when _BSD_SOURCE was set before including <time.h>"
 * In practice, you do not need to define it yourself (tested on glibc-2.2.1 
 * and 2.3.6) but if you *do* define it yourself, it makes *all* functions
 * favour BSD-like behaviour over of GNU/POSIX, which seems dangerous.
 */
// #define _BSD_SOURCE 1
#include <time.h>
], 
                [ struct tm tm; long l = tm.tm_gmtoff; ], 
                [ ac_cv_tm_gmtoff="yes" ],
                [ ac_cv_tm_gmtoff="no" ]
        )
])
if test "x$ac_cv_tm_gmtoff" = "xyes" ; then
        AC_DEFINE(HAVE_TM_GMTOFF, [1], [struct tm has member tm_gmtoff])
fi

AC_CACHE_CHECK([whether timezone is a long], ac_cv_long_timezone, [
        AC_TRY_LINK([
/* On Linux/glibc, tzset(3) says "extern long timezone;" (seconds West of GMT)
 * but on BSD char *timezone(int,int) is a function returning a string name.
 * The BSD function timegm() may be the equivalent, but this should
 * not be necessary because on BSD the code should use tm.tm_gmtoff instead
 * (use of long timezone is a fallback strategy for when tm_gmtoff exists not).
 */
#include <stdio.h>
#include <time.h>
extern long timezone;
  ], 
    [ printf("%ld", timezone); ], 
    [ ac_cv_long_timezone="yes" ],
    [ ac_cv_long_timezone="no" ]
   )
])
if test "x$ac_cv_long_timezone" = "xyes" ; then
  AC_DEFINE(HAVE_LONG_TIMEZONE, [1], [extern timezone is a long integer, not a function])
fi

AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(shmget shmat shmdt mmap)
AC_CHECK_FUNCS(scandir)         dnl supported by BSD and Linux, but you never know...
AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_FUNC(clock_gettime, AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Has clock_gettime()] ))
dnl Look for Win32 networking stuff
AC_CHECK_HEADERS(winsock.h)
AC_CHECK_HEADERS(winsock2.h)

GNASH_PKG_FIND(nspr, [nspr.h], [Netscape Portable Runtime (NSPR)], PR_Init)

AC_PATH_TOOL(WINDRES, [windres])
AC_SUBST(WINDRES)

GNASH_PKG_FIND(z, [zlib.h], [zlib compression library], compress)
GNASH_PKG_FIND(jpeg, [jpeglib.h], [jpeg images], jpeg_mem_init)
GNASH_PKG_FIND(png, [png.h], [png images], png_info_init)
GNASH_PKG_FIND(gif, [gif_lib.h], [gif images], DGifOpen)
if test x"${GIF_LIBS}" = x ; then
 GNASH_PKG_FIND(ungif, [gif_lib.h], [gif images], DGifOpen)
 GIF_LIBS=${UNGIF_LIBS}
 GIF_CFLAGS=${UNGIF_CFLAGS}
fi
if test x"$testsuite" = x"yes"; then
  GNASH_PKG_INCLUDES([dejagnu], [dejagnu.h])
fi

GNASH_PKG_FIND(speex, [speex/speex.h], [speex audio codec], speex_decode_int)
AM_CONDITIONAL(HAVE_SPEEX, [ test x$has_speex = xyes ])
if test x$has_speex = xyes ; then
  AC_DEFINE([DECODING_SPEEX], [1], [Speex codec available])
fi

GNASH_PKG_FIND(speexdsp, [speex/speex_resampler.h], [speex DSP utilities], speex_resampler_process_int)
if test x$has_speexdsp = xyes ; then
  AC_DEFINE([RESAMPLING_SPEEX], [1], [Speex resampler available])
fi

dnl Find freetype and fontconfig
GNASH_PATH_FREETYPE2
GNASH_PKG_FIND(fontconfig, [fontconfig/fontconfig.h], [fontconfig library], FcFontMatch)

GNASH_PATH_CURL

if test x$cross_compiling = xno; then
  AC_PATH_MING
fi

if test x"$MING_VERSION_CODE" = x; then
 MING_VERSION_CODE=00000000
fi

AM_CONDITIONAL(ENABLE_MING,
	[ test x"$MAKESWF" != x -a $MING_VERSION_CODE -gt 00040000 ])

AM_CONDITIONAL(MING_VERSION_0_4,
        [ test $MING_VERSION_CODE -ge 00040000  ])
AM_CONDITIONAL(MAKESWF_SUPPORTS_PREBUILT_CLIPS,
        [ test $MING_VERSION_CODE -ge 00040002  ])
AM_CONDITIONAL(MING_SUPPORTS_INIT_ACTIONS,
        [ test $MING_VERSION_CODE -ge 00040004  ])
AM_CONDITIONAL(MING_SUPPORTS_REPLACE_TAG,
        [ test $MING_VERSION_CODE -ge 00040005 ])
AM_CONDITIONAL(MING_SUPPORTS_SWFBUTTON_ADD_CHARACTER,
        [ test $MING_VERSION_CODE -ge 00040005 ])
AM_CONDITIONAL(MING_SUPPORTS_STREAMING_SOUND,
        [ test $MING_VERSION_CODE -ge 00040006 ])
AM_CONDITIONAL(MING_SUPPORTS_SWFBUTTON_SET_DEPTH,
        [ test $MING_VERSION_CODE -ge 00040006 ])
AM_CONDITIONAL(MING_VERSION_0_4_3,
        [ test $MING_VERSION_CODE -ge 00040300 ])
AM_CONDITIONAL(MING_VERSION_0_4_4,
        [ test $MING_VERSION_CODE -ge 00040400 ])

if test x$cross_compiling = xno; then
    AC_ARG_WITH([swfdec_testsuite],
        AC_HELP_STRING([--with-swfdec-testsuite],
            [directory where swfdec testsuite (the 'test' dir) is]),
        if test x"${withval}" = xyes; then
            dir=`dirname $0`
            dir=`cd ${dir} && pwd`
            withval="${dir}/testsuite/swfdec/src/test"
        fi
        SWFDEC_TESTSUITE=${withval}
    )
    AC_SUBST(SWFDEC_TESTSUITE)
fi
AM_CONDITIONAL(ENABLE_SWFDEC_TESTSUITE, [ test x"$SWFDEC_TESTSUITE" != x ])

if test x$cross_compiling = xno; then
  AC_ARG_ENABLE([http_testsuite],
      AC_HELP_STRING([--enable-http-testsuite@<:@=URL@:>@],
          [Enable http based testsuite (default url is http://www.gnashdev.org/testcases)]),
          [case "${enableval}" in
             no) HTTP_TESTSUITE="" ;;
            yes) HTTP_TESTSUITE="http://www.gnashdev.org/testcases" ;;
              *) HTTP_TESTSUITE="${enableval}";;
           esac])
  AC_SUBST(HTTP_TESTSUITE)
fi
AM_CONDITIONAL(ENABLE_HTTP_TESTSUITE, [ test x"$HTTP_TESTSUITE" != x ])

if test x$cross_compiling = xno; then
  AC_ARG_ENABLE([red5_testing],
      AC_HELP_STRING([--enable-red5-testing@<:@=HOST@:>@],
          [Enable red5 based testing (default host is www.gnashdev.org)]),
          [case "${enableval}" in
             no) RED5_HOST="" ;;
            yes) RED5_HOST="www.gnashdev.org" ;;
              *) RED5_HOST="${enableval}";;
           esac
               if test x"$RED5_HOST" != x -a x"$curl_rtmp_support" != x; then
                 RED5_TESTING=yes
             fi])
  AC_SUBST(RED5_HOST)
fi
AM_CONDITIONAL(ENABLE_RED5_TESTING, [ test x"$RED5_TESTING" != x ])

if test x$cross_compiling = xno; then
  AC_ARG_ENABLE([rtmpy_testing],
      AC_HELP_STRING([--enable-rtmpy-testing@<:@=HOST@:>@],
          [Enable rtmpy based testing (default host is www.gnashdev.org)]),
          [case "${enableval}" in
             no) RTMPY_HOST="" ;;
            yes) RTMPY_HOST="www.gnashdev.org" ;;
              *) RTMPY_HOST="${enableval}";;
           esac])
  AC_SUBST(RTMPY_HOST)
fi
AM_CONDITIONAL(ENABLE_RTMPY_TESTING, [ test x"$RTMPY_HOST" != x ])

dnl The name might differ between systems.
if test x"$testsuite" = x"yes"; then
AC_PATH_PROGS(NETCAT, [nc netcat])
AC_PATH_PROG(WGET, wget)
fi
AM_CONDITIONAL(HAS_NETCAT, [ test x"$NETCAT" != x ])
AM_CONDITIONAL(HAS_WGET, [ test x"$WGET" != x ])

dnl
dnl See if we can use the swfmill, mtasc, swfc and haxe based testsuites 
dnl
if test x"$testsuite" = x"yes" -a x$cross_compiling = xno; then
  AC_PATH_PROG(AS3COMPILE, as3compile)
  AC_PATH_PROG(SWFC, swfc)
  AC_PATH_SWFMILL
  AC_PATH_MTASC
  AC_PATH_HAXE
fi

AM_CONDITIONAL(ENABLE_SWFMILL, [ test x"$SWFMILL" != x ])
AM_CONDITIONAL(SWFMILL_AS3_SUPPORT,
        [ test x"$SWFMILL" != x && test $SWFMILL_VERSION -ge 00021206 ])

dnl SWFMILL versions older than 0.3 didn't get function2 flags order correctly
AM_CONDITIONAL(SWFMILL_FUNCTION2_FLAGS_ORDER_CORRECT,
        [ test x"$SWFMILL" != x && test $SWFMILL_VERSION -ge 00021206 ])

AM_CONDITIONAL(ENABLE_AS3COMPILE, [ test x"$AS3COMPILE" != x ])
AM_CONDITIONAL(ENABLE_MTASC, [ test x"$MTASC" != x ])
AM_CONDITIONAL(ENABLE_HAXE, [ test x"$HAXE" != x ])
AM_CONDITIONAL(ENABLE_SWFC, [ test x"$SWFC" != x ])
AM_CONDITIONAL(ENABLE_HAXE, [ test x"$HAXE" != x ])

AC_PATH_PROG(DOXYGEN, doxygen)
AM_CONDITIONAL(ENABLE_DOXYGEN, [ test x"$DOXYGEN" != x ])

AM_CONDITIONAL(HAVE_KDE3,    [test x$has_kde3 = xyes])
AM_CONDITIONAL(HAVE_KDE4,    [test x$has_kde4 = xyes])
AM_CONDITIONAL(HAVE_QT3,     [test x$has_qt3 = xyes])
AM_CONDITIONAL(HAVE_QT4,     [test x$has_qt4 = xyes])

AM_CONDITIONAL([QT_X11],     [test "$platform" = "X11"])
AM_CONDITIONAL([QTOPIA],     [test "$platform" = "Qtopia"])
AM_CONDITIONAL([QT_OSX],     [test "$platform" = "OSX"])
AM_CONDITIONAL([QT_OS9],     [test "$platform" = "OS9"])
AM_CONDITIONAL([QT_WIN32],   [test "$platform" = "Win32"])

dnl Need GLIB for both GTK and GST
if test x"${build_gtk}" = xyes -o x"${build_media_gst}" = xyes; then
  GNASH_PATH_GLIB
fi

AM_CONDITIONAL(HAVE_GLIB, [ test x"${has_glib}" = xyes ])

if test x$npapi = xyes; then
  if ! test x$build_gtk = xyes -o x$build_qt4 = xyes; then
    AC_MSG_WARN(["Enabled NPAPI plugin, but it's not supported by the selected GUI"])
  fi
fi

if test x$windows = xyes -a x$npapi = xyes; then
  if test "x$NSPR_CFLAGS" = x -a "x$NSPR_LIBS" = x; then
    AC_MSG_ERROR(["On Win32, NPAPI plugin requires NSPR."])
  fi
  if test "x$WINDRES" = x; then
    AC_MSG_ERROR(["On Win32, NPAPI plugin requires windres."])
  fi
fi

dnl Need GLIB for NPAPI plugin
if test x$npapi = xyes; then
  GNASH_PATH_GLIB
fi

dnl if kde isn't installed, even if it's specified, don't try to build
dnl the KPARTS plugin, which is KDE based.
if test x$has_kde3 = xno -a x$build_kparts3 = xyes; then
  build_kparts3=no
  AC_MSG_WARN(["Disabling KPARTS 3.x plugin, no KDE development found"])
fi

if test x$build_kde3 = xno -a x$build_kparts3 = xyes; then
  AC_MSG_WARN(["Enabled KPARTS 3.x plugin, but you aren't building a KDE based GUI!"])
fi
if test x$has_kde4 = xno -a x$build_kparts4 = xyes; then
  build_kparts4=no
  AC_MSG_WARN(["Disabling KPARTS 4.x plugin, no KDE 4.x development found"])
fi

if test x$build_qt4 = xno -a x$kparts4 = xyes; then
  AC_MSG_WARN(["Enabled KPARTS 4.x plugin, but you aren't building a KDE 4.x based GUI!"])
fi

AM_CONDITIONAL(BUILD_QTOPIA3_GUI,  [ test x$build_qtopia3 = xyes ])
AM_CONDITIONAL(BUILD_QTOPIA4_GUI,  [ test x$build_qtopia4 = xyes ])

AM_CONDITIONAL(BUILD_KDE3_GUI,     [ test x$build_kde3 = xyes ])
AM_CONDITIONAL(BUILD_QT4_GUI,     [ test x$build_qt4 = xyes ])

AM_CONDITIONAL(BUILD_GTK_GUI,      [ test x$build_gtk = xyes ])
AM_CONDITIONAL(BUILD_FLTK_GUI,     [ test x$build_fltk = xyes ])
AM_CONDITIONAL(BUILD_SDL_GUI,      [ test x$build_sdl = xyes ])
AM_CONDITIONAL(BUILD_FB_GUI,       [ test x$build_fb = xyes ])
AM_CONDITIONAL(BUILD_AQUA_GUI,     [ test x$build_aqua = xyes ])
AM_CONDITIONAL(BUILD_DUMP_GUI,     [ test x$build_dump = xyes ])
AM_CONDITIONAL(BUILD_AMIGAOS4_GUI, [ test x$build_aos4 = xyes ])
AM_CONDITIONAL(BUILD_HAIKU_GUI,    [ test x$build_haiku = xyes ])

# plugin building flags
AM_CONDITIONAL(NPAPI,   [test x"${npapi}" = xyes])
AM_CONDITIONAL(KPARTS3, [test x"${build_kparts3}" = xyes])
AM_CONDITIONAL(KPARTS4, [test x"${build_kparts4}" = xyes])

if test x"${build_gles1}"; then
  GNASH_PATH_GLES
fi

dnl only Linux supports /dev/fb0
if test x"${build_rawfb_device}" = xyes; then
   AC_DEFINE([BUILD_RAWFB_DEVICE], [1], [Use raw Framebuffer device support])
fi

if test x"${build_directfb_device}" = xyes; then
   GNASH_PKG_FIND(directfb, [directfb.h], [DirectFB render library], DirectFBCreate)
   AC_DEFINE([BUILD_DIRECTFB_DEVICE], [1], [Use DirectFB device support])
fi

AM_CONDITIONAL(BUILD_VAAPI_DEVICE, [test x"${use_libva}" = xyes])
AM_CONDITIONAL(BUILD_EGL_DEVICE, [test x"${build_egl_device}" = xyes])
AM_CONDITIONAL(BUILD_DIRECTFB_DEVICE, [ test x${build_directfb_device} = xyes])
AM_CONDITIONAL(BUILD_RAWFB_DEVICE, [ test x${build_rawfb_device} = xyes])
AM_CONDITIONAL(BUILD_X11_DEVICE, [test x${build_x11_device} = xyes])

if test x"${build_gtk}" = xyes; then
  AC_ARG_ENABLE(ghelp,
    AC_HELP_STRING([--enable-ghelp], [Enable support for the GNOME help system]),
    [case "${enableval}" in
      yes) ghelp=yes ;;
      no)  ghelp=no ;;
      *)   AC_MSG_ERROR([bad value ${enableval} for enable-ghelp option]) ;;
    esac], ghelp=no
  )

  if test x"${ghelp}" = x"yes" ; then
    AC_PATH_PROG(SCROLLKEEPER, scrollkeeper-config, [], [$PATH:/usr/bin/X11:/usr/local/bin/X11:/opt/X11])
    AC_PATH_PROG(SCROLLUPDATE, scrollkeeper-update, [],	[$PATH:/usr/bin/X11:/usr/local/bin/X11:/opt/X11])
    AC_PATH_PROG(SCROLLINSTALL, scrollkeeper-preinstall, [], [$PATH:/usr/bin/X11:/usr/local/bin/X11:/opt/X11])

    if test x"$SCROLLKEEPER" = x -o x"$SCROLLUPDATE" = x -o x"$SCROLLINSTALL" = x ; then
      ghelp=no
      AC_MSG_WARN([You need to install scrollkeeper for gnome help])
    fi
  fi
fi
AM_CONDITIONAL(GHELP, [test x${ghelp} = xyes])

if test x${build_fltk} = xyes; then
  GNASH_PKG_FIND(Xft, [Xft.h], [xft library], XftGlyphRender)
fi

dnl Some systems have a pervered set of dependencies.
dnl Fedora Core 6 appears to have a dependency on expat for fontconfig.
dnl We only need the library, but this is the easy wind to find it.
GNASH_PKG_FIND(expat, [expat.h], [Expat library], XML_ErrorString)

dnl these conditionals were moved out of kde.m4
AM_CONDITIONAL(HAS_KDE3, [test x$has_kde3 = xyes])
# used to disable x11-specific stuff on special platforms
AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no")
AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no")
AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")

AM_CONDITIONAL(HAVE_GLEXT, [test x$glext = xyes])

dnl We don't have GTKGLExt, so default to SDL, and don't build the Firefox plugin
if test x$glext = xno -a x$build_ogl = xyes; then
  if test x$gtk2 = xyes -a x$build_gtk = xyes; then
    AC_ERROR([You have GTK installed, but not GtkGLExt. You need GtkGLExt to use the OpenGL renderer. Attempting to build SDL version])
  fi
  gui=sdl
  npapi=no
  AC_MSG_WARN([GTK2 specified for the GUI, but GtkGlExt is not present. Trying SDL instead.])
fi

missing_codecs=""
if test x"$build_media_gst" = "xyes"; then
  AC_PATH_PROG(GST_INSPECT, gst-inspect, ,[${pathlist}])
  if test "x$GST_INSPECT" != "x" -a x"${darwin}" = xno ; then
    AC_PATH_PROG(GST_INSPECT, gst-inspect-0.10, ,[${pathlist}])
  fi
  if test "x$GST_INSPECT" != "x" -a x"${darwin}" = xno ; then
    dnl FIXME: there may be multiple acceptable plugins that are acceptable for
    dnl our use. For example, mad or FFmpeg will play mp3.
    codecs="ffdec_flv ffdec_flashsv ffdec_vp6f ffdec_flashsv mad vorbisdec ffdec_vp6"
    for i in $codecs; do
       hits="`$GST_INSPECT $i | grep -c 'Long name'`"
       if test $hits -eq 0; then
         missing_codecs="$missing_codecs $i"
         AC_MSG_WARN([Missing codec: $i])
       fi
    done
  fi
  GNASH_PKG_FIND(gstreamer_plugins_base, [gst/interfaces/probeprobe.h], [gstreamer interfaces library], gst_property_probe_probe_and_get_values_name, [0.10])
  GNASH_PKG_FIND(gstreamer_app, [gst/app/gstappsink.h], [gstreamer app library], call_gmon_start, [0.10])
  GNASH_PKG_FIND(gstreamer, [gst/gst.h], [gstreamer library], gst_init, [0.10])
  dnl if cross compiling, we're usually not going to be able to pop up
  dnl the codec installer to download the package to install, so disable
  dnl it if cross compiling with gstreamer support.
  if test x$cross_compiling = xno; then
    GNASH_PKG_FIND(gstreamer_pbutils, [gst/pbutils/install-plugins.h], [gstreamer PB Utils library], gst_install_plugins_supported, [0.10])
  fi
  dnl when cross compiling Gstreamer, not all supplied SDKs include all the
  dnl development libraries since most devices don't need to support plugin
  dnl development, only the runtime. In these caes we often have the header
  dnl files but not the libraries.
  if test x"${has_gstreamer_plugins_base}" = xyes; then
    GSTREAMER_LIBS="-lgstinterfaces-0.10 $GSTREAMER_LIBS"
    AC_DEFINE(HAS_GSTREAMER_PLUGINS_BASE, [1], [Has the Gstreamer Plugin Dev package installed])
  fi
fi

AM_CONDITIONAL(HAVE_CAIRO, [true])
AM_CONDITIONAL(HAVE_OPENGL, [true])

AM_CONDITIONAL(USE_SOUND_SDL, test x$build_sound_sdl = xyes)
AM_CONDITIONAL(USE_SOUND_AHI, test x$build_sound_ahi = xyes)
AM_CONDITIONAL(USE_SOUND_MKIT, test x$build_sound_mkit = xyes)
AM_CONDITIONAL(USE_FFMPEG_ENGINE, test x"${build_media_ffmpeg}" = x"yes")
AM_CONDITIONAL(USE_GST_ENGINE, test x"${build_media_gst}" = x"yes")
AM_CONDITIONAL(HAVE_OPENGL, test x"${OPENGL_LIBS}" != x)
dnl for now the Haiku media handler is experimental
AM_CONDITIONAL(USE_HAIKU_ENGINE, test x"$build_media_haiku" = xyes)

if test x"${build_media_ffmpeg}" = x"yes"; then
  AC_DEFINE([ENABLE_FFMPEG_MEDIA],  [1], [Use FFmpeg for media decoding])
fi

if test x"${build_media_gst}" = x"yes"; then
  AC_DEFINE([ENABLE_GST_MEDIA],  [1], [Use gstreamer for media decoding])
fi

if test x"${build_media_haiku}" = x"yes"; then
  AC_DEFINE([ENABLE_HAIKU_MEDIA],  [1], [Use haiku for media decoding])
fi

if test x$build_sound_mkit = xyes; then
  if test x"${haiku}" != xyes; then
    AC_MSG_ERROR([Media Kit sound handling is supported only under Haiku]);
  else
    AC_DEFINE([SOUND_MKIT],  [1], [Use Haiku Media Kit for sound handling])
  fi
fi

if test x"${build_sound_sdl}" = xyes; then
  AC_DEFINE([SOUND_SDL],  [1], [Use SDL for sound handling])
fi

if test x"${build_sound_ahi}" = xyes; then
  if test x"$amigaos4" != xyes; then
    AC_MSG_ERROR([AHI sound handling is supported only under AmigaOS]);
  else
    AC_DEFINE([SOUND_AHI],  [1], [Use AmigaOS AHI for sound handling])
  fi
fi

if test x$build_fltk = xyes; then
  GNASH_PKG_FIND(fltk2, [fltk/FL_API.h], [Fast Light Toolkit], fl_window_flush)
  if test x"${has_fltk2}" = xyes; then
    AC_CHECK_LIB(Xi, XInput_find_display,
      [AC_SUBST(FLTK2_LIBS, "$FLTK2_LIBS -lXi")])
  fi
fi

AM_CONDITIONAL(HAVE_FLTK2, [ test x$has_fltk2 = xyes ])
AM_CONDITIONAL(HAS_XFT, [ test x$has_xft = xyes ])

GNASH_DOCBOOK
AM_CONDITIONAL(ENABLE_INFO, test x${INSTALL_INFO} != x)
AM_CONDITIONAL(DOCBOOK, test x$docbook = xyes)
AM_CONDITIONAL(ENABLE_TEXI, [ test x"$DB2X_TEXI" != x -o x"$DB2X_TEXIXML" != x ])
AM_CONDITIONAL(ENABLE_PDF, [ test x"$DB2X_PDF" ])
AM_CONDITIONAL(ENABLE_HTML, [ test x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
AM_CONDITIONAL(ENABLE_FOP, [ test x"$FOP" != x -a x"$docbook_styles" != x ])
AM_CONDITIONAL(ENABLE_XMLTEX, [ test x"$PDFXMLTEX" != x -a x"$XSLTPROC" != x -a x"$docbook_styles" != x ])
AM_CONDITIONAL(ENABLE_MAN, [ test x"$DB2X_MAN" != x -o x"$DB2X_MANXML" != x ])
AM_CONDITIONAL(HAVE_AGG, [test x"${AGG_LIBS}" != x])

dnl Define winsock if we're on windows. We could do something complicated,
dnl but since AC_EXEEXT does it for us, we'll do this the easy way.
if test x"$EXEEXT" = "exe"; then
  AC_DEFINE(HAVE_WINSOCK,1,[This is defined is we are on Win32])
fi

dnl ****************************************
dnl *** Check for ELF visibility support ***
dnl ****************************************

AC_ARG_ENABLE([visibility],
  AC_HELP_STRING([--enable-visibility], [Use ELF visibility attributes]), [], [enable_visibility=no])

if test x"$enable_visibility" != x"no"; then
  dnl Check whether the compiler supports the visibility attribute
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -Wall -Werror"
  AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
  AC_COMPILE_IFELSE([AC_LANG_SOURCE(
    [
      void __attribute__ ((visibility("default"))) test_default (void) {}
      void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
      int main (int argc, char **argv) { test_default (); test_hidden (); return 0; }
    ])],
    [
      AC_DEFINE([HAVE_GNUC_VISIBILITY], [1], [Define this for GCC-visibility.])
      AC_MSG_RESULT([yes])
    ],
    [
      AC_MSG_RESULT([no])
    ]
  )
  CFLAGS="$save_CFLAGS"
fi

AC_ARG_ENABLE([pch],
  AC_HELP_STRING([--enable-pch], [Enable precompiled header support]), [], [enable_pch=no])

AM_CONDITIONAL([ENABLE_PCH], [test x"$enable_pch" != x"no"])

PCH_FLAGS="-include all-includes.h -Winvalid-pch"
AC_SUBST(PCH_FLAGS)

GNASH_PATH_PTHREADS

GNASH_PATH_BOOST

AC_ARG_ENABLE([strict],
  AC_HELP_STRING([--enable-strict],[Accept only standards compliant code (GCC only)]),
  [case "${enableval}" in
    yes) strict=yes ;;
    no) strict=no ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-strict option]) ;;
  esac],
  [strict=no]
)

if test x"$strict" = x"yes" -a x$build_agg = xyes; then
   AC_MSG_ERROR([agg renderer will fail with --enable-strict.]);	
fi

# We want warnings, lots of warnings  :-)
# It should be possible to build with -ansi, not with
# -pedantic because of agg.
#
# -ansi was actually dropped because it hides 'fileno', which
# is used in a few places
#
if test x"$GCC" = x"yes"; then
  CXXFLAGS="$CXXFLAGS \
    $CROSS_CXXFLAGS \
    -W \
    -Wall \
    -Wcast-qual \
    -Wpointer-arith \
    -Wreturn-type \
    -Wnon-virtual-dtor \
    -Wunused \
    "
  CFLAGS="$CFLAGS \
    $CROSS_CXXFLAGS \
    -W \
    -Wall \
    -Wcast-align \
    -Wcast-qual \
    -Wpointer-arith \
    -Wreturn-type \
    -Wmissing-declarations \
    -Wmissing-prototypes \
    -Wstrict-prototypes \
    "
  if test x"$strict" = x"yes"; then
    CXXFLAGS="$CXXFLAGS \
      -Wextra \   
      -pedantic \
      -Wno-long-long \
      "

    CFLAGS="$CFLAGS \
      -pedantic \
      -Wno-long-long \
      -ansi \
      "
  fi
fi

AC_ARG_ENABLE([cassert],
  AC_HELP_STRING([--disable-cassert],[Disable assertion checking]),
  [case "${enableval}" in
    yes) cassert=yes ;;
    no) cassert=no ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-cassert option]) ;;
  esac],
  [cassert=yes]
)

if test x"$cassert" = x"no"; then
    CXXFLAGS="$CXXFLAGS \
      -DNDEBUG \
      "
    CFLAGS="$CFLAGS \
      -DNDEBUG \
      "
fi

dnl /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
AC_DEFUN([CHECK_VISIBILITY_GCC_BUG],
  [
    AC_CACHE_CHECK([if -fvisibility-inlines-hidden is broken], ac_cv_gcc_visibility_bug, [
        AC_LANG_PUSH(C++)
        save_CFLAGS=$CFLAGS
        save_CXXFLAGS=$CXXFLAGS
        save_LDFLAGS=$LDFLAGS
        CFLAGS="-fPIC -O0"
        CXXFLAGS="-fPIC -fvisibility-inlines-hidden -O0"
        LDFLAGS="$LDFLAGS -shared -fPIC"

        AC_TRY_LINK(
        [          
          template<typename CharT>
          struct VisTest
          {
            inline VisTest ();
          };
          template<typename CharT>
          inline VisTest<CharT>::VisTest()
        {}
        extern template class VisTest<char>;  // It works if we drop that line
        int some_function( int do_something ) __attribute__((visibility("default")));
	int some_function( int )
          {
            VisTest<char> a;
            return 0;
          }
        ], [],
        ac_cv_gcc_visibility_bug=no, ac_cv_gcc_visibility_bug=yes)

        CFLAGS=$save_CFLAGS
        CXXFLAGS=$save_CXXFLAGS
        LDFLAGS=$save_LDFLAGS
        AC_LANG_POP(C++)
      ]
    )
    if test x$ac_cv_gcc_visibility_bug = xno; then
      CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
    fi
  ]
)

CHECK_VISIBILITY_GCC_BUG

if test x$ac_cv_gcc_visibility_bug = xno; then
  AC_LANG_PUSH(C++)
  AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
  save_CXXFLAGS=$CXXFLAGS
  CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  AC_LINK_IFELSE([AC_LANG_PROGRAM()], 
                 [ac_cv_gcc_visibility=yes;
                  AC_MSG_RESULT([yes])],
                 [ac_cv_gcc_visibility=no;
                  AC_MSG_RESULT([no])]);
  CXXFLAGS="$save_CXXFLAGS"
  AC_LANG_POP(C++)
fi


AM_CONDITIONAL(VISIBILITY_WORKS, test x"$ac_cv_gcc_visibility" = xyes)

if test x"$ac_cv_gcc_visibility" = xyes -a x"$enable_visibility" != xno; then
  CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi

AC_ARG_ENABLE([harden],
  AC_HELP_STRING([--disable-harden],[Disable hardening]),
  [case "${enableval}" in
    yes) harden=yes ;;
    no)  harden=no ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-harden option]) ;;
  esac],
  [harden=yes]
)

if test x"$harden" = x"yes" -a x"${host_cpu}" != x"mips" -a x"${android}" != x"yes" -a x"$GCC" = x"yes"; then
    CPPFLAGS="${CPPFLAGS} -D_FORTIFY_SOURCE=2"
    CFLAGS="${CFLAGS} -fPIE -fstack-protector --param ssp-buffer-size=4 -Wformat -Werror=format-security"
    CXXFLAGS="${CXXFLAGS} -fPIE -fstack-protector --param ssp-buffer-size=4 -Wformat -Werror=format-security"

    if test x"$with_gnu_ld" = x"yes"; then
      LDFLAGS="${LDFLAGS} -fPIE -pie -Wl,-z,relro -Wl,-z,now"
    elif test x"$darwin" = x"yes"; then
      LDFLAGS="${LDFLAGS} -fPIE -pie"
    else
      LDFLAGS="${LDFLAGS}"
    fi
fi

dnl Define convenience constants so Gnash can print out the
dnl default configuration of the build.
RENDERER_CONFIG="${renderer_list}"
RENDERER_LIBS=
for rend in `echo "${add_renderer}" | tr ',' ' '`; do
	RENDERER_LIBS="${RENDERER_LIBS} \$(top_builddir)/librender/libgnash${rend}.la"
done
AC_SUBST(RENDERER_LIBS)
AC_SUBST(RENDERER_CONFIG)

HWACCEL_CONFIG="${device_list}"
AC_SUBST(HWACCEL_CONFIG)

dnl check for missing libraries and disable them.
if test x"$BOOST_LIBS" != x; then
  if test x"${cygnal_missing_libs}" != x; then
    for i in ${cygnal_missing_libs}; do
      if test $i = serialization; then
        AC_DEFINE([BOOST_MULTI_INDEX_DISABLE_SERIALIZATION], ["1"], [if the library is missing, don't use it.])
      fi
    done
  fi
fi

dnl ========= Check for GConf

AC_MSG_CHECKING([whether GConf support is requested])
AC_ARG_WITH([gconf],
  [AS_HELP_STRING([--without-gconf],
          [Disable the use of gconf])],
  [],
  [case "${host}" in
    *-cygwin* | *-mingw* | *-pw32*) with_gconf=no ;;
    *) with_gconf=yes ;;
   esac])
AC_MSG_RESULT([$with_gconf])

AM_CONDITIONAL([WITH_GCONF],[test "$with_gconf" = "yes"])

if test "$with_gconf" = "yes"; then
   PKG_CHECK_MODULES([GCONF],[gconf-2.0])
   AC_DEFINE([WITH_GCONF],[1],[Define if GConf support is enabled])

   AM_GCONF_SOURCE_2

   AC_PATH_PROG([GCONFTOOL], [gconftool-2], [false])
   if test "$GCONFTOOL" = "false"; then
      AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
   fi
else
   AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL],false)
fi


CYGNAL_PATHS

SUPPORTED_GUIS=
if test x$build_qtopia3 = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},qtopia3"
fi
if test x$build_qtopia4 = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},qtopia4"
fi
if test x$build_fb = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},fb"
fi
if test x$build_fltk = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},fltk"
fi
if test x$build_kde3 = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},kde3"
fi
if test x$build_qt4 = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},qt4"
fi
if test x$build_gtk = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},gtk"
fi
if test x$build_sdl = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},sdl"
fi
if test x$build_aqua = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},aqua"
fi
if test x$build_dump = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},dump"
fi
if test x$build_aos4 = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},aos4"
fi
if test x$build_haiku = xyes; then
  SUPPORTED_GUIS="${SUPPORTED_GUIS},haiku"
fi
SUPPORTED_GUIS="`echo ${SUPPORTED_GUIS} | sed 's/,//'`" # Strip leading comma
AC_SUBST(SUPPORTED_GUIS)

AC_CONFIG_LINKS(cygnal/testsuite/cygnal.all/cygnalrc:cygnal/testsuite/cygnal.all/cygnalrc.in)
AC_CONFIG_LINKS(testsuite/libbase.all/gnashrc:testsuite/libbase.all/gnashrc.in)
AC_CONFIG_LINKS(testsuite/libbase.all/gnashrc-local:testsuite/libbase.all/gnashrc-local.in)

AC_CONFIG_FILES(
gnash.pc:gnash.pc.in
desktop/gnash-gtk-launcher:desktop/gnash-gtk-launcher.in
desktop/gnash-qt-launcher:desktop/gnash-qt-launcher.in
)

AC_OUTPUT(Makefile
desktop/Makefile
po/Makefile
libmedia/Makefile
libsound/Makefile
libbase/Makefile
libcore/Makefile
libcore/vm/Makefile
libcore/parser/Makefile
librender/Makefile
utilities/Makefile
doc/Makefile
doc/C/Makefile
doc/Doxyfile
testsuite/Makefile
testsuite/media/Makefile
testsuite/libbase.all/Makefile
testsuite/as3compile.all/Makefile
testsuite/actionscript.all/Makefile
testsuite/samples/Makefile
testsuite/swfdec/Makefile
testsuite/misc-ming.all/Makefile
testsuite/misc-ming.all/action_order/Makefile
testsuite/misc-ming.all/sound/Makefile
testsuite/misc-ming.all/displaylist_depths/Makefile
testsuite/misc-ming.all/init_action/Makefile
testsuite/misc-ming.all/loop/Makefile
testsuite/misc-ming.all/loading/Makefile
testsuite/misc-ming.all/register_class/Makefile
testsuite/misc-mtasc.all/Makefile
testsuite/misc-haxe.all/Makefile
testsuite/misc-haxe.all/classes.all/Makefile
testsuite/misc-swfmill.all/Makefile
testsuite/misc-swfmill.all/trace-as2/Makefile
testsuite/misc-swfmill.all/trace-as3/Makefile
testsuite/misc-swfc.all/Makefile
testsuite/network.all/Makefile
testsuite/movies.all/Makefile
testsuite/libcore.all/Makefile
testsuite/libmedia.all/Makefile
gui/Makefile
gui/Info.plist
gui/pythonmod/Makefile
extensions/Makefile
extensions/dejagnu/Makefile
extensions/mysql/Makefile
extensions/fileio/Makefile
extensions/gtk2/Makefile
extensions/lirc/Makefile
extensions/dbus/Makefile
plugin/Makefile
plugin/npapi/Makefile
plugin/klash/Makefile
plugin/klash4/Makefile
plugin/win32/Makefile
plugin/aos4/Makefile
libdevice/Makefile
cygnal/Makefile
cygnal/libnet/Makefile
cygnal/libamf/Makefile
cygnal/cgi-bin/Makefile
cygnal/cgi-bin/echo/Makefile
cygnal/cgi-bin/oflaDemo/Makefile
cygnal/cgi-bin/fitcDemo/Makefile
cygnal/testsuite/Makefile
cygnal/testsuite/libamf.all/Makefile
cygnal/testsuite/libnet.all/Makefile
cygnal/testsuite/cygnal.all/Makefile
)

###
########################## Final report begins... ############################
###

dnl Create temporary directory in a secure way
tmp=`mktemp -d ${TMPDIR=/tmp}/gnash-configure-XXXXXX`
if test \! -n "$tmp" || test \! -d "$tmp"; then
  tmp=`(umask 077 && mkdir -d ${TMPDIR=/tmp}/gnash-configure-${RANDOM}-$$) 2>/dev/null`
fi
cerr="${tmp}/errors"
cwarn="${tmp}/warnings"
crec="${tmp}/recommended"
deb_err="${tmp}/deb_err"
deb_war="${tmp}/deb_war"
deb_rec="${tmp}/deb_rec"
rpm_err="${tmp}/rpm_err"
rpm_war="${tmp}/rpm_war"
rpm_rec="${tmp}/rpm_rec"
yast_err="${tmp}/yast_err"
yast_war="${tmp}/yast_war"
yast_rec="${tmp}/yast_rec"
echo ""

#trap 'rm cerr' 0 # trap isn't a good idea, might override other traps
exec 3> $cerr 
exec 4> $cwarn
exec 5> $crec

for F in "$deb_err" "$deb_war" "$deb_rec" "$rpm_err" "$rpm_war" "$rpm_rec" "$yast_err" "$yast_war" "$yast_rec"; do
  touch "$F";
done

pkg_out_fd=
deb_dest=
rpm_dest=
yast_dest=

dnl These macros should be portable as I checked most things used are in
dnl POSIX-2008, GNU CoreUtils, and shipped in MinGW. Old unices? No clue.
dnl In any case, they are hardly relevant on non-GNU systems.

dnl Beware, here comes some long scary shell commands.

AC_DEFUN([PKG_ERR],
[
  pkg_out_fd=3
  echo "          ERROR: `echo "$1" | fold -s -w 62 | sed 's/^/                 /' | tr '\n' '#' | cut -b 18- | tr '#' '\n'`" >&$pkg_out_fd
  deb_dest="$deb_err"
  rpm_dest="$rpm_err"
  yast_dest="$yast_err"
])

AC_DEFUN([PKG_WAR],
[
  pkg_out_fd=4
  echo "        WARNING: `echo "$1" | fold -s -w 62 | sed 's/^/                 /' | tr '\n' '#' | cut -b 18- | tr '#' '\n'`" >&$pkg_out_fd
  deb_dest="$deb_war"
  rpm_dest="$rpm_war"
  yast_dest="$yast_war"
])

AC_DEFUN([PKG_REC],
[
  pkg_out_fd=5
  echo "    RECOMMENDED: `echo "$1" | fold -s -w 62 | sed 's/^/                 /' | tr '\n' '#' | cut -b 18- | tr '#' '\n'`" >&$pkg_out_fd
  deb_dest="$deb_rec"
  rpm_dest="$rpm_rec"
  yast_dest="$yast_rec"
])

AC_DEFUN([PKG_SUGGEST],
[
  echo "`echo "$1" | fold -s -w 62 | sed 's/^/                 /'`" >&$pkg_out_fd
])

AC_DEFUN([DEB_INSTALL],
[
  echo "                 or .deb users: `echo "apt-get install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n " $1" >> "$deb_dest"
])

AC_DEFUN([DEB_ALTERNATIVE],
[
  echo "                 or maybe     : `echo "apt-get install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n "/$1" >> "$deb_dest"
])

AC_DEFUN([RPM_INSTALL],
[
  echo "                 or .rpm users: `echo "yum install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n " $1" >> "$rpm_dest"
])

AC_DEFUN([RPM_ALTERNATIVE],
[
  echo "                 or maybe     : `echo "yum install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n "/$1" >> "$rpm_dest"
])

AC_DEFUN([YAST_INSTALL],
[
  echo "                 or yast users: `echo "yast install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n " $1" >> "$yast_dest"
])

AC_DEFUN([YAST_ALTERNATIVE],
[
  echo "                 or maybe     : `echo "yast install $1" | fold -s -w 48 | sed 's/^/                                /' | tr '\n' '#' | cut -b 33- | tr '#' '\n'`" >&$pkg_out_fd
  echo -n "/$1" >> "$yast_dest"
])

AC_DEFUN([PKG_ALTERNATIVE],
[
  echo "`echo "$1" | fold -s -w 62 | sed 's/^/                 /'`" >&$pkg_out_fd
])

echo "Configurable options are:"

if test x"${jemalloc}" = x"yes"; then
  echo "        JEMALLOC Memory management enabled (default)."
else
  echo "        JEMALLOC Memory management disabled."
fi

if test x"${pthreads}" = x"yes"; then
  echo "        POSIX Threads support enabled (default)."
else
  if test x"${build_haiku}" = x"yes"; then
     echo "        POSIX Thread support built into C library."
  else
     echo "        POSIX Thread support disabled."
  fi
fi

if test x"${npapi}" = x"yes"; then
  echo "        NPAPI plugin enabled (default). Use --disable-npapi to disable."
  echo "        NPAPI plugin will be installed in ${FIREFOX_PLUGINS}"
else
  echo "        NPAPI plugin disabled."
fi

if test x"${build_kparts3}" = x"yes"; then
  echo "        KPARTS 3.x plugin enabled (default). Use --disable-kparts3 to disable"
  echo "            KPARTS 3.x plugin will be installed in ${KDE3_PLUGINDIR}"
  echo "            KPARTS 3.x service will be installed in ${KDE3_SERVICESDIR}"
  echo "            KPARTS 3.x config dir will be in ${KDE3_CONFIGDIR}"
  echo "            KPARTS 3.x appsdata will be installed in ${KDE3_APPSDATADIR}"
else
  echo "        KPARTS 3.x plugin disabled."
fi

if test x"${build_kparts4}" = x"yes"; then
  echo "        KPARTS 4.x plugin enabled (default). Use --disable-kparts4 to disable"
  echo "            KPARTS 4.x plugin will be installed in ${KDE4_PLUGINDIR}"
  echo "            KPARTS 4.x service will be installed in ${KDE4_SERVICESDIR}"
  echo "            KPARTS 4.x config dir will be in ${KDE4_CONFIGDIR}"
  echo "            KPARTS 4.x appsdata will be installed in ${KDE4_APPSDATADIR}"
else
  echo "        KPARTS 4.x plugin disabled."
fi

# set a variable if we shouldn't continue. This way we can print
# out everything that is missing in one pass, hopefully making it
# easy for new developers to get everything they need installed.

echo ""
echo "Configured paths for ${build} are:"

if test x"${jemalloc}" = x"yes"; then
  if test x"${has_jemalloc}" = xyes; then
    echo "        JEMALLOC flags are: ${JEMALLOC_CFLAGS}"
    echo "        JEMALLOC libs are: ${JEMALLOC_LIBS}"
  else
    PKG_ERR([No jemalloc development package installed!])
    PKG_SUGGEST([Install a jemalloc development environment from
    http://www.canonware.com/jemalloc/])
    DEB_INSTALL([libjemalloc-dev])
    RPM_INSTALL([jemalloc-devel])
    PKG_ALTERNATIVE([or specify --disable-jemalloc])
  fi
fi

dnl Dump QT3 options is the user specified a QTOPIA3 or KDE3 GUI
if test x"${build_kde3}" = xyes -o x"${build_qtopia3}" = xyes; then
  if test x"${has_qt3}" = xyes; then
    echo "        QT3 flags are: ${QT3_CFLAGS}"
    echo "        QT3 libs are: ${QT3_LIBS}"
  else
    PKG_ERR([No QT 3.x development package installed!])
    PKG_SUGGEST([Install a QT 3.x development environment from http://qt.nokia.com/])
    DEB_INSTALL([libqt3-mt-dev])
    RPM_INSTALL([qt3-devel])
    RPM_ALTERNATIVE([qt-devel])
    PKG_ALTERNATIVE([or change to a different gui with --enable-gui=...])
  fi
fi

dnl Dump QT4 options is the user specified a QTOPIA4 or Qt4 GUI
if test x"${build_qt4}" = xyes -o x"${build_qtopia4}" = xyes; then
  if test x"${has_qt4}" = xyes; then
    echo "        QT4 flags are: ${QT4_CFLAGS}"
    echo "        QT4 libs are: ${QT4_LIBS}"
  else
    PKG_ERR([No QT 4.x development package installed!])
    PKG_SUGGEST([Install a QT 4.x development environment from http://qt.nokia.com/])
    DEB_INSTALL([libqt4-dev])
    DEB_ALTERNATIVE([qt4-dev-tools]) dnl TODO: Is this required?
    RPM_INSTALL([qt4-devel])
    RPM_ALTERNATIVE([qt-devel])
    PKG_ALTERNATIVE([or change to a different gui with --enable-gui=...])
  fi
fi

if test x"${build_kparts4}" = xyes; then
  if test x"${has_kde4}" = xyes; then
    echo "        KDE4 flags are: ${KDE4_CFLAGS}"
    echo "        KDE4 libs are: ${KDE4_LIBS}"
  else
    PKG_WAR([kparts4 plugin is disabled!])
    PKG_SUGGEST([Install version 4.x of the KDE development environment from http://kde.org])
    DEB_INSTALL([kdelibs5-dev])
    RPM_INSTALL([kdelibs-devel])
  fi
fi

if test x"$build_qtopia3" = xyes; then
  if test x"${QTOPIA3_LIBS}" != x ; then
    if test x"${QTOPIA3_CFLAGS}" != x ; then
      echo "        QTOPIA 3.x flags are: $QTOPIA3_CFLAGS"
    else
      echo "        QTOPIA 3.x flags are: default include path"
    fi
    echo "        QTOPIA 3.x libs are: $QTOPIA3_LIBS"
  else
    PKG_ERR([No QTOPIA 3.x library development package installed!])
    PKG_SUGGEST([Install it from http://trolltech.com/downloads/ as binary packages are not available.]) dnl TODO: This link is no longer valid.
  fi
fi

if test x"$build_qtopia4" = xyes; then
  if test x"${QTOPIA4_LIBS}" != x ; then
    if test x"${QTOPIA4_CFLAGS}" != x ; then
      echo "        QTOPIA 4.x flags are: $QTOPIA4_CFLAGS"
    else
      echo "        QTOPIA 4.x flags are: default include path"
    fi
    echo "        QTOPIA 4.x libs are: $QTOPIA4_LIBS"
  else
    PKG_ERR([No QTOPIA 4.x library development package installed!])
    PKG_SUGGEST([Install it from http://trolltech.com/downloads/ as binary packages are not available.]) dnl TODO: This link is no longer valid.
  fi
fi


# -o x$build_kparts3 = xyes
if test x$build_kde3 = xyes; then
  if test x"$has_kde3" = xyes; then
    echo "        KDE 3.x flags are: $KDE3_CFLAGS"
    echo "        KDE 3.x libs are: $KDE3_LIBS"
  else
    PKG_ERR([No KDE 3.x development package installed!])
    PKG_SUGGEST([Install version 3.x of the KDE development environment from http://kde.org])
    DEB_INSTALL([kdelibs4-dev])
    RPM_INSTALL([kdelibs3-devel])
    PKG_ALTERNATIVE([or disable the KDE 3.x gui, and reconfiguring using --enable-gui=<list-of-guis> and omitting kde from the list or avoiding --enable-gui=... as a whole.])
  fi
fi

if test x"${JPEG_LIBS}" != x ; then
  if test x"${JPEG_CFLAGS}" != x ; then
    echo "        JPEG flags are: $JPEG_CFLAGS"
  else
    echo "        JPEG flags are: default include path"
  fi
  echo "        JPEG libs are: $JPEG_LIBS"
else
  PKG_ERR([No JPEG library development package installed!])
  PKG_SUGGEST([Install it from http://ijg.org])
  DEB_INSTALL([libjpeg-dev])
  RPM_INSTALL([libjpeg-devel])
fi

if test x"${GIF_LIBS}" != x ; then
  if test x"${GIF_CFLAGS}" != x ; then
    echo "        GIF flags are: $GIF_CFLAGS"
  else
    echo "        GIF flags are: default include path"
  fi
  echo "        GIF libs are: $GIF_LIBS"
else
  PKG_ERR([No GIF library development package installed!])
  PKG_SUGGEST([Install it from http://sourceforge.net/projects/giflib/])
  DEB_INSTALL([libungif-dev])
  DEB_ALTERNATIVE([libgif-dev])
  RPM_INSTALL([libgif-devel])
  RPM_ALTERNATIVE([giflib-devel])
  RPM_ALTERNATIVE([libungif-devel])
fi

if test x"${PNG_LIBS}" != x ; then
  if test x"${PNG_CFLAGS}" != x ; then
    echo "        PNG flags are: $PNG_CFLAGS"
  else
    echo "        PNG flags are: default include path"
  fi
  echo "        PNG libs are: $PNG_LIBS"
else
  PKG_REC([No PNG library development package installed!])
  PKG_SUGGEST([Gnash will be built without support for dynamic loading of PNG files.])
  PKG_SUGGEST([Install it from http://www.libpng.org])
  DEB_INSTALL([libpng12-dev])
  RPM_INSTALL([libpng-devel])
fi

if test x"${build_ovg}" = x"yes"; then
  if test x"${has_openvg}" = xyes; then
    echo "        OpenVG flags are: $OPENVG_CFLAGS"
    echo "        OpenVG libs are: $OPENVG_LIBS"
    else
      echo "        ERROR: No OpenVG development package installed!" >&3
      echo "               You need to install the libmesa development package" >&3
      echo "               or .deb users: apt-get install libopenvg1-mesa-dev" >&3
      echo "               or .rpm users: yum install mesa-libOpenVG-devel-7.8.1-7.fc13.i686" >&3
      echo "               or use a different renderer with --enable-renderer=" >&3
  fi
fi

if test x"${build_ogl}" = x"yes"; then
  if test x"$OPENGL_LIBS" != x; then
    if test x"$OPENGL_CFLAGS" != x; then
      echo "        OpenGL flags are: $OPENGL_CFLAGS"
    else
      echo "        OpenGL flags are: default include path"
    fi
    echo "        OpenGL libs are: $OPENGL_LIBS"
    else
      PKG_ERR([No OpenGL development package installed!])
      PKG_SUGGEST([You need to install the libmesa development package])
      DEB_INSTALL([libgl1-mesa-dev])
      RPM_INSTALL([mesa-libGL-devel])
      RPM_ALTERNATIVE([xorg-x11-Mesa-libGL])
      PKG_ALTERNATIVE([or use a different renderer with --enable-renderer=])
  fi
fi

if test x"${build_gles1}" = x"yes"; then
  if test x"${has_gles1}" = xyes; then
    if test x"${GLES1_CFLAGS}" != x; then
      echo "        OpenGLES1 flags are: ${GLES1_CFLAGS}"
    else
      echo "        OpenGLES1 flags are: default include path"
    fi
    echo "        OpenGLES1 libs are: ${GLES1_LIBS}"
  else
      PKG_ERR([No OpenGL-ES development package installed!])
      PKG_SUGGEST([You need to install the this from source probably])
      PKG_ALTERNATIVE([or use a different renderer with --enable-renderer=])
  fi
fi

dnl GLEXT is only needed for GTK/OpenGL
if test x$build_gtk = xyes -a x$build_ogl = xyes ; then
  if test x"$GLEXT_LIBS" != x; then
    if test x"$GLEXT_CFLAGS" != x; then
      echo "        GtkGLExt flags are: $GLEXT_CFLAGS"
    else
      echo "        GtkGLExt flags are: default include path"
    fi
      echo "        GtkGLExt libs are: $GLEXT_LIBS"
  else
    PKG_ERR([No GtkGLExt development package installed!])
    PKG_SUGGEST([It is needed to build the GTK/OpenGL GUI/renderer combination.])
    PKG_SUGGEST([Install it from http://gtkglext.sourceforge.net])
    DEB_INSTALL([libgtkglext1-dev])
    RPM_INSTALL([gtkglext-devel])
    PKG_ALTERNATIVE([or --enable-gui=sdl or --enable-renderer=agg])
  fi
fi

if test x$build_gtk = xyes; then #{
  if test x"$GTK2_LIBS" != x; then
    if test x"$GTK2_CFLAGS" != x; then
      echo "        GTK2 flags are: $GTK2_CFLAGS"
    else
      echo "        GTK2 flags are: default include path"
    fi
      echo "        GTK2 libs are: $GTK2_LIBS"
  else
    PKG_ERR([No GTK2 development package installed!])
    PKG_SUGGEST([Install it from http://gtk.org])
    DEB_INSTALL([libgtk2.0-dev])
    RPM_INSTALL([gtk2-devel])
  fi

  if test x"$PANGO_LIBS" != x; then
    if test x"$PANGO_CFLAGS" != x; then
      echo "        Pango flags are: $PANGO_CFLAGS"
    else
      echo "        Pango flags are: default include path"
    fi
    echo "        Pango libs are: $PANGO_LIBS"
  else
    PKG_ERR([No Pango development package installed!])
    PKG_SUGGEST([Install it from http://pango.org])
    DEB_INSTALL([libpango1.0-dev])
    RPM_INSTALL([pango-devel])
  fi

  if test x"$GLIB_LIBS" != x; then
    if test x"$GLIB_CFLAGS" != x; then
      echo "        GLib flags are: $GLIB_CFLAGS"
    else
      echo "        GLib flags are: default include path"
    fi
    echo "        GLib libs are: $GLIB_LIBS"
  else
    PKG_ERR([No GLib development package installed!])
    PKG_SUGGEST([Install it from http://gtk.org])
    DEB_INSTALL([libglib2.0-dev])
    RPM_INSTALL([glib2-devel])
  fi

  if test x"$ATK_LIBS" != x; then
    if test x"$ATK_CFLAGS" != x; then
      echo "        ATK flags are: $ATK_CFLAGS"
    else
      echo "        ATK flags are: default include path"
    fi
      echo "        ATK libs are: $ATK_LIBS"
  else
    PKG_ERR([No ATK development package installed!])
    PKG_SUGGEST([Install it from http://atk.org])
    DEB_INSTALL([libatk1.0-dev])
    RPM_INSTALL([atk-devel])
  fi

fi

if test x"$build_media_gst" = x"yes"; then
  if test x"$missing_codecs" != x; then   
      echo "        Your Gstreamer installation is missing these codecs: $missing_codecs"
      echo "        Please install the gstreamer-ffmpeg for Gstreamer"
  fi  
  if test x"$GSTREAMER_LIBS" != x; then
    if test x"$GSTREAMER_CFLAGS" != x; then
      echo "        Gstreamer flags are: $GSTREAMER_CFLAGS"
    else
      echo "        Gstreamer flags are: default include path"
    fi
    echo "        Gstreamer libs are: $GSTREAMER_LIBS"
  else
    PKG_ERR([GST media handling requested but gstreamer-0.10+ not found])
    PKG_SUGGEST([Install it from http://www.gstreamer.net])
    DEB_INSTALL([libgstreamer0.10-dev])
    RPM_INSTALL([gstreamer-devel])
    YAST_INSTALL([gstreamer010-devel])
  fi
  if test x"$has_gstreamer_pbutils" != "xyes"; then
    PKG_REC([If the user has not installed the necessary Gstreamer plugins, Gstreamer can pop up a message prompting them to.])
    PKG_SUGGEST([Install gstpbutils (>= 0.10.15) from http://www.gstreamer.net for that to be enabled])
    DEB_INSTALL([libgstreamer-plugins-base0.10-dev])
    PKG_SUGGEST([or .rpm users: simply install the below package]) dnl TODO: Can/should this notice be done cleaner?
    PKG_SUGGEST([Also see --with-gstpbutils-incl and --with-gstpbutils-lib])
  fi
  if test x"$has_gstreamer_plugins_base" = "xno"; then
    dnl TODO: Check if this is really a mandatory asset!
    PKG_ERR([Base plugins are required for gstreamer media!])
    PKG_SUGGEST([Install gstreamer-plugins-base from http://www.gstreamer.net])
    DEB_INSTALL([libgstreamer-plugins-base0.10-dev])
    RPM_INSTALL([gstreamer-plugins-base-devel])
  fi
fi

dnl TODO: figure out some RPM package names.
dnl TODO: The following tests is probably incorrect for any/older/exotic systems! Could someone experienced look at it?
if test x"${build_media_ffmpeg}" = x"yes"; then
  if test x"$FFMPEG_LIBS" != x; then
    echo "        MP3 and video support enabled through FFmpeg"
    if test x"$FFMPEG_CFLAGS" != x; then
      echo "        FFmpeg flags are: $FFMPEG_CFLAGS"
    else
      echo "        FFmpeg flags are: default include path"
    fi
    echo "        FFmpeg libs are: $FFMPEG_LIBS"
  else
    PKG_ERR([No FFmpeg development package installed!])
    PKG_SUGGEST([You can install FFmpeg from http://ffmpeg.org])
    DEB_INSTALL([libavcodec-dev])
    RPM_INSTALL([ffmpeg-devel])
    PKG_ALTERNATIVE(or reconfigure with --enable-media=gst)
  fi

  if test x"${avformat_h}" = x; then
    PKG_ERR([FFmpeg's avformat header is installed but not libavformat!])
    PKG_SUGGEST([You can install FFmpeg from http://ffmpeg.org])
    DEB_INSTALL([libavformat-dev])
    YAST_INSTALL([libavformat-api]) dnl (but currently installs into /usr/lib64)
    PKG_ALTERNATIVE(or explicitly set the path using --with-ffmpeg-incl=)
    PKG_ALTERNATIVE(or reconfigure with --enable-media=gst)
  fi

  if test x"${have_ffmpeg_swscale}" = "xno"; then
    PKG_ERR([No libswscale development package installed!])
    PKG_SUGGEST([You can install libswscale from http://ffmpeg.org])
    DEB_INSTALL([libswscale-dev])
    PKG_ALTERNATIVE(or reconfigure with --enable-media=gst)
  fi

  if test x"${have_ffmpeg_libavutil}" = "xno"; then
    PKG_ERR([No libavutil development package installed!])
    PKG_SUGGEST([You can install libavutil from http://ffmpeg.org])
    DEB_INSTALL([libavutil-dev])
    PKG_ALTERNATIVE(or reconfigure with --enable-media=gst)
  fi

  if test x"${ffmpeg_aac_float_planar}" = "xyes" -a \
    x"${have_ffmpeg_swresample}" = "xno" -a \
    x"${have_libav_avresample}" = "xno"; then
      PKG_REC([Please install libswresample/libavresample development package. If you don't, Gnash will be unable to resample some formats (e.g. AAC on youtube)])
      PKG_SUGGEST([You can install libavresample from http://libav.org])
      PKG_SUGGEST([You can install libswresample from http://ffmpeg.org])
      DEB_INSTALL([libavresample-dev])
      PKG_ALTERNATIVE(or reconfigure with --enable-media=gst)
  fi
fi

if test x$build_cairo = xyes; then
  if test x"$CAIRO_LIBS" != x; then
    if test x"$CAIRO_CFLAGS" != x; then
      echo "        Cairo flags are: $CAIRO_CFLAGS"
    else
      echo "        Cairo flags are: default include path"
    fi
    echo "        Cairo libs are: $CAIRO_LIBS"
  else
    PKG_ERR([No Cairo development package installed!])
    PKG_SUGGEST([You need to have the Cairo development package installed if you have used --enable-render=cairo to configure.])
    PKG_SUGGEST([Install it from http://cairographics.org])
    DEB_INSTALL([libcairo-dev])
    RPM_INSTALL([cairo-devel])
  fi
fi

if test x$build_fltk = xyes; then
  if test x"$FLTK2_LIBS" != x; then
    if test x"$FLTK2_CFLAGS" != x; then
      echo "        FLTK flags are: $FLTK2_CFLAGS"
    else
      echo "        FLTK flags are: default include path"
    fi
      echo "        FLTK libs are: $FLTK2_LIBS"
  else
    PKG_ERR([No FLTK2 development package installed!])
    PKG_SUGGEST([Install it from http://fltk.org])
    PKG_ALTERNATIVE(or change to a different gui with --enable-gui=...)
  fi
fi

if test x$build_fltk = xyes; then
  if test x"$XFT_LIBS" != x; then
    if test x"$XFT_CFLAGS" != x; then
      echo "        Xft flags are: $XFT_CFLAGS"
    else
      echo "        Xft flags are: default include path"
    fi
    echo "        Xft libs are: $XFT_LIBS"
  fi
fi

# See whether SDL is required
need_sdl=false
test x$build_sdl = xyes			&& need_sdl=true
test x$build_sound_sdl = xyes	&& need_sdl=true

if $need_sdl; then
  if test x"$SDL_LIBS" != x; then
    echo "        SDL flags are: $SDL_CFLAGS"
    echo "        SDL libs are: $SDL_LIBS"
  else
    PKG_ERR([No SDL development package installed!])
    PKG_SUGGEST([Install it from http://www.libsdl.org/download-1.2.php])
    DEB_INSTALL([libsdl1.2-dev])
    RPM_INSTALL([SDL-devel])
    PKG_ALTERNATIVE(or change to a different gui with --enable-gui=...)
  fi
fi
unset need_sdl

if test x"$nsapi" = x"yes"; then
    echo "        Plugin will be installed in ${FIREFOX_PLUGINS}"
fi

if test x"${pthreads}" = x"yes"; then
  if test x"$PTHREAD_CFLAGS" != x; then
    echo "        POSIX Threads flags are: $PTHREAD_CFLAGS"
  fi
  if test x"${PTHREAD_LIBS}" != x; then
    echo "        POSIX Threads lib is: $PTHREAD_LIBS"
  else
    if test x"${cross_compiling}" = xno; then
      echo "ERROR: No pthread development package installed!" >&3
    fi
  fi
fi

if test x"${docbook}" = x"yes"; then
  if test x"$MAKEINFO" = x; then
    PKG_ERR([No makeinfo tools installed!])
    PKG_SUGGEST([Install it from http://www.gnu.org/software/texinfo/])
    DEB_INSTALL([texinfo])
    RPM_INSTALL([texinfo])
    RPM_ALTERNATIVE([texinfo-tex])
  fi
  dnl low-level tools
  if test x"$DB2X_TEXIXML" = x -o x"$DB2X_MANXML" = x -o x"$DB2X_XSLTPROC" = x; then
    dnl high-level tools
    if test x"${DB2X_TEXI}" = x -o x"${DB2X_MAN}" = x; then
      PKG_ERR([No DocBook2X tools installed!])
      PKG_SUGGEST([Install it from http://docbook2x.sourceforge.net])
      dnl TODO: Could someone look at this and confirm the needed software is installed?
      dnl FIXME: I removed the texidocbook and docbook-utilsnfo packages as they are not on my system.
      DEB_INSTALL([docbook2x docbook-xml docbook-xsl texinfo xsltproc])
      PKG_ALTERNATIVE([or configure without --enable-docbook])
    fi
  else
    echo "        You have version $db2x_version of the DocBook2X tools."
  fi
else
  PKG_WAR([without --enable-docbook we will use the cached documentation files included in the gnash distribution. If you change files in doc/C, you should --enable-docbook.])
fi

if test x"$CURL_LIBS" != x; then
  if test x"$CURL_CFLAGS" != x; then
    echo "        CURL flags are: $CURL_CFLAGS"
  else
    echo "        CURL flags are: default include path"
  fi
  echo "        CURL libs are: $CURL_LIBS"
  if test -z "$curl_rtmp_support"; then
    PKG_REC([CURL library present but built without RTMP protocol support.])
    PKG_SUGGEST([If you install it with RTMP protocol support, Gnash will be able to play RTMP streaming.])
  fi
else
  PKG_REC([If you install the CURL library, Gnash will be able to display remote content (streaming from URLs) using CURL.])
  PKG_SUGGEST([Install libcurl from http://curl.haxx.se/libcurl])
  DEB_INSTALL([libcurl4-gnutls-dev]) dnl TODO: Do we prefer this one? GnuTLS is LGPL'd so it's probably more licensively compatible than OpenSSL?
  DEB_ALTERNATIVE([libcurl-dev])
  RPM_INSTALL([curl-devel])
fi

if test x"$SPEEX_LIBS" != x; then
  if test x"$SPEEX_CFLAGS" != x; then
    echo "        Speex flags are: $SPEEX_CFLAGS"
  else
    echo "        Speex flags are: default include path"
  fi
    echo "        Speex libs are: $SPEEX_LIBS"
else
  PKG_REC([If you install the Speex library, Gnash will be able to decoded Speex encoded audio in FLV files.])
  PKG_SUGGEST([Install libspeex from http://speex.org])
  DEB_INSTALL([libspeex-dev])
  RPM_INSTALL([speex-devel])
fi

if test x"$SPEEXDSP_LIBS" != x; then
  if test x"$SPEEXDSP_CFLAGS" != x; then
    echo "        Speex DSP flags are: $SPEEXDSP_CFLAGS"
  else
    echo "        Speex DSP flags are: default include path"
  fi
    echo "        Speex DSP libs are: $SPEEXDSP_LIBS"
else
  PKG_REC([If you install the Speex DSP library, Gnash will be able to resample Speex encoded audio in FLV files.])
  PKG_SUGGEST([Install libspeexdsp from http://speex.org])
  DEB_INSTALL([libspeexdsp-dev])
  RPM_INSTALL([speex-devel])
fi

if test x"$ext_dbus" = xyes; then
  if test x"$DBUS_LIBS" != x; then
    if test x"$DBUS_CFLAGS" != x; then
      echo "        DBUS flags are: $DBUS_CFLAGS"
    else
      echo "        DBUS flags are: default include path"
    fi
      echo "        DBUS libs are: $DBUS_LIBS"
  else
    PKG_WAR([No DBUS development package was found! Gnash will be built without support for remote controls.])
    PKG_SUGGEST([Install libdbus from http://www.dbus.org])
    DEB_INSTALL([dbus-dev])
    DEB_ALTERNATIVE([libdbus-1-dev])
    RPM_INSTALL([dbus-devel])
  fi
fi

if test x$build_agg = xyes; then # {
  echo "        AGG Pixel format is: $pixelformat"
  if test x"$AGG_LIBS" != x -a x"${agg25}" == xyes; then # {
    if test x"$AGG_CFLAGS" != x; then # {
      echo "        AGG flags are: $AGG_CFLAGS"
    else # }{
      echo "        AGG flags are: default include path"
    fi # }
    echo "        AGG libs are: $AGG_LIBS"
  else # }{
    if test x"$AGG_LIBS" != x -a x"${agg25}" != xyes; then
      PKG_ERR([Your installation of AGG appears to be version 2.4 or older. Please upgrade to AGG 2.5 or greater.])
    else
      PKG_ERR([No AGG development package installed!])
    fi
    PKG_SUGGEST([Install it from http://www.antigrain.com])
    DEB_INSTALL([libagg-dev])
    RPM_INSTALL([agg-devel])
  fi # }
fi # }

dnl TODO: This package is handled a bit stupidly in regard to the package
dnl suggestion system. It would be better to check for each package
dnl separately, instead of passing the missing ones in variables..
if test x"$BOOST_LIBS" != x; then
  echo "        BOOST flags are: $BOOST_CFLAGS"
  echo "        BOOST libs are: $BOOST_LIBS"
  echo "        BOOST libs for cygnal are: $BOOST_CYGNAL_LIBS"

  if test x"${missing_headers}" != x; then
    for i in ${missing_headers}; do
      PKG_ERR([The Boost $i header is not installed])
      PKG_SUGGEST([Install it from http://www.boost.org])
    done
  fi

  if test x"${cygnal}" = x"yes"; then
    if test x"${cygnal_missing_libs}" != x; then
      for i in ${cygnal_missing_libs}; do
        PKG_ERR([No Boost $i package installed])
        PKG_SUGGEST([Install it from http://www.boost.org])
        debtmppkg="libboost-`echo ${i} | sed 's/_/-/g'`-dev"
        DEB_INSTALL([$debtmppkg])
        PKG_ALTERNATIVE([or configure with --disable-cygnal])
      done
    fi
  fi

  if test x"${missing_libs}" != x; then
    for i in ${missing_libs}; do
      PKG_ERR([No Boost $i package installed])
      PKG_SUGGEST([Install it from http://www.boost.org])
      debtmppkg="libboost-`echo ${i} | sed 's/_/-/g'`-dev"
      DEB_INSTALL([$debtmppkg])
    done
  fi
else
  PKG_ERR([No Boost development package installed])
  PKG_SUGGEST([Install it from http://www.boost.org])
  dnl I am not sure that libboost-program-options-dev should be passed here, but
  dnl it seems like the cleanest way to get it.
  if test x"$cygnal" = xyes; then
    DEB_INSTALL([libboost-dev libboost-thread-dev libboost-program-options-dev libboost-date-time-dev])
  else
    DEB_INSTALL([libboost-dev libboost-thread-dev libboost-program-options-dev])
  fi
  RPM_INSTALL([boost-devel])
fi

dnl don't look for the flash compilers when cross compiling.
if test x"$testsuite" = x"yes"; then
  if test x$cross_compiling = xno; then
    if test x"$MING_LIBS" != x; then
      echo "        MING flags are $MING_CFLAGS"
      echo "        MING libs are $MING_LIBS"
    else
      PKG_WAR([You need to have the Ming development package installed to run most of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://www.libming.org/])
      DEB_INSTALL([libming-dev])
      RPM_INSTALL([libming-devel])
    fi

    if test x"$MAKESWF" != x; then
      echo "        MING version code is $MING_VERSION_CODE"
      echo "        MAKESWF is $MAKESWF"
    else
      PKG_WAR([You need to have the Ming utilities package version 0.4 or higher installed to run many of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://www.libming.org/])
      DEB_INSTALL([libming-util])
      RPM_INSTALL([ming-util])
      RPM_ALTERNATIVE([ming-utils])
    fi

    if test x"$MAKESWF" != x && test $MING_VERSION_CODE -lt 00040006; then
      echo "        WARNING: You have an older version of Ming installed and will not" >&4
      echo "                 be able to run all of the tests in Gnash testsuite." >&4
      echo "                 Install the latest version from http://www.libming.org" >&4
    fi

    if test x"$SWFDEC_TESTSUITE" != x; then
      echo "        SWFDEC testsuite dir is $SWFDEC_TESTSUITE"
    fi

    if test x"$MTASC" != x; then
      echo "        MTASC is $MTASC"
      echo "        MTASC CLASSPATH is $MTASC_CLASSPATH"
    else
      PKG_WAR([You need to have the MTASC compiler packages installed to run some of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://mtasc.org])
      DEB_INSTALL([mtasc])
      RPM_INSTALL([mtasc])
    fi

    if test x"$HAXE" != x; then
      echo "        HAXE is $HAXE"
      echo "        HAXE CLASSPATH is $HAXE_CLASSPATH"
    else
      PKG_WAR([You need to have the HAXE compiler package version 2.00 or higher installed to run some of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://haxe.org])
      DEB_INSTALL([haxe])
      RPM_INSTALL([haxe])
    fi

    if test x"$SWFMILL" != x; then
      echo "        SWFMILL is $SWFMILL"
      if test x"$ENABLE_AVM2" != x -a "$SWFMILL_VERSION" -lt 00021206; then
        PKG_WAR([You are building Gnash with AVM2 support but your swfmill version is too old to run AS3 tests.])
      fi
    else
      PKG_WAR([You need to have the swfmill tool installed to run some of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://swfmill.org])
      DEB_INSTALL([swfmill])
      RPM_INSTALL([swfmill])
    fi

    if test x"$SWFC" != x; then
      echo "        SWFC is $SWFC"
    else
      PKG_WAR([You need to have swfc from SWFTools installed to run some of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://swftools.org])
      DEB_INSTALL([swftools])
      RPM_INSTALL([swftools])
    fi

    if test x"$AS3COMPILE" != x; then
      echo "        AS3COMPILE is $AS3COMPILE"
    else
      PKG_WAR([You need to have as3compile from SWFTools installed to run some of the tests in Gnash testsuite.])
      PKG_SUGGEST([Install it from http://swftools.org])
    fi

    if test x"$HTTP_TESTSUITE" != x; then
      echo "        HTTP testsuite dir is $HTTP_TESTSUITE"
    fi

    if test x"$RED5_TESTING" != x; then
      echo "        RED5 testing host is $RED5_HOST"
    fi
  fi
fi

  if test x"$PERL" != x; then
    echo "        PERL is $PERL"
  else
    PKG_WAR([You need to have perl installed to run some of the tests in Gnash testsuite.])
    PKG_SUGGEST([Install it from http://perl.org])
    DEB_INSTALL([perl])
    RPM_INSTALL([perl])
  fi

if test x"$testsuite" = x"yes"; then
  if test x"$CSOUND" != x; then
    echo "        CSOUND is $CSOUND"
  else
    echo "        WARNING: You need to have csound installed" >&4
    echo "                 to have real fun." >&4
    echo "                 Install it from http://www.csounds.com/" >&4
    echo "                 or .deb users: apt-get install csound" >&4
    echo "                 or .rpm users: yum install csound" >&4
  fi
fi

if test x"$Z_LIBS" != x; then
  if test x"$Z_CFLAGS" != x; then
    echo "        Z flags are: $Z_CFLAGS"
  else
    echo "        Z flags are: default include path"
  fi
  echo "        Z libs are: $Z_LIBS"
else
  PKG_REC([You need to have the zlib development packages installed to play compressed SWF (most of them from version 6 up) and to display some kinds of JPEG files.])
  PKG_SUGGEST([Install it from http://zlib.net])
  DEB_INSTALL([zlib1g-dev])
  RPM_INSTALL([zlib-devel])
  PKG_ALTERNATIVE([It may still be possible to configure without zlib.])
fi

if test x"$FREETYPE2_LIBS" != x; then
  if test x"$FREETYPE2_CFLAGS" != x; then
    echo "        FreeType flags are: $FREETYPE2_CFLAGS"
  else
    echo "        FreeType flags are: default include path"
  fi
  echo "        FreeType libs are: $FREETYPE2_LIBS"
else
  PKG_REC([You need to have the freetype development packages installed to use device fonts.])
  PKG_SUGGEST([Install it from http://freetype.org])
  DEB_INSTALL([libfreetype6-dev])
  RPM_INSTALL([freetype-devel])
  PKG_ALTERNATIVE([It may still be possible to configure without freetype.])
fi

if test x"$FONTCONFIG_LIBS" != x; then
  if test x"$FONTCONFIG_CFLAGS" != x; then
    echo "        Fontconfig flags are: $FONTCONFIG_CFLAGS"
  else
    echo "        Fontconfig flags are: default include path"
  fi
  echo "        Fontconfig libs are: $FONTCONFIG_LIBS"
else
  PKG_REC([You need to have the fontconfig development packages installed to use device fonts.])
  PKG_SUGGEST([Install it from http://fontconfig.org])
  DEB_INSTALL([libfontconfig1-dev])
  RPM_INSTALL([fontconfig-devel])
  PKG_ALTERNATIVE([It may still be possible to configure without fontconfig.])
fi

if test x$ext_mysql = xyes; then
  if test x$mysql != xno; then
    if test x"$MYSQL_LIBS" != x; then
      echo "        MYSQL flags are: $MYSQL_CFLAGS"
      echo "        MYSQL libs are: $MYSQL_LIBS"
    else
      PKG_ERR([No MySQL development package is installed.])
      PKG_SUGGEST([Install it from http://mysql.org])
      DEB_INSTALL([libmysqlclient-dev])
      RPM_INSTALL([mysql-devel])
      PKG_ALTERNATIVE([or reconfigure without --enable-extensions=mysql])
    fi
  fi
fi

if test "$GMSGFMT" = ":"; then
  PKG_WAR([You need the gettext package installed to use translations. Required for building a package or 'make distcheck'])
  PKG_SUGGEST([Install it from http://www.gnu.org/software/gettext/])
  DEB_INSTALL([gettext])
  RPM_INSTALL([gettext])
fi

if test x"${build_vaapi}" = x"yes"; then
  if test x"${LIBVA_CFLAGS}" = xyes; then
      echo "        LIBVA flags are: default"
    else
      echo "        LIBVA flags are: $LIBVA_CFLAGS"
      echo "        LIBVA libraries are: $LIBVA_LIBS"
  fi
  if test x$use_libva_x11 = xyes; then
    if test x"${LIBVA_X11_CFLAGS}" = xyes; then
      echo "        LIBVA X11 flags are: default"
    else
      echo "        LIBVA X11 flags are: $LIBVA_X11_CFLAGS"
      echo "        LIBVA X11 libraries are: $LIBVA_X11_LIBS"
    fi
  fi
  if test x$use_libva_glx = xyes; then
    if test x"${LIBVA_GLX_CFLAGS}" = xyes; then
      echo "        LIBVA GLXflags are: default"
    else
      echo "        LIBVA GLX flags are: $LIBVA_GLX_CFLAGS"
    fi
    echo "        LIBVA GLX libraries are: $LIBVA_GLX_LIBS"
  fi
fi

if test x"$ac_cv_gcc_visibility" != xyes; then
  if test x"$npapi" = xyes; then
    PKG_WAR([NPAPI (mozilla) plugin is enabled, but your compiler does not support symbol visibility. This may cause the plugin to malfunction and may result in small children being eaten. You have been warned!])
  fi
fi

if test x"$npapi" = xyes; then
  if test x"$has_npapi" = xyes; then
    echo "        NPAPI flags are: $NPAPI_CFLAGS"
  else
    PKG_ERR([No xulrunner development package is installed!])
    PKG_SUGGEST([Install it from http://releases.mozilla.org/pub/mozilla.org/xulrunner])
    DEB_INSTALL([xulrunner-dev])
    DEB_ALTERNATIVE([firefox-dev])
    RPM_INSTALL([xulrunner-devel])
    PKG_ALTERNATIVE([or specify --disable-npapi])
  fi
else
  echo "        NPAPI plugin is disabled"
fi

if test x"${DEJAGNU}" != x""; then
  echo "        DEJAGNU's runtest is $DEJAGNU"
else
  PKG_WAR([You need the dejagnu package installed to get a summary after running 'make check'.])
  PKG_SUGGEST([Install it from http://www.gnu.org/software/dejagnu/])
  DEB_INSTALL([dejagnu])
  RPM_INSTALL([dejagnu])
fi

dnl Haiku
if test x"${build_haiku}" = xyes -o x"${build_sound_mkit}" = xyes -o x"${build_media_haiku}" = x"yes"; then
    echo "        Haiku libs are: $HAIKU_LIBS"
fi

if test x"$has_ltdl" = x"yes";then
  echo "        LIBLTDL flags are: $LTDL_CFLAGS"
  echo "        LIBLTDL libs are: $LTDL_LIBS"
else
  if test x"${extensions_support}" != xno; then
    PKG_ERR([No libltdl development package is installed, yet --disable-extensions was not specified.])
    PKG_SUGGEST([Install it from ftp://ftp.gnu.org/gnu/libtool/])
    DEB_INSTALL([libltdl-dev])
    RPM_INSTALL([libtool-ltdl-devel])
  fi
fi

if test x"$enable_visibility" != xno; then
  if test x"${extensions_support}" != xno; then
    PKG_ERR([Extensions not supported with ELF visibility activated.])
    PKG_SUGGEST([Use --disable-extensions or --disable-visibility.])
  fi
fi
 
if test x"$python" = x"yes"; then
  if test x"$has_python" = x"yes"; then
    echo "        PYTHON flags are: $PYTHON_CFLAGS"
    echo "        PYTHON libs are: $PYTHON_LIBS"
    echo "        PYTHON executable is: $PYTHON"
  else
    PKG_ERR([No Python development package is installed, but it's enabled.])
  fi
fi
if test x${build_ssl} = xyes; then
  if test x"${has_ssl}" = xyes; then
    if test x"${SSL_CFLAGS}" = xyes; then
      echo "        SSL flags are: default"
    else
      echo "        SSL flags are: $SSL_CFLAGS"
    fi
    echo "        SSL libs are: $SSL_LIBS"
  else
    PKG_ERR([No SSL development package is installed, but it's enabled."])
  fi
fi

if test x${build_ssh} = xyes; then
  if test x"${has_ssh}" = xyes; then
    if test x"${SSH_CFLAGS}" = xyes; then
      echo "        SSH flags are: default"
    else
      echo "        SSH flags are: $SSH_CFLAGS"
    fi
    echo "        SSH libs are: $SSH_LIBS"
  else
    PKG_ERR([No SSH development package is installed, but it's enabled."])
  fi
fi

if test x"${build_all_as3}" = x"yes"; then
  echo "        Building the entire ActionScript class libary"
else
  echo "        Only building these ActionScript classes into the library:"
  echo "     ${classlist}"
fi

if test x"$testsuite" = x"yes"; then
  if test x"$NETCAT" != x; then
    echo "        You have netcat installed, which is only used for testing"
  else
    echo "        Install netcat for networking test support"
  fi
  if test x"$WGET" != x; then
    echo "        You have wget installed, which is only used for testing"
  else
    echo "        Install wget for networking test support"
  fi
fi

if test x$cross_compiling = xyes; then
   if test x"${android_ndk}" != xno; then
      AC_MSG_NOTICE([This build is setup for cross compiling for Android])
   else
      AC_MSG_NOTICE([This build is setup for cross compiling])
   fi
fi

echo "--------"

if test x"${cygnal}" = x"yes"; then
  echo "        Building Cygnal media server enabled (default). Use --disable-cygnal to disable."
else
  echo "        Building Cygnal media server disabled."
fi

if test x"${with_top_level}" != x; then
  echo "        Top level for cross compiling support files is: $with_top_level"
fi

if test x"${build_gtk}" = xyes -a x"${pixelformat}" = xrgb565; then
  echo "        WARNING: Pixel format RGB565 selected in combination with the" >&4
  echo "                 GTK GUI. Only a hacked GTK will work (e.g. on the OLPC)." >&4
fi

if test x"${extensions_list}" != x; then
  echo "        Building extensions: ${extensions_list}"
fi

if test x"${extensions_support}" = xno; then
  echo "        Extension support disabled."
fi

if test x"${security_list}" != x; then
  echo "        Enabling security features: ${security_list}"
fi

if test x"${statistics_list}" != x; then
  echo "        Enabling statistics collecting for: ${statistics_list}"
fi

if test x"${SUPPORTED_GUIS}" = x; then
  AC_MSG_ERROR(no supported GUIs found);
fi

echo "        GUI toolkits supported: ${SUPPORTED_GUIS}"
echo "        Renderers supported: ${renderer_list}"
echo "        Hardware Acceleration: ${device_list}"
echo "        Media handlers: ${media_list}"
echo "        Using ${add_sound} for sound handling"

if test x"$docbook" = x"yes"; then
  echo '        DocBook document processing enabled (for "make html" and "make pdf")'
  if test x"$docbook_styles" != x; then
    echo "        Docbook styles sheets in $docbook_styles"
  fi
else
  echo "        DocBook document processing disabled (default)"
fi

dnl The Framebuffer GUI has several other settings. As it doesn't have X11,
dnl we have to handle input devics ourselves.
if test x"${build_fb}" = xyes; then
echo "        Using ${input_events} for Input"
  if test x"${fakefb}" != x; then
    echo "        Using shared memory as a fake framebuffer"
  fi
  if test x"${offscreen}" = xyes; then
    echo "        Using offscreen rendering"
  fi
  if test x"${doublebuf}" = xyes; then
    echo "        Using double buffering when rendering"
  fi
fi

if test -s $cwarn; then
  echo ""
  cat $cwarn
  rm $cwarn
  echo ""
  echo "Gnash should still compile even with these warnings."
  echo "If it doesn't, report the warnings as a bug."
else
  rm $cwarn
fi

if test -s $crec; then
  echo ""
  cat $crec
  rm $crec
  echo ""
  echo "Gnash should still compile, but you'll miss important support"
else
  rm $crec
fi

if test -s $cerr; then
  echo ""
  cat $cerr >&2
fi

deb_err="`cat $deb_err`"
deb_war="`cat $deb_war`"
deb_rec="`cat $deb_rec`"
rpm_err="`cat $rpm_err`"
rpm_war="`cat $rpm_war`"
rpm_rec="`cat $rpm_rec`"
yast_err="`cat $yast_err`"
yast_war="`cat $yast_war`"
yast_rec="`cat $yast_rec`"

if test x"${android}" != xyes; then
  # Pipe stderr to /dev/null since Fedora complains when target isn't there.
  if test x`which apt-get 2>/dev/null` != x; then
    if test x"$deb_err" != x -o x"$deb_war" != x -o x"$deb_rec" != x; then
      echo "#!/bin/sh" > deb-attempt-install-dependencies.sh
      echo "packages=\"$deb_err $deb_war $deb_rec\"" >> deb-attempt-install-dependencies.sh
      echo "PKGCOMMAND=\"apt-get install -y -q\"" >> deb-attempt-install-dependencies.sh
      cat ${srcdir}/base-attempter.sh >> deb-attempt-install-dependencies.sh
      chmod +x deb-attempt-install-dependencies.sh
      echo ""
      echo ".deb users might be able to install most dependencies by executing:"
      echo "sudo ./deb-attempt-install-dependencies.sh"
    fi
  fi

  if test x`which yum 2>/dev/null` != x; then
    if test x"$rpm_err" != x -o x"$rpm_war" != x -o x"$deb_rec" != x; then
      echo "#!/bin/sh" > rpm-attempt-install-dependencies.sh
      echo "packages=\"$rpm_err $rpm_war  $rpm_rec\"" >> rpm-attempt-install-dependencies.sh
      echo "PKGCOMMAND=\"yum install -y \""    >> rpm-attempt-install-dependencies.sh
      cat ${srcdir}/base-attempter.sh >> rpm-attempt-install-dependencies.sh
      chmod +x rpm-attempt-install-dependencies.sh
      echo ""
      echo ".rpm users might be able to install most dependencies by executing:"
      echo "sudo ./rpm-attempt-install-dependencies.sh"
    fi
  fi
fi

dnl TODO: Add support for yast here, which AFAIK is used on OpenSuse.

dnl If anything critical is missing, don't bother to continue
if test -s $cerr; then
  echo ""
  rm $cerr
  AC_MSG_ERROR([Please install required packages])
else
  rm $cerr
fi

rm -rf $tmp

if test x"$fork" = x"no"; then
  echo ""
  AC_MSG_ERROR([Currently only forking the standalone player works!])
fi
echo ""

# Local Variables:
# c-basic-offset: 2
# tab-width: 2
# indent-tabs-mode: nil
# End: