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
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
|
dnl $Id$
dnl An autoconf script to automatically configure ACE.
dnl Process this file with autoconf to produce a configure script.
dnl Statically (i.e. at autoconf-time) determine the version of ACE.
dnl This is necessary since the version argument to AC_INIT is
dnl supposed to be a static value, not a dynamic one (e.g. a shell
dnl variable).
dnl
dnl Note that this macro removes the newline output by the M4
dnl "esyscmd" built-in. Unless you understand what you're doing,
dnl particularly with M4, do not modify this macro definition.
define([ACE_VERSION], patsubst(esyscmd(grep ACE_VERSION ace/Version.h | sed 's/.*\" *\(.*\)\".*/\1/'), [
]))dnl remove newline ending every `esyscmd' answer
AC_INIT([ACE],
ACE_VERSION,
[ace-bugs@cs.wustl.edu],
[ace])
AC_REVISION([$Id$])
AC_COPYRIGHT([ACE(TM), TAO(TM), CIAO(TM), and CoSMIC(TM) (henceforth
referred to as "DOC software") are copyrighted by Douglas C.
Schmidt and his research group at Washington University,
University of California, Irvine, and Vanderbilt University,
Copyright (c) 1993-2005, all rights reserved. Since DOC software is
open-source, free software, you are free to use, modify, copy, and
distribute--perpetually and irrevocably--the DOC software source code
and object code produced from the source, as well as copy and
distribute modified versions of this software. You must, however,
include this copyright statement along with code built using DOC
software.
Please see the file `COPYING' in the top level ACE directory for
additional details.])
dnl Require GNU Autoconf 2.58 or better. Previous versions did not
dnl correctly support HP-UX.
AC_PREREQ([2.58])
dnl Autoconf explicitly forbids patterns containing "_AC_". This causes
dnl a problem when using MPC to generate the Automake ".am" files since
dnl the "AC_CLD" project in ACE_wrappers/examples/C++NPv2 ends up having
dnl a Makefile containing "NPv2_AC_CLD" in it, triggering the forbidden
dnl "_AC_" pattern. Explicitly allow our pattern.
m4_pattern_allow([NPv2_AC_CLD])
AC_CONFIG_SRCDIR([ace/ACE.cpp])
AC_CONFIG_AUX_DIR([aux_config])
AC_CONFIG_MACRO_DIR([m4])
dnl Check what platform we are running on.
AC_CANONICAL_TARGET([])
dnl Initialize GNU Automake, and require Automake 1.9.6 or better.
AM_INIT_AUTOMAKE([1.9.6 foreign no-define nostdinc])
dnl Add maintainer mode option to the option list.
dnl AM_MAINTAINER_MODE
dnl The maintainer of this configure script.
ACE_CONFIGURE_MAINTAINER='ace-users@list.isis.vanderbilt.edu'
dnl Until autoconf support in ACE is complete, prevent this script
dnl from running unless the user explictly forces the configure script
dnl to run using the "--enable-maintainer-mode" configure script
dnl option.
dnl if test $USE_MAINTAINER_MODE != yes; then
dnl AC_MSG_ERROR([
dnl ACE autoconf support is currently disabled by default since it is
dnl still under development. Please use the stock ACE build procedure
dnl detailed in the file \`ACE-INSTALL.html'.
dnl
dnl If you wish to experiment with ACE's autoconf support then use the
dnl \"--enable-maintainer-mode\" configure script option to enable
dnl autoconf support. For more details see the file
dnl \`ACE-configuration.txt'.])
dnl fi dnl test $USE_MAINTAINER_MODE != yes
dnl Should we use "egrep" or "grep -E"? This sets the "$EGREP" shell
dnl variable.
AC_PROG_EGREP
dnl If we are configuring in a CVS controlled directory then don't
dnl continue any further. The idea is to prevent automatically
dnl generated files from being checked into the repository. This
dnl will prevent accidental overwrites of ACE's current Makefiles by
dnl the automatically generated ones, for example.
dnl ACE_CHECK_FOR_CVS_DIR
dnl Prevent the configure script from continuing any further if
dnl configuration is being performed in the top-level directory. The
dnl idea is to prevent files generated during configuration and build
dnl from overwriting the stock files of the same name.
ACE_CHECK_TOP_SRCDIR
dnl Prepare the `ace/config.h.in' header template.
ACE_PREP_CONFIG_HEADER
dnl Allow the standard program name transformations.
dnl We probably don't need AC_ARG_PROGRAM any longer since AM_INIT_AUTOMAKE
dnl handles this functionality. -- Ossama
dnl AC_ARG_PROGRAM
dnl Generate a header file with all settings.
AC_CONFIG_HEADERS([ace/config.h])
dnl Move before the AC_ARG_ENABLE stuff to prevent autoconf complaints.
dnl This is a bit messy but it makes life easier for me.
dnl -Ossama
dnl
dnl SECTION: checks for programs
dnl
dnl Check if system supports "#! /bin/sh" line in scripts
AC_SYS_INTERPRETER
dnl Check the C compiler and preprocessor.
dnl AC_PROG_CC
dnl AC_PROG_CPP
dnl AC_PROG_CC_C_O
dnl Check the C++ compiler and preprocessor.
AC_PROG_CXX
AC_PROG_CXXCPP
dnl Set the test language as C++
AC_LANG([C++])
dnl If we are cross compiling disable certain things in the Makefiles.
AM_CONDITIONAL([ACE_CROSS_COMPILED], [test X$cross_compiling = Xyes])
dnl Look for the best awk-style program available.
AC_PROG_AWK
dnl Parse the version information argument.
dnl Note that "ACE_VERSION" is an m4 macro.
ace_version_temp=ACE_VERSION
ace_save_ifs="$IFS"; IFS='.'
set dummy $ace_version_temp 0 0 0
IFS="$ace_save_ifs"
ACE_MAJOR=$2
ACE_MINOR=$3
ACE_BETA=$4
ACE_VERSION_NAME=ACE_VERSION
AC_SUBST([ACE_MAJOR])
AC_SUBST([ACE_MINOR])
AC_SUBST([ACE_BETA])
AC_SUBST([ACE_VERSION_NAME])
dnl Do the usual install settings; don't forget to include a
dnl `install-sh' script, in case there is no BSD compatible `install'
dnl installed (no pun intended) in your machine.
dnl We don't need this anymore since AM_INIT_AUTOMAKE calls AC_PROG_INSTALL.
dnl -- Ossama
dnl AC_PROG_INSTALL
dnl Special handling for some UNIX variants and Cygwin32
dnl AC_AIX
dnl AC_MINIX
case $host_os in
*cygwin* ) CYGWIN=yes;;
* ) CYGWIN=no;;
esac
dnl Check if we support symbolic links
AC_PROG_LN_S
dnl Check if a lexical analyzer exists (lex, flex, etc.)
AM_PROG_LEX
dnl Check if some implementation of YACC exists (yacc, byacc, bison, etc.)
AC_PROG_YACC
dnl if test -z "$YACC"; then
dnl ./missing yacc
dnl fi
dnl Check for perfect hash function generator
AC_CHECK_PROG([GPERF],[gperf],[gperf])
dnl Check for profiling progam
AC_CHECK_PROGS([PROF],[gprof prof],)
dnl The user's/default C++ flags are stored in "CXXFLAGS." We use
dnl the variable "ACE_CXXFLAGS" to set the C++ flags we want. At the end
dnl of the configuration process we combine ACE_CXXFLAGS and CXXFLAGS
dnl into CXXFLAGS (e.g., CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"). CXXFLAGS
dnl goes after ACE_CXXFLAGS so that the user's C++ flag command line
dnl choices always override the configure script's choices.
ACE_CXXFLAGS=""
ACE_CFLAGS=""
dnl SECTION 2: Configure script command line options
dnl Determine which subsets to build
dnl This is done using the autoconf "--enable-foobar" mechanism.
ACE_CHECK_SUBSETS
dnl Some of the third party libraries (X11, openssl, etc.) depend on
dnl other libraries. Check for those before the processing --enable
dnl options.
dnl Check if the socket library is available
AC_SEARCH_LIBS([socket],[socket],,,[-lnsl])
dnl Check for gethostbyname in -lnsl since some platforms (e.g. Solaris)
dnl put it there.
AC_SEARCH_LIBS([gethostbyname],[nsl],,)
dnl Add --{enable,disable,with,without}-feature options.
ACE_CONFIGURATION_OPTIONS
ACE_COMPILATION_OPTIONS
# Autoconf's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
# Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting
# the test language to C. We do it before any libtool setup macros are
# called so that the proper values are cached beforehand. We also do
# it before any linker flags (LDFLAGS) are set so that C++ specific
# ones don't break the tests.
dnl AC_LANG_PUSH([C])
dnl AC_OBJEXT
dnl AC_EXEEXT
dnl AC_LANG_POP([C])
dnl Call ACE_SET_COMPILER_FLAGS before AC_PROG_LIBTOOL and after the
dnl AC_ARG_ENABLE and AC_ARG_WITH calls.
ACE_SET_COMPILER_FLAGS
dnl SECTION 3: check for programs <--- moved before section 2 (Ossama)
dnl Platform specific libraries needed for ACE's autoconf tests
dnl that currently do not have tests themselves.
dnl Platform specific flags
case "$host" in
*osf3.2*)
LIBS="$LIBS -lmach -lsys5 -lcxx -lc"
;;
*osf4.0* | *osf5.0*)
LIBS="$LIBS -lmach"
;;
*psos*)
LIBS="$LIBS -lm"
;;
esac
dnl SECTION 4: checks for libraries
dnl Additional X library checks
dnl We only check for these libraries if the user has
dnl enabled XtReactor support.
xt_reactor_go=no
if test "$ace_user_enable_xt_reactor" = yes; then
XTREACTOR_TEST_XLIBS=""
dnl Check for Motif if we have X
T_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
dnl Note that ACE currently only needs -lX11 and -lXt for the XtReactor
dnl so we define another library variable that contains additional
dnl libraries for the XtReactor test since it needs either Motif or the
dnl Athena widget set.
AC_CHECK_LIB([Xm],[XmCreateRowColumn],
[
AC_DEFINE([ACE_HAS_XT])
XTREACTOR_TEST_XLIBS="-lXm"
xt_reactor_go=yes
],
[
AC_DEFINE([ACE_LACKS_MOTIF])
AC_CHECK_LIB([Xaw],[XawInitializeWidgetSet],
[
AC_DEFINE([ACE_HAS_XT])
XTREACTOR_TEST_XLIBS="-lXaw -lXmu"
xt_reactor_go=yes
],
[
xt_reactor_go=no
AC_MSG_WARN([No usable X widget libraries were found.])
AC_MSG_WARN([XtReactor support will be disabled.])
],[-lXmu])
],[-lXt])
AC_SUBST([XTREACTOR_TEST_XLIBS])
dnl Restore pre-test linker flags
LDFLAGS="$T_LDFLAGS"
fi dnl test "$ace_user_enable_xt_reactor"= yes
AM_CONDITIONAL([COMPILE_XTREACTOR_TEST],[test X$xt_reactor_go = Xyes])
dnl End additional X library checks
dnl Some platforms do not have a dynamic linking library, however the
dnl dlopen, dlclose, etc., functions may exist in the C library.
dnl (e.g. Digital UNIX)
dnl Check for dynamic linking library
AC_SEARCH_LIBS([dlopen],[dl svld],[ace_has_svr4_dynamic_linking=yes],
[
ace_has_svr4_dynamic_linking=no
AC_CHECK_LIB([dld],[shl_get],,)
])
dnl Check for getservbyname in -lxnet since some platforms (e.g. Solaris)
dnl may put it there.
AC_SEARCH_LIBS([getservbyname],[socket xnet],,[AC_DEFINE([ACE_LACKS_GETSERVBYNAME])],[-lnsl])
dnl Check for compile() regex function in -lgen. Solaris, for example,
dnl may put it there.
AC_SEARCH_LIBS([compile],[gen],,)
dnl Check for exception handling library (e.g. for Digital UNIX)
AC_SEARCH_LIBS([exc_continue],[exc],,)
dnl Check for ctime_r in -lc_r. Some platforms, such as Digital UNIX,
dnl put reentrant functions such as asctime_r, ctime_r, gmtime_r, and
dnl localtime_r in -lc_r.
AC_SEARCH_LIBS([ctime_r],[c_r],,)
dnl XTI/TLI check. Check for XTI first, since it's preferred. If there's
dnl no XTI, try for TLI. t_getprotaddr() is only in XTI.
AC_SEARCH_LIBS([t_getprotaddr],[xti nsl],
[ace_has_xti_funcs=yes],[ace_has_xti_funcs=no])
AS_IF([test "$ace_has_xti_funcs" = no],
[
AC_SEARCH_LIBS([t_accept],[tli_r tli nsl],
[ace_has_tli_funcs=yes],[ace_has_tli_funcs=no])
],[])
dnl Check for all of the things we need to compile and link threads
dnl properly.
AS_IF([test "$ace_user_enable_threads" = yes],
[
ACE_CHECK_THREADS
],[])
dnl Setup Libtool
dnl This should be done in the "programs" section of this file but
dnl libtool may then be unaware of compiler flags set during the
dnl thread checks.
dnl Disable building of static libraries by default
AC_DISABLE_STATIC
dnl Enable Libtool module support
AC_LIBTOOL_DLOPEN
dnl Enable support for "clean" DLLs.
AC_LIBTOOL_WIN32_DLL
dnl
dnl ###### Relies on the as of yet unreleased Libtool 1.6 distribuion ###
dnl
dnl Only enable C++ libtool support. Support for other languages is
dnl unnecessary.
dnl AC_LIBTOOL_TAGS([CXX])
dnl FIXME: Temporary hack to make libtool work with g++.
dnl Shared library support will only work with GNU g++ and GNU ld
dnl right now.
dnl save_CC="$CC"
dnl CC="$CXX"
dnl Check for libtool and turn on Automake processing for Libtool
AC_PROG_LIBTOOL
dnl Enable C++ support in libtool
dnl AC_LIBTOOL_CXX
dnl Temporary hack until I get integrate libtool's new tag support
dnl into automake.
dnl This hack forces libtool to always use the C++ tag.
dnl LIBTOOL="$LIBTOOL --tag=CXX"
dnl Check for sched_yield() in posix4 library.
dnl Some platforms, such as Solaris, may define sched_yield() there.
dnl Later we run AC_CHECK_FUNC(sched_yield), which is redundant in this case
dnl but is needed if sched_yield() is defined in one of the other libraries
dnl we check for.
AC_SEARCH_LIBS([sched_yield],[rt posix4],[ace_has_sched_yield=yes],)
dnl Check for asynchronous IO calls (perform check *after* thread check!)
ACE_CHECK_ASYNCH_IO
dnl Additional `-lposix4' library check since it may not be added by the
dnl above checks on some platforms that may need it
dnl AC_SEARCH_LIBS([clock_gettime],
dnl [rt posix4],[AC_DEFINE(ACE_HAS_CLOCK_GETTIME)],)
dnl This check was added to work around a system-supplied header
dnl (/usr/include/netinet/ip.h) that won't compile with Visual Age C++
dnl unless the _NO_BITFIELDS preprocessor macro is defined. The comments
dnl there recommend use of _NO_BITFIELDS (and recode where needed to allow
dnl that), but we won't just turn it on. Check to see if it's needed. Note
dnl that this check is related to headers but done before we really know if
dnl the header is present. Thus, if the bare compile fails, but succeeds
dnl with _NO_BITFIELDS, set the flag, else leave things alone.
AC_CACHE_CHECK([to see if _NO_BITFIELDS needed to compile netinet/ip.h],
[ac_cv_needs_no_bitfields],
[
ace_save_CXXFLAGS="$CXXFLAGS"
dnl Try compiling without any flags first.
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <netinet/tcp.h>
],
[
return 0;
])
],
[
ac_cv_needs_no_bitfields=no
],
[
CXXFLAGS="$CXXFLAGS -D_NO_BITFIELDS"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <netinet/tcp.h>
],
[
return 0;
])
],
[
ac_cv_needs_no_bitfields=yes
],
[
ac_cv_needs_no_bitfields=no
CXXFLAGS="$ace_save_CXXFLAGS"
])
])
])
dnl SECTION 5: checks for header files
dnl Set known platform specific flags
ACE_SET_PLATFORM_MACROS
dnl Check for dirent headers
AC_HEADER_DIRENT
AS_IF([test "$ac_cv_header_dirent_dirent_h" = yes ||
test "$ac_cv_header_dirent_sys_ndir_h" = yes ||
test "$ac_cv_header_dirent_sys_dir_h" = yes ||
test "$ac_cv_header_dirent_ndir_h" = yes],
[
AC_DEFINE([ACE_HAS_DIRENT])
],[])
dnl Check for sys/wait.h Posix.1 compliance
AC_HEADER_SYS_WAIT
AC_CHECK_HEADER([dlfcn.h],
[
dnl We already checked for dlopen in the previous library checks however,
dnl it is possible that ac_cv_func_dlopen=yes if dlopen wasn't found before
dnl the library test. Hence we cannot use AC_CHECK_FUNC(dlopen) here
dnl the previously cached value may prevent ACE_HAS_SVR4_DYNAMIC_LINKING
dnl from being defined.
dnl -Ossama
AS_IF([test "$ace_has_svr4_dynamic_linking" = yes],
[
AC_DEFINE([ACE_HAS_SVR4_DYNAMIC_LINKING])
case "$host_os" in
darwin*)
AC_DEFINE([ACE_LD_SEARCH_PATH],
[ACE_LIB_TEXT ("DYLD_LIBRARY_PATH")],
[Define to environment variable used for DLL search path])
AC_DEFINE([ACE_DLL_SUFFIX],
[ACE_LIB_TEXT (".dylib")],
[Define to DLL file suffix])
;;
esac
],[])
],)
ACE_CHECK_LACKS_HEADERS(inttypes.h malloc.h memory.h stdint.h)
AC_CHECK_HEADER([sys/msg.h],
[
ACE_CACHE_CHECK([if _KERNEL is needed for msg prototypes],
[ace_cv_lib_broken_msg_h],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef UNIXWARE_7_1
# define _KMEMUSER
#endif
#include <sys/msg.h>
]],[[
struct msg ace_msg;
]])],[
ace_cv_lib_broken_msg_h=no
],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _KERNEL
# define _KERNEL
# ifdef UNIXWARE_7_1
# define _KMEMUSER
# endif
#endif
#include <sys/msg.h>
]],
[[
struct msg ace_msg;
]])],
[
ace_cv_lib_broken_msg_h=yes
],
[
dnl If we get here, then we have no idea if it is broken or not.
ace_cv_lib_broken_msg_h=no
])
])
],
[
AC_DEFINE([ACE_HAS_BROKEN_MSG_H])
],)
],
[AC_DEFINE([ACE_LACKS_SYS_MSG_H])])
AC_CHECK_HEADER([sys/sem.h],,)
AC_CHECK_HEADER([sys/shm.h],,)
ACE_CHECK_LACKS_HEADERS(sys/param.h)
AC_CHECK_HEADER([sys/priocntl.h],[],[])
dnl Check for <ucontext.h> _before_ <sys/procfs.h>
ACE_CHECK_LACKS_HEADERS(ucontext.h)
AC_CHECK_HEADER([sys/procfs.h],
[
dnl Check if <sys/procfs.h> conflicts with <ucontext.h>
dnl Some (early?) versions of glibc2.1 define the same variables
dnl in <sys/procfs.h> and <ucontext.h>.
ACE_CACHE_CHECK([if sys/procfs.h conflicts with ucontext.h],
[ace_cv_has_procfs_conflict],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_UCONTEXT_H
# include <ucontext.h>
#endif
#include <sys/procfs.h>
]],[[
int a = 0;
]])],[
ace_cv_has_procfs_conflict=no
],[
ace_cv_has_procfs_conflict=yes
])
],
[
],
[
dnl If ace_cv_has_procfs_conflict = no then define ACE_HAS_PROC_FS.
AC_DEFINE([ACE_HAS_PROC_FS])
])
],)
ACE_CHECK_LACKS_HEADERS(arpa/inet.h)
ACE_CHECK_HAS_HEADERS(bytesex.h)
ACE_CHECK_HAS_HEADERS(byteswap.h)
ACE_CHECK_LACKS_HEADERS(dirent.h)
ACE_CHECK_LACKS_HEADERS(dlfcn.h)
ACE_CHECK_LACKS_HEADERS(errno.h)
ACE_CHECK_LACKS_HEADERS(execinfo.h)
ACE_CHECK_LACKS_HEADERS(fcntl.h)
ACE_CHECK_HAS_HEADERS(pdh.h)
ACE_CHECK_HAS_HEADERS(pthread_np.h)
ACE_CHECK_LACKS_HEADERS(sched.h)
ACE_CHECK_LACKS_HEADERS(search.h)
ACE_CHECK_HAS_HEADERS(select.h)
ACE_CHECK_LACKS_HEADERS(semaphore.h)
ACE_CHECK_LACKS_HEADERS(signal.h)
ACE_CHECK_LACKS_HEADERS(stdlib.h)
ACE_CHECK_LACKS_HEADERS(string.h)
ACE_CHECK_LACKS_HEADERS(strings.h)
ACE_CHECK_LACKS_HEADERS(netdb.h)
ACE_CHECK_LACKS_HEADERS(netinet/in.h)
ACE_CHECK_LACKS_HEADERS(netinet/tcp.h)
ACE_CHECK_LACKS_HEADERS(sys/socket.h)
ACE_CHECK_LACKS_HEADERS(net/if.h, [], [],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef ACE_LACKS_SYS_SOCKET_H
# include <sys/socket.h>
# endif
])
ACE_CHECK_HAS_HEADERS(sys/filio.h)
ACE_CHECK_HAS_HEADERS(intrin.h)
ACE_CHECK_HAS_HEADERS(ia64intrin.h)
ACE_CHECK_HAS_HEADERS(ia32intrin.h)
ACE_CHECK_LACKS_HEADERS(sys/ioctl.h)
ACE_CHECK_LACKS_HEADERS(sys/ipc.h)
ACE_CHECK_HAS_HEADERS(sys/loadavg.h)
ACE_CHECK_LACKS_HEADERS(sys/mman.h)
ACE_CHECK_HAS_HEADERS(sys/pstat.h)
ACE_CHECK_LACKS_HEADERS(sys/resource.h)
ACE_CHECK_LACKS_HEADERS(sys/sem.h)
ACE_CHECK_LACKS_HEADERS(sys/shm.h)
ACE_CHECK_LACKS_HEADERS(sys/select.h)
ACE_CHECK_HAS_HEADERS(sys/sockio.h)
ACE_CHECK_LACKS_HEADERS(sys/stat.h)
dnl Test for <sys/types.h> out of alphabetical order, since it must
dnl be (conditionally) #included in other feature tests.
ACE_CHECK_LACKS_HEADERS(sys/types.h)
ACE_CHECK_LACKS_HEADERS(sys/sysctl.h, [], [],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef ACE_LACKS_SYS_PARAM_H
# include <sys/param.h>
#endif
])
ACE_CHECK_LACKS_HEADERS(sys/time.h)
ACE_CHECK_LACKS_HEADERS(sys/uio.h)
ACE_CHECK_LACKS_HEADERS(sys/un.h)
ACE_CHECK_LACKS_HEADERS(sys/wait.h)
ACE_CHECK_HAS_HEADERS(sysent.h)
ACE_CHECK_LACKS_HEADERS(time.h)
ACE_CHECK_LACKS_HEADERS(termio.h termios.h)
ACE_CHECK_LACKS_HEADERS(wctype.h)
AC_CHECK_TYPE([struct termio],
[AC_DEFINE([ACE_HAS_TERMIO], 1,
[Define to 1 if system supports SysV tty API.])],
[],
[
#ifndef ACE_LACKS_TERMIO_H
#include <termio.h>
#endif
])
AC_CHECK_TYPE([struct termios],
[AC_DEFINE([ACE_HAS_TERMIOS], 1,
[Define to 1 if system supports POSIX tty API.])],
[],
[
#ifndef ACE_LACKS_TERMIOS_H
#include <termios.h>
#endif
])
dnl If the platform has XTI, don't bother with the TLI checks as XTI is
dnl preferred.
AS_IF([test "$ace_has_xti_funcs" = yes],
[
AC_CHECK_HEADER([xti.h],
[
ace_has_xti=yes
AC_DEFINE([ACE_HAS_XTI])
],)
AC_CHECK_HEADER([sys/xti.h],
[
ace_has_xti=yes
AC_DEFINE([ACE_HAS_SYS_XTI_H])
AC_DEFINE([ACE_HAS_XTI])
],)
AC_CHECK_HEADER([sys/timod.h],
[
AC_DEFINE([ACE_HAS_TIMOD_H])
],)
dnl Check if XTI headers define TCP macros that conflict with netinet/tcp.h's
ACE_CACHE_CHECK([if TCP macros in sys/xti.h conflict with netinet/tcp.h],
[ace_cv_lib_has_conflicting_xti_macros],
[
ACE_CONVERT_WARNINGS_TO_ERRORS([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# if defined (ACE_HAS_XTI)
# include <sys/types.h>
# if defined (ACE_HAS_SYS_XTI_H)
# include /**/ <sys/xti.h>
# else
# include /**/ <xti.h>
# endif /* ACE_HAS_SYS_XTI_H */
# else
# if defined (ACE_HAS_TIUSER_H)
# include /**/ <tiuser.h>
# endif
# endif /* ACE_HAS_XTI */
# if !defined (ACE_LACKS_NETINET_TCP_H)
# include /**/ <netinet/tcp.h>
# endif /* !ACE_LACKS_NETIINET_TCP_H */
]],[[
int a = 0;
]])],[
ace_cv_lib_has_conflicting_xti_macros=no
],[
ace_cv_lib_has_conflicting_xti_macros=yes
])
])
],
[
AC_DEFINE([ACE_HAS_CONFLICTING_XTI_MACROS])
],)
],[])
AS_IF([test "$ace_has_tli_funcs" = yes],
[
AC_CHECK_HEADER([tiuser.h],
[
ace_has_tli=yes
AC_DEFINE([ACE_HAS_TIUSER_H])
AC_DEFINE([ACE_HAS_TLI])
],)
AC_CHECK_HEADER([sys/timod.h],
[
AC_DEFINE([ACE_HAS_TIMOD_H])
],
[
AC_CHECK_HEADER([tli/timod.h],
[
AC_DEFINE([ACE_HAS_OSF_TIMOD_H])
],)
])
AC_CHECK_FUNC([t_getname],
[AC_DEFINE([ACE_HAS_SVR4_TLI])],)
if test "$ac_cv_header_tiuser_h" = yes; then
ACE_CACHE_CHECK([if tiuser.h is protected by extern "C"],
[ace_cv_lib_tiuser_with_extern_c],[
AC_EGREP_HEADER([extern \"C\"],[tiuser.h],
[
ace_cv_lib_tiuser_with_extern_c=yes
],
[
ace_cv_lib_tiuser_with_extern_c=no
])
],,[AC_DEFINE([ACE_HAS_TIUSER_H_BROKEN_EXTERN_C])])
fi dnl test "$ac_cv_header_tiuser_h" = yes
AC_CHECK_HEADER([xliuser.h],
[
ace_has_tli=yes
AC_DEFINE([ACE_HAS_XLI])
AC_DEFINE([ACE_HAS_TLI])
],)
dnl Check for TLI prototypes.
if test "$ace_has_tli" = yes; then
ACE_CACHE_CHECK([for TLI prototypes],
[ace_cv_lib_tli_prototypes],
[
dnl We only check for t_accept. This should hopefully be enough.
AC_EGREP_CPP([t_accept],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#if defined (ACE_HAS_TIMOD_H)
# include <sys/timod.h>
#endif
#if defined (ACE_HAS_OSF_TIMOD_H)
# include <tli/timod.h>
#endif
#if defined (ACE_HAS_TIUSER_H)
# include /**/ <tiuser.h>
#endif /* ACE_HAS_TIUSER_H */
#if defined (ACE_HAS_XLI)
# include <xliuser.h>
#endif
],
[
ace_cv_lib_tli_prototypes=yes
],
[
ace_cv_lib_tli_prototypes=no
])
],[AC_DEFINE([ACE_HAS_TLI_PROTOTYPES])],)
dnl Check for t_errno type in TLI headers
ACE_CACHE_CHECK([for t_errno in TLI headers],
[ace_cv_lib_has_t_errno],
[
dnl Check if t_errno is declared in the TLI headers
AC_EGREP_CPP([t_errno],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#if defined (ACE_HAS_TIMOD_H)
# include <sys/timod.h>
#endif
#if defined (ACE_HAS_OSF_TIMOD_H)
# include <tli/timod.h>
#endif
#if defined (ACE_HAS_TIUSER_H)
# include /**/ <tiuser.h>
#endif /* ACE_HAS_TIUSER_H */
#if defined (ACE_HAS_XLI)
# include <xliuser.h>
#endif
],
[
ace_cv_lib_has_t_errno=yes
],
[
ace_cv_lib_has_t_errno=no
])
],,[AC_DEFINE([ACE_LACKS_T_ERRNO])])
fi dnl test "$ace_has_tli_funcs" = yes
],[])
dnl These checks are needed for both XTI and TLI.
AS_IF([test "$ace_has_xti" = yes || test "$ace_has_tli" = yes],
[
dnl Check if t_error incorrectly accepts char *
ACE_CONVERT_WARNINGS_TO_ERRORS([
ACE_CACHE_CHECK([if t_error incorrectly accepts char *],
[ace_cv_lib_has_broken_t_error],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#if defined (ACE_HAS_XTI)
# if defined (ACE_HAS_SYS_XTI_H)
# include <sys/xti.h>
# else
# include <xti.h>
# endif /* ACE_HAS_SYS_XTI_H */
#elif defined (ACE_HAS_TIUSER_H)
# include /**/ <tiuser.h>
#endif /* ACE_HAS_TIUSER_H */
#if defined (ACE_HAS_XLI)
# include <xliuser.h>
#endif
]],[[
const char *ace_errmsg = "FOO";
t_error (ace_errmsg);
]])],[
ace_cv_lib_has_broken_t_error=no
],[
ace_cv_lib_has_broken_t_error=yes
])
],
[
AC_DEFINE([ACE_HAS_BROKEN_T_ERROR])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
],[])
dnl See the notes about ACE_LACKS_MMAP in the functions section of this
dnl configure script.
dnl -Ossama
AC_CHECK_HEADER([sys/mman.h],
[
AC_EGREP_HEADER([extern \"C\"],[sys/mman.h],
,
[
AC_DEFINE([ACE_HAS_BROKEN_MMAP_H])
])
],
[
AC_DEFINE([ACE_LACKS_MMAP])
])
dnl Check for bzero() prototype if bstring.h exists.
AC_CHECK_HEADER([bstring.h],
[
AC_EGREP_HEADER([bzero],[bstring.h],
[
AC_DEFINE([ACE_HAS_BSTRING])
],)
],)
AC_CHECK_HEADER([strings.h],
[
AC_EGREP_HEADER([bzero],[strings.h],
[
AC_DEFINE([ACE_HAS_STRINGS])
],)
],)
ACE_CHECK_HAS_HEADERS(sys/syscall.h)
AC_CHECK_HEADER([poll.h],
[AC_DEFINE([ACE_HAS_POLL])],)
ACE_CHECK_LACKS_HEADERS(pwd.h)
AC_CHECK_HEADER([regexpr.h],
[AC_DEFINE([ACE_HAS_REGEX])],)
AC_CHECK_HEADER([stropts.h],
[AC_DEFINE([ACE_HAS_STREAMS])],
[AC_DEFINE([ACE_LACKS_STROPTS_H])])
ACE_CHECK_LACKS_HEADERS(siginfo.h)
ACE_CHECK_LACKS_HEADERS(unistd.h)
ACE_CHECK_LACKS_HEADERS(utime.h)
ACE_CHECK_LACKS_HEADERS(wchar.h)
AC_CHECK_HEADER([wchar.h],
[AC_DEFINE([ACE_HAS_WCHAR])],)
AC_CHECK_HEADER([new],
[AC_DEFINE([ACE_HAS_NEW_NO_H])],
[
ACE_CHECK_HAS_HEADERS([new.h])
])
dnl ace/OS.i can #include <cstring>,not #include <cstring.h>
dnl "cstring" is the correct form.
dnl TODO: Double check the above comment.
AC_CHECK_HEADER([cstring],
[AC_DEFINE([ACE_HAS_GNU_CSTRING_H])],)
AC_CHECK_HEADER([memory],,)
dnl Check for availablity of "new style" C++ stream headers
AC_CHECK_HEADERS([iomanip ios iostream istream ostream fstream streambuf],
,
[AC_CHECK_HEADERS([iostream.h fstream.h],
[AC_DEFINE([ACE_USES_OLD_IOSTREAMS])],
[AC_DEFINE([ACE_LACKS_IOSTREAM_TOTALLY])])])
dnl Check for old malloc() prototype.
ACE_CONVERT_WARNINGS_TO_ERRORS([
ACE_CACHE_CHECK([for old malloc() prototype],
[ace_cv_lib_old_malloc_proto],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
#ifndef ACE_LACKS_MALLOC_H
# include <malloc.h>
#endif
]],[[
char *s = 0;
s = malloc(sizeof(int));
]])],[
ace_cv_lib_old_malloc_proto=yes
],[
ace_cv_lib_old_malloc_proto=no
])
],[AC_DEFINE([ACE_HAS_OLD_MALLOC])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check for *_timedwait() prototypes
dnl TODO: We only check for one of the *_timedwait() prototypes.
dnl Is this enough?
AC_CHECK_DECL([recv_timedwait],
[],
[AC_DEFINE([ACE_LACKS_TIMEDWAIT_PROTOTYPES], 1,
[Define to 1 if platform lacks the declarations
of recv_timedwait, send_timedwait, etc.])],
[#include <pthread.h>
#include <fcntl.h>])
dnl Check for {get,set}rlimit prototypes
AC_CHECK_DECL([getrlimit],[],[],[#include <sys/resource.h>])
AC_CHECK_DECL([setrlimit],[],[],[#include <sys/resource.h>])
if test "$ac_cv_have_decl_getrlimit" != yes ||
test "$ac_cv_have_decl_setrlimit" != yes; then
AC_DEFINE([ACE_LACKS_RLIMIT_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration of
{get,set}rlimit().])
fi
dnl SECTION 6: Checks for typedefs
dnl dnl Standard typedef checks (All of them may not be needed)
dnl AC_TYPE_UID_T
dnl AC_TYPE_MODE_T
dnl AC_TYPE_OFF_T
dnl AC_TYPE_PID_T
dnl AC_TYPE_SIZE_T
dnl AC_CHECK_TYPE([off64_t],[long long])
dnl Specific typedef checks
dnl TODO: Check whether these typedefs can be defined somewhere else.
AC_CHECK_TYPE([cpu_set_t],
[AC_DEFINE([ACE_HAS_CPU_SET_T], 1,
[Define to 1 if the system has the type `cpu_set_t'.])],
[],
[
#if !defined(ACE_LACKS_SCHED_H)
#include <sched.h>
#endif
])
AC_CHECK_TYPE([idtype_t],
[AC_DEFINE([ACE_HAS_IDTYPE_T], 1,
[Define to 1 if the system has the type `idtype_t'.])],
[],
[#include <signal.h>])
AC_CHECK_TYPE([key_t],
[],
[AC_DEFINE([ACE_LACKS_KEY_T], 1,
[Define to 1 if the system lacks the type `key_t'.])],
[#include <sys/types.h>])
AC_CHECK_TYPE([sem_t],
[],
[],
[#include <semaphore.h>])
AC_CHECK_TYPE([pri_t],
[],
[AC_DEFINE([ACE_LACKS_PRI_T], 1,
[Define to 1 if the system lacks the type 'pri_t'.])],
[#include <sys/types.h>])
AC_CHECK_TYPE([sig_atomic_t],
[AC_DEFINE([ACE_HAS_SIG_ATOMIC_T], 1,
[Define to 1 if the system has the type 'sig_atomic_t'.])],
[],
[#include <signal.h>])
AC_CHECK_TYPE([union sigval],
[],
[],
[#include <signal.h>])
if test "$ac_cv_type_union_sigval" = yes; then
dnl Depending on the system, the field names of union sigval have
dnl either a sival_ (POSIX) or sigval_ (older versions of FreeBSD)
dnl prefix. Define ACE_HAS_SIGVAL_SIGVAL_INT accordingly.
AC_CHECK_MEMBER([union sigval.sigval_int],
[AC_DEFINE([ACE_HAS_SIGVAL_SIGVAL_INT], 1,
[Define to 1 if `sigval_int' is a member of `union sigval'.])],
[],
[#include <signal.h>])
dnl Depending on the system, the field names of union sigval have
dnl either a sival_ (POSIX) or sigval_ (older versions of FreeBSD)
dnl prefix. Define ACE_HAS_SIGVAL_SIGVAL_PTR accordingly.
AC_CHECK_MEMBER([union sigval.sigval_ptr],
[AC_DEFINE([ACE_HAS_SIGVAL_SIGVAL_PTR], 1,
[Define to 1 if `sigval_ptr' is a member of `union sigval'.])],
[],
[#include <signal.h>])
fi
AC_CHECK_TYPE([ssize_t],
[AC_DEFINE([ACE_HAS_SSIZE_T], 1,
[Define to 1 if the system has the type `ssize_t'.])],
[],
[#include <sys/types.h>])
AC_CHECK_TYPE([suseconds_t],
[],
[AC_DEFINE([ACE_LACKS_SUSECONDS_T], 1,
[Define to 1 if the system lacks the type 'suseconds_t'.])],
[#include <sys/types.h>])
AC_CHECK_TYPE([useconds_t],
[],
[AC_DEFINE([ACE_LACKS_USECONDS_T], 1,
[Define to 1 if the system lacks the type 'useconds_t'.])],
[#include <sys/types.h>])
dnl Some platforms define ucontext_t in <sys/ucontext.h>, but ACE
dnl doesn't explicitly include that header. However, it is very
dnl likely that <signal.h> does, either directly or indirectly.
AC_CHECK_TYPE([ucontext_t],
[AC_DEFINE([ACE_HAS_UCONTEXT_T], 1,
[Define to 1 if the system has the type `ucontext_t'.])],
[],
[#include <signal.h>
#ifndef ACE_LACKS_UCONTEXT_H
# include <ucontext.h>
#endif
])
AC_CHECK_TYPE([u_longlong_t],
[],
[AC_DEFINE([ACE_LACKS_U_LONGLONG_T], 1,
[Define to 1 if the system lacks the type `u_long_long_t'.])],
[#include <sys/types.h>])
AC_CHECK_TYPE([wchar_t],
[],
[AC_DEFINE([ACE_LACKS_WCHAR_T], 1,
[Define to 1 if the system lacks the type `wchar_t'.])],
[#include <sys/types.h>
#include <wchar.h>
])
AC_CHECK_TYPE([socklen_t],
[AC_DEFINE([ACE_HAS_SOCKLEN_T], 1,
[Define to 1 if the system has the type `socklen_t'.])],
[],
[
#ifndef ACE_LACKS_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef ACE_LACKS_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
if test $ac_cv_type_socklen_t = no; then
dnl The compiler in linux just issues a warning, and the test
dnl passes!!!
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if socket size is denoted by size_t
ACE_CACHE_CHECK([if socket size is denoted by size_t],
[ace_cv_lib_posix_socket_len_size_t],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef ACE_LACKS_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]],[[
int s = 0;
struct sockaddr* addr = 0;
int* addrlen = 0;
accept(s, addr, addrlen);
]])],[
ace_cv_lib_posix_socket_len_size_t=no
],[
dnl Now see if it really does take a size_t socket size
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef ACE_LACKS_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]],
[[
int s = 0;
struct sockaddr* addr = 0;
size_t* addrlen = 0;
accept(s, addr, addrlen);
]])],
[
ace_cv_lib_posix_socket_len_size_t=yes
],
[
ace_cv_lib_posix_socket_len_size_t=no
])
])
],[AC_DEFINE([ACE_HAS_SIZET_SOCKET_LEN])],)
])
fi
dnl SECTION 7: checks for structures
dnl TODO: Check whether these structures can be defined somewhere else.
AC_CHECK_TYPE([struct dirent],
[],
[AC_DEFINE([ACE_LACKS_STRUCT_DIR], 1,
[Define to 1 if the system lacks the type `struct dirent'.])],
[#include <dirent.h>])
AC_CHECK_TYPE([struct flock],
[],
[AC_DEFINE([ACE_LACKS_FILELOCKS], 1,
[Define to 1 if the system lacks the type `struct flock'.])],
[#include <fcntl.h>])
AC_CHECK_TYPE([rwlock_t],
[],
[AC_DEFINE([ACE_LACKS_RWLOCK_T], 1,
[Define to 1 if the system lacks the type `rwlock_t'.])],
[#include <synch.h>])
AC_CHECK_TYPE([struct strbuf],
[AC_DEFINE([ACE_HAS_STRBUF_T], 1,
[Define to 1 if the system has the type `struct strbuf'.])],
[],
[#include <stropts.h>])
case "$host" in
*irix*)
dnl IRIX prusage fields don't match what ACE currently supports.
;;
*)
AC_CHECK_TYPE([prusage_t],
[AC_DEFINE([ACE_HAS_PRUSAGE_T], 1,
[Define to 1 if the system has the type `prusage_t'.])],
[],
[#include <sys/procfs.h>])
;;
esac
AC_CHECK_TYPE([struct strrecvfd],
[],
[AC_DEFINE([ACE_LACKS_STRRECVFD], 1,
[Define to 1 if the system lacks the type `struct strrecvfd'.])],
[#include <stropts.h>])
AC_CHECK_TYPE([struct sigaction],
[],
[AC_DEFINE([ACE_LACKS_SIGACTION], 1,
[Define to 1 if the system lacks the type `struct sigaction'.])],
[#include <signal.h>])
AC_CHECK_TYPE([sigset_t],
[],
[AC_DEFINE([ACE_LACKS_SIGSET], 1,
[Define to 1 if the system lacks the type `sigset_t'.])],
[#include <signal.h>])
AC_CHECK_TYPE([struct utsname],
[],
[AC_DEFINE([ACE_LACKS_UTSNAME_T], 1,
[Define to 1 if the system lacks the type `struct utsname'.])],
[#include <sys/utsname.h>])
AC_CHECK_TYPE([struct sembuf],
[],
[AC_DEFINE([ACE_LACKS_SEMBUF_T], 1,
[Define to 1 if the system lacks the type `struct sembuf'.])],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/ipc.h>
#include <sys/sem.h>])
dnl Thanks to Konstantinos Margaritis <kmargar@cc.uoa.gr> for pointing out
dnl that struct siginfo_t may also be defined in signal.h
AC_CHECK_TYPE([siginfo_t],
[AC_DEFINE([ACE_HAS_SIGINFO_T], 1,
[Define to 1 if the system has the type `siginfo_t'.])],
[],
[#include <signal.h>
#ifndef ACE_LACKS_SIGINFO_H
#include <siginfo.h>
#endif])
if test "$ac_cv_type_siginfo_t" = yes; then
AC_CHECK_MEMBER([siginfo_t.si_addr],
[],
[AC_DEFINE([ACE_LACKS_SI_ADDR], 1,
[Define to 1 if `si_addr' is not a member of `siginfo_t'.])],
[#include <signal.h>
#ifndef ACE_LACKS_SIGINFO_H
#include <siginfo.h>
#endif])
fi
dnl Some platforms need to include sys/types.h before sys/socket.h
dnl in order for struct msghdr to work.
dnl Check for msghdr structure.
ACE_CACHE_CHECK([for struct msghdr],[ace_cv_struct_msghdr],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]],[[
struct msghdr ace_msghdr;
]])],[
ace_cv_struct_msghdr=yes
],[
ace_cv_struct_msghdr=no
])
], [AC_DEFINE([ACE_HAS_MSG])],)
ACE_CACHE_CHECK([for condition variable support],[ace_cv_struct_cond_t],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]],[[
pthread_cond_t ace_pthread_cond_t;
]])],[
ace_cv_struct_cond_t=yes
],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <synch.h>
]],
[[
cond_t ace_cond_t;
]])],
[
ace_cv_struct_cond_t=yes
],
[
ace_cv_struct_cond_t=no
])
])
],,[AC_DEFINE([ACE_LACKS_COND_T])])
dnl Check for struct timespec
ACE_CACHE_CHECK([for POSIX timer structure],
[ace_cv_lib_posix_timer_struct],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if !defined(ACE_LACKS_SYS_TIME_H)
# include <sys/time.h>
#endif
#include <time.h>
]],[[
timespec sr;
]])],[
ace_cv_lib_posix_timer_struct=yes
],[
dnl Check if platform uses struct timestruc_t for POSIX timers
dnl instead of struct timespec.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <time.h>
]],
[[
timestruc_t sr;
]])],
[
ace_cv_lib_posix_timer_struct=yes
dnl Check for struct timespec in <sys/timers.h>
ACE_CACHE_CHECK([for struct timespec in sys/timers.h],
[ace_cv_lib_posix_struct_timespec_broken],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <sys/timers.h>
]],
[[
timespec sr;
]])],
[
ace_cv_lib_posix_struct_timespec_broken=yes
],
[
ace_cv_lib_posix_struct_timespec_broken=no
])
],,)
],
[
ace_cv_lib_posix_timer_struct=no
])
])
],
[
AC_DEFINE([ACE_HAS_POSIX_TIME])
if test "$ace_cv_lib_posix_struct_timespec_broken" = yes; then
AC_DEFINE([ACE_HAS_BROKEN_POSIX_TIME])
fi
],
[
dnl Check for struct timespec in <sys/timers.h>
ACE_CACHE_CHECK([for struct timespec in sys/timers.h],
[ace_cv_lib_posix_struct_timespec_broken],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/timers.h>
]],[[
timespec sr;
]])],[
ace_cv_lib_posix_struct_timespec_broken=yes
],[
ace_cv_lib_posix_struct_timespec_broken=no
])
],[AC_DEFINE([ACE_HAS_BROKEN_POSIX_TIME])],)
])
dnl Check for typedef timespec_t
dnl TODO: Check whether this typedef can be defined somewhere else.
ACE_CACHE_CHECK([for timespec_t],
[ace_cv_lib_posix_timespec_t],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <time.h>
]],[[
timespec_t tt;
]])],[
ace_cv_lib_posix_timespec_t=yes
],[
ace_cv_lib_posix_timespec_t=no
])
],,[AC_DEFINE([ACE_LACKS_TIMESPEC_T])])
dnl Check for union semun
ACE_CACHE_CHECK([for union semun],
[ace_cv_lib_posix_defines_union_semun],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/sem.h>
]],[[
/* We could also check if the macro _SEM_SEMUN_UNDEFINED is defined.
No big deal. */
semun us;
]])],[
ace_cv_lib_posix_defines_union_semun=yes
],[
ace_cv_lib_posix_defines_union_semun=no
])
],[AC_DEFINE([ACE_HAS_SEMUN])],)
dnl SECTION 8: checks for variables
dnl Check for more than two fields in struct rusage
ACE_CACHE_CHECK([for limited struct rusage],
[ace_cv_lib_limited_rusage],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/time.h>
#include <sys/resource.h>
]],[[
rusage ace_rusage;
/*
We just pick three (i.e. > 2) of the fields that
ACE uses to see if we have a struct rusage that
has more than two fields.
*/
ace_rusage.ru_ixrss = 0;
ace_rusage.ru_idrss = 0;
ace_rusage.ru_isrss = 0;
]])],[
ace_cv_lib_limited_rusage=no
],[
ace_cv_lib_limited_rusage=yes
])
],[AC_DEFINE([ACE_HAS_LIMITED_RUSAGE_T])],)
dnl Check for sin_len member in struct sockaddr_in
AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
[AC_DEFINE([ACE_HAS_SOCKADDR_IN_SIN_LEN], 1,
[Define to 1 if `sin_len' is a member of `sockaddr_in'.])],
[],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
#include <netinet/in.h>
])
dnl Check for sin6_len member in struct sockaddr_in6
AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
[AC_DEFINE([ACE_HAS_SOCKADDR_IN6_SIN6_LEN], 1,
[Define to 1 if `sin6_len' is a member of `sockaddr_in6'.])],
[],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
#include <netinet/in.h>
])
dnl Check for sys_siglist
dnl TODO: Check whether this variable can be defined somewhere else.
dnl [OSSAMA: Should we use autoconf's AC_CHECK_DECLS([sys_siglist])
dnl test instead?]
ACE_CACHE_CHECK([for sys_siglist],
[ace_cv_lib_posix_sys_siglist],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
#include <signal.h>
#if !defined (_sys_siglist)
# define _sys_siglist sys_siglist
#endif
]],[[
void* vp = (void*) &_sys_siglist;
]])],[
ace_cv_lib_posix_sys_siglist=yes
],[
ace_cv_lib_posix_sys_siglist=no
])
],[AC_DEFINE([ACE_HAS_SYS_SIGLIST])],)
dnl Check for sys_errlist
dnl TODO: Check whether this variable can be defined somewhere else.
ACE_CACHE_CHECK([for sys_errlist],
[ace_cv_lib_posix_sys_errlist],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <errno.h>
#if !defined (_sys_errlist)
# define _sys_errlist sys_errlist
#endif
]],[[
void* vp = (void*) &_sys_errlist;
]])],[
ace_cv_lib_posix_sys_errlist=yes
],[
dnl Check if sys_errlist is a global variable in a library
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <stdio.h>
#include <errno.h>
#if !defined (_sys_errlist)
# define _sys_errlist sys_errlist
#endif
extern const char * const _sys_errlist[];
]],
[[
void* vp = (void*) &_sys_errlist;
]])],
[
ace_cv_lib_posix_sys_errlist=yes
],
[
ace_cv_lib_posix_sys_errlist=no
])
])
],[AC_DEFINE([ACE_HAS_SYS_ERRLIST])],)
dnl Save the cache for debugging purposes
AC_CACHE_SAVE
dnl SECTION 9: checks for compiler characteristics
dnl Check if compiler accepts "#pragma once" directive
ACE_CONVERT_WARNINGS_TO_ERRORS([
ACE_CACHE_CHECK([if compiler accepts "pragma once" directive],
[ace_cv_has_pragma_once],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#pragma once
]],[[
int a = 0; /* Put this here so we don't have an empty main(). */
]])],[
ace_cv_has_pragma_once=yes
],[
ace_cv_has_pragma_once=no
])
],,[AC_DEFINE([ACE_LACKS_PRAGMA_ONCE])])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl If we are using GNU C++, see if it accepts the -pipe compiler flag.
dnl "-pipe" on cygwin32 doesn't seem to work, for example.
if test "$GXX" = yes; then
PREPIPECXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -pipe"
PREPIPECFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -pipe"
ACE_CACHE_CHECK([if "-pipe" compiler flag is supported],
[ace_cv_feature_gxx_has_pipe],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int a = 0;]])],[
ace_cv_feature_gxx_has_pipe=yes
],[
ace_cv_feature_gxx_has_pipe=no
])
],
[
dnl We don't need to add "-pipe" here since it was already added
dnl for the test.
dnl CXXFLAGS="$PREPIPECXXFLAGS -pipe"
dnl CFLAGS="$PREPIPECFLAGS -pipe"
],
[
CXXFLAGS="$PREPIPECXXFLAGS"
CFLAGS="$PREPIPECFLAGS"
])
fi
dnl Check to see if we are running on a big endian platform
dnl "ace/Basic_Types.h" should perhaps be modified to take advantage
dnl of the results of this test.
dnl Do not run this test if we are using a cross-compiler.
AS_IF([test "$cross_compiling" != yes],
[
AC_C_BIGENDIAN
],[])
dnl Check type sizes
dnl If we get a size of zero, then the type is unknown to the compiler.
dnl We don't need to check for sizeof(char) right now. Also conflicts with
dnl ACE definition in Basic_Types.h, so we leave the test out.
if test "$cross_compiling" != yes; then
AC_CHECK_SIZEOF([wchar_t])
if test "$ac_cv_sizeof_wchar_t" != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_WCHAR],[$ac_cv_sizeof_wchar_t],
[Size of the native "wchar_t" type])
fi
AC_CHECK_SIZEOF([short])
if test "$ac_cv_sizeof_short" != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_SHORT],[$ac_cv_sizeof_short],
[Size of the native "short" type])
fi
AC_CHECK_SIZEOF([int])
if test $ac_cv_sizeof_int != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_INT],[$ac_cv_sizeof_int],
[Size of the native "int" type])
fi
AC_CHECK_SIZEOF([long])
if test $ac_cv_sizeof_long != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG],[$ac_cv_sizeof_long],
[Size of the native "long" type])
fi
AC_CHECK_SIZEOF([long long])
if test $ac_cv_sizeof_long_long != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],
[Size of the native "long long" type])
else
AC_DEFINE([ACE_LACKS_LONGLONG_T])
fi
AC_CHECK_SIZEOF([void *])
if test $ac_cv_sizeof_void_p != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_VOID_P],[$ac_cv_sizeof_void_p],
[Size of the native "pointer to void" type])
fi
AC_CHECK_SIZEOF([float])
if test $ac_cv_sizeof_float != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_FLOAT],[$ac_cv_sizeof_float],
[Size of the native "float" type])
fi
AC_CHECK_SIZEOF([double])
if test $ac_cv_sizeof_double != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_DOUBLE],[$ac_cv_sizeof_double],
[Size of the native "double" type])
fi
AC_CHECK_SIZEOF([long double])
if test $ac_cv_sizeof_long_double != 0; then
AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG_DOUBLE],[$ac_cv_sizeof_long_double],
[Size of the native "long double" type])
fi
dnl Set the 64 bit typedefs
ACE_INT64=""
ACE_UINT64=""
dnl if test "$ace_cv_type_u_longlong_t" = yes; then
dnl This doesn't work: AC_CHECK_SIZEOF([u_longlong_t],[8])
dnl if test $ac_cv_sizeof_u_longlong_t = 8; then
dnl ACE_UINT64="u_longlong_t"
dnl ace_u_long_long_typedef_set=yes
dnl fi
dnl elif test $ac_cv_sizeof_long = 8; then
if test $ac_cv_sizeof_long = 8; then
ACE_INT64="signed long"
ACE_UINT64="unsigned long"
ace_u_long_long_typedef_set=yes
elif test $ac_cv_sizeof_long_long = 8; then
ACE_INT64="signed long long"
ACE_UINT64="unsigned long long"
ace_u_long_long_typedef_set=yes
else
ace_u_long_long_typedef_set=no
fi
dnl Check for broken "signed char"
dnl If AC_CHECK_SIZEOF(signed char) returns zero then "signed char"
dnl is broken.
AC_CHECK_SIZEOF([signed char],[1])
if test $ac_cv_sizeof_signed_char = 0; then
AC_DEFINE([ACE_LACKS_SIGNED_CHAR])
fi
else
ace_u_long_long_typedef_set=no
fi dnl test "$cross_compiling" != yes
AC_CHECK_TYPE([intmax_t],
[],
[AC_DEFINE([ACE_LACKS_INTMAX_T], 1,
[Define to 1 if the system lacks the type `intmax_t'.])],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uintmax_t],
[],
[AC_DEFINE([ACE_LACKS_UINTMAX_T], 1,
[Define to 1 if the system lacks the type `uintmax_t'.])],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([intptr_t],
[],
[AC_DEFINE([ACE_LACKS_INTPTR_T], 1,
[Define to 1 if the system lacks the type `intptr_t'.])],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uintptr_t],
[],
[AC_DEFINE([ACE_LACKS_UINTPTR_T], 1,
[Define to 1 if the system lacks the type `uintptr_t'.])],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([int8_t],
[AC_DEFINE([ACE_HAS_INT8_T], 1,
[Define to 1 if the system has the type `int8_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uint8_t],
[AC_DEFINE([ACE_HAS_UINT8_T], 1,
[Define to 1 if the system has the type `uint8_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([int16_t],
[AC_DEFINE([ACE_HAS_INT16_T], 1,
[Define to 1 if the system has the type `int16_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uint16_t],
[AC_DEFINE([ACE_HAS_UINT16_T], 1,
[Define to 1 if the system has the type `uint16_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([int32_t],
[AC_DEFINE([ACE_HAS_INT32_T], 1,
[Define to 1 if the system has the type `int32_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uint32_t],
[AC_DEFINE([ACE_HAS_UINT32_T], 1,
[Define to 1 if the system has the type `uint32_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([int64_t],
[AC_DEFINE([ACE_HAS_INT64_T], 1,
[Define to 1 if the system has the type `int64_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
AC_CHECK_TYPE([uint64_t],
[AC_DEFINE([ACE_HAS_UINT64_T], 1,
[Define to 1 if the system has the type `uint64_t'.])],
[],
[
#ifndef ACE_LACKS_STDINT_H
#include <stdint.h>
#endif
#ifndef ACE_LACKS_INTTYPES_H
#include <inttypes.h>
#endif])
ACE_CACHE_CHECK([for std::numeric_limits<>],
[ace_cv_func_numeric_limits],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <limits>],
[return std::numeric_limits<int>::max();])],
[ace_cv_func_numeric_limits=yes],
[ace_cv_func_numeric_limits=no])
],,[AC_DEFINE([ACE_LACKS_NUMERIC_LIMITS])])
dnl Other checks
ACE_VAR_TIMEZONE
dnl Check for istream operator>> for char, unsigned char and signed char
ACE_CACHE_CHECK([for istream operator>> for char types],
[ace_cv_feature_char_right_shifts],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream.h>
]],[[
unsigned char a = 0;
cin >> a;
#ifndef ACE_LACKS_SIGNED_CHAR
signed char b = 0;
cin >> b;
#endif
]])],[
ace_cv_feature_char_right_shifts=yes
],[
ace_cv_feature_char_right_shifts=no
])
],,[AC_DEFINE([ACE_LACKS_CHAR_RIGHT_SHIFTS])])
dnl Check for istream operator>> for char *, unsigned char * and signed char *
ACE_CACHE_CHECK([for istream operator>> for char * types],
[ace_cv_feature_char_ptr_right_shifts],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream.h>
]],[[
unsigned char * a = 0;
cin >> a;
#ifndef ACE_LACKS_SIGNED_CHAR
signed char * b = 0;
cin >> b;
#endif
]])],[
ace_cv_feature_char_ptr_right_shifts=yes
],[
ace_cv_feature_char_ptr_right_shifts=no
])
],,[AC_DEFINE([ACE_LACKS_CHAR_STAR_RIGHT_SHIFTS])])
dnl Check to see how to call the explicit destructor on a template.
dnl There are a few different possibilities:
dnl ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR (two cases):
dnl ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS: ~CLASS<PARAM>()
dnl (no other settings): ~CLASS()
dnl w/o ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR:
dnl CLASS<PARAM>::~CLASS()
dnl
dnl The first seems to be the most widely used form, although very few
dnl hand-made configs have it set. Many compilers take all three forms.
dnl The only one that seems to be less-used is #2 above, ~CLASS().
dnl So, we check for the first two cases, and if neither of them work,
dnl we assume the third (no config macros).
ACE_CACHE_CHECK([to see if template destructor call takes template args],
[ace_cv_feature_explicit_template_des_takes_args],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
class dyn
{
public:
dyn () { }
~dyn () { }
};
template <class T>
class Base
{
public:
Base () { }
virtual void f (void) { }
~Base () { }
};
template <class T>
class Derived
{
public:
Derived ()
{
x_ = new Base<T> ();
}
virtual void f (void) { }
~Derived () { x_->~Base<T> (); }
private:
Base<T> *x_;
T t_;
};
]],[[
Derived<dyn> *x = new Derived<dyn> ();
x->f ();
delete x;
return 0;
]])],[
ace_cv_feature_explicit_template_des_takes_args=yes
],[
ace_cv_feature_explicit_template_des_takes_args=no
])
],[
AC_DEFINE([ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS])
AC_DEFINE([ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR])
],
)
dnl Check for the second form of C++ explicit template destructors
dnl Thanks to Nanbor Wang <nanbor@cs.wustl.edu> for providing this test.
if test "$ace_cv_feature_explicit_template_des_takes_args" = no; then
ACE_CACHE_CHECK([for working C++ explicit template destructors],
[ace_cv_feature_working_explicit_des],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
class dyn
{
public:
dyn () { }
~dyn () { }
};
template <class T>
class Base
{
public:
Base () { }
virtual void f (void) { }
~Base () { }
};
template <class T>
class Derived
{
public:
Derived ()
{
x_ = new Base<T> ();
}
virtual void f (void) { }
~Derived () { x_->~Base (); }
private:
Base<T> *x_;
T t_;
};
]],[[
Derived<dyn> *x = new Derived<dyn> ();
x->f ();
delete x;
return 0;
]])],[
ace_cv_feature_working_explicit_des=yes
],[
ace_cv_feature_working_explicit_des=no
])
],[AC_DEFINE([ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR])],)
fi
dnl Check for C++ "std" namespace
ACE_CACHE_CHECK([for C++ "std" namespace],
[ace_cv_feature_posix_uses_std_namespace],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (ACE_USES_OLD_IOSTREAMS)
# include <iostream.h>
#else
# include <iostream>
#endif
]],[[
std::cout << "FOO" << std::endl;
]])],[
ace_cv_feature_posix_uses_std_namespace=yes
],[
ace_cv_feature_posix_uses_std_namespace=no
])
],[AC_DEFINE([ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB])],)
dnl Check for new style C++ include file support
ACE_CACHE_CHECK([for new style C++ include file support],
[ace_cv_lib_posix_standard_includes],[
ace_cv_lib_posix_standard_includes=no
if test "$ace_cv_feature_posix_uses_std_namespace" = yes; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <string>
]],[[
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
std::string str;
#else
string str;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
]])],[ace_cv_lib_posix_standard_includes=yes],[])
fi
],
[
AC_DEFINE([ACE_HAS_STDCPP_STL_INCLUDES])
AC_DEFINE([ACE_HAS_STRING_CLASS])
],)
dnl Check whether platform supports the standard C++ library
dnl TODO: For now, check whether headers <new>, <iomanip>
dnl and <memory> exist; is there a better way?
if test "$ac_cv_header_new" = yes &&
test "$ac_cv_header_iomanip" = yes &&
test "$ac_cv_header_memory" = yes; then
dnl Check for auto_ptr class
ACE_CACHE_CHECK([for C++ auto_ptr class],
[ace_cv_lib_auto_ptr_class],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <memory>
]],[[
int *foo = new int;
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
std::auto_ptr<int> safe (foo);
#else
auto_ptr<int> safe (foo);
#endif
foo = safe.release ();
delete foo;
]])],[
ace_cv_lib_auto_ptr_class=yes
],[
ace_cv_lib_auto_ptr_class=no
])
],
[
AC_DEFINE([ACE_HAS_STANDARD_CPP_LIBRARY])
],
[
AC_DEFINE([ACE_LACKS_AUTO_PTR])
])
fi
if test "$ace_cv_lib_auto_ptr_class" = yes; then
dnl Check for auto_ptr reset method
ACE_CACHE_CHECK([for C++ auto_ptr reset method],
[ace_cv_lib_auto_ptr_reset],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <memory>
]],[[
int *foo = new int;
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
std::auto_ptr<int> safe (foo);
#else
auto_ptr<int> safe (foo);
#endif
int *bar = new int;
safe.reset (bar);
foo = safe.release ();
]])],[
ace_cv_lib_auto_ptr_reset=yes
],[
ace_cv_lib_auto_ptr_reset=no
])
],,[AC_DEFINE([ACE_AUTO_PTR_LACKS_RESET])])
fi dnl test $ace_cv_lib_auto_ptr_class=yes
dnl Check if platform supports placement delete operator
ACE_CACHE_CHECK([for C++ placement delete operator],
[ace_cv_feature_placement_delete],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif
class foo
{
public:
void *operator new (size_t, void *p) { return p; }
void operator delete (void *p, void *) {}
};
]],[[
int *x = 0;
foo *f = new (x) foo;
// delete f; // Don't call delete for this test!
]])],[
ace_cv_feature_placement_delete=yes
],[
ace_cv_feature_placement_delete=no
])
],,[AC_DEFINE([ACE_LACKS_PLACEMENT_OPERATOR_DELETE])])
dnl Check if templates require source on platform
dnl
dnl FIXME: This test may be broken.
dnl
dnl FIXME: This test contains vestigial bits of tests for explicit
dnl template instantiation feature macros, even though support for
dnl the same has been removed.
dnl
dnl A rewrite to test only whether ACE_TEMPLATES_REQUIRE_SOURCE or
dnl ACE_TEMPLATES_REQUIRE_PRAGMA is clearly needed.
dnl
ACE_CACHE_CHECK([if templates require source],
[ace_cv_feature_templates_require_source],
[
dnl Create the common header file
cat > ace_test.h <<EOF
#ifndef FOO_H
#define FOO_H
template <class T>
class Foo
{
public:
Foo (T val);
private:
T value_;
};
template <class T>
class Bar
{
public:
Bar (Foo<T> *);
private:
Foo<T> *foo_ptr;
};
#endif /* FOO_H */
EOF
dnl Create template source test file
cat > ace_test.$ac_ext <<EOF
#include "ace_test.h"
#ifndef FOO_CXX
#define FOO_CXX
template <class T>
Foo<T>::Foo (T val)
: value_ (val)
{
// Nothing else to do.
}
template <class T>
Bar<T>::Bar (Foo<T> *val)
: foo_ptr (val)
{
// Nothing else to do.
}
#endif /* FOO_CXX */
EOF
dnl Add the ACE-specific compiler flags to the compiler flags for
dnl the duration of this test.
ace_cxx_template_save_CXXFLAGS="$CXXFLAGS"
ace_cxx_template_save_CPPFLAGS="$CPPFLAGS"
ace_cxx_template_save_LDFLAGS="$LDFLAGS"
CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"
CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
dnl Remove any template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl First try without explicit template instantiation.
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include "ace_test.h"
]],[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],[
dnl Template source is not required.
ace_cv_feature_templates_require_source=no
dnl Template source does not require pragma.
AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is not required.
AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=no])
dnl Pragma template instantiation is not required.
AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=no])
],[
dnl Remove any template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Now try including the template source.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#include "ace_test.$ac_ext"
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template source is required!
ace_cv_feature_templates_require_source=yes
dnl Template source does not require pragma.
AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is not required.
AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=no])
dnl Pragma template instantiation is not required.
AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=no])
],
[
dnl BEGIN OUTER REQUIRE SOURCE #########################################
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Now try with explicit template instantiation.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
template class Foo<int>;
template class Bar<char>;
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template source is not required.
ace_cv_feature_templates_require_source=no
dnl Template source does not require pragma.
AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is required.
AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=yes])
dnl Pragma template instantiation is not required.
AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=no])
],
[
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Don't set
dnl ace_cv_feature_pragma_template_instantiation
dnl to "no" here. It should only be set to "no" if
dnl explicit template instantiation works.
dnl Now try including the template source.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#include "ace_test.$ac_ext"
template class Foo<int>;
template class Bar<char>;
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template source is required!
ace_cv_feature_templates_require_source=yes
dnl Template source does not require pragma.
AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is required.
AC_CACHE_VAL(
[ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=yes])
dnl Pragma template instantiation is not required.
AC_CACHE_VAL(
[ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=no])
],
[
dnl BEGIN INNER REQUIRE SOURCE #########################################
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Don't set
dnl ace_cv_feature_explicit_template_instantiation
dnl to "no" here. It should only be set to "no" if
dnl pragma template instantiation works.
dnl Now try with pragma template instantiation.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#pragma instantiate Foo<int>
#pragma instantiate Bar<char>
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template source is not required.
ace_cv_feature_templates_require_source=no
dnl Template source does not require pragma.
AC_CACHE_VAL(
[ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is not required.
AC_CACHE_VAL(
[ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=no])
dnl Pragma template instantiation is required.
AC_CACHE_VAL(
[ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=yes])
],
[
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Don't set
dnl ace_cv_feature_explicit_template_instantiation
dnl to "no" here. It should only be set to "no" if
dnl pragma template instantiation works.
dnl Now try including the template source.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#include "ace_test.$ac_ext"
#pragma instantiate Foo<int>
#pragma instantiate Bar<char>
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template source is required!
ace_cv_feature_templates_require_source=yes
dnl Template source does not require pragma.
AC_CACHE_VAL(
[ace_cv_feature_templates_require_pragma],
[ace_cv_feature_templates_require_pragma=no])
dnl Explicit template instantiation is not required.
AC_CACHE_VAL(
[ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=no])
dnl Pragma template instantiation is required.
AC_CACHE_VAL(
[ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=yes])
],
[
dnl If we get here, then we have no idea what is needed!
ace_cv_feature_templates_require_source=no
])
])
dnl END INNER REQUIRE SOURCE #########################################
])
])
dnl END OUTER REQUIRE SOURCE #########################################
])
])
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Remove the test additional test files.
rm -f ace_test*
dnl Restore the compiler flags
CXXFLAGS="$ace_cxx_template_save_CXXFLAGS"
CPPFLAGS="$ace_cxx_template_save_CPPFLAGS"
LDFLAGS="$ace_cxx_template_save_LDFLAGS"
],
[
AC_DEFINE([ACE_TEMPLATES_REQUIRE_SOURCE])
],
[
dnl Check if templates require pragma.
ACE_CACHE_CHECK([if templates require pragma],
[ace_cv_feature_templates_require_pragma],
[
dnl Create the common header file
cat > ace_test.h <<EOF
#ifndef FOO_H
#define FOO_H
template <class T>
class Foo
{
public:
Foo (T val);
private:
T value_;
};
template <class T>
class Bar
{
public:
Bar (Foo<T> *);
private:
Foo<T> *foo_ptr;
};
#endif /* FOO_H */
EOF
dnl Create template source test file
cat > ace_test.$ac_ext <<EOF
#include "ace_test.h"
#ifndef FOO_CXX
#define FOO_CXX
template <class T>
Foo<T>::Foo (T val)
: value_ (val)
{
// Nothing else to do.
}
template <class T>
Bar<T>::Bar (Foo<T> *val)
: foo_ptr (val)
{
// Nothing else to do.
}
#endif /* FOO_CXX */
EOF
dnl Add the ACE-specific compiler flags to the compiler flags for
dnl the duration of this test.
ace_cxx_template_save_CXXFLAGS="$CXXFLAGS"
ace_cxx_template_save_CPPFLAGS="$CPPFLAGS"
ace_cxx_template_save_LDFLAGS="$LDFLAGS"
CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"
CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
dnl Remove any template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl We already know that the simplest case doesn't work so go
dnl straight to the "require pragma" test.
dnl Now try including the template pragma.
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include "ace_test.h"
#pragma implementation ("ace_test.$ac_ext")
]],[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],[
dnl Template source is required!
ace_cv_feature_templates_require_pragma=yes
],[
dnl BEGIN OUTER REQUIRE PRAGMA #########################################
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Now try with explicit template instantiation.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#pragma implementation ("ace_test.$ac_ext")
template class Foo<int>;
template class Bar<char>;
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template pragma is required!
ace_cv_feature_templates_require_pragma=yes
dnl Explicit template instantiation is required.
AC_CACHE_VAL(
[ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=yes])
dnl Pragma template instantiation is not required.
AC_CACHE_VAL(
[ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=no])
],
[
dnl BEGIN INNER REQUIRE PRAGMA #########################################
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Now try with pragma template instantiation.
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include "ace_test.h"
#pragma implementation ("ace_test.$ac_ext")
#pragma instantiate Foo<int>
#pragma instantiate Bar<char>
]],
[[
Foo<int> foo (15);
Bar<char> bar (0);
]])],
[
dnl Template pragma is required!
ace_cv_feature_templates_require_pragma=yes
dnl Explicit template instantiation is not required.
AC_CACHE_VAL(
[ace_cv_feature_explicit_template_instantiation],
[ace_cv_feature_explicit_template_instantiation=no])
dnl Pragma template instantiation is required.
AC_CACHE_VAL(
[ace_cv_feature_pragma_template_instantiation],
[ace_cv_feature_pragma_template_instantiation=yes])
],
[
dnl If we get here, then we have no idea what is needed!
ace_cv_feature_templates_require_pragma=no
])
dnl END INNER REQUIRE PRAGMA #########################################
])
dnl END OUTER REQUIRE PRAGMA #########################################
])
dnl Remove any generated template repositories.
rm -rf Templates.DB SunWS_cache ptrepository *.rpo
dnl Remove the additional test files.
rm -f ace_test*
dnl Restore the compiler flags
CXXFLAGS="$ace_cxx_template_save_CXXFLAGS"
CPPFLAGS="$ace_cxx_template_save_CPPFLAGS"
LDFLAGS="$ace_cxx_template_save_LDFLAGS"
],
[
AC_DEFINE([ACE_TEMPLATES_REQUIRE_PRAGMA])
],
[
dnl Do nothing.
])
])
dnl Check if platform supports template typedefs
ACE_CACHE_CHECK([for template typedefs],
[ace_cv_feature_posix_template_typedefs],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
class Bar
{
public:
typedef int Y;
Bar(int bar) : bar_(bar) {}
int value() const { return bar_; }
private:
int bar_;
};
template <class T>
class Foo
{
public:
typedef typename T::Y Y;
Foo(T* foo) : foo_(foo) {}
void print(Y);
private:
T* foo_;
};
template <class T>
void Foo<T>::print(typename T::Y)
{
}
]],[[
Bar bar(15);
Foo<Bar> foo(&bar);
foo.print(11);
]])],[
ace_cv_feature_posix_template_typedefs=yes
],[
ace_cv_feature_posix_template_typedefs=no
])
],[AC_DEFINE([ACE_HAS_TEMPLATE_TYPEDEFS])],)
dnl Check if platform supports static data member templates
ACE_CACHE_CHECK([for static data member templates],
[ace_cv_feature_posix_static_data_member_templates],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
template <class T>
class Foo
{
public:
static T* sdm;
};
template <class T> T* Foo<T>::sdm = 0;
]],[[
/* No body */
]])],[
ace_cv_feature_posix_static_data_member_templates=yes
],[
ace_cv_feature_posix_static_data_member_templates=no
])
],,[AC_DEFINE([ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES])])
dnl Check if compiler needs definitions for hidden functions
ACE_CACHE_CHECK([if definition is needed for hidden functions],
[ace_cv_feature_need_func_def],
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
class Foo
{
public:
Foo (void) { a_ = 0; }
private:
Foo (const Foo &);
void operator= (const Foo &);
int a_;
};
]],[[
Foo Bar;
]])],[
ace_cv_feature_need_func_def=no
],[
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
class Foo
{
public:
Foo (void) { a_ = 0; }
private:
Foo (const Foo &);
const Foo & operator= (const Foo &);
int a_;
};
Foo::Foo (const Foo &)
{
a_ = 0;
}
const Foo &
Foo::operator= (const Foo &)
{
a_ = 0;
return *this;
}
]],
[[
Foo Bar;
]])],
[
ace_cv_feature_need_func_def=yes
],
[
dnl If we get here then we don't know what is needed!
ace_cv_feature_need_func_def=no
])
])
],
[
AC_DEFINE([ACE_NEEDS_FUNC_DEFINITIONS])
],)
dnl Check if platform supports C++ exceptions
if test "$ace_user_enable_exceptions" = yes; then
ACE_CACHE_CHECK([for C++ exceptions],
[ace_cv_feature_posix_exceptions],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[
int ret = 0;
class ACE {};
try
{
throw ACE();
}
catch (ACE)
{
ret = 1;
}
]])],[
ace_cv_feature_posix_exceptions=yes
],[
ace_cv_feature_posix_exceptions=no
])
],[AC_DEFINE([ACE_HAS_EXCEPTIONS])],[ace_user_enable_exceptions=no])
fi dnl test "$ace_user_enable_exceptions" = yes
dnl Check if we need a non-static object manager
dnl TODO / FIXME
dnl ACE_CACHE_CHECK([if we need a non-static object manager],
dnl [ace_cv_feature_nonstatic_object_manager],[
dnl ace_cv_feature_nonstatic_object_manager=yes
dnl TODO: Should we check for this thing (and HOW), or
dnl should it be the user's choice?
dnl For now, we will leave it as a user's choice.
dnl -Ossama
dnl ],
dnl [
dnl Don't define anything until we have a test for this.
dnl AC_DEFINE([ACE_HAS_NONSTATIC_OBJECT_MANAGER])
dnl ],)
dnl Save the cache for debugging purposes
AC_CACHE_SAVE
dnl SECTION 10: checks for library functions
ACE_FUNC_STRCASECMP
ACE_FUNC_STRNCASECMP
ACE_FUNC_STRDUP
ACE_FUNC_WCSCASECMP
ACE_FUNC_WCSNCASECMP
ACE_FUNC_WCSDUP
if test "$ace_user_enable_alloca" = yes; then
AC_FUNC_ALLOCA
if test "$ac_cv_header_alloca_h" = yes; then
AC_DEFINE([ACE_HAS_ALLOCA_H])
fi
if test "$ac_cv_func_alloca_works" = yes; then
AC_DEFINE([ACE_HAS_ALLOCA])
fi
fi
dnl ACE should really have something for both the sys/mman.h header
dnl and the mmap function since we need sys/mman.h for functions like
dnl mprotect and msync, but don't want to use mmap if it doesn't work.
dnl For now, we just check for the sys/mman.h header earlier in this
dnl configure script.
dnl AC_FUNC_MMAP
dnl if test "$ac_cv_func_mmap_fixed_mapped" = no; then
dnl Even if we have mmap, do not use if broken!
dnl AC_DEFINE(ACE_LACKS_MMAP)
dnl fi
dnl Check if closedir() returns a meaningful value
AC_FUNC_CLOSEDIR_VOID
dnl Check for PWD functions
AC_CHECK_FUNC([getpwnam],,)
AC_CHECK_FUNC([setpwent],,)
AC_CHECK_FUNC([endpwent],,)
AC_CHECK_FUNC([getpwent],,)
AC_CHECK_FUNC([getpwuid],,)
if test "$ac_cv_func_getpwnam" != yes ||
test "$ac_cv_func_setpwent" != yes ||
test "$ac_cv_func_endpwent" != yes ||
test "$ac_cv_func_getpwent" != yes ||
test "$ac_cv_func_getpwuid" != yes; then
AC_DEFINE([ACE_LACKS_PWD_FUNCTIONS])
else
dnl The password file related functions above are required for ACE's
dnl alternate implementation.
ACE_CONVERT_WARNINGS_TO_ERRORS([
dnl Check for functions necessary for ACE's alternate implementation
dnl of the now obsolete cuserid() function.
ACE_CACHE_CHECK([checking if ACE cuserid() implementation should be used],
[ace_cv_lib_use_alt_cuserid],
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
/* Undefine _XOPEN_SOURCE since it may make the cuserid() prototype
visible. ACE should not rely on such feature test macros. */
#undef _XOPEN_SOURCE
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#else
# error No unistd.h header. Need header where cuserid() is located.
#endif /* ACE_LACKS_UNISTD_H */
]],[[
char * foo = cuserid ((char *)0);
]])],[
dnl If successful then use the system cuserid() implementation,
dnl despite the fact that ACE's implementation may be safer.
ace_cv_lib_use_alt_cuserid=no
],[
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#undef _XOPEN_SOURCE
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#else
# error No unistd.h header. Need header where geteuid() is located.
#endif
]],
[[
uid_t foo = geteuid ();
]])],
[
dnl All of the functions necessary for ACE's cuserid()
dnl implementation exist.
ace_cv_lib_use_alt_cuserid=yes
],
[
dnl If we get here, we're hosed!
ace_cv_lib_use_alt_cuserid=no
])
])
],
[
AC_DEFINE([ACE_HAS_ALT_CUSERID])
],)
])
fi
dnl Check for `strftime' in the `intl' library, for SCO UNIX
AC_FUNC_STRFTIME
case "$host_os" in
*win32*)
AC_CHECK_FUNC([CancelIO],
[AC_DEFINE([ACE_HAS_CANCEL_IO])],)
AC_CHECK_FUNC([SignalObjectAndWait],
[AC_DEFINE([ACE_HAS_SIGNAL_OBJECT_AND_WAIT])],)
AC_CHECK_FUNC([TryEnterCriticalSection],
[AC_DEFINE([ACE_HAS_WIN32_TRYLOCK])],)
;;
*)
;;
esac
ACE_CHECK_HAS_FUNCS(_InterlockedIncrement _InterlockedDecrement _InterlockedExchangeAdd)
if test "$ac_cv_func__InterlockedIncrement" = yes &&
test "$ac_cv_func__InterlockedDecrement" = yes &&
test "$ac_cv_func__InterlockedExchangeAdd" = yes; then
AC_DEFINE([ACE_HAS_INTRINSIC_INTERLOCKED])
fi
ACE_CHECK_LACKS_FUNCS(access)
ACE_CHECK_LACKS_FUNCS(alphasort)
ACE_CHECK_LACKS_FUNCS(asctime)
ACE_CHECK_LACKS_FUNCS(asctime_r)
ACE_CHECK_LACKS_FUNCS(alarm)
ACE_CHECK_LACKS_FUNCS(bsearch)
ACE_CHECK_HAS_DEFINES([bswap16])
if test "$ace_cv_defined_bswap16" = no; then
ACE_CHECK_HAS_DEFINES([bswap_16],[],[],[
#if ACE_HAS_BYTESWAP_H
#include <byteswap.h>
#endif])
fi
ACE_CHECK_HAS_DEFINES([bswap32])
if test "$ace_cv_defined_bswap32" = no; then
ACE_CHECK_HAS_DEFINES([bswap_32],[],[],[
#if ACE_HAS_BYTESWAP_H
#include <byteswap.h>
#endif])
fi
ACE_CHECK_HAS_DEFINES([bswap64])
if test "$ace_cv_defined_bswap64" = no; then
ACE_CHECK_HAS_DEFINES([bswap_64],[],[],[
#if ACE_HAS_BYTESWAP_H
#include <byteswap.h>
#endif])
fi
ACE_CHECK_LACKS_FUNCS(chdir)
ACE_CHECK_HAS_FUNCS(clock_gettime clock_settime nanosleep)
ACE_CHECK_LACKS_FUNCS(difftime)
ACE_CHECK_LACKS_FUNCS(dup)
ACE_CHECK_LACKS_FUNCS(dup2)
dnl ACE uses execv, execvp and execve, so we don't bother to check
dnl for the others (e.g. execl, execlp, execle)
AC_CHECK_FUNC(execv)
AC_CHECK_FUNC(execvp)
AC_CHECK_FUNC(execve)
if test "$ac_cv_func_execv" != yes &&
test "$ac_cv_func_execvp" != yes &&
test "$ac_cv_func_execve" != yes; then
AC_DEFINE([ACE_LACKS_EXEC])
fi
ACE_CHECK_LACKS_FUNCS(fgetwc fcntl fork fsync)
ACE_CHECK_LACKS_FUNCS(getcwd)
ACE_CHECK_LACKS_FUNCS(gethostent)
ACE_CHECK_LACKS_FUNCS(getipnodebyaddr)
ACE_CHECK_LACKS_FUNCS(getipnodebyname)
ACE_CHECK_HAS_FUNCS(getifaddrs)
ACE_CHECK_LACKS_FUNCS(getegid geteuid getgid)
ACE_CHECK_LACKS_FUNCS(setenv unsetenv)
ACE_CHECK_LACKS_FUNCS(getopt)
if test $ac_cv_func_getopt = yes; then
AC_CHECK_DECL([getopt],
[],
[AC_DEFINE([ACE_LACKS_GETOPT_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of getopt().])],
[#include <stdlib.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif])
fi
AC_CHECK_FUNC([getpagesize],
[AC_DEFINE([ACE_HAS_GETPAGESIZE])],
[AC_DEFINE([ACE_PAGE_SIZE], [4096])])
ACE_CHECK_LACKS_FUNCS(getpid)
ACE_CHECK_LACKS_FUNCS([getpgid])
if test "$ac_cv_func_getpgid" = yes; then
dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
dnl needed to make the getpgid() prototype visible.
ACE_CACHE_CHECK([for getpgid prototype],
[ace_cv_lib_has_getpgid_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_EGREP_HEADER([[^_]+getpgid], [unistd.h],
[
ace_cv_lib_has_getpgid_prototype=yes
],
[
ace_cv_lib_has_getpgid_prototype=no
])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
],, [AC_DEFINE([ACE_LACKS_GETPGID_PROTOTYPE])])
AH_TEMPLATE([ACE_LACKS_GETPGID_PROTOTYPE],
[Define to 1 if platform lacks getpgid() declaration in <unistd.h>.])
fi
ACE_CHECK_LACKS_FUNCS(getppid)
ACE_CHECK_HAS_FUNCS(getprogname)
ACE_CHECK_HAS_FUNCS(getrusage)
if test $ac_cv_func_getrusage = yes; then
AC_CHECK_DECL([getrusage],
[AC_DEFINE([ACE_HAS_GETRUSAGE_PROTOTYPE], 1,
[Define to 1 if platform has the declaration
of getrusage().])],
[],
[#include <sys/resource.h>])
fi
ACE_CHECK_LACKS_FUNCS(getuid)
ACE_CHECK_LACKS_FUNCS(gmtime)
ACE_CHECK_LACKS_FUNCS(gmtime_r)
ACE_CHECK_LACKS_FUNCS(inet_aton)
ACE_CHECK_LACKS_FUNCS(isatty)
AC_CHECK_FUNC(isastream)
if test $ac_cv_func_isastream = yes; then
AC_CHECK_DECL([isastream],
[AC_DEFINE([ACE_HAS_ISASTREAM_PROTOTYPE], 1,
[Define to 1 if platform has the declaration
of isastream().])],
[],
[#include <stropts.h>])
fi
ACE_CHECK_HAS_FUNCS(itoa)
dnl Check for 64 bit llseek() or lseek64()
case "$host" in
*UnixWare7*)
dnl Skip the check
;;
*)
ACE_CHECK_LSEEK64
;;
esac
ACE_CHECK_LACKS_FUNCS(kill)
ACE_CHECK_LACKS_FUNCS(localtime)
ACE_CHECK_LACKS_FUNCS(log2)
ACE_CHECK_LACKS_FUNCS(lstat)
ACE_CHECK_LACKS_FUNCS(madvise)
if test $ac_cv_func_madvise = yes; then
AC_CHECK_DECL([madvise],
[],
[AC_DEFINE([ACE_LACKS_MADVISE_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of madvise().])],
[
#if !defined(ACE_LACKS_SYS_TYPES_H)
# include <sys/types.h>
#endif
#include <sys/mman.h>
])
fi
ACE_CHECK_HAS_FUNCS(mkdir)
if test "$ac_cv_func_mkdir" = yes; then
dnl The mkdir() function has only one argument on Windows and VxWorks
AC_MSG_CHECKING([for 1- or 2-param mkdir])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <sys/stat.h>
]],
[[
const char path[] = "mypath";
int result = mkdir (path);
]])],
[
AC_DEFINE([ACE_MKDIR_LACKS_MODE], 1,
[Define to 1 if platform has 1 parameter mkdir()])
AC_MSG_RESULT([1])
],
[
AC_MSG_RESULT([2])
])
fi dnl test "$ac_cv_func_mkdir" = yes
ACE_CHECK_HAS_FUNCS(memchr)
ACE_CHECK_LACKS_FUNCS(mkfifo)
ACE_CHECK_LACKS_FUNCS(mkstemp)
if test $ac_cv_func_mkstemp = yes; then
AC_CHECK_DECL([mkstemp],
[],
[AC_DEFINE([ACE_LACKS_MKSTEMP_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of mkstemp().])],
[#include <stdlib.h>])
fi
ACE_CHECK_LACKS_FUNCS(mktemp)
if test $ac_cv_func_mktemp = yes; then
AC_CHECK_DECL([mktemp],
[],
[AC_DEFINE([ACE_LACKS_MKTEMP_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of mktemp().])],
[#include <stdlib.h>])
fi
ACE_CHECK_LACKS_FUNCS(msync mprotect)
ACE_CHECK_LACKS_FUNCS(pipe)
ACE_CHECK_LACKS_FUNCS(qsort)
ACE_CHECK_LACKS_FUNCS(realpath)
ACE_CHECK_LACKS_FUNCS(setegid seteuid setgid)
ACE_CHECK_LACKS_FUNCS([setpgid])
if test "$ac_cv_func_setpgid" = yes; then
dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
dnl needed to make the setpgid() prototype visible.
ACE_CACHE_CHECK([for setpgid prototype],
[ace_cv_lib_has_setpgid_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_EGREP_HEADER([[^_]+setpgid], [unistd.h],
[
ace_cv_lib_has_setpgid_prototype=yes
],
[
ace_cv_lib_has_setpgid_prototype=no
])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
],, [AC_DEFINE([ACE_LACKS_SETPGID_PROTOTYPE])])
AH_TEMPLATE([ACE_LACKS_SETPGID_PROTOTYPE],
[Define to 1 if platform lacks setpgid() declaration in <unistd.h>.])
fi
ACE_CHECK_HAS_FUNCS([setprogname])
ACE_CHECK_LACKS_FUNCS([setregid])
if test "$ac_cv_func_setregid" = yes; then
dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
dnl needed to make the setregid() prototype visible.
ACE_CACHE_CHECK([for setregid prototype],
[ace_cv_lib_has_setregid_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_BSD_SOURCE -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_EGREP_HEADER([[^_]+setregid], [unistd.h],
[
ace_cv_lib_has_setregid_prototype=yes
],
[
ace_cv_lib_has_setregid_prototype=no
])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
],, [AC_DEFINE([ACE_LACKS_SETREGID_PROTOTYPE])])
AH_TEMPLATE([ACE_LACKS_SETREGID_PROTOTYPE],
[Define to 1 if platform lacks setregid() declaration in <unistd.h>.])
fi
ACE_CHECK_LACKS_FUNCS([setreuid])
if test "$ac_cv_func_setreuid" = yes; then
dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
dnl needed to make the setreuid() prototype visible.
ACE_CACHE_CHECK([for setreuid prototype],
[ace_cv_lib_has_setreuid_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_BSD_SOURCE -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_EGREP_HEADER([[^_]+setreuid], [unistd.h],
[
ace_cv_lib_has_setreuid_prototype=yes
],
[
ace_cv_lib_has_setreuid_prototype=no
])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
],, [AC_DEFINE([ACE_LACKS_SETREUID_PROTOTYPE])])
AH_TEMPLATE([ACE_LACKS_SETREUID_PROTOTYPE],
[Define to 1 if platform lacks setreuid() declaration in <unistd.h>.])
fi
ACE_CHECK_LACKS_FUNCS(setsid setuid)
ACE_CHECK_LACKS_FUNCS(sigaction)
ACE_CHECK_HAS_FUNCS(strnlen)
if test "$ac_cv_func_strnlen" = yes; then
AC_CHECK_DECL([strnlen],
[],
[AC_DEFINE([ACE_LACKS_STRNLEN_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of strnlen().])],
[#include <string.h>])
fi
ACE_CHECK_LACKS_FUNCS(strchr)
# believe it or not, both ACE_LACKS_STRERROR and ACE_HAS_STRERROR
# feature test macros are currently used.
ACE_CHECK_HAS_FUNCS(strerror)
ACE_CHECK_LACKS_FUNCS(strerror)
ACE_CHECK_LACKS_FUNCS(strftime)
ACE_CHECK_LACKS_FUNCS(strpbrk)
ACE_CHECK_LACKS_FUNCS(strrchr)
ACE_CHECK_LACKS_FUNCS(strspn)
ACE_CHECK_LACKS_FUNCS(strtod)
ACE_CHECK_LACKS_FUNCS(strtol)
ACE_FUNC_STRTOLL
ACE_CHECK_LACKS_FUNCS(strtoul)
ACE_FUNC_STRTOULL
# swab() comes in a number of forms:
# swab (const void*, void*, size_t) is POSIX, XPG4, SUS, SUSv2 standard.
# swab (const char*, char*, size_t) is SVID third edition.
# swab (char*, char*, size_t) is on some odd platforms like Windows.
# So, if swab() is available, figure out which of the three variants it is.
# The second and third have ACE config settings.
ACE_CHECK_LACKS_FUNCS([swab],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <stdlib.h>
#include <unistd.h>
],
[
// If this compiles, we have the POSIX, XPG4, etc. standard.
const char src[2] = {'a', 'b'};
char dst[2];
const void *vsrc = src;
void *vdst = dst;
swab (vsrc, vdst, 2);
])
],
[
ace_cv_std_swab=yes
],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <stdlib.h>
#include <unistd.h>
],
[
// If this compiles, we have the SVID3 version, else it's the odd,
// non-const one.
const char src[2] = {'a', 'b'};
char dst[2];
swab (src, dst, 2);
])
],
[
AC_DEFINE([ACE_HAS_CONST_CHAR_SWAB])
],
[
AC_DEFINE([ACE_HAS_NONCONST_SWAB])
])
])
],
)
ACE_CHECK_LACKS_FUNCS(sysconf)
ACE_CHECK_HAS_FUNCS(sysctl)
ACE_CHECK_FUNC_SYSINFO
ACE_CHECK_LACKS_FUNCS(system)
AC_CHECK_FUNC([getmsg],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif /* !ACE_LACKS_UNISTD_H */
#ifndef ACE_LACKS_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif /* ACE_LACKS_SYS_IOCTL_H */
#ifdef ACE_HAS_STREAMS
# include <stropts.h>
#endif /* ACE_HAS_STREAMS */
int
main ()
{
int fds[2];
if (pipe (fds) != 0)
return -1;
/*
* Verify that we can actually set a STREAM option that ACE uses.
* This is particularly necessary for platforms where compiling and
* linking succeed but fail at run-time due to a missing actual
* STREAMS implementation. For example, Linux/glibc requires a
* STREAMS patch/add-on.
*/
int arg = RMSGN;
if (ioctl (fds[0], I_SRDOPT, (void *) arg) != 0)
return -1;
return 0;
}
]])],[
AC_DEFINE([ACE_HAS_STREAM_PIPES])
],[],[
dnl action if cross-compiling
AC_DEFINE([ACE_HAS_STREAM_PIPES])
])
],)
AC_CHECK_FUNC([gethostbyaddr],,)
case "$host" in
*linux*)
dnl Linux Event Poll
ACE_CACHE_CHECK([for epoll_create],
[ace_cv_linux_event_poll],
[
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include <sys/epoll.h>
],
[
int const ACE_NUM_DESCRIPTORS = 10;
return epoll_create (ACE_NUM_DESCRIPTORS) == -1 ? -1 : 0;
])
],
[
ace_cv_linux_event_poll=yes
],
[
ace_cv_linux_event_poll=no
])
],
[
AC_DEFINE([ACE_HAS_EVENT_POLL])
],
[])
;;
*)
dnl Check if /dev/poll character device file exists and is
dnl useable. Just because /dev/poll is present doesn't mean its
dnl useable - this is the case on HP-UX 11. /dev/poll is there, but
dnl getting it to work requires a set of patches.
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <sys/devpoll.h>
#include <fcntl.h>
int
main ()
{
int fd = open ("/dev/poll", O_RDWR);
close (fd);
return fd == -1 ? -1 : 0;
}
]])],
[
AC_DEFINE([ACE_HAS_DEV_POLL])
],
[],
[])
;;
esac
AC_CHECK_FUNC([gethrtime])
if test $ac_cv_func_gethrtime = "yes"; then
AC_CHECK_TYPE([hrtime_t],
[AC_DEFINE([ACE_HAS_HI_RES_TIMER], 1,
[Define to 1 if system has SunOS high resolution timer.])],
[],
[#include <sys/time.h>])
fi
AC_CHECK_FUNC([pread],
[AC_CHECK_FUNC([pwrite],
[
AC_DEFINE([ACE_HAS_P_READ_WRITE])
dnl Check if _XOPEN_SOURCE=500 macro is needed to make the pread() and
dnl pwrite() prototypes visible.
ACE_CACHE_CHECK([for pread prototype],
[ace_cv_lib_has_pread_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_XOPEN_SOURCE"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_EGREP_HEADER([[^_]+pread], [unistd.h],
[
ace_cv_lib_has_pread_prototype=yes
],
[
ace_cv_lib_has_pread_prototype=no
])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
],,[AC_DEFINE([ACE_LACKS_PREAD_PROTOTYPE])])
],)],)
ACE_CHECK_LACKS_FUNCS(readv writev)
ACE_CHECK_HAS_FUNCS(set_t_errno)
ACE_CHECK_HAS_FUNCS(sigsuspend sigtimedwait)
ACE_CHECK_LACKS_FUNCS(socketpair)
AC_CHECK_FUNC(strptime)
if test "$ac_cv_func_strptime" = yes; then
dnl strptime() is available, but its prototype is not always visible to
dnl the compiler. Check if _XOPEN_SOURCE macro is needed to make the
dnl strptime() prototype visible.
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_xopen="-U_XOPEN_SOURCE"
CPPFLAGS="$CPPFLAGS $ace_no_xopen"
AC_CHECK_DECL([strptime],
[],
[AC_DEFINE([ACE_LACKS_STRPTIME_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of strptime().])],
[#include <time.h>])
dnl Reset the compiler flags
CPPFLAGS="$ace_save_CPPFLAGS"
else
AC_DEFINE([ACE_LACKS_STRPTIME], 1,
[Define to 1 if platform lacks strptime().])
fi
if test "$ac_cv_type_wchar_t" = yes; then
AC_CHECK_FUNC([wcslen],
[AC_DEFINE([ACE_HAS_XPG4_MULTIBYTE_CHAR])],)
fi
ACE_CHECK_LACKS_FUNCS(syscall)
AC_CHECK_FUNC([alarm],,)
AC_CHECK_FUNC([signal],,)
if test "$ac_cv_func_alarm" != yes &&
test "$ac_cv_func_signal" != yes; then
AC_DEFINE([ACE_LACKS_UNIX_SIGNALS])
fi
AC_CHECK_FUNC([getrlimit])
AC_CHECK_FUNC([setrlimit])
if test "$ac_cv_func_getrlimit" != yes ||
test "$ac_cv_func_setrlimit" != yes; then
AC_DEFINE([ACE_LACKS_RLIMIT])
fi
ACE_CHECK_LACKS_FUNCS(readlink rename recvmsg sendmsg)
if test "$ac_cv_header_sys_priocntl_h" = yes; then
AC_CHECK_FUNC([priocntl],
[AC_DEFINE([ACE_HAS_PRIOCNTL])],)
dnl Some platforms define priocntl as a macro!
if test "$ac_cv_func_priocntl" = no; then
ACE_CACHE_CHECK([for priocntl macro],
[ace_cv_lib_has_priocntl_macro],
[
AC_EGREP_CPP([ACE_PRIOCNTL_MACRO],
[
#include <sys/priocntl.h>
#if defined (priocntl)
ACE_PRIOCNTL_MACRO
#endif
],
[
ace_cv_lib_has_priocntl_macro=yes
],
[
ace_cv_lib_has_priocntl_macro=no
])
], [AC_DEFINE([ACE_HAS_PRIOCNTL])],)
fi dnl test "$ac_cv_func_priocntl" = no
fi dnl test "$ac_cv_header_sys_priocntl_h" = yes
dnl FIXME: How do we check for a working sbrk()? Do we need to?
ACE_CHECK_LACKS_FUNCS(sbrk)
ACE_CHECK_HAS_FUNCS(ualarm)
if test $ac_cv_func_ualarm = yes; then
AC_CHECK_DECL([ualarm],
[],
[AC_DEFINE([ACE_LACKS_UALARM_PROTOTYPE], 1,
[Define to 1 if platform lacks the declaration
of ualarm().])],
[#include <unistd.h>])
fi
ACE_CHECK_LACKS_FUNCS(umask)
ACE_CHECK_LACKS_FUNCS(uname)
ACE_CHECK_LACKS_FUNCS(unlink)
ACE_CHECK_HAS_FUNCS(vasprintf vaswprintf vfwprintf vswprintf)
ACE_CHECK_HAS_FUNCS(wcsnlen)
ACE_CHECK_LACKS_FUNCS(fgetws fputws isblank iswblank isctype iswctype itow towlower towupper wcscat wcschr wcscmp wcscpy wcscspn wcslen wcsncat wcsncmp wcsncpy wcsnicmp wcspbrk wcsrchr wcsspn wcsstr wcstod)
ACE_CHECK_LACKS_FUNCS(wcstok)
if test "$ac_cv_func_wcstok" = yes; then
dnl The wcstok() function varies with standards. Check which one we have.
AC_MSG_CHECKING([for 2- or 3-param wcstok])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <wchar.h>
]],
[[
wchar_t str[] = L"junk";
const wchar_t delim[] = L"\t\n";
wchar_t *ptr;
wchar_t *p = wcstok (str, delim, &ptr);
]])],
[
AC_DEFINE([ACE_HAS_3_PARAM_WCSTOK], 1,
[Define to 1 if platform has 3 parameter wcstok()])
AC_MSG_RESULT([3])
],
[
AC_MSG_RESULT([2])
])
fi dnl test "$ac_cv_func_wcstok" = yes
ACE_CHECK_LACKS_FUNCS(wcstol)
ACE_FUNC_WCSTOLL
ACE_CHECK_LACKS_FUNCS(wcstoul)
ACE_FUNC_WCSTOULL
dnl Check for SYSV IPC functions
dnl
dnl Although Darwin/OS X does not implement any of the SysV IPC API,
dnl its C library contains stubs for all the system calls (probably
dnl left over from the BSD libc). This causes false positives from
dnl AC_CHECK_FUNC which results in configure reporting that SysV IPC
dnl is supported. We avoid this problem by avoiding the function
dnl checks if the cooresponding headers were not detected earlier.
dnl
if test "$ac_cv_header_sys_msg_h" = yes; then
AC_CHECK_FUNC([msgctl],,)
AC_CHECK_FUNC([msgget],,)
AC_CHECK_FUNC([msgrcv],,)
fi dnl test "$ac_cv_header_sys_msg_h" = yes
if test "$ac_cv_header_sys_sem_h" = yes; then
AC_CHECK_FUNC([semctl],,)
AC_CHECK_FUNC([semget],,)
AC_CHECK_FUNC([semop],,)
fi dnl test "$ac_cv_header_sys_sem_h" = yes
if test "$ac_cv_header_sys_shm_h" = yes; then
AC_CHECK_FUNC([shmat],,)
AC_CHECK_FUNC([shmctl],,)
AC_CHECK_FUNC([shmdt],,)
AC_CHECK_FUNC([shmget],,)
fi dnl test "$ac_cv_header_sys_shm_h" = yes
dnl End check for SYSV IPC functions
AC_CHECK_FUNC([read_real_time],
[AC_DEFINE([ACE_HAS_AIX_HI_RES_TIMER])],)
dnl See shm_open() test after this one ...
dnl AC_CHECK_FUNC([shm_open], [AC_DEFINE([ACE_HAS_SHM_OPEN])],)
dnl Use a more comprehensive test for shm_open() since the prototype
dnl may not be visible on all platforms without enabling POSIX.1b
dnl support (e.g. when the user defines _POSIX_C_SOURCE > 2).
AC_MSG_CHECKING([for shm_open])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
]],
[[
const char name[] = "Foo";
const int oflag = O_RDONLY;
const mode_t mode = 0400; /* Whatever */
const int fd = shm_open (name, oflag, mode);
]])],
[
AC_DEFINE([ACE_HAS_SHM_OPEN])
AC_MSG_RESULT([yes])
dnl Now see if running it requires a leading slash.
ACE_CACHE_CHECK([if shm_open requires one slash],
[ace_cv_shm_open_requires_one_slash],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
int main (int argc, char *argv[])
{
const char name[] = "ACE_Foo";
const char name2[] = "/ACE_Foo";
const int oflag = O_RDWR | O_CREAT;
const mode_t mode = 0400; /* Whatever */
int fd = shm_open (name, oflag, mode);
if (fd != -1)
{
close (fd);
shm_unlink (name);
return 1; /* Don't need the slash */
}
fd = shm_open (name2, oflag, mode);
if (fd != -1)
{
close (fd);
shm_unlink (name2);
return 0;
}
return 1; /* Nothing worked, so say 'no' */
}
]])],[
ace_cv_shm_open_requires_one_slash=yes
],[
ace_cv_shm_open_requires_one_slash=no
],[
dnl action if cross-compiling
ace_cv_shm_open_requires_one_slash=no
])
],AC_DEFINE([ACE_SHM_OPEN_REQUIRES_ONE_SLASH]),)
],
[
AC_MSG_RESULT([no])
])
dnl if test "$ace_cv_shm_open_requires_one_slash" = yes; then
dnl AC_DEFINE([ACE_SHM_OPEN_REQUIRES_ONE_SLASH])
dnl fi
ACE_CHECK_HAS_FUNCS(snprintf)
ACE_CHECK_LACKS_FUNCS(tempnam truncate)
dnl Save the cache for debugging purposes
AC_CACHE_SAVE
dnl Check for POSIX Semaphore functions
dnl We only check for a few of them since some platforms don't have these.
dnl On some platforms, a separate library is required, so use AC_SEARCH_LIBS
dnl instead of AC_CHECK_FUNC. This will add any needed library to LIBS.
AC_SEARCH_LIBS([sem_init],rt,[ace_cv_func_sem_init=yes],,)
AC_SEARCH_LIBS([sem_destroy],rt,[ace_cv_func_sem_destroy=yes],,)
if test "$ace_cv_func_sem_init" = yes &&
test "$ace_cv_func_sem_destroy" = yes &&
test "$ac_cv_type_sem_t" = yes; then
dnl Only enable POSIX semaphore support if process shared semaphores
dnl are supported. Presumably process shared semaphores are only
dnl available if the _POSIX_THREAD_PROCESS_SHARED macro is defined by
dnl the platform.
AC_EGREP_CPP([WE_HAVE_SHARED_POSIX_SEMAPHORES],
[
#ifndef _REENTRANT
#define _REENTRANT
#endif
#ifndef _THREAD_SAFE
#define _THREAD_SAFE
#endif
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h> /* needed for _POSIX_THREAD_PROCESS_SHARED */
#endif
#include <pthread.h>
#include <semaphore.h>
#if defined (_POSIX_THREAD_PROCESS_SHARED)
WE_HAVE_SHARED_POSIX_SEMAPHORES
#endif
],
[
AC_DEFINE([ACE_HAS_POSIX_SEM])
AC_CHECK_FUNC([sem_open])
AC_CHECK_FUNC([sem_close])
AC_CHECK_FUNC([sem_unlink])
if test "$ac_cv_func_sem_open" = no ||
test "$ac_cv_func_sem_close" = no ||
test "$ac_cv_func_sem_unlink" = no; then
AC_DEFINE([ACE_LACKS_NAMED_POSIX_SEM])
else
dnl Check if it works! For example, in glibc 2.x sem_open exists
dnl but it appears to be a stub. However, it isn't listed as a
dnl stub in <gnu/stubs.h> so the configure script thinks it is
dnl implemented!
ACE_CACHE_CHECK([if sem_open works],
[ace_cv_sem_open_works],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef ACE_LACKS_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <stddef.h> /* for definition of "NULL" */
#include <semaphore.h>
#ifndef SEM_FAILED
# define SEM_FAILED ((sem_t *) -1)
#endif
int
main ()
{
sem_t *s = 0;
s = sem_open ("ace_semaphore_foo", O_CREAT | O_EXCL, 0600, 1);
if (s == SEM_FAILED)
return -1; /* FAILURE */
sem_unlink ("ace_semaphore_foo");
if (sem_close (s) != 0)
return -1; /* Something went wrong! */
return 0;
}
]])],[
ace_cv_sem_open_works=yes
],[
ace_cv_sem_open_works=no
],[
dnl action if cross-compiling
ace_cv_sem_open_works=yes
])
],, [AC_DEFINE([ACE_LACKS_NAMED_POSIX_SEM])])
fi
],)
fi dnl check for POSIX Semaphore functions
dnl If we have POSIX semaphores available, check to see if we also have
dnl the timed wait capability.
if test "$ac_cv_func_sem_open" = yes &&
test "$ac_cv_func_sem_close" = yes &&
test "$ac_cv_func_sem_unlink" = yes; then
dnl Check if sem_timedwait() works - often it compiles and will run
dnl but if called return ENOTSUP. In that case, we don't want it.
ACE_CACHE_CHECK([if sem_timedwait works],
[ace_cv_sem_timedwait_works],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef ACE_LACKS_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <stddef.h> /* for definition of "NULL" */
#if !defined (ACE_LACKS_ERRNO_H)
# include <errno.h>
#endif
#include <semaphore.h>
#ifndef SEM_FAILED
# define SEM_FAILED ((sem_t *) -1)
#endif
int
main ()
{
sem_t *s = 0;
struct timespec tmo;
int status = 0;
s = sem_open ("ace_semaphore_foo", O_CREAT, 0600, 1);
if (s == SEM_FAILED)
return -1; /* FAILURE */
/* Don't care about the time, only whether the call works */
tmo.tv_sec = 0;
tmo.tv_nsec = 0;
if (sem_timedwait (s, &tmo) == -1)
{
if (errno == ENOTSUP)
status = -1;
}
else
sem_post (s);
sem_unlink ("ace_semaphore_foo");
sem_close (s);
return status;
}
]])],[
ace_cv_sem_timedwait_works=yes
],[
ace_cv_sem_timedwait_works=no
],[
dnl action if cross-compiling
ace_cv_sem_timedwait_works=yes
])
],
[AC_DEFINE([ACE_HAS_POSIX_SEM_TIMEOUT])],)
fi
dnl The following tests are performed only when the user has enabled
dnl support for threads.
dnl NOTE: Make sure the thread library is in "LIBS"
dnl (e.g.: LIBS="$LIBS -lpthread")
dnl otherwise the below thread "CHECK_FUNCs"
dnl will not work correctly.
if test "$ace_user_enable_threads" = yes; then
if test "$ace_has_pthreads" = yes; then
dnl Digital UNIX 4.0 "mangles" the following pthread functions:
dnl pthread_attr_getguardsize_np
dnl pthread_attr_getinheritsched
dnl pthread_attr_getstacksize
dnl pthread_attr_setguardsize_np
dnl pthread_attr_setinheritsched
dnl pthread_attr_setstacksize
dnl pthread_cancel
dnl pthread_cond_broadcast
dnl pthread_cond_destroy
dnl pthread_cond_init
dnl pthread_cond_sig_preempt_int_np
dnl pthread_cond_signal
dnl pthread_cond_signal_int_np
dnl pthread_cond_timedwait
dnl pthread_cond_wait
dnl pthread_create
dnl pthread_delay_np
dnl pthread_detach
dnl pthread_equal
dnl pthread_exit
dnl pthread_get_expiration_np
dnl pthread_getspecific
dnl pthread_join
dnl pthread_lock_global_np
dnl pthread_mutex_destroy
dnl pthread_mutex_init
dnl pthread_mutex_lock
dnl pthread_mutex_trylock
dnl pthread_mutex_unlock
dnl pthread_once
dnl pthread_self
dnl pthread_setspecific
dnl pthread_testcancel
dnl pthread_unlock_global_np
dnl These functions have a double underscore "__" prepended to maintain
dnl backwards compatibility with Pthread Draft 4 functions of the same
dnl name.
ACE_CHECK_LACKS_FUNCS(pthread_sigmask)
if test $ac_cv_func_pthread_sigmask = yes; then
AC_CHECK_DECL([pthread_sigmask],
[AC_DEFINE([ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE], 1,
[Define to 1 if platform has the declaration
of pthread_sigmask().])],
[],
[#include <pthread.h>
#include <signal.h>])
fi
AC_CHECK_FUNC([pthread_key_create],
[AC_DEFINE([ACE_HAS_THREAD_SPECIFIC_STORAGE])],
[
AC_CHECK_FUNC([pthread_keycreate],
[AC_DEFINE(ACE_HAS_THREAD_SPECIFIC_STORAGE)],
[AC_DEFINE(ACE_HAS_TSS_EMULATION)])
])
ACE_CHECK_HAS_FUNCS(pthread_condattr_setkind_np)
ACE_CHECK_HAS_FUNCS(pthread_mutexattr_setkind_np)
dnl Can't use ACE_CHECK_LACKS_FUNCS because the macro doesn't match the
dnl tested function name.
AC_CHECK_FUNC([pthread_condattr_setpshared],
[],
[AC_DEFINE([ACE_LACKS_CONDATTR_PSHARED], 1,
[Define to 1 if system lacks pthread_condattr_setpshared()])])
dnl ACE_CHECK_LACKS_FUNCS(pthread_attr_setstack)
dnl Can't use ACE_CHECK_LACKS_FUNCS because the lower-down AC macros build
dnl a program with a stubbed-out pthread_attr_setstack(), avoiding the need
dnl to see pthread_attr_setstack() in pthreads.h. This is usually not a
dnl problem since the link will fail. However, on HP-UX 11iv2 there is a
dnl pthread_attr_setstack() in libpthread, but not in the header. Thus,
dnl the test passes, but ACE build fails. Don't hack in use of this until
dnl HP sees fit to include it in pthread.h (which it does at 11iv3).
AC_MSG_CHECKING([for pthread_attr_setstack])
AH_TEMPLATE([ACE_LACKS_PTHREAD_ATTR_SETSTACK],
[Define to 1 if platform lacks pthread_attr_setstack()])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <pthread.h>
]],
[[
pthread_attr_t attr;
void *stack;
size_t size;
pthread_attr_setstack (&attr, stack, size);
]])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([ACE_LACKS_PTHREAD_ATTR_SETSTACK])
])
ACE_CHECK_LACKS_FUNCS(pthread_attr_setstackaddr)
ACE_CHECK_LACKS_FUNCS(pthread_attr_setstacksize)
ACE_CHECK_FUNC([pthread_cancel], [pthread.h],
[
dnl Make sure the prototype actually exists. Some platforms,
dnl such as FreeBSD 4, appear to have a missing prototype. If
dnl the prototype is missing, then don't use pthread_cancel.
dnl Creating a prototype for it in ACE is probably a bad idea.
ace_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ACE_THR_CPPFLAGS"
AC_EGREP_HEADER([pthread_cancel], [pthread.h],,
[
AC_DEFINE([ACE_LACKS_PTHREAD_CANCEL])
])
dnl Reset the preprocessor flags
CPPFLAGS="$ace_save_CPPFLAGS"
],
[
AC_DEFINE([ACE_LACKS_PTHREAD_CANCEL])
])
ACE_CHECK_LACKS_FUNCS(pthread_yield)
ACE_CHECK_LACKS_FUNCS(pthread_thr_sigsetmask)
AC_CHECK_FUNC([pthread_attr_setdetachstate],
,
[AC_DEFINE([ACE_LACKS_SETDETACH])])
dnl ACE currently doesn't provide enough fine grained control over
dnl these functions so both must be present in order to prevent
dnl ACE_LACKS_SETSCHED from being defined.
AC_CHECK_FUNC([sched_setscheduler],
[
AC_CHECK_FUNC([pthread_attr_setschedpolicy],,
[AC_CHECK_FUNC([pthread_attr_setsched],,
[AC_DEFINE([ACE_LACKS_SETSCHED])])])
],
[
AC_DEFINE([ACE_LACKS_SETSCHED])
])
AC_CHECK_FUNC([pthread_attr_setscope],
[],
[AC_DEFINE([ACE_LACKS_THREAD_PROCESS_SCOPING])])
AC_CHECK_FUNC([pthread_mutexattr_setpshared],
[],
[AC_DEFINE([ACE_LACKS_MUTEXATTR_PSHARED], 1,
[Define to 1 if system lacks pthread_mutexattr_setpshared().])])
dnl Check for POSIX Threads Draft 4 functions
AC_CHECK_FUNC([pthread_mutexattr_create],,)
AC_CHECK_FUNC([pthread_mutexattr_delete],,)
AC_CHECK_FUNC([pthread_condattr_delete],,)
AC_CHECK_FUNC([pthread_condattr_create],,)
AC_CHECK_FUNC([pthread_setprio],,)
AC_CHECK_FUNC([pthread_getprio],,)
AC_CHECK_FUNC([pthread_setcancel],,)
AC_CHECK_FUNC([pthread_setasynccancel],,)
AC_CHECK_FUNC([pthread_kill],,)
dnl Check for POSIX Threads Draft 6 functions
AC_CHECK_FUNC([pthread_attr_setprio],,)
AC_CHECK_FUNC([pthread_attr_getprio],,)
AC_CHECK_FUNC([pthread_setintr],,)
AC_CHECK_FUNC([pthread_setintrtype],,)
dnl Check for POSIX threads Draft 6, 7 and Standard common functions
AC_CHECK_FUNC([pthread_mutexattr_init],,)
AC_CHECK_FUNC([pthread_mutexattr_destroy],,)
AC_CHECK_FUNC([pthread_condattr_init],,)
AC_CHECK_FUNC([pthread_condattr_destroy],,)
dnl Check for POSIX Threads Draft 7 and Draft Standard common functions
AC_CHECK_FUNC([pthread_setschedparam],,)
AC_CHECK_FUNC([pthread_getschedparam],,)
AC_CHECK_FUNC([pthread_setcancelstate],,)
AC_CHECK_FUNC([pthread_setcanceltype],,)
dnl Check for POSIX Threads Draft Standard functions
dnl sched_yield() is in the C library or perhaps in "-lposix4."
dnl We need to add other library checks in this script's "check libraries"
dnl section if it is in another library.
dnl AC_CHECK_FUNC(sched_yield,,)
dnl We already check for this during the library checks.
dnl Check for Unix98 pthreads extensions
AC_CHECK_TYPE([pthread_rwlock_t],
[],
[],
[
#ifndef ACE_LACKS_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <pthread.h>])
AC_CHECK_TYPE([pthread_rwlockattr_t],
[],
[],
[
#ifndef ACE_LACKS_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <pthread.h>])
ACE_CHECK_HAS_FUNCS(pthread_continue pthread_continue_np pthread_resume_np pthread_suspend pthread_suspend_np)
ACE_CHECK_HAS_FUNCS(pthread_getconcurrency pthread_setconcurrency)
ACE_CHECK_HAS_FUNCS(pthread_attr_setcreatesuspend_np)
dnl Don't test for pthread_getaffinity_np() or pthread_setaffinity_np()
dnl if the system doesn't also have cpu_set_t. The functions are almost
dnl certainly incompatible with our wrapper facade, as we use a "dummy"
dnl cpu_set_t defined in ace/os_include/os_sched.h.
if test "$ac_cv_type_cpu_set_t" = yes; then
ACE_CHECK_HAS_FUNCS(pthread_getaffinity_np pthread_setaffinity_np)
fi
dnl Linux's sched_{set,get}affinity interface has changed three times:
dnl
dnl In glibc 2.3.2, it was:
dnl
dnl int sched_setaffinity(pid_t __pid,
dnl unsigned int __len, unsigned long * __mask);
dnl
dnl In glibc 2.3.3, it was changed to:
dnl
dnl int sched_setaffinity(pid_t __pid, const cpu_set_t* __mask);
dnl
dnl And in glibc ?.?.?, it was changed again to:
dnl
dnl int sched_setaffinity(pid_t __pid, size_t __cpusetsize,
dnl const cpu_set_t* __cpuset);
dnl
dnl The following feature tests attempt to determine which (if any)
dnl version is supported by the system. A further complication is
dnl that the C library may support one version, the kernel may not,
dnl and vice versa.
dnl
dnl As of this writing, ACE's ACE_OS::sched_setaffinity() wrapper
dnl facade implementation only supports the latter two varients. So
dnl if the system doesn't define cpu_set_t, we simply avoid checking
dnl for sched_setaffinity(). No attempt is made to verify C library /
dnl kernel consistency.
dnl
dnl The "right" thing to do is to implement something similar to the
dnl PLPA (Portable Linux Processor Affinity) Library, converting the
dnl arguments and invoking the syscall directly (instead of calling
dnl the C library wrapper).
dnl
if test "$ac_cv_type_cpu_set_t" = yes; then
ACE_CHECK_HAS_FUNCS(sched_getaffinity)
if test "$ac_cv_func_sched_getaffinity" = yes; then
dnl The sched_getaffinity() function varies between linux versions
dnl Check which one we have.
AC_MSG_CHECKING([for 2- or 3-param sched_getaffinity])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#if !defined(ACE_LACKS_SYS_TYPES_H)
#include <sys/types.h>
#endif
#if !defined(ACE_LACKS_SCHED_H)
#include <sched.h>
#endif
]],
[[
pid_t pid;
cpu_set_t cpuset;
sched_getaffinity(pid, sizeof(cpuset), &cpuset);
]])],
[
AC_MSG_RESULT([3])
],
[
AC_MSG_RESULT([2])
AC_DEFINE([ACE_HAS_2_PARAM_SCHED_GETAFFINITY], 1,
[Define to 1 if platform has 2 parameter sched_getaffinity()])
])
fi dnl test "$ac_cv_func_sched_getaffinity" = yes
ACE_CHECK_HAS_FUNCS(sched_setaffinity)
if test "$ac_cv_func_sched_setaffinity" = yes; then
dnl The sched_setaffinity() function varies between linux versions
dnl Check which one we have.
AC_MSG_CHECKING([for 2- or 3-param sched_setaffinity])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#if !defined(ACE_LACKS_SYS_TYPES_H)
#include <sys/types.h>
#endif
#if !defined(ACE_LACKS_SCHED_H)
#include <sched.h>
#endif
]],
[[
pid_t pid;
cpu_set_t cpuset;
sched_setaffinity(pid, sizeof(cpuset), &cpuset);
]])],
[
AC_MSG_RESULT([3])
],
[
AC_MSG_RESULT([2])
AC_DEFINE([ACE_HAS_2_PARAM_SCHED_SETAFFINITY], 1,
[Define to 1 if platform has 2 parameter sched_setaffinity()])
])
fi dnl test "$ac_cv_func_sched_setaffinity" = yes
fi dnl test "$ac_cv_type_cpu_set_t" = yes
AC_CHECK_FUNC([pthread_rwlock_init],,)
AC_CHECK_FUNC([pthread_rwlock_destroy],,)
AC_CHECK_FUNC([pthread_rwlock_rdlock],,)
AC_CHECK_FUNC([pthread_rwlock_wrlock],,)
AC_CHECK_FUNC([pthread_rwlock_unlock],,)
AC_CHECK_FUNC([pthread_rwlock_tryrdlock],,)
AC_CHECK_FUNC([pthread_rwlock_trywrlock],,)
AC_CHECK_FUNC([pthread_rwlockattr_init],,)
AC_CHECK_FUNC([pthread_rwlockattr_destroy],,)
AC_CHECK_FUNC([pthread_rwlockattr_setpshared],
[],
[AC_DEFINE([ACE_LACKS_RWLOCKATTR_PSHARED], 1,
[Define to 1 if system lacks pthread_rwlockattr_setpshared().])])
if test "$ac_cv_type_pthread_rwlock_t" = yes &&
test "$ac_cv_type_pthread_rwlockattr_t" = yes &&
test "$ac_cv_func_pthread_rwlock_init" = yes &&
test "$ac_cv_func_pthread_rwlock_destroy" = yes &&
test "$ac_cv_func_pthread_rwlock_rdlock" = yes &&
test "$ac_cv_func_pthread_rwlock_wrlock" = yes &&
test "$ac_cv_func_pthread_rwlock_unlock" = yes &&
test "$ac_cv_func_pthread_rwlock_tryrdlock" = yes &&
test "$ac_cv_func_pthread_rwlock_trywrlock" = yes &&
test "$ac_cv_func_pthread_rwlockattr_init" = yes &&
test "$ac_cv_func_pthread_rwlockattr_destroy" = yes; then
AC_DEFINE([ACE_HAS_PTHREADS_UNIX98_EXT])
fi dnl Unix98 pthreads extensions
dnl Check if platform has thread_self() rather than pthread_self()
ACE_CHECK_FUNC([pthread_self], [pthread.h],
,
[
AC_CHECK_FUNC([thread_self],
[
AC_DEFINE([ACE_HAS_THREAD_SELF])
],)
])
dnl Check if pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and
dnl PTHREAD_PROCESS_SHARED values.
ACE_CACHE_CHECK([for PTHREAD_PROCESS_* enumeration in pthread.h],
[ace_cv_lib_pthread_process_enum],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
/* Undefine PTHREAD_PROCESS_SHARED in case some platforms #define it */
#undef PTHREAD_PROCESS_SHARED
int foo = PTHREAD_PROCESS_SHARED;
]])],[
ace_cv_lib_pthread_process_enum=yes
],[
ace_cv_lib_pthread_process_enum=no
])
],
[
AC_DEFINE([ACE_HAS_PTHREAD_PROCESS_ENUM])
],)
dnl Check if pthread_create requires an extern "C" start routine
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if pthread_create requires an extern "C" start routine],
[ace_cv_lib_pthread_c_func],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
void *ace_start_routine(void *);
]], [[
pthread_create(0, 0, ace_start_routine, 0);
]])],[
ace_cv_lib_pthread_c_func=no
],[
dnl Check if extern "C" start routine is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <pthread.h>
extern "C" void *ace_start_routine(void *);
]],
[[
pthread_create(0, 0, ace_start_routine, 0);
]])],
[
ace_cv_lib_pthread_c_func=yes
],
[
ace_cv_lib_pthread_c_func=no
])
])
],
[
AC_DEFINE([ACE_HAS_THR_C_FUNC])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if pthread_key_create has a standard arg thread destructor
ACE_CACHE_CHECK([if pthread_key_create has std arg thread destructor],
[ace_cv_lib_pthread_stdarg_dest],[
if test "$ac_cv_func_pthread_key_create" = yes; then
ace_pthread_key_create=pthread_key_create
else
ace_pthread_key_create=pthread_keycreate
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
void ace_destructor(void *);
]], [[
${ace_pthread_key_create}(0, ace_destructor);
]])],[
ace_cv_lib_pthread_stdarg_dest=no
],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <pthread.h>
void ace_destructor(...);
]],
[[
${ace_pthread_key_create}(0, ace_destructor);
]])],
[
ace_cv_lib_pthread_stdarg_dest=yes
],
[
ace_cv_lib_pthread_stdarg_dest=no
])
])
],
[
AC_DEFINE([ACE_HAS_STDARG_THR_DEST])
],)
dnl Check if pthread_key_create requires an extern "C" start routine
ACE_CONVERT_WARNINGS_TO_ERRORS([
ACE_CACHE_CHECK([if pthread_key_create requires an extern "C" start routine],
[ace_cv_lib_pthread_c_dest],[
if test "$ac_cv_func_pthread_key_create" = yes; then
ace_pthread_key_create=pthread_key_create
else
ace_pthread_key_create=pthread_keycreate
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
void ace_destructor(void *);
]], [[
${ace_pthread_key_create}(0, ace_destructor);
]])],[
ace_cv_lib_pthread_c_dest=no
],[
dnl Check if extern "C" start routine is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <pthread.h>
extern "C" void ace_destructor(void *);
]],
[[
${ace_pthread_key_create}(0, ace_destructor);
]])],
[
ace_cv_lib_pthread_c_dest=yes
],
[
ace_cv_lib_pthread_c_dest=no
])
])
],
[
AC_DEFINE([ACE_HAS_THR_C_DEST])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
AC_CHECK_FUNC([sched_get_priority_min],,
[
dnl Check if the PTHREAD_MIN_PRIORITY constant exists.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
int p = (int) PTHREAD_MIN_PRIORITY;
]])
],
[
dnl Since we have PTHREAD_MIN_PRIORITY, denote that PX_PRIO_MIN
dnl should not be used.
ace_has_px_prio_min=no
],
[
dnl PTHREAD_MIN_PRIORITY doesn't appear to be defined, so
dnl check if the platform defines PX_PRIO_MIN, instead.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
int p = (int) PX_PRIO_MIN;
]])],
[
ace_has_px_prio_min=yes
],
[
ace_has_px_prio_min=no
])
])
])
if test "$ace_has_px_prio_min" = yes; then
AC_DEFINE([PTHREAD_MIN_PRIORITY],
[PX_PRIO_MIN],
[Minimum thread priority])
fi
AC_CHECK_FUNC([sched_get_priority_max],,
[
dnl Check if the PTHREAD_MAX_PRIORITY constant exists.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
int p = (int) PTHREAD_MAX_PRIORITY;
]])
],
[
dnl Since we have PTHREAD_MAX_PRIORITY, denote that PX_PRIO_MAX
dnl should not be used.
ace_has_px_prio_max=no
],
[
dnl PTHREAD_MAX_PRIORITY doesn't appear to be defined, so
dnl check if the platform defines PX_PRIO_MAX, instead.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
]], [[
int p = (int) PX_PRIO_MAX;
]])],
[
ace_has_px_prio_max=yes
],
[
ace_has_px_prio_max=no
])
])
])
if test "$ace_has_px_prio_max" = yes; then
AC_DEFINE([PTHREAD_MAX_PRIORITY],
[PX_PRIO_MAX],
[Maximum thread priority])
fi
fi dnl test "$ace_has_pthreads" = yes
if test "$ace_has_sthreads" = yes; then
dnl Only check for these functions if we have the UNIX International
dnl Threads library "thread."
AC_CHECK_FUNC([thr_keycreate],
[AC_DEFINE([ACE_HAS_THREAD_SPECIFIC_STORAGE])],
[AC_DEFINE([ACE_HAS_TSS_EMULATION])])
AC_CHECK_FUNC([thr_yield],
[AC_DEFINE([ACE_HAS_THR_YIELD])],)
AC_CHECK_FUNC([thr_keydelete],
[AC_DEFINE([ACE_HAS_THR_KEYDELETE])],)
AC_CHECK_FUNC([thr_min_stack],[],
[
AC_CHECK_FUNC([thr_minstack],
[AC_DEFINE([ACE_HAS_THR_MINSTACK])],)
])
fi dnl test "$ace_has_sthreads" = yes
fi dnl test "$ace_user_enable_threads" = yes
dnl
dnl By Eric:
dnl ACE will define a sigwait function if we lie and say we don't have
dnl one. Unfortunately, the ACE function may conflict with our
dnl function, so we'll go ahead and turn this on, even if we are
dnl ignoring threads.
ACE_CHECK_HAS_FUNCS(sigwait)
dnl Check for reentrant functions
if test "$ace_user_enable_reentrant_funcs" = yes; then
AC_CHECK_FUNC([rand_r])
AC_CHECK_FUNC([strtok_r],
[
dnl Check if _POSIX_SOURCE macro is needed to make the strtok_r()
dnl prototype visible.
ACE_CACHE_CHECK([for strtok_r prototype],
[ace_cv_lib_has_strtok_r_prototype],
[
ace_save_CPPFLAGS="$CPPFLAGS"
ace_no_posix="-U_POSIX_SOURCE $ACE_THR_CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ace_no_posix"
AC_EGREP_HEADER([[^_]+strtok_r], [string.h],
[
ace_cv_lib_has_strtok_r_prototype=yes
],
[
ace_cv_lib_has_strtok_r_prototype=no
])
dnl Reset the preprocessor flags
CPPFLAGS="$ace_save_CPPFLAGS"
],, [AC_DEFINE([ACE_LACKS_STRTOK_R_PROTOTYPE])])
],)
AC_CHECK_FUNC([getpwnam_r],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _REENTRANT
# define _REENTRANT
#endif
#ifndef ACE_LACKS_PWD_H
# include <pwd.h>
#endif
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
]],
[[
const char * name;
struct passwd * pwent;
char * buffer;
int buflen;
struct passwd * result;
int status = getpwnam_r (name, pwent, buffer, buflen, &result);
]])],
[
if test "$ace_user_enable_reentrant_funcs" = yes; then
AC_DEFINE([ACE_HAS_POSIX_GETPWNAM_R])
fi
],
[
dnl Nothing to do!
])
],
[AC_DEFINE([ACE_LACKS_PWD_REENTRANT_FUNCTIONS])])
AC_CHECK_FUNC([ctime_r],,)
AC_CHECK_FUNC([localtime_r],,)
AC_CHECK_FUNC([gmtime_r],,)
AC_CHECK_FUNC([asctime_r],,)
AC_CHECK_FUNC([getprotobyname_r],,)
AC_CHECK_FUNC([getprotobynumber_r],,)
AC_CHECK_FUNC([gethostbyaddr_r],,)
AC_CHECK_FUNC([gethostbyname_r],,)
AC_CHECK_FUNC([getservbyname_r],,)
fi dnl End checks for reentrant functions
ACE_CHECK_LACKS_FUNCS(readdir_r)
if test "$ac_cv_func_readdir_r" = yes; then
dnl The readdir_r() function varies with standards. Check which one we have.
AC_MSG_CHECKING([for 2- or 3-param readdir_r])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <dirent.h>
]],
[[
readdir_r(0, 0, 0);
]])],
[
AC_DEFINE([ACE_HAS_3_PARAM_READDIR_R], 1,
[Define to 1 if platform has 3 parameter readdir_r()])
AC_MSG_RESULT([3])
],
[
AC_MSG_RESULT([2])
])
fi dnl test "$ac_cv_func_readdir" = yes
dnl Disabled until we figure out what to do with the comparator
dnl function argument inconsistencies between different platforms.
dnl For example:
dnl int comparator (const void * d1, const void * d2)
dnl instead of:
dnl int comparator (const dirent ** d1, const dirent ** d2)
dnl
dnl ACE_CHECK_HAS_FUNCS([scandir])
ACE_CHECK_LACKS_FUNCS(seekdir telldir)
dnl
dnl SECTION 11: checks for function characteristics
dnl
ACE_CONVERT_WARNINGS_TO_ERRORS([
dnl Check if dlopen takes a char * arg instead of const char *
if test "$ace_has_svr4_dynamic_linking" = yes; then
ACE_CACHE_CHECK([if dlopen takes a char *],
[ace_cv_lib_charptr_dl],
[
dnl Check if it takes a const char *, first.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <dlfcn.h>
]], [[
const char *filename = 0;
int flag = 0;
void *ptr = dlopen(filename, flag);
]])],[
ace_cv_lib_charptr_dl=no
],[
dnl Now check if it takes a non-const char *.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <dlfcn.h>
]],
[[
char *filename = 0;
int flag = 0;
void *ptr = dlopen(filename, flag);
]])],
[
ace_cv_lib_charptr_dl=yes
],
[
ace_cv_lib_charptr_dl=no
])
])
], [AC_DEFINE([ACE_HAS_CHARPTR_DL])],)
fi dnl test "$ace_has_svr4_dynamic_linking" = yes
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
ACE_CONVERT_WARNINGS_TO_ERRORS([
dnl Check if "getby" functions use a non-const char * argument
if test "$ac_cv_func_gethostbyaddr" = yes; then
ACE_CACHE_CHECK(["getby" functions take a non-const char *],
[ace_cv_lib_nonconst_getby],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/socket.h>
]], [[
char *addr = 0;
int len = 0;
int type = 0;
struct hostent *mystruct = 0;
mystruct = gethostbyaddr(name, len, type);
]])],[
ace_cv_lib_nonconst_getby=yes
],[
ace_cv_lib_nonconst_getby=no
])
], [AC_DEFINE([ACE_HAS_NONCONST_GETBY])],)
fi dnl test "$ac_cv_func_gethostbyaddr" = yes
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if new throws exception upon failure
if test "$ace_user_enable_exceptions" = yes; then
ACE_CACHE_CHECK([if new throws std::bad_alloc exception on failure],
[ace_cv_new_throws_bad_alloc_exception],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif
#if defined (ACE_HAS_STDEXCEPT_NO_H)
# include <stdexcept>
#elif defined (ACE_HAS_EXCEPTION_H)
# include <exception.h>
#endif
/* We already checked for ACE_LACKS_NUMERIC_LIMITS */
#if !defined ACE_LACKS_NUMERIC_LIMITS
#include <limits>
#endif
/* We already checked for ACE_LACKS_SYS_RESOURCE_H */
#if !defined ACE_LACKS_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
int main(int, char *[]) {
#if defined ACE_LACKS_NUMERIC_LIMITS
const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
#else
const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
#endif
#if !defined (ACE_LACKS_RLIMIT)
/* set memory limit to the allocation size, so this test
should terminate on the first iteration. */
struct rlimit rlimit;
if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
rlimit.rlim_cur = ALLOC_SIZE;
setrlimit(RLIMIT_DATA, &rlimit);
}
#endif
while (1) {
try {
char *a = new char[ALLOC_SIZE];
if (a == 0) {
return 1; /* new() does NOT throw exceptions */
}
}
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
catch (std::bad_alloc)
#else
catch (bad_alloc)
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
{
return 0; /* new() does throw exceptions */
}
};
return 1; /* ERROR: We shouldn't get this far! */
}
]])],[
ace_cv_new_throws_bad_alloc_exception=yes
],[
ace_cv_new_throws_bad_alloc_exception=no
],[
ace_cv_new_throws_bad_alloc_exception=no
])
], [AC_DEFINE([ACE_NEW_THROWS_EXCEPTIONS])],)
if test "$ace_cv_new_throws_bad_alloc_exception" != yes; then
ACE_CACHE_CHECK([if new throws xalloc exception on failure],
[ace_cv_new_throws_xalloc_exception],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif
#if defined (ACE_HAS_STDEXCEPT_NO_H)
# include <stdexcept>
#elif defined (ACE_HAS_EXCEPTION_H)
# include <exception.h>
#endif
/* We already checked for ACE_LACKS_NUMERIC_LIMITS */
#if !defined ACE_LACKS_NUMERIC_LIMITS
#include <limits>
#endif
/* We already checked for ACE_LACKS_SYS_RESOURCE_H */
#if !defined ACE_LACKS_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
int main(int, char *[]) {
#if defined ACE_LACKS_NUMERIC_LIMITS
const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
#else
const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
#endif
#if !defined (ACE_LACKS_RLIMIT)
/* set memory limit to the allocation size, so this test
should terminate on the first iteration. */
struct rlimit rlimit;
if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
rlimit.rlim_cur = ALLOC_SIZE;
setrlimit(RLIMIT_DATA, &rlimit);
}
#endif
while (1) {
try {
char *a = new char[ALLOC_SIZE];
if (a == 0) {
return 1; /* new() does NOT throw exceptions */
}
}
catch (xalloc)
{
return 0; /* new() does throw exceptions */
}
};
return 1; /* ERROR: We shouldn't get this far! */
}
]])],[
ace_cv_new_throws_xalloc_exception=yes
],[
ace_cv_new_throws_xalloc_exception=no
],[
ace_cv_new_throws_xalloc_exception=no
])
], [AC_DEFINE([ACE_NEW_THROWS_EXCEPTIONS])],)
fi dnl ace_cv_new_throws_bad_alloc_exceptions = no
fi dnl $ace_user_enable_exceptions = yes
AC_CACHE_CHECK([if compiler supports new(std::nothrow)],
[ace_cv_has_new_nothrow],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif
int main(int, char*[]) {
int *foo;
#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
foo = new (std::nothrow) int;
#else
foo = new (nothrow) int;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
}]])], [
ace_cv_has_new_nothrow=yes
],[
ace_cv_has_new_nothrow=no
])])
if test $ace_cv_has_new_nothrow = yes; then
AC_DEFINE([ACE_HAS_NEW_NOTHROW])
fi
ACE_CONVERT_WARNINGS_TO_ERRORS([
dnl Check if putmsg takes a const struct strbuf *
dnl If we have getmsg() we can be pretty sure that we have putmsg()
if test "$ac_cv_func_getmsg" = yes ||
test "$ac_cv_header_stropts_h" = yes; then
ACE_CACHE_CHECK([if putmsg takes a const struct strbuf*],
[ace_cv_lib_const_strbufptr],
[
dnl Check if it takes a const struct strbuf *, first.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stropts.h>
]], [[
int result = 0;
int fd = 0;
const struct strbuf * ace_str = 0;
int flags = 0;
result = putmsg(fd, ace_str, ace_str, flags);
]])],[
ace_cv_lib_const_strbufptr=yes
],[
ace_cv_lib_const_strbufptr=no
])
],, [AC_DEFINE([ACE_LACKS_CONST_STRBUF_PTR])])
fi dnl "$ac_cv_func_getmsg" = yes || "$ac_cv_header_stropts_h" = yes
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if setrlimit() takes an enum as 1st argument
ACE_CHECK_SETRLIMIT_ENUM
dnl This test fails (i.e. passes when it shouldn't) when compiling with
dnl GCC/G++ since the compiler treats passing a const to a non-const
dnl argument as a warning and not as an error since the const is
dnl simply discarded. To correct this problem, we use "-Werror" which
dnl converts all warnings to errors, whenever we are compiling with
dnl G++.
dnl -Ossama
dnl Check if getrusage() takes an enum as 1st argument
ACE_CHECK_GETRUSAGE_ENUM
dnl TODO: This doesn't work.
dnl The compiler in linux just issues a warning, and the test passes!!!
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if select takes a const fifth argument (timeval)
ACE_CACHE_CHECK([if select takes a const struct timeval],
[ace_cv_lib_posix_select_const_timeval],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/time.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
#ifndef ACE_LACKS_SYS_SELECT_H
# include <sys/select.h>
#endif
]], [[
int n = 0;
fd_set *readfds = 0;
fd_set *writefds = 0;
fd_set *exceptfds = 0;
const struct timeval* timeout = 0;
select(n, readfds, writefds, exceptfds, timeout);
]])],[
ace_cv_lib_posix_select_const_timeval=yes
],[
ace_cv_lib_posix_select_const_timeval=no
])
], , [AC_DEFINE([ACE_HAS_NONCONST_SELECT_TIMEVAL])])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Only run the following tests if the msghdr structure exists.
if test "$ace_cv_struct_msghdr" = yes &&
test "$ac_cv_func_sendmsg" = yes; then
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if sendmsg takes a const 2nd argument
ACE_CACHE_CHECK([if sendmsg omits const qualifier from the msghdr argument],
[ace_cv_lib_nonconst_sendmsg],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
int s = 0;
const struct msghdr *msg = 0;
unsigned int flags = 0;
int result = 0;
result = (int) sendmsg(s, msg, flags);
]])],[
ace_cv_lib_nonconst_sendmsg=no
],[
ace_cv_lib_nonconst_sendmsg=yes
])
], [AC_DEFINE([ACE_HAS_NONCONST_SENDMSG])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
fi dnl "$ace_cv_struct_msghdr" = yes && $ac_cv_func_sendmsg = yes
dnl Only run the following tests if the setrlimit function exists
if test "$ac_cv_func_setrlimit" = yes; then
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if setrlimit() takes a const pointer as 2nd argument
ACE_CACHE_CHECK([if setrlimit omits const qualifier from the rlimit argument],
[ace_cv_lib_nonconst_setrlimit],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/time.h>
#include <sys/resource.h>
]], [[
const struct rlimit* rlp = 0;
setrlimit(RLIMIT_CPU, rlp);
]])],[
ace_cv_lib_nonconst_setrlimit=no
],[
ace_cv_lib_nonconst_setrlimit=yes
])
], [AC_DEFINE([ACE_HAS_NONCONST_SETRLIMIT])])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
fi dnl "$ac_cv_func_setrlimit" = yes; then
dnl Only run the following tests if the readv function exists
if test "$ac_cv_header_sys_uio_h" = yes &&
test "$ac_cv_func_readv" = yes; then
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if readv omits the const from the iovec argument
ACE_CACHE_CHECK([if readv omits const qualifier from the iovec argument],
[ace_cv_lib_nonconst_readv],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
#include <sys/uio.h>
]], [[
int filedes = 0;
const struct iovec *vector = 0;
size_t count = 0;
int result = 0;
result = (int) readv(filedes, vector, count);
]])],[
ace_cv_lib_nonconst_readv=no
],[
ace_cv_lib_nonconst_readv=yes
])
], [AC_DEFINE([ACE_HAS_NONCONST_READV])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
fi dnl $ac_cv_header_sys_uio_h = yes && $ac_cv_func_writev = yes
dnl Only run the following tests if the writev function exists
if test "$ac_cv_header_sys_uio_h" = yes &&
test "$ac_cv_func_writev" = yes; then
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if writev omits the const from the iovec argument
ACE_CACHE_CHECK([if writev omits const qualifier from the iovec argument],
[ace_cv_lib_nonconst_writev],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
#include <sys/uio.h>
]], [[
int filedes = 0;
const struct iovec *vector = 0;
size_t count = 0;
int result = 0;
result = (int) writev(filedes, vector, count);
]])],[
ace_cv_lib_nonconst_writev=no
],[
ace_cv_lib_nonconst_writev=yes
])
], [AC_DEFINE([ACE_HAS_NONCONST_WRITEV])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
fi dnl $ac_cv_header_sys_uio_h = yes && $ac_cv_func_writev = yes
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([for (struct sockaddr *) msg_name field in msghdr],
[ace_cv_lib_sockaddr_msg_name],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
msghdr ace_msghdr;
struct sockaddr *addr = 0;
/*
* Note that some platforms declare msg_name to be a void*,
* in which case this assignment will work.
* Should we _not_ define ACE_HAS_SOCKADDR_MSG_NAME in that
* case? I tend to think it is more appropriate to define
* ACE_HAS_SOCKADDR_MSG_NAME rather than cast addr to a char*,
* as is done in ACE when the macro is not defined.
* -Ossama
*/
ace_msghdr.msg_name = (struct sockaddr *)addr;
]])],[
ace_cv_lib_sockaddr_msg_name=yes
],[
ace_cv_lib_sockaddr_msg_name=no
])
], [AC_DEFINE([ACE_HAS_SOCKADDR_MSG_NAME])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if setsockopt() takes a void* fourth argument],
[ace_cv_lib_posix_setsockopt_voidp_4],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
int s = 0;
int level = 0;
int optname = 0;
void* optval = 0;
#if defined (ACE_HAS_SOCKLEN_T)
socklen_t optlen = 0;
#elif defined (ACE_HAS_SIZET_SOCKET_LEN)
size_t optlen = 0;
#else
int optlen = 0;
#endif
setsockopt (s, level, optname, optval, optlen);
]])],[
ace_cv_lib_posix_setsockopt_voidp_4=yes
],[
ace_cv_lib_posix_setsockopt_voidp_4=no
])
],
[
AC_DEFINE([ACE_HAS_VOIDPTR_SOCKOPT])
],
[
ACE_CACHE_CHECK([if setsockopt() takes a char* fourth argument],
[ace_cv_lib_posix_setsockopt_charp_4],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
int s = 0;
int level = 0;
int optname = 0;
char* optval = 0;
#if defined (ACE_HAS_SOCKLEN_T)
socklen_t optlen = 0;
#elif defined (ACE_HAS_SIZET_SOCKET_LEN)
size_t optlen = 0;
#else
int optlen = 0;
#endif
setsockopt (s, level, optname, optval, optlen);
]])],[
ace_cv_lib_posix_setsockopt_charp_4=yes
],[
ace_cv_lib_posix_setsockopt_charp_4=no
])
],
[
AC_DEFINE([ACE_HAS_CHARPTR_SOCKOPT])
],)
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if mmap() takes a void* first argument],
[ace_cv_lib_posix_voidptr_mmap],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
#include <sys/mman.h>
]], [[
void *start = 0;
size_t length = 0;
int prot = 0;
int flags = 0;
int fd = 0;
off_t offset = 0;
void *result = 0;
result = (void *)mmap(start, length, prot, flags, fd, offset);
]])],[
ace_cv_lib_posix_voidptr_mmap=yes
],[
ace_cv_lib_posix_voidptr_mmap=no
])
], [AC_DEFINE([ACE_HAS_VOIDPTR_MMAP])],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if platform has iostream method ipfx()
ACE_CACHE_CHECK([for iostream method ipfx()],
[ace_cv_feature_has_iostream_ipfx],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream.h>
]], [[
cin.ipfx();
]])],[
ace_cv_feature_has_iostream_ipfx=yes
],[
ace_cv_feature_has_iostream_ipfx=no
])
], , [AC_DEFINE([ACE_LACKS_IOSTREAM_FX])])
dnl Check if platform has line-buffered streambufs
ACE_CACHE_CHECK([for line-buffered streambufs],
[ace_cv_feature_has_linebuffered_streambuf],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream.h>
]], [[
cin.rdbuf()->linebuffered(1);
]])],[
ace_cv_feature_has_linebuffered_streambuf=yes
],[
ace_cv_feature_has_linebuffered_streambuf=no
])
], , [AC_DEFINE([ACE_LACKS_LINEBUFFERED_STREAMBUF])])
dnl Check if platform has unbuffered streambufs
ACE_CACHE_CHECK([for unbuffered streambufs],
[ace_cv_feature_has_unbuffered_streambuf],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <iostream.h>
]], [[
cin.rdbuf()->unbuffered(1);
]])],[
ace_cv_feature_has_unbuffered_streambuf=yes
],[
ace_cv_feature_has_unbuffered_streambuf=no
])
], , [AC_DEFINE([ACE_LACKS_UNBUFFERED_STREAMBUF])])
dnl Check if signal takes a void (*)(int) as second argument
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if signal takes a void (*)(int) as second argument],
[ace_cv_lib_signal_vi1_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int);
static void handler(int) { }
]], [[
SA nn = handler;
signal(SIGINT, nn);
]])],[
ace_cv_lib_signal_vi1_2=yes
],[
dnl Check if extern "C" signal handler is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <signal.h>
extern "C"
{
typedef void (*SA)(int);
void handler(int) { }
}
]],
[[
SA nn = handler;
signal(SIGINT, nn);
]])],
[
ace_cv_lib_signal_vi1_2=yes
],
[
ace_cv_lib_signal_vi1_2=no
])
])
],
[
AC_DEFINE([ACE_HAS_SIG_C_FUNC])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if signal takes a void (*)(void) as second argument
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if signal takes a void (*)(void) as second argument],
[ace_cv_lib_signal_vv1_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(void);
void handler(void) { }
]], [[
SA nn = handler;
signal(SIGINT, nn);
]])],[
ace_cv_lib_signal_vv1_2=yes
],[
dnl Check if extern "C" signal handler is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <signal.h>
extern "C"
{
typedef void (*SA)(void);
void handler(void) { }
}
]],
[[
SA nn = handler;
signal(SIGINT, nn);
]])],
[
ace_cv_lib_signal_vv1_2=yes
],
[
ace_cv_lib_signal_vv1_2=no
])
])
],
[
AC_DEFINE([ACE_HAS_SIG_C_FUNC])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if signal takes a void (*)(int, ...) as second argument
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if signal takes a void (*)(int, ...) as second argument],
[ace_cv_lib_signal_vi1a2_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int, ...);
void handler(int, ...) { }
]], [[
SA nn = handler;
signal(SIGINT, nn);
]])],[
ace_cv_lib_signal_vi1a2_2=yes
],[
dnl Check if extern "C" signal handler is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <signal.h>
extern "C"
{
typedef void (*SA)(int, ...);
void handler(int, ...) { }
}
]],
[[
SA nn = handler;
signal(SIGINT, nn);
]])],
[
ace_cv_lib_signal_vi1a2_2=yes
],
[
ace_cv_lib_signal_vi1a2_2=no
])
])
],
[
AC_DEFINE([ACE_HAS_SIG_C_FUNC])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if signal takes a void (*)(...) as second argument
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
ACE_CACHE_CHECK([if signal takes a void (*)(...) as second argument],
[ace_cv_lib_signal_va1_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(...);
void handler(...) { }
]], [[
SA nn = handler;
signal(SIGINT, nn);
]])],[
ace_cv_lib_signal_va1_2=yes
],[
dnl Check if extern "C" signal handler is required.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <signal.h>
extern "C"
{
typedef void (*SA)(...);
void handler(...) { }
}
]],
[[
SA nn = handler;
signal(SIGINT, nn);
]])],
[
ace_cv_lib_signal_va1_2=yes
],
[
ace_cv_lib_signal_va1_2=no
])
])
],
[
AC_DEFINE([ACE_HAS_SIG_C_FUNC])
],)
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl Check if signal returns a void (*)(int)
AC_CACHE_CHECK([if signal returns a void (*)(int)],
[ace_cv_lib_signal_vi1_ret],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int);
void foo(SA nn) { }
]], [[
SA nn = SIG_DFL;
nn = signal(SIGINT, 0);
foo(nn);
]])],[
ace_cv_lib_signal_vi1_ret=yes
],[
ace_cv_lib_signal_vi1_ret=no
])
])
dnl Check if signal returns a void (*)(void)
AC_CACHE_CHECK([if signal returns a void (*)(void)],
[ace_cv_lib_signal_vv1_ret],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(void);
void foo(SA nn) { }
]], [[
SA nn = SIG_DFL;
nn = signal(SIGINT, 0);
foo(nn);
]])],[
ace_cv_lib_signal_vv1_ret=yes
],[
ace_cv_lib_signal_vv1_ret=no
])
])
dnl Check if signal returns a void (*)(int, ...)
AC_CACHE_CHECK([if signal returns a void (*)(int, ...)],
[ace_cv_lib_signal_vi1a2_ret],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int, ...);
]], [[
SA oo = signal(SIGINT, 0);
]])],[
ace_cv_lib_signal_vi1a2_ret=yes
],[
ace_cv_lib_signal_vi1a2_ret=no
])
])
dnl Check if signal returns a void (*)(...)
AC_CACHE_CHECK([if signal returns a void (*)(...)],
[ace_cv_lib_signal_va1_ret],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(...);
]], [[
SA oo = signal(SIGINT, 0);
]])],[
ace_cv_lib_signal_va1_ret=yes
],[
ace_cv_lib_signal_va1_ret=no
])
])
if test "$ac_cv_type_struct_sigaction" = yes; then
dnl Check if struct sigaction takes a void (*)(int) handler
AC_CACHE_CHECK([if struct sigaction takes a void (*)(int) handler],
[ace_cv_lib_struct_sigaction_vi1_handler],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int);
void foo(struct sigaction* sa, SA nn) { }
]], [[
struct sigaction sa;
SA nn = SIG_DFL;
sa.sa_handler = nn;
foo(&sa, nn);
]])],[
ace_cv_lib_struct_sigaction_vi1_handler=yes
],[
ace_cv_lib_struct_sigaction_vi1_handler=no
])
])
dnl Check if struct sigaction takes a void (*)(void) handler
AC_CACHE_CHECK([if struct sigaction takes a void (*)(void) handler],
[ace_cv_lib_struct_sigaction_vv1_handler],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(void);
void foo(struct sigaction* sa, SA nn) { }
]], [[
struct sigaction sa;
SA nn = SIG_DFL;
sa.sa_handler = nn;
foo(&sa, nn);
]])],[
ace_cv_lib_struct_sigaction_vv1_handler=yes
],[
ace_cv_lib_struct_sigaction_vv1_handler=no
])
])
dnl Check if struct sigaction takes a void (*)(int, ...) handler
AC_CACHE_CHECK([if struct sigaction takes a void (*)(int, ...) handler],
[ace_cv_lib_struct_sigaction_vi1a2_handler],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(int, ...);
void foo(struct sigaction* sa, SA nn) { }
]], [[
struct sigaction sa;
SA nn = SIG_DFL;
sa.sa_handler = nn;
foo(&sa, nn);
]])],[
ace_cv_lib_struct_sigaction_vi1a2_handler=yes
],[
ace_cv_lib_struct_sigaction_vi1a2_handler=no
])
])
dnl Check if struct sigaction takes a void (*)(...) handler
AC_CACHE_CHECK([if struct sigaction takes a void (*)(...) handler],
[ace_cv_lib_struct_sigaction_va1_handler],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
typedef void (*SA)(...);
void foo(struct sigaction* sa, SA nn) { }
]], [[
struct sigaction sa;
SA nn = SIG_DFL;
sa.sa_handler = nn;
foo(&sa, nn);
]])],[
ace_cv_lib_struct_sigaction_va1_handler=yes
],[
ace_cv_lib_struct_sigaction_va1_handler=no
])
])
fi dnl test "$ac_cv_type_struct_sigaction" = yes
dnl TODO: This doesn't work.
dnl The linux compiler issues a warning regarding the invalid void*
dnl conversion.
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if msgsnd() takes a struct msgbuf* second argument
ACE_CACHE_CHECK([if msgsnd() takes a struct msgbuf* second argument],
[ace_cv_lib_posix_msgsnd_msgbufp_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
# include <sys/ipc.h>
#ifndef ACE_LACKS_SYS_MSG_H
# include <sys/msg.h>
#endif
]], [[
int msqid = 0;
struct msgbuf* msgp = 0;
int msgsz = 0;
int msgflg = 0;
msgsnd(msqid, msgp, msgsz, msgflg);
]])],[
ace_cv_lib_posix_msgsnd_msgbufp_2=yes
],[
ace_cv_lib_posix_msgsnd_msgbufp_2=no
])
],
[
dnl "ACTIONS-IF-SUCCESSFUL" handled later in configure.in
],
[
dnl Check if msgsnd() takes a const void* second argument
ACE_CACHE_CHECK([if msgsnd() takes a const void* second argument],
[ace_cv_lib_posix_msgsnd_cvoidp_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
# include <sys/ipc.h>
#ifndef ACE_LACKS_SYS_MSG_H
# include <sys/msg.h>
#endif
]], [[
int msqid = 0;
const void* msgp = 0;
int msgsz = 0;
int msgflg = 0;
msgsnd(msqid, msgp, msgsz, msgflg);
]])],[
ace_cv_lib_posix_msgsnd_cvoidp_2=yes
],[
ace_cv_lib_posix_msgsnd_cvoidp_2=no
])
],
[
dnl Do nothing if msgsnd takes a const void* second argument
],
[
dnl If we get this far we presumably have a non-const void* second param
AC_DEFINE([ACE_HAS_NONCONST_MSGSND])
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
dnl TODO: This doesn't work.
dnl The linux compiler issues a warning regarding the invalid void*
dnl conversion.
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if msgrcv() takes a void* second argument
AC_CACHE_CHECK([if msgrcv() takes a void* second argument],
[ace_cv_lib_posix_msgrcv_voidp_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
# include <sys/ipc.h>
#ifndef ACE_LACKS_SYS_MSG_H
# include <sys/msg.h>
#endif
]], [[
int msqid = 0;
void* msgp = 0;
int msgsz = 0;
long msgtyp = 0;
int msgflg = 0;
msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
]])],[
ace_cv_lib_posix_msgrcv_voidp_2=yes
],[
ace_cv_lib_posix_msgrcv_voidp_2=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
if test "$ac_cv_func_shmat" = yes; then
dnl TODO: This doesn't work.
dnl The linux compiler issues a warning regarding the invalid void*
dnl conversion.
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if shmat() takes a void* second argument
AC_CACHE_CHECK([if shmat() takes a void* second argument],
[ace_cv_lib_posix_shmat_voidp_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
# include <sys/ipc.h>
# include <sys/shm.h>
]], [[
int shmid = 0;
void* shmaddr = 0;
int shmflg = 0;
shmat(shmid, shmaddr, shmflg);
]])],[
ace_cv_lib_posix_shmat_voidp_2=yes
],[
ace_cv_lib_posix_shmat_voidp_2=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
if test "$ace_cv_lib_posix_shmat_voidp_2" = no; then
AC_DEFINE([ACE_HAS_CHARPTR_SHMAT], 1,
[Define to 1 if arg 2 of 'shmat' is char *'])
fi
fi
if test "$ac_cv_func_shmdt" = yes; then
dnl TODO: This doesn't work.
dnl The linux compiler issues a warning regarding the invalid void*
dnl conversion.
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if shmdt() takes a void* second argument
AC_CACHE_CHECK([if shmdt() takes a void* argument],
[ace_cv_lib_posix_shmdt_voidp],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
# include <sys/ipc.h>
# include <sys/shm.h>
]], [[
void* shmaddr = 0;
shmdt(shmaddr);
]])],[
ace_cv_lib_posix_shmdt_voidp=yes
],[
ace_cv_lib_posix_shmdt_voidp=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
if test "$ace_cv_lib_posix_shmdt_voidp" = no; then
AC_DEFINE([ACE_HAS_CHARPTR_SHMDT], 1,
[Define to 1 if arg 1 of 'shmdt' is char *'])
fi
fi
dnl TODO: This doesn't work.
dnl The linux compiler issues a warning regarding the invalid void*
dnl conversion.
dnl
dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
dnl -Ossama
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check if sigaction() takes a const* second argument
AC_CACHE_CHECK([if sigaction() takes a const* second argument],
[ace_cv_lib_posix_sigaction_constp_2],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h>
]], [[
int signum = 0;
const struct sigaction* act = 0;
struct sigaction* oldact = 0;
sigaction(signum, act, oldact);
]])],[
ace_cv_lib_posix_sigaction_constp_2=yes
],[
ace_cv_lib_posix_sigaction_constp_2=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
if test "$ace_cv_lib_posix_sigaction_constp_2" = yes; then
AC_DEFINE([ACE_HAS_SIGACTION_CONSTP2])
fi
dnl We need to use the ACE_CONVERT_WARNINGS_TO_ERRORS() macro since
dnl passing a void * just caused implicit conversion warnings when
dnl using GNU C++, for example.
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check for SVR4 style gettimeofday()
AC_CACHE_CHECK([if gettimeofday() takes a void * second argument],
[ace_cv_lib_voidptr_gettimeofday],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/time.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
]], [[
struct timeval *tv = 0;
void *tzp = 0;
gettimeofday(tv, tzp);
]])],[
ace_cv_lib_voidptr_gettimeofday=yes
],[
ace_cv_lib_voidptr_gettimeofday=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
if test "$ace_cv_lib_voidptr_gettimeofday" = no; then
ACE_CONVERT_WARNINGS_TO_ERRORS(
[
dnl Check for old OSF1 style gettimeofday()
AC_CACHE_CHECK([if gettimeofday() takes a struct timezone * second argument],
[ace_cv_lib_timezone_gettimeofday],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/time.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
]], [[
struct timeval *tv = 0;
struct timezone *tzp = 0;
gettimeofday(tv, tzp);
]])],[
ace_cv_lib_timezone_gettimeofday=yes
],[
ace_cv_lib_timezone_gettimeofday=no
])
])
]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
fi dnl test "$ace_cv_lib_voidptr_gettimeofday" = no
dnl Check for gettimeofday() protoype
if test "$ace_cv_lib_voidptr_gettimeofday" = yes ||
test "$ace_cv_lib_timezone_gettimeofday" = yes; then
AC_CHECK_DECL([gettimeofday],
[
if test "$ace_cv_lib_voidptr_gettimeofday" = yes; then
AC_DEFINE([ACE_HAS_VOIDPTR_GETTIMEOFDAY])
else
AC_DEFINE([ACE_HAS_TIMEZONE_GETTIMEOFDAY])
fi
],[
if test "$ace_cv_lib_voidptr_gettimeofday" = yes; then
AC_DEFINE([ACE_HAS_SVR4_GETTIMEOFDAY])
else
AC_DEFINE([ACE_HAS_OSF1_GETTIMEOFDAY])
fi
],
[
#include <sys/time.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
])
fi dnl Check for gettimeofday() protoype
dnl Check if ctime_r() takes two arguments
if test "$ac_cv_func_ctime_r" = yes; then
ACE_CACHE_CHECK([if ctime_r() takes two arguments],
[ace_cv_lib_posix_ctime_r_2_params],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _REENTRANT
# define _REENTRANT
#endif
#include <time.h>
]], [[
const time_t *t = 0;
char *buf;
ctime_r(t, buf);
]])],[
ace_cv_lib_posix_ctime_r_2_params=yes
],[
ace_cv_lib_posix_ctime_r_2_params=no
])
], [AC_DEFINE([ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R])],)
fi dnl test "$ac_cv_func_ctime_r" = yes
dnl
dnl SECTION 12: checks for type characteristics
dnl
dnl struct msghdr stuff
dnl Only run the following tests if the msghdr structure exists.
if test "$ace_cv_struct_msghdr" = yes; then
ACE_CACHE_CHECK([if struct msghdr has a msg_accrights member],
[ace_cv_lib_posix_struct_msghdr_has_msg_accrights],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
msghdr mh;
mh.msg_accrights = 0;
]])],[
ace_cv_lib_posix_struct_msghdr_has_msg_accrights=yes
],[
ace_cv_lib_posix_struct_msghdr_has_msg_accrights=no
])
])
ACE_CACHE_CHECK([if struct msghdr has a msg_accrightslen member],
[ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]], [[
msghdr mh;
mh.msg_accrightslen = 0;
]])],[
ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen=yes
],[
ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen=no
])
])
dnl Check for 4.4 BSD style struct msghdr members
dnl The following test should only be run if the above two testsfail.
if test "$ace_cv_lib_posix_struct_msghdr_has_msg_accrights" = no &&
test "$ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen" = no; then
AC_DEFINE([ACE_LACKS_MSG_ACCRIGHTS])
ACE_CACHE_CHECK([for 4.4 BSD style struct msghdr],
[ace_cv_lib_4_4bsd_msghdr],[
AC_EGREP_HEADER([msg_control], [sys/socket.h],
[
ace_cv_lib_4_4bsd_msghdr=yes
],
[
ace_cv_lib_4_4bsd_msghdr=no
])
],
[
AC_DEFINE([ACE_HAS_4_4BSD_SENDMSG_RECVMSG])
],
[
AC_MSG_WARN([No supported msghdr structure was found. ACE may not compile or function properly.])
])
fi
fi dnl End struct msghdr_stuff
dnl
dnl SECTION 13: checks for system services
dnl
dnl Check if platform defines ctime() as a macro
ACE_CACHE_CHECK([for ctime() macro],
[ace_cv_feature_have_ctime_macro],
[
AC_EGREP_CPP([ACE_CTIME_MACRO],
[
#include <time.h>
#if defined (ctime)
ACE_CTIME_MACRO
#endif
],
[
ace_cv_feature_have_ctime_macro=yes
],
[
ace_cv_feature_have_ctime_macro=no
])
], [AC_DEFINE([ACE_HAS_BROKEN_CTIME])],)
dnl Check if platform defines ctime_r, asctime_r, rand_r or getpwnam_r
dnl as macros.
ACE_CACHE_CHECK([for reentrant function macros],
[ace_cv_feature_has_broken_r_routines],
[
AC_EGREP_CPP([ACE_R_MACROS],
[
#ifndef _REENTRANT
# define _REENTRANT
#endif
#include <time.h>
#if !defined (ACE_LACKS_PWD_H)
# include <pwd.h>
#endif
#if defined (ctime_r) || \
defined (asctime_r) || \
defined (rand_r) || \
defined (getpwnam_r)
ACE_R_MACROS
#endif
],
[
ace_cv_feature_has_broken_r_routines=yes
],
[
ace_cv_feature_has_broken_r_routines=no
])
], [AC_DEFINE([ACE_HAS_BROKEN_R_ROUTINES])],)
dnl Check if platform defines sig{empty,fill,add,del}set as macros
ACE_CACHE_CHECK([for sig{empty fill add del}set macros],
[ace_cv_feature_have_sig_macros],
[
AC_EGREP_CPP([ACE_SIG_MACROS],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <signal.h>
#if defined (sigemptyset) || \
defined (sigfillset) || \
defined (sigaddset) || \
defined (sigdelset) || \
defined (sigismember)
ACE_SIG_MACROS
#endif
],
[
ace_cv_feature_have_sig_macros=yes
],
[
ace_cv_feature_have_sig_macros=no
])
], [AC_DEFINE([ACE_HAS_SIG_MACROS])],)
dnl Check for open() mode masks
ACE_CACHE_CHECK([for open() mode masks],
[ace_cv_feature_have_open_mode_masks],[
AC_EGREP_CPP([ACE_OPEN_MODE_MASKS_EXIST],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
/* These are ORed so that ACE will not redefine any of them if any of
them exist. */
#if defined (S_IRWXU) || \
defined (S_IRUSR) || \
defined (S_IWUSR) || \
defined (S_IXUSR) || \
defined (S_IRWXG) || \
defined (S_IRGRP) || \
defined (S_IWGRP) || \
defined (S_IXGRP) || \
defined (S_IRWXO) || \
defined (S_IROTH) || \
defined (S_IWOTH) || \
defined (S_IXOTH)
ACE_OPEN_MODE_MASKS_EXIST
#endif
],
[
ace_cv_feature_have_open_mode_masks=yes
],
[
ace_cv_feature_have_open_mode_masks=no
])
], , [AC_DEFINE([ACE_LACKS_MODE_MASKS])])
dnl Check if platform supports POSIX O_NONBLOCK semantics
ACE_CACHE_CHECK([for POSIX O_NONBLOCK semantics],
[ace_cv_feature_posix_o_nonblock],[
AC_EGREP_CPP([ACE_POSIX_O_NONBLOCK],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#if defined (O_NONBLOCK)
ACE_POSIX_O_NONBLOCK
#endif
],
[
ace_cv_feature_posix_o_nonblock=yes
],
[
ace_cv_feature_posix_o_nonblock=no
])
], [AC_DEFINE([ACE_HAS_POSIX_NONBLOCK])],)
dnl Check for MAP_FAILED constant
ACE_CACHE_CHECK([for MAP_FAILED constant],
[ace_cv_lib_have_map_failed],[
dnl We need the square brackets around "ACEMAPFAILED.+[0-9]" to
dnl prevent the character class "[0-9]" from becoming "0-9" due to
dnl M4 quoting.
AC_EGREP_CPP([ACEMAPFAILED.+[0-9]],
[
#include <sys/mman.h>
ACEMAPFAILED MAP_FAILED
],
[
ace_cv_lib_have_map_failed=yes
],
[
ace_cv_lib_have_map_failed=no
])
],
[
dnl Check if platform defines MAP_FAILED as a long constant
ACE_CACHE_CHECK([if MAP_FAILED is a long constant],
[ace_cv_feature_long_map_failed],[
dnl We need the square brackets around "ACEMAPFAILED.+[0-9]L" to
dnl prevent the character class "[0-9]" from becoming "0-9" due to
dnl M4 quoting.
AC_EGREP_CPP([ACEMAPFAILED.+[0-9]L],
[
#include <sys/mman.h>
ACEMAPFAILED MAP_FAILED
],
[
ace_cv_feature_long_map_failed=yes
],
[
ace_cv_feature_long_map_failed=no
])
], [AC_DEFINE([ACE_HAS_LONG_MAP_FAILED])],
[
dnl Check if MAP_FAILED is _not_ cast to void *
ACE_CACHE_CHECK([if MAP_FAILED is not cast to void *],
[ace_cv_have_broken_map_failed],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/mman.h>
]], [[
void * foo = MAP_FAILED;
]])],[
ace_cv_have_broken_map_failed=no
],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <sys/mman.h>
]],
[[
void * foo = (void *) MAP_FAILED;
]])],
[
ace_cv_have_broken_map_failed=yes
],
[
dnl If we get here then we have no idea what is wrong!
ace_cv_have_broken_map_failed=no
])
])
], [AC_DEFINE([ACE_HAS_BROKEN_MAP_FAILED])],)
])
],)
dnl Check if platform supports TCP_NODELAY support
ACE_CACHE_CHECK([for TCP_NODELAY support],
[ace_cv_feature_tcp_nodelay],[
AC_EGREP_CPP([ACE_TCPNODELAY],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <netinet/tcp.h>
#if defined (TCP_NODELAY)
ACE_TCPNODELAY
#endif
],
[
ace_cv_feature_tcp_nodelay=yes
],
[
ace_cv_feature_tcp_nodelay=no
])
], , [AC_DEFINE([ACE_LACKS_TCP_NODELAY])])
dnl Check if platform supports SO_SNDBUF/SO_RCVBUF socket options
ACE_CACHE_CHECK([for SO_SNDBUF/SO_RCVBUF socket options],
[ace_cv_feature_so_sndbuf_rcvbuf],[
AC_EGREP_CPP([ACE_SO_BUF],
[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
#if defined (SO_SNDBUF) && \
defined (SO_RCVBUF)
ACE_SO_BUF
#endif
],
[
ace_cv_feature_so_sndbuf_rcvbuf=yes
],
[
ace_cv_feature_so_sndbuf_rcvbuf=no
])
], , [AC_DEFINE([ACE_LACKS_SOCKET_BUFSIZ])])
dnl Check if memcpy is faster or loop unrolling is faster on a given
dnl platform
ACE_CACHE_CHECK([if ACE memcpy needs loop unrolling], [ace_cv_memcpy_loop_unroll],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <string.h>
void*
smemcpy (void* dest, const void* src, const size_t n)
{
unsigned char* to = static_cast<unsigned char*>( dest) ;
const unsigned char* from = static_cast<const unsigned char*>( src) ;
// Unroll the loop...
switch (n)
{
case 16: to[15] = from[15] ;
case 15: to[14] = from[14] ;
case 14: to[13] = from[13] ;
case 13: to[12] = from[12] ;
case 12: to[11] = from[11] ;
case 11: to[10] = from[10] ;
case 10: to[9] = from[9] ;
case 9: to[8] = from[8] ;
case 8: to[7] = from[7] ;
case 7: to[6] = from[6] ;
case 6: to[5] = from[5] ;
case 5: to[4] = from[4] ;
case 4: to[3] = from[3] ;
case 3: to[2] = from[2] ;
case 2: to[1] = from[1] ;
case 1: to[0] = from[0] ;
case 0: return dest;
default: return memcpy (dest, src, n);
}
}
// Function pointer
void* (* test_func) (void *dst, const void* src, size_t);
namespace { enum { ITERATIONS = 100000 }; }
#include <sys/time.h>
#include <time.h>
int
main(int argc, char* argv[])
{
struct timeval start, now;
double value;
// Test buffer
char dest [16];
const void* src = " THIS IS A TEST";
// We want to test if the loop unrolling is faster for sizes
// from 1..16
for (size_t counter = 16; counter >=1; counter--)
{
test_func = smemcpy;
// Warm up
for (int i = ITERATIONS ; i > 0 ; --i)
test_func ((void *)dest, src, counter);
gettimeofday (&start, 0) ;
for (int j = ITERATIONS ; j > 0 ; --j)
test_func ((void *)dest, src, counter);
gettimeofday (&now, 0);
double fast = 1000000 * (now.tv_sec - start.tv_sec) +
now.tv_usec - start.tv_usec ;
test_func = memcpy;
// Warm up
for (int k = ITERATIONS ; k > 0 ; --k)
test_func ((void *)dest, src, counter);
gettimeofday (&start, 0) ;
for (int l = ITERATIONS ; l > 0 ; --l)
test_func ((void *)dest, src, counter);
gettimeofday (&now, 0) ;
double slow = 1000000 * (now.tv_sec-start.tv_sec) +
now.tv_usec - start.tv_usec ;
if (fast > slow)
return 1; // Unrolling was slower than actual memcpy
if (1.10*fast > slow)
return 1; // Unrolling was not faster by 10%
}
return 0; // Unrolling was faster -- success
}]])], [ace_cv_memcpy_loop_unroll=yes],
[ace_cv_memcpy_loop_unroll=no],
dnl Cross compilation case
[ace_cv_memcpy_loop_unroll=no])],
dnl only if the test succeeds set the macro
[AC_DEFINE([ACE_HAS_MEMCPY_LOOP_UNROLL], 1,
[Define to 1 if unrolled ACE_OS::fast_memcpy() is faster than system memcpy()])],)
dnl TODO: We only check for ACE_HAS_AUTOMATIC_INIT_FINI on platforms that
dnl have SVR4 dynamic linking since ACE doesn't support it otherwise.
if test "$ac_cv_header_dlfcn_h" = yes &&
test "$ace_has_svr4_dynamic_linking" = yes; then
dnl Check if platform calls init/fini automatically
ACE_CACHE_CHECK([for automatic init/fini calls],
[ace_cv_feature_auto_init_fini],[
ace_cv_feature_auto_init_fini=yes
# TODO: We know how to check for this, but we need to:
#
# 1. Compile one file.
# 2. Compile and link another file.
# 3. Run file in point (2); it returns what we need.
#
# How do we do all that?
], [AC_DEFINE([ACE_HAS_AUTOMATIC_INIT_FINI])],)
fi dnl test "$ac_cv_header_dlfcn_h" = yes &&
dnl "$ace_has_svr4_dynamic_linking" = yes
dnl Check for recursive thread exit semantics
if test "$ace_user_enable_threads" = yes; then
ACE_CACHE_CHECK([for recursive thread exit semantics],
[ace_cv_feature_recursive_thr_exit],[
ace_cv_feature_recursive_thr_exit=yes
# TODO: How do we check for recursive thread exit semantics
], [AC_DEFINE([ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS])],)
fi
dnl Check for UNIX domain sockets
ACE_CACHE_CHECK([for UNIX domain sockets],
[ace_cv_feature_unix_sockets],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/un.h>
]], [[
sockaddr_un su;
]])],[
ace_cv_feature_unix_sockets=yes
],[
ace_cv_feature_unix_sockets=no
])
], , [AC_DEFINE([ACE_LACKS_UNIX_DOMAIN_SOCKETS])])
dnl Check for raw sockets
ACE_CACHE_CHECK([for raw sockets],
[ace_cv_feature_raw_sockets],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
#include <netinet/in.h>
]], [[
return socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
]])],[
ace_cv_feature_raw_sockets=yes
],[
ace_cv_feature_raw_sockets=no
])
], [AC_DEFINE([ACE_HAS_ICMP_SUPPORT])])
dnl Check for ACE_Handle_Set optimized for select()
ACE_CACHE_CHECK([for ACE_Handle_Set optimized for select()],
[ace_cv_feature_handle_set_optimized_for_select],[
ace_cv_feature_handle_set_optimized_for_select=yes
# TODO: We know how to check this. We need to:
#
# 1. Compile and link a file.
# 2. Run nm on that file.
#
# How do we do that?
], [AC_DEFINE([ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT])],)
dnl Even we if we don't have IP multicasting, we still need to define
dnl "ACE_HAS_IP_MULTICAST" since struct ip_mreq gets redefined by ACE.
dnl What do we do about this problem?
dnl -Ossama
dnl Check for IP multicast support
ACE_CACHE_CHECK([for IP multicast support],
[ace_cv_feature_ip_multicast],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <netinet/in.h>
]], [[
ip_mreq im;
]])],[
ace_cv_feature_ip_multicast=yes
],[
dnl Some platforms define ip_mreq in <sys/netinet/in.h>.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#ifndef ACE_LACKS_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/netinet/in.h>
]],
[[
ip_mreq im;
]])],
[
ace_cv_feature_ip_multicast=yes
],
[
ace_cv_feature_ip_multicast=no
])
])
], [AC_DEFINE([ACE_HAS_IP_MULTICAST])],)
ACE_CACHE_CHECK([if running on an Alpha],
[ace_cv_feature_alpha],[
case "$host" in
alpha*)
ace_cv_feature_alpha=yes
;;
*)
ace_cv_feature_alpha=no
;;
esac
],
[
case "$host" in
*linux*)
dnl We only define ACE_HAS_ALPHA_TIMER if we are running Linux
dnl on an Alpha and are using GNU C++!
if test "$GXX" = yes; then
AC_DEFINE([ACE_HAS_ALPHA_TIMER], 1,
[Define to 1 if system should use Alpha's cycle counter])
fi
;;
esac
],)
ACE_CACHE_CHECK([if running on a Power PC],
[ace_cv_feature_powerpc],[
case "$host" in
powerpc*)
ace_cv_feature_powerpc=yes
;;
*)
ace_cv_feature_powerpc=no
;;
esac
],
[
case "$host" in
*aix*)
dnl We don't do anything for AIX since AIX already has a
dnl hi-res timer function!
;;
*)
dnl Only define ACE_HAS_POWERPC_TIMER when using GNU C++!
if test "$GXX" = yes; then
AC_DEFINE([ACE_HAS_POWERPC_TIMER], 1,
[Define to 1 if system should use PowerPC's cycle counter])
fi
;;
esac
],)
ACE_CACHE_CHECK([if running on a Pentium(tm) processor],
[ace_cv_feature_pentium],[
case "$host" in
i386-* | i486-* |i586-* | i686-*)
dnl If we do have a pentium, than define ACE_HAS_PENTIUM and add
dnl gethrtime.cpp to the source list, but only if we're using GNU C++
dnl since gethrtime.cpp uses assembler code specific to that compiler.
if test "$GXX" = yes; then
ace_cv_feature_pentium=yes
else
ace_cv_feature_pentium=no
fi
;;
*)
ace_cv_feature_pentium=no
;;
esac
],
[
AC_DEFINE([ACE_HAS_PENTIUM], 1,
[Define to 1 if system is using Intel Pentium(tm) processor])
],)
AM_CONDITIONAL([ACE_ON_PENTIUM], [test X$ace_cv_feature_pentium = Xyes])
case "$host" in
i386-* | i486-* | i586-* | i686-* | x86_64-*)
if test "$GXX" = yes; then
ace_cv_has_intel_assembly=yes
else
ace_cv_has_intel_assembly=no
fi
;;
*)
ace_cv_has_intel_assembly=no
;;
esac
if test "$ace_cv_has_intel_assembly" != "no"; then
AC_DEFINE([ACE_HAS_INTEL_ASSEMBLY], 1,
[Define to 1 if the system supports x86/x86_64 inline assembly])
fi
dnl
dnl SECTION 14: checks for aggregated features
dnl TODO: Little by little, get rid of these...
dnl
dnl Macro ACE_HAS_REENTRANT_FUNCTIONS means the following functions
dnl are usable:
dnl
dnl rand_r
dnl strtok_r
dnl getpwnam_r (if we don't have, define ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
dnl ctime_r
dnl localtime_r
dnl gmtime_r
dnl asctime_r
dnl * getprotobyname_r
dnl * getprotobynumber_r
dnl * gethostbyaddr_r
dnl * gethostbyname_r
dnl * getservbyname_r
dnl
dnl Those marked with '*' are NOT usable if
dnl ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) is defined.
dnl
dnl The time has come to create feature macros for each of these...
dnl With the separate feature macros, we will define (for now)
dnl ACE_HAS_REENTRANT_FUNCTIONS only when all of those WITHOUHT a '*'
dnl are defined. Also, if any of those with '*' are missing, we will
dnl define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS.
dnl Don't bother with reentrant functions if they are disabled by the user.
if test "$ace_user_enable_reentrant_funcs" = yes &&
test "$ac_cv_func_rand_r" = yes &&
test "$ac_cv_func_strtok_r" = yes &&
test "$ac_cv_func_ctime_r" = yes &&
test "$ac_cv_func_localtime_r" = yes &&
test "$ac_cv_func_gmtime_r" = yes &&
test "$ac_cv_func_asctime_r" = yes; then
AC_DEFINE([ACE_HAS_REENTRANT_FUNCTIONS])
# Explicitly enable reentrant functions if thread support is not enabled.
if test "$ace_user_enable_threads" = no; then
ACE_CPPFLAGS="$ACE_CPPFLAGS -D_REENTRANT"
fi
fi
dnl Don't bother with reentrant functions if they are disabled by the user.
if test "$ace_user_enable_reentrant_funcs" = no ||
test "$ac_cv_func_getprotobyname_r" = no ||
test "$ac_cv_func_getprotobynumber_r" = no ||
test "$ac_cv_func_gethostbyaddr_r" = no ||
test "$ac_cv_func_gethostbyname_r" = no ||
test "$ac_cv_func_getservbyname_r" = no; then
AC_DEFINE([ACE_LACKS_NETDB_REENTRANT_FUNCTIONS])
fi
dnl FIXME!!!
dnl The following is a kludge until the netdb reentrant function
dnl number of arguments is handled.
case "$host" in
*linux*) AC_DEFINE([ACE_LACKS_NETDB_REENTRANT_FUNCTIONS]);;
*) ;;
esac
dnl Macro ACE_LACKS_SOME_POSIX_PROTOTYPES implies any of the following
dnl features:
dnl
dnl ! ACE_HAS_MSGSND_MSGBUFP_2
dnl ! ACE_LACKS_MSGRCV_VOIDP_2
dnl ! ACE_LACKS_SHMAT_VOIDP_2
dnl
dnl So, for now, we define it if any of those were autoconf'ed.
dnl @@ THESE NEED TO BE ADDED AS PROPER CONFIG SETTINGS. --Steve
dnl if test "$ace_cv_lib_posix_msgsnd_msgbufp_2" = yes ||
dnl test "$ace_cv_lib_posix_msgrcv_voidp_2" != yes ||
dnl test "$ace_cv_lib_posix_shmat_voidp_2" != yes ; then
dnl AC_DEFINE([ACE_LACKS_SOME_POSIX_PROTOTYPES])
dnl fi
if test "$ac_cv_func_msgctl" = yes &&
test "$ac_cv_func_msgget" = yes &&
test "$ac_cv_func_msgrcv" = yes &&
test "$ac_cv_func_semctl" = yes &&
test "$ac_cv_func_semget" = yes &&
test "$ac_cv_func_semop" = yes &&
test "$ac_cv_func_shmat" = yes &&
test "$ac_cv_func_shmctl" = yes &&
test "$ac_cv_func_shmdt" = yes &&
test "$ac_cv_func_shmget" = yes; then
AC_DEFINE([ACE_HAS_SYSV_IPC])
fi
if test "$ac_cv_func_shmat" != yes ||
test "$ac_cv_func_shmctl" != yes ||
test "$ac_cv_func_shmdt" != yes ||
test "$ac_cv_func_shmget" != yes; then
AC_DEFINE([ACE_LACKS_SYSV_SHMEM])
fi
dnl Check for what POSIX threads draft we have
AC_MSG_CHECKING([which POSIX thread library was found])
ace_has_pthreads=no
dnl Check if we have Pthreads Draft 4
dnl if test "$ac_cv_func_pthread_delay_np" = yes &&
if test "$ac_cv_func_pthread_mutexattr_create" = yes &&
dnl test "$ac_cv_func_pthread_mutexattr_setkind_np" = yes &&
test "$ac_cv_func_pthread_mutexattr_delete" = yes &&
test "$ac_cv_func_pthread_condattr_delete" = yes &&
test "$ac_cv_func_pthread_condattr_create" = yes &&
test "$ac_cv_func_pthread_setprio" = yes &&
test "$ac_cv_func_pthread_getprio" = yes &&
dnl test "$ac_cv_func_pthread_getspecific" = yes &&
test "$ac_cv_func_pthread_setcancel" = yes &&
test "$ac_cv_func_pthread_setasynccancel" = yes &&
test "$ac_cv_func_pthread_kill" = yes; then
ace_has_pthreads=yes
AC_MSG_RESULT([POSIX Threads Draft 4])
AC_DEFINE([ACE_HAS_PTHREADS_DRAFT4], 1,
[Platform supports POSIX Threads .4a Draft 4])
dnl Check if we have Pthreads Draft 6
elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_init" = yes &&
test "$ac_cv_func_pthread_attr_setprio" = yes &&
test "$ac_cv_func_pthread_attr_getprio" = yes &&
test "$ac_cv_func_pthread_setintr" = yes &&
test "$ac_cv_func_pthread_setintrtype" = yes; then
ace_has_pthreads=yes
AC_MSG_RESULT([POSIX Threads Draft 6])
AC_DEFINE([ACE_HAS_PTHREADS_DRAFT6], 1,
[Platform supports POSIX Threads .4a Draft 6])
dnl Check if we have Pthreads Draft 7
elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_init" = yes &&
test "$ac_cv_func_pthread_setschedparam" = yes &&
test "$ac_cv_func_pthread_getschedparam" = yes &&
test "$ac_cv_func_pthread_setcancelstate" = yes &&
test "$ac_cv_func_pthread_setcanceltype" = yes &&
test "$ace_has_sched_yield" != yes; then
ace_has_pthreads=yes
AC_MSG_RESULT([POSIX Threads Draft 7])
AC_DEFINE([ACE_HAS_PTHREADS_DRAFT7], 1,
[Platform supports POSIX Threads .1c Draft 7])
dnl Check if we have Pthreads Draft Standard
elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_destroy" = yes &&
test "$ac_cv_func_pthread_condattr_init" = yes &&
test "$ac_cv_func_pthread_setschedparam" = yes &&
test "$ac_cv_func_pthread_getschedparam" = yes &&
test "$ac_cv_func_pthread_setcancelstate" = yes &&
test "$ac_cv_func_pthread_setcanceltype" = yes &&
test "$ace_has_sched_yield" = yes; then
ace_has_pthreads=yes
AC_MSG_RESULT([POSIX Threads Draft Standard])
AC_DEFINE([ACE_HAS_PTHREADS_STD], 1,
[Platform supports POSIX.1c-1995 threads])
else
ace_has_pthreads=no
AC_MSG_RESULT([none])
fi dnl PTHREAD DRAFT CHECKS
dnl Check if we have UNIX International threads
AC_MSG_CHECKING([if a UNIX International thread library was found])
if test "$ace_has_sthreads" = yes; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
if test "$ace_user_enable_threads" != yes ||
test "$ace_has_pthreads" != yes &&
test "$ace_has_sthreads" != yes; then
dnl We don't have a usable thread library!
ace_user_enable_threads=no
dnl Make sure _REENTRANT and _THREAD_SAFE are not in the
dnl preprocessor flags since thread support is being disabled.
dnl Removal of these flags is only performed if the configure script
dnl added them.
if test -n "$ACE_THR_CPPFLAGS"; then
dnl changequote(, )dnl
CPPFLAGS=`eval "echo $CPPFLAGS | sed -e 's/$ACE_THR_CPPFLAGS//' -e 's/-D_THREAD_SAFE\(=[[0-9]]*\)\?//'"`
dnl changequote([, ])dnl
fi
AC_MSG_WARN([It appears that you do NOT have any usable thread libraries])
AC_MSG_WARN([or thread support was explicitly disabled.])
AC_MSG_WARN([Disabling thread support.])
dnl ACE uses different versions of readdir_r depending on the thread
dnl library being used, i.e. on the ACE_HAS_*THREADS* macros. Since
dnl it doesn't seem like a good idea to define any ACE_HAS_*THREADS*
dnl macro if ACE won't be supporting threads, define ACE_LACKS_READDIR_R
dnl regardless if readdir_r() exists.
if test "$ac_cv_func_readdir_r" = yes; then
AC_MSG_WARN([Disabling support for readdir_r() since thread support])
AC_MSG_WARN([is being disabled.])
AC_DEFINE([ACE_LACKS_READDIR_R])
fi dnl test "$ac_cv_func_readdir_r" = yes
fi dnl
if test "$ace_user_enable_threads" = yes; then
dnl If we get this far then we have threads.
dnl FIXME: The "_POSIX" macros may need to be defined _before_ the checks for
dnl reentrant functions! However, we don't want to define them if
dnl the UNIX International threads library was detected.
AC_DEFINE([ACE_HAS_THREADS])
AC_DEFINE([ACE_MT_SAFE])
ACE_CPPFLAGS="$ACE_CPPFLAGS $ACE_THR_CPPFLAGS"
if test "$ace_has_pthreads" = yes; then
dnl Check if OS requires non-null status pointer for ::pthread_join ()
dnl
dnl This test must be performed after the POSIX threads implementation
dnl that the platform supports has been determined.
ACE_CACHE_CHECK([for pthread_join null status pointer support],
[ace_cv_have_null_status_pthread_join],[
AC_EGREP_CPP([WE_HAVE_PTHREADS_D4],
[
#if defined (ACE_HAS_PTHREADS) && defined (ACE_HAS_PTHREADS_DRAFT4)
/* This test is only valid for Pthreads Draft 4 */
WE_HAVE_PTHREADS_D4
#endif
],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <pthread.h>
/* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
#ifndef _THREAD_SAFE
#define _THREAD_SAFE
#endif
#include <stdio.h>
#ifdef __cplusplus
extern "C"
#endif
void *
nothing (void *unused)
{
return (void *) 34;
};
int
main ()
{
pthread_attr_t attr;
pthread_t id;
void *status;
int retval = 0;
/* ----- */
/* We return 0 on error for these calls since we only want to
return an error status if pthread_join fails. If these calls
fail then we've got other problems! */
if (pthread_attr_create (&attr) != 0) return 0 /*1*/;
if (pthread_create (&id, attr, nothing, 0) != 0) return 0 /*2*/;
if (pthread_attr_delete (&attr) != 0) return /*3*/;
/* ----- */
/* With a second (status) arg of 0, LynxOS 3.0.0 pthread_join ()
will fail with errno 14 (address fault detected). */
if (pthread_join (id, 0) == -1) {
fprintf (stderr, "%s: %d; ", __FILE__, __LINE__);
perror ("pthread_join");
retval = 1;
}
if (pthread_join (id, &status) == -1) {
fprintf (stderr, "%s: %d; ", __FILE__, __LINE__);
perror ("pthread_join");
retval = 2;
}
return retval;
}
]])],[
ace_cv_have_null_status_pthread_join=yes
],[
ace_cv_have_null_status_pthread_join=no
],[
dnl If we are cross-compiling let's hope that
dnl that we have a working null status pointer
dnl for pthread_join.
ace_cv_have_null_status_pthread_join=yes
])
],
[
ace_cv_have_null_status_pthread_join=yes
])
], , [AC_DEFINE([ACE_LACKS_NULL_PTHREAD_STATUS])])
dnl Check if OS supports mutex timeouts
dnl (e.g. pthread_mutex_timedlock()).
ACE_CACHE_CHECK([for mutex timeouts],
[ace_cv_have_mutex_timeouts],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <pthread.h>
/* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
#ifndef _THREAD_SAFE
#define _THREAD_SAFE
#endif
#include <stdio.h>
#include <errno.h>
#include <sys/time.h>
#include <stdlib.h>
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#ifdef __cplusplus
extern "C"
#endif
void *threadFunc (void *parm)
{
int rc;
int i;
struct timespec deltatime;
struct timeval tv;
if (gettimeofday (&tv, 0) != 0)
{
return 0;
}
deltatime.tv_sec = tv.tv_sec + 5;
deltatime.tv_nsec = 0;
rc = pthread_mutex_timedlock (&mutex, &deltatime);
if (rc != ETIMEDOUT)
{
/* printf("Got an incorrect return code from pthread_mutex_timedlock\n"); */
}
return 0;
}
int main (void)
{
int rc =0;
pthread_t thread;
rc = pthread_mutex_lock (&mutex);
if (rc != 0)
{
exit (-1);
}
rc = pthread_create (&thread, NULL, threadFunc, NULL);
if (rc != 0)
{
exit (-1);
}
rc = pthread_join (thread, NULL);
if (rc != 0)
{
exit (-1);
}
pthread_mutex_destroy (&mutex);
return 0;
}
]])],[
ace_cv_have_mutex_timeouts=yes
],[
ace_cv_have_mutex_timeouts=no
],[
dnl Cross-compiled case
AC_CHECK_FUNC([pthread_mutex_timedlock],
[ace_cv_have_mutex_timeouts=yes],
[ace_cv_have_mutex_timeouts=no])
])
], [AC_DEFINE([ACE_HAS_MUTEX_TIMEOUTS])],)
dnl Check if platform needs to #include <sched.h> to get thread
dnl scheduling defs.
ACE_CACHE_CHECK([if sched.h is needed for thread scheduling definitions],
[ace_cv_needs_sched_h],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef ACE_HAS_STHREADS
#include <thread.h>
#endif
#ifdef ACE_HAS_PTHREADS
#include <pthread.h>
#endif
]], [[
int foo = SCHED_OTHER;
]])],[
ace_cv_needs_sched_h=no
],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#ifdef ACE_HAS_STHREADS
#include <thread.h>
#endif
#ifdef ACE_HAS_PTHREADS
#include <pthread.h>
#endif
#include <sched.h>
]],
[[
int foo = SCHED_OTHER;
]])],
[
ace_cv_needs_sched_h=yes
],
[
dnl We're hosed if we get here!
ace_cv_needs_sched_h=no
])
])
],
[
AC_DEFINE([ACE_NEEDS_SCHED_H])
],)
dnl Check if platform only supports SCHED_OTHER scheduling policy
dnl
dnl This test must be performed after the POSIX threads implementation
dnl that the platform supports has been determined.
ACE_CACHE_CHECK([if SCHED_OTHER is only scheduling policy],
[ace_cv_feature_only_have_sched_other],
[
AC_EGREP_CPP([WE_ONLY_HAVE_SCHED_OTHER],
[
#ifdef ACE_HAS_STHREADS
# include <thread.h>
#endif
#ifdef ACE_HAS_PTHREADS
# include <pthread.h>
#endif
#if defined (ACE_NEEDS_SCHED_H)
# include <sched.h>
#endif
/* These are ORed so that ACE will not redefine
any of them if any of them exist. */
#if !defined (SCHED_FIFO) && \
!defined (SCHED_RR) && \
defined (SCHED_OTHER)
WE_ONLY_HAVE_SCHED_OTHER
#endif
],
[
ace_cv_feature_only_have_sched_other=yes
],
[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <pthread.h>
/* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
#ifndef _THREAD_SAFE
#define _THREAD_SAFE
#endif
#include <stdio.h>
#include <errno.h>
int main ()
{
pthread_attr_t ace_attr;
#if defined (ACE_HAS_PTHREADS_DRAFT4)
if (pthread_attr_create (&ace_attr) != 0)
#else
if (pthread_attr_init (&ace_attr) != 0)
#endif
{
perror ("pthread_attr_init");
return 0; /* Return "successfully" since only the policy call
will return with an error for this test. */
}
#if defined (ACE_HAS_PTHREADS_DRAFT4)
if (pthread_attr_setsched (&ace_attr, SCHED_FIFO) != 0)
#else
if (pthread_attr_setschedpolicy (&ace_attr, SCHED_FIFO) != 0)
#endif
{
perror ("pthread_attr_setschedpolicy");
return -1;
}
#if defined (ACE_HAS_PTHREADS_DRAFT4)
if (pthread_attr_delete (&ace_attr) != 0)
#else
if (pthread_attr_destroy (&ace_attr) != 0)
#endif
{
perror ("pthread_attr_destroy");
return 0; /* Return "successfully" since only the policy call
will return with an error for this test. */
}
return 0;
}
]])],[
ace_cv_feature_only_have_sched_other=no
],[
ace_cv_feature_only_have_sched_other=yes
],[
dnl We only get here if polices other than SCHED_OTHER
dnl were found in the headers and we are cross-compiling.
dnl
dnl If we are cross-compiling let's hope that the
dnl scheduling policies found in the headers
dnl besides SCHED_OTHER (e.g. SCHED_FIFO, SCHED_RR)
dnl are supported.
ace_cv_feature_only_have_sched_other=no
])
])
], [AC_DEFINE([ACE_HAS_ONLY_SCHED_OTHER])],)
fi dnl test "$ace_has_pthreads" = yes
fi dnl test "$ace_user_enable_threads" = yes
AC_CHECK_HEADER(libc.h)
AC_CHECK_HEADER(osfcn.h)
if test "$ac_cv_header_libc_h" != yes ||
test "$ac_cv_header_osfcn_h" != yes; then
AC_DEFINE([ACE_HAS_CPLUSPLUS_HEADERS])
fi
if test "$ace_cv_lib_signal_vi1_2" = yes &&
test "$ace_cv_lib_signal_vi1_ret" = yes &&
test "$ace_cv_lib_struct_sigaction_vi1_handler" = yes; then
AC_DEFINE([ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES])
elif test "$ace_cv_lib_signal_vi1_2" != yes &&
test "$ace_cv_lib_signal_vv1_2" != yes &&
test "$ace_cv_lib_signal_vi1a2_2" != yes &&
test "$ace_cv_lib_signal_va1_2" = yes &&
test "$ace_cv_lib_signal_vi1_ret" != yes &&
test "$ace_cv_lib_signal_vv1_ret" != yes &&
test "$ace_cv_lib_signal_vi1a2_ret" != yes &&
test "$ace_cv_lib_signal_va1_ret" = yes &&
test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_vv1_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_vi1a2_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_va1_handler" = yes; then
AC_DEFINE([ACE_HAS_LYNXOS_SIGNALS])
AC_DEFINE([ACE_HAS_TANDEM_SIGNALS])
elif test "$ace_cv_lib_signal_vi1_2" = yes &&
test "$ace_cv_lib_signal_vi1_ret" = yes &&
test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes; then
AC_DEFINE([ACE_HAS_SVR4_SIGNAL_T])
elif test "$ace_cv_lib_signal_vi1_2" = yes &&
test "$ace_cv_lib_signal_vv1_ret" = yes &&
test "$ace_cv_lib_struct_sigaction_vv1_handler" = yes; then
AC_DEFINE([ACE_HAS_SVR4_SIGNAL_T])
elif test "$ace_cv_lib_signal_vi1_2" = yes &&
test "$ace_cv_lib_signal_vi1_ret" != yes &&
test "$ace_cv_lib_signal_vv1_ret" != yes &&
test "$ace_cv_lib_signal_vi1a2_ret" != yes &&
test "$ace_cv_lib_signal_va1_ret" = yes &&
test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_vv1_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_vi1a2_handler" != yes &&
test "$ace_cv_lib_struct_sigaction_va1_handler" = yes; then
AC_DEFINE([ACE_HAS_UNIXWARE_SVR4_SIGNAL_T])
fi dnl ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
dnl
dnl SECTION 15: Final checks
dnl
dnl Make final substitutions and defines
if test "$ace_u_long_long_typedef_set" = yes; then
AC_DEFINE_UNQUOTED([ACE_INT64_TYPE], [$ACE_INT64],
[Define to signed 64 bit integer type])
AC_DEFINE_UNQUOTED([ACE_UINT64_TYPE], [$ACE_UINT64],
[Define to unsigned 64 bit integer type])
fi
dnl Combine package set flags with user's flags.
dnl User's flags go after package flags to allow user to override
dnl package defaults.
dnl X_CFLAGS comes from AC_PATH_XTRA. It may include, for example,
dnl additional include file paths or macros that need to be defined
dnl in order for X11 related files to be compiled properly.
if test "$ace_user_enable_optimize"; then
dnl We want OCXXFLAGS to be on the end, so we use CXXFLAGS,
dnl not ACE_CXXFLAGS!
CXXFLAGS="$CXXFLAGS $OCXXFLAGS"
CFLAGS="$CFLAGS $OCFLAGS"
fi
CXXFLAGS="$ACE_CXXFLAGS $X_CFLAGS $CXXFLAGS"
CFLAGS="$ACE_CFLAGS $X_CFLAGS $CFLAGS"
CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
dnl The following tests should be performed _after_ the bulk of the
dnl ACE macros have been defined.
dnl Flush the cache so that it is easier to debug the configure script
dnl if the following integrity check fails.
AC_CACHE_SAVE
dnl Verify the integrity of the current configuration.
ACE_CACHE_CHECK([if generated ACE configuration is usable],
[ace_cv_configuration_is_usable],
[
dnl We want an empty ace/config.h to prevent multiple defines
dnl with Autoconf's confdefs.h
ACE_USE_TEMP_FILE([ace/config.h],
[
dnl Now run the compilation test
ACE_TRY_COMPILE([-I. -I${srcdir}],
[
// Include ".cpp" files instead of headers so that we can get a more
// thorough test compile.
#include "ace/Time_Value.cpp"
#include "ace/Reactor.cpp"
],
[
ACE_Time_Value t = ACE_OS::gettimeofday ();
t++;
ACE_Reactor * r = ACE_Reactor::instance ();
(void) r->close ();
],
[
ace_cv_configuration_is_usable=yes
],
[
ace_cv_configuration_is_usable=no
])
])
],
[
dnl Looks good! Do nothing.
dnl It appears that ace/OS.cpp compiled. If it didn't compile then
dnl there would be no chance that the rest of ACE would compile.
],
[
AC_MSG_WARN(
[
The generated configuration appears to be unusable. Please verify
that your system path and environment variables are correct. If they
appear to be correct then please send the maintainer of this configure
script $ACE_CONFIGURE_MAINTAINER the *COMPRESSED* 'config.log' file,
the generated ace/config.h file and the following information:
ACE 'configure' Script Information
==================================
[RCS] translit([$Id$], [$"])
ACE Version: ACE_VERSION
C++ Compiler: $CXX
C++ Preprocessor: $CXXCPP
C++ Flags: $CXXFLAGS
Preprocessor Flags: $CPPFLAGS
Linker: $LD
Linker Flags: $LDFLAGS
Libraries: $LIBS
System type information:
Build: $build Host: $host
In the meantime, please use the stock ACE build procedure detailed in
the file 'ACE-INSTALL.html'.
])
])
dnl "
dnl Check for ACE_IOStream support
ACE_CACHE_CHECK([for ACE_IOStream support],
[ace_cv_feature_ace_iostream],
[
dnl We want an empty ace/config.h to prevent multiple defines
dnl with Autoconf's confdefs.h
ACE_USE_TEMP_FILE([ace/config.h],
[
dnl Now run the compilation test
ACE_TRY_COMPILE([-I. -I${srcdir}],
[
#include "ace/IOStream.cpp"
],
[
int a = 0; a += 1;
],
[
ace_cv_feature_ace_iostream=yes
],
[
ace_cv_feature_ace_iostream=no
])
])
], , [AC_DEFINE([ACE_LACKS_ACE_IOSTREAM])])
dnl Check if ACE needs conversion to pass ACE_TTY_IO to DEV_Connector
ACE_CACHE_CHECK([if ACE needs conversion to pass ACE_TTY_IO to DEV_Connector],
[ace_cv_lib_need_dev_io_conv],
[
dnl We want an empty ace/config.h to prevent multiple defines
dnl with Autoconf's confdefs.h
ACE_USE_TEMP_FILE([ace/config.h],
[
dnl Now run the compilation test
ACE_TRY_COMPILE([-I. -I${srcdir}],
[
#include "ace/OS.cpp"
],
[
int a=0; a += 1;
],
[
ace_cv_lib_need_dev_io_conv=no
],
[
dnl Now check if ACE_NEEDS_DEV_IO_CONVERSION makes
dnl compilation work!
ACE_TRY_COMPILE([-I. -I${srcdir}],
[
#define ACE_NEEDS_DEV_IO_CONVERSION
#include "ace/DEV_Connector.cpp"
],
[
int a=0; a += 1;
],
[
ace_cv_lib_need_dev_io_conv=yes
],
[
dnl If we get here, then we have no idea what is wrong!
ace_cv_lib_need_dev_io_conv=no
])
])
])
], [AC_DEFINE([ACE_NEEDS_DEV_IO_CONVERSION])],)
dnl End ACE macro tests!
dnl Substitute whatever X libraries ACE needs, if any.
AC_SUBST([ACE_XLIBS])
dnl Prepend purify and quantify command lines if purify and quantify are
dnl enabled. Otherwise, PURELINK and PRELINK will just be "blank."
LD="$PURELINK $PRELINK $LD"
dnl LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
dnl AC_SUBST(LDFLAGS)
dnl AC_SUBST(LIBOBJS)
dnl Force CXXFLAGS to be substituted in Makefiles that don't "need" them.
AC_SUBST([CXXFLAGS])
dnl Precompute the absolute pathname of the ACE tests directory so
dnl that we can avoid using GNU Make extensions in the ACE tests
dnl Makefile.
ACE_TESTS_DIR=`pwd`/tests
AC_SUBST([ACE_TESTS_DIR])
dnl
dnl SECTION 16: AC_CONFIG_FILES([FILE...])
dnl
dnl
dnl We can finally create all the files listed here; Makefile is
dnl created from Makefile.in, etc. Top-level Makefiles should be
dnl created first.
dnl Makefile
dnl ace/Makefile
dnl apps/Makefile
dnl apps/gperf/Makefile
dnl apps/gperf/src/Makefile
dnl man/Makefile
dnl man/man3/Makefile
dnl netsvcs/Makefile
dnl netsvcs/clients/Makefile
dnl netsvcs/clients/Logger/Makefile
dnl netsvcs/clients/Naming/Makefile
dnl netsvcs/clients/Naming/Client/Makefile
dnl netsvcs/clients/Naming/Dump_Restore/Makefile
dnl netsvcs/clients/Tokens/Makefile
dnl netsvcs/clients/Tokens/collection/Makefile
dnl netsvcs/clients/Tokens/deadlock/Makefile
dnl netsvcs/clients/Tokens/invariant/Makefile
dnl netsvcs/clients/Tokens/manual/Makefile
dnl netsvcs/clients/Tokens/mutex/Makefile
dnl netsvcs/clients/Tokens/rw_lock/Makefile
dnl netsvcs/lib/Makefile
dnl netsvcs/servers/Makefile
dnl tests/Makefile
AC_CONFIG_FILES([
Makefile
ace/Makefile
ace/ETCL/Makefile
ace/Monitor_Control/Makefile
ace/QoS/Makefile
ace/SSL/Makefile
apps/Makefile
apps/Gateway/Makefile
apps/Gateway/Gateway/Makefile
apps/Gateway/Peer/Makefile
apps/JAWS/Makefile
apps/JAWS/clients/Makefile
apps/JAWS/clients/Blobby/Makefile
apps/JAWS/clients/Caching/Makefile
apps/JAWS/server/Makefile
apps/JAWS2/Makefile
apps/JAWS2/HTTPU/Makefile
apps/JAWS2/JAWS/Makefile
apps/JAWS3/Makefile
apps/JAWS3/jaws3/Makefile
apps/drwho/Makefile
apps/gperf/Makefile
apps/gperf/src/Makefile
apps/gperf/tests/Makefile
apps/mkcsregdb/Makefile
apps/soreduce/Makefile
bin/Makefile
bin/PerlACE/Makefile
netsvcs/Makefile
netsvcs/lib/Makefile
netsvcs/clients/Makefile
netsvcs/clients/Logger/Makefile
netsvcs/clients/Naming/Makefile
netsvcs/clients/Naming/Client/Makefile
netsvcs/clients/Naming/Dump_Restore/Makefile
netsvcs/servers/Makefile
websvcs/Makefile
websvcs/lib/Makefile
websvcs/tests/Makefile
])
dnl Configure examples if configured...
if test "$ace_build_examples" = yes; then
AC_CONFIG_FILES([
examples/Makefile
examples/APG/Makefile
examples/APG/Active_Objects/Makefile
examples/APG/Config/Makefile
examples/APG/Containers/Makefile
examples/APG/Logging/Makefile
examples/APG/Misc_IPC/Makefile
examples/APG/Naming/Makefile
examples/APG/Proactor/Makefile
examples/APG/Processes/Makefile
examples/APG/Reactor/Makefile
examples/APG/Shared_Memory/Makefile
examples/APG/Signals/Makefile
examples/APG/Sockets/Makefile
examples/APG/Streams/Makefile
examples/APG/Svc_Config/Makefile
examples/APG/ThreadManagement/Makefile
examples/APG/ThreadPools/Makefile
examples/APG/ThreadSafety/Makefile
examples/APG/Threads/Makefile
examples/APG/Timers/Makefile
examples/ASX/Makefile
examples/ASX/CCM_App/Makefile
examples/ASX/Event_Server/Makefile
examples/ASX/Event_Server/Event_Server/Makefile
examples/ASX/Event_Server/Transceiver/Makefile
examples/ASX/Message_Queue/Makefile
examples/ASX/UPIPE_Event_Server/Makefile
examples/Bounded_Packet_Relay/Makefile
examples/C++NPv1/Makefile
examples/C++NPv2/Makefile
examples/ConfigViewer/Makefile
examples/Connection/Makefile
examples/Connection/blocking/Makefile
examples/Connection/misc/Makefile
examples/Connection/non_blocking/Makefile
examples/DLL/Makefile
examples/Export/Makefile
examples/IOStream/Makefile
examples/IOStream/client/Makefile
examples/IOStream/server/Makefile
examples/IPC_SAP/Makefile
examples/IPC_SAP/ATM_SAP/Makefile
examples/IPC_SAP/DEV_SAP/Makefile
examples/IPC_SAP/DEV_SAP/reader/Makefile
examples/IPC_SAP/DEV_SAP/writer/Makefile
examples/IPC_SAP/FIFO_SAP/Makefile
examples/IPC_SAP/FILE_SAP/Makefile
examples/IPC_SAP/SOCK_SAP/Makefile
examples/IPC_SAP/SPIPE_SAP/Makefile
examples/IPC_SAP/SSL_SAP/Makefile
examples/IPC_SAP/TLI_SAP/Makefile
examples/IPC_SAP/UPIPE_SAP/Makefile
examples/Log_Msg/Makefile
examples/Logger/Makefile
examples/Logger/Acceptor-server/Makefile
examples/Logger/client/Makefile
examples/Logger/simple-server/Makefile
examples/Map_Manager/Makefile
examples/Mem_Map/Makefile
examples/Mem_Map/IO-tests/Makefile
examples/Mem_Map/file-reverse/Makefile
examples/Misc/Makefile
examples/Monitor/Makefile
examples/Monitor/Bytes_Sent/Makefile
examples/Monitor/Message_Queue_Size/Makefile
examples/Monitor/Constraint/Makefile
examples/Monitor/CPU_Load/Makefile
examples/Monitor/Num_Threads/Makefile
examples/Monitor/Group/Makefile
examples/Monitor/Memory_Usage/Makefile
examples/NT_Service/Makefile
examples/Naming/Makefile
examples/OS/Makefile
examples/OS/Process/Makefile
examples/QOS/Makefile
examples/QOS/Change_Receiver_FlowSpec/Makefile
examples/QOS/Change_Sender_TSpec/Makefile
examples/QOS/Diffserv/Makefile
examples/QOS/Simple/Makefile
examples/Reactor/Makefile
examples/Reactor/Dgram/Makefile
examples/Reactor/FIFO/Makefile
examples/Reactor/Misc/Makefile
examples/Reactor/Multicast/Makefile
examples/Reactor/Ntalker/Makefile
examples/Reactor/Proactor/Makefile
examples/Reactor/TP_Reactor/Makefile
examples/Reactor/WFMO_Reactor/Makefile
examples/Registry/Makefile
examples/Semaphores/Makefile
examples/Service_Configurator/Makefile
examples/Service_Configurator/IPC-tests/Makefile
examples/Service_Configurator/IPC-tests/client/Makefile
examples/Service_Configurator/IPC-tests/server/Makefile
examples/Service_Configurator/Misc/Makefile
examples/Shared_Malloc/Makefile
examples/Shared_Memory/Makefile
examples/Smart_Pointers/Makefile
examples/Synch/Makefile
examples/System_V_IPC/Makefile
examples/System_V_IPC/SV_Message_Queues/Makefile
examples/System_V_IPC/SV_Semaphores/Makefile
examples/Threads/Makefile
examples/Timer_Queue/Makefile
examples/Web_Crawler/Makefile
])
fi
dnl Configure tests if configured...
if test "$ace_build_tests" = yes; then
AC_CONFIG_FILES([
performance-tests/Makefile
performance-tests/Misc/Makefile
performance-tests/SCTP/Makefile
performance-tests/Server_Concurrency/Leader_Follower/Makefile
performance-tests/Server_Concurrency/Makefile
performance-tests/Server_Concurrency/Queue_Based_Workers/Makefile
performance-tests/Synch-Benchmarks/Base_Test/Makefile
performance-tests/Synch-Benchmarks/Makefile
performance-tests/Synch-Benchmarks/Perf_Test/Makefile
performance-tests/Synch-Benchmarks/Synch_Lib/Makefile
performance-tests/TCP/Makefile
performance-tests/UDP/Makefile
tests/Makefile
tests/SSL/Makefile
])
fi
dnl Configure subdirectories if they are present.
if test -d $srcdir/ACEXML; then
AC_CONFIG_FILES([
ACEXML/Makefile
ACEXML/common/Makefile
ACEXML/parser/Makefile
ACEXML/parser/parser/Makefile
ACEXML/apps/Makefile
ACEXML/apps/svcconf/Makefile
ACEXML/examples/Makefile
ACEXML/examples/SAXPrint/Makefile
ACEXML/tests/Makefile
ACEXML/tests/util/Makefile
])
AC_SUBST([ACEXML],[ACEXML])
fi
if test -d $srcdir/ASNMP; then
AC_CONFIG_FILES([
ASNMP/Makefile
ASNMP/asnmp/Makefile
ASNMP/agent/Makefile
ASNMP/examples/Makefile
ASNMP/examples/get/Makefile
ASNMP/examples/next/Makefile
ASNMP/examples/set/Makefile
ASNMP/examples/trap/Makefile
ASNMP/examples/walk/Makefile
ASNMP/tests/Makefile
])
AC_SUBST([ASNMP],[ASNMP])
fi
if test -d $srcdir/Kokyu; then
AC_CONFIG_FILES([
Kokyu/Makefile
Kokyu/tests/Makefile
Kokyu/tests/DSRT_MIF/Makefile
Kokyu/tests/EDF/Makefile
Kokyu/tests/FIFO/Makefile
])
AC_SUBST([KOKYU],[Kokyu])
fi
if test -d $srcdir/protocols; then
AC_CONFIG_FILES([
protocols/Makefile
protocols/ace/Makefile
protocols/ace/HTBP/Makefile
protocols/ace/RMCast/Makefile
protocols/ace/TMCast/Makefile
])
dnl Configure examples if configured...
if test "$ace_build_examples" = yes; then
AC_CONFIG_FILES([
protocols/examples/Makefile
protocols/examples/RMCast/Makefile
protocols/examples/RMCast/Send_Msg/Makefile
protocols/examples/TMCast/Makefile
protocols/examples/TMCast/Member/Makefile
])
fi
dnl Configure tests if configured...
if test "$ace_build_tests" = yes; then
AC_CONFIG_FILES([
protocols/tests/HTBP/Makefile
protocols/tests/HTBP/Reactor_Tests/Makefile
protocols/tests/HTBP/Send_Large_Msg/Makefile
protocols/tests/HTBP/Send_Recv_Tests/Makefile
protocols/tests/HTBP/ping/Makefile
protocols/tests/Makefile
protocols/tests/RMCast/Makefile
])
fi
AC_SUBST([protocols],[protocols])
fi
if test -d $srcdir/TAO -a X$ace_user_with_tao = Xyes; then
AC_CONFIG_SUBDIRS([TAO])
AC_SUBST([TAO],[TAO])
fi
dnl Note that the "ACE_VERSION" in the message below is an M4 macro
dnl that expands to the version of ACE being configured.
AC_CONFIG_COMMANDS([default],[
echo ""
echo "Configuration of ACE ACE_VERSION is now complete."
echo ""
],[])
AC_OUTPUT
|