summaryrefslogtreecommitdiff
path: root/autoconf/configure.in
blob: 35f843911aa444c3ec0e67cc4e7bd63c8e51ff18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
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
dnl
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 2000-2022 Kern Sibbald
dnl License: BSD 2-Clause; see file LICENSE-FOSS
dnl
dnl require a recent autoconf
AC_PREREQ(2.61)
AC_INIT([bacula], m4_esyscmd([sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ../src/version.h src/version.h 2> /dev/null | tr -d '\n']))
AC_CONFIG_SRCDIR(src/version.h)

BUILD_DIR=`pwd`
cd ..
TOP_DIR=`pwd`
cd ${BUILD_DIR}
AC_SUBST(BUILD_DIR)
AC_SUBST(TOP_DIR)
AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_HEADERS(src/config.h:autoconf/config.h.in)

dnl minimal Win32 stuff for "make clean"
WIN32BUILDDIR=${BUILD_DIR}/src/win32
WIN32MAINDIR=${BUILD_DIR}
WIN32TOPDIR=${TOP_DIR}
AC_SUBST(WIN32BUILDDIR)
AC_SUBST(WIN32MAINDIR)
AC_SUBST(WIN32TOPDIR)

dnl search for true and false programs.
AC_PATH_PROGS(TRUEPRG, true, :)
AC_PATH_PROGS(FALSEPRG, false, :)


dnl bacula version
post_host=
if test "x$BACULA" != x; then
   post_host=`echo -${BACULA} | tr 'A-Z ' 'a-z-'`
fi
BACULA=${BACULA:-Bacula}
VERSION=`sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
RELEASE=`sed -n -e 's/^#define RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
DATE=`sed -n -e 's/^#define BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LSMDATE=`sed -n -e 's/^#define LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
BDB_VERSION=`sed -n -e 's/^#define BDB_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
DEPKGS_VERSION=`sed -n -e 's/^#define DEPKGS_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
DEPKGS_QT_VERSION=`sed -n -e 's/^#define DEPKGS_QT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
BQT_VERSION=`sed -n -e 's/^#define BQT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
VIX_VERSION=`sed -n -e 's/^#define VIX_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
JAVA_VERSION=`sed -n -e 's/^#define JAVA_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
NDMP_VERSION=`sed -n -e 's/^#define NDMP_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LIBRSYNC_VERSION=`sed -n -e 's/^#define LIBRSYNC_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
KUBERNETES_IMAGE_VERSION=`sed -n -e 's/^#define KUBERNETES_IMAGE_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
AC_SUBST(VERSION)dnl
AC_SUBST(DATE)dnl
AC_SUBST(LSMDATE)dnl
AC_SUBST(BACULA)dnl
AC_SUBST(post_host)dnl
AC_SUBST(BDB_VERSION)dnl
AC_SUBST(DEPKGS_QT_VERSION)dnl
AC_SUBST(DEPKGS_VERSION)dnl
AC_SUBST(VIX_VERSION)dnl
AC_SUBST(JAVA_VERSION)dnl
AC_SUBST(NDMP_VERSION)dnl
AC_SUBST(LIBRSYNC_VERSION)dnl
AC_SUBST(KUBERNETES_IMAGE_VERSION)dnl



dnl src/lib
dnl can be overwritten by specific values from version.h
LIBBAC_LT_RELEASE=`sed -n -e 's/^#.*LIBBAC_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LIBBACCFG_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCFG_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LIBBACPY_LT_RELEASE=`sed -n -e 's/^#.*LIBBACPY_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`

LIBBAC_LT_RELEASE=${LIBBAC_LT_RELEASE:-$VERSION}
LIBBACCFG_LT_RELEASE=${LIBBACCFG_LT_RELEASE:-$VERSION}

AC_SUBST(LIBBAC_LT_RELEASE)dnl
AC_SUBST(LIBBACCFG_LT_RELEASE)dnl

dnl src/cats
dnl can be overwritten by specific values from version.h
LIBBACSQL_LT_RELEASE=`sed -n -e 's/^#.*LIBBACSQL_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LIBBACCATS_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCATS_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`

LIBBACSQL_LT_RELEASE=${LIBBACSQL_LT_RELEASE:-$VERSION}
LIBBACCATS_LT_RELEASE=${LIBBACCATS_LT_RELEASE:-$VERSION}

AC_SUBST(LIBBACSQL_LT_RELEASE)dnl
AC_SUBST(LIBBACCATS_LT_RELEASE)dnl

dnl src/findlib
dnl can be overwritten by specific values from version.h
LIBBACFIND_LT_RELEASE=`sed -n -e 's/^#.*LIBBACFIND_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`

LIBBACFIND_LT_RELEASE=${LIBBACFIND_LT_RELEASE:-$VERSION}

AC_SUBST(LIBBACFIND_LT_RELEASE)dnl

dnl PFILES are platform or plugin specific files
PFILES="platforms/Makefile"

echo "configuring for ${BACULA} $VERSION ($DATE)"


dnl -------------------------------------------------------
dnl Check for compiler.
dnl ------------------------------------------------------

AC_PROG_CC		dnl this sets $GCC if using GNU C compiler
AC_PROG_CXX
AC_PROG_CC_C_O		dnl Determine if C compiler support -c -o.
AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional.

BASECC=`basename $CC`
have_gcc=no
if test x"$GCC" = "xyes"; then
   AC_DEFINE(HAVE_GCC)
   have_gcc=yes
fi
AC_PATH_PROG(CXX, $CXX, $CXX)
if test ! -e $CXX; then
   AC_MSG_ERROR(Unable to find C++ compiler)
fi

dnl -------------------------------------------------------
dnl Check for multiarch.
dnl ------------------------------------------------------
AC_MSG_CHECKING(for multiarch system)
multiarch=`$CC $CFLAGS -print-multiarch 2>/dev/null`
AC_MSG_RESULT($multiarch)

dnl -------------------------------------------------------
dnl Check for programs.
dnl ------------------------------------------------------
AC_PROG_INSTALL
AC_PATH_PROG(MV, mv, mv)
dnl Alert !!!
dnl If we name the variable RM it will shadow the RM variable in the configure script and we overwrite the
dnl value with the name of the rm command and not rm -f which is its normal content. This gives all kind
dnl of strange output of the configure script (like things don't exist etc.).
dnl So we name it REMOVE (more software has run into this problem)
AC_PATH_PROG(REMOVE, rm, rm)
AC_PATH_PROG(CP, cp, cp)
AC_PATH_PROG(SED, sed, sed)
AC_PATH_PROG(ECHO, echo, echo)
AC_PATH_PROG(CMP, cmp, cmp)
AC_PATH_PROG(TBL, tbl, tbl)
AC_PATH_PROG(AR, ar, ar)
AC_PATH_PROG(OPENSSL, openssl, none)
AC_PATH_PROG(MTX, mtx, mtx)
AC_PATH_PROG(DD, dd, dd)
AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
AC_PATH_PROG(PYTHON, python, python)
AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
dnl Using AC_PATH_PROG() to find pkg-config is not cross-compile safe.
dnl The macro PKG_PROG_PKG_CONFIG avoids this problem.
dnl AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
PKG_PROG_PKG_CONFIG()
AC_PATH_TOOL(QMAKE, qmake, none)
AC_PATH_PROG(GMAKE, gmake, none)
AC_PATH_PROG(PIDOF, pidof, pidof)
AC_PROG_AWK
# Some AWK programs fail, so test it and warn the user
if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 }
      { if ((prog == $2) || (("(" prog ")") == $2) ||
      (("[" prog "]") == $2) ||
      ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
else
  AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
   The regex engine of $AWK is too broken to be used you
   might want to install GNU AWK.
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
fi
THE_AWK=$AWK
AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)


test -n "$ARFLAG" || ARFLAGS="cr"
AC_SUBST(ARFLAGS)

MAKE_SHELL=/bin/sh
AC_SUBST(MAKE_SHELL)

AC_SUBST(LOCAL_LIBS)
AC_SUBST(LOCAL_CFLAGS)
AC_SUBST(LOCAL_LDFLAGS)
AC_SUBST(LOCAL_DEFS)

dnl --------------------------------------------------
dnl Libtool config
dnl --------------------------------------------------
use_libtool=yes
AC_ARG_ENABLE(libtool,
   AC_HELP_STRING([--enable-libtool], [enable building using GNU libtool @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  use_libtool=no
       fi
   ]
)
LT_INIT([shared disable-static])
LT_LIB_DLLOAD
LT_LANG([C++])

if test x$use_libtool != xno; then
   DEFAULT_OBJECT_TYPE=".lo"
   DEFAULT_ARCHIVE_TYPE=".la"
   DEFAULT_SHARED_OBJECT_TYPE=".la"
   LIBTOOL="\$(LIBTOOL)"
   LIBTOOL_INSTALL_TARGET="libtool-install"
   LIBTOOL_UNINSTALL_TARGET="libtool-uninstall"
   LIBTOOL_CLEAN_TARGET="libtool-clean"
   QMAKE_LIBTOOL="${BUILD_DIR}/libtool"
   FD_PLUGIN_DIR="src/plugins/fd"
   DIR_PLUGIN_DIR="src/plugins/dir"
   DLIB="-rpath \$(libdir)"
   have_plugins=yes
else
   DEFAULT_OBJECT_TYPE=".o"
   DEFAULT_ARCHIVE_TYPE=".a"
   DEFAULT_SHARED_OBJECT_TYPE=".so"
   LIBTOOL="# \$(LIBTOOL)"
   LIBTOOL_INSTALL_TARGET=""
   LIBTOOL_UNINSTALL_TARGET=""
   LIBTOOL_CLEAN_TARGET=""
   QMAKE_LIBTOOL="# ${BUILD_DIR}/libtool"
   FD_PLUGIN_DIR=""
   DIR_PLUGIN_DIR=""
   have_plugins=no
fi

AC_SUBST(DEFAULT_OBJECT_TYPE)
AC_SUBST(DEFAULT_ARCHIVE_TYPE)
AC_SUBST(DEFAULT_SHARED_OBJECT_TYPE)
AC_SUBST(LIBTOOL)
AC_SUBST(LIBTOOL_INSTALL_TARGET)
AC_SUBST(LIBTOOL_UNINSTALL_TARGET)
AC_SUBST(LIBTOOL_CLEAN_TARGET)
AC_SUBST(QMAKE_LIBTOOL)

dnl --------------------------------------------------
dnl Include file handling
dnl --------------------------------------------------
AC_ARG_ENABLE(includes,
   AC_HELP_STRING([--enable-includes], [enable installing of include files @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  install_includes=yes
       fi
   ]
)

dnl It only makes sense to install include files when you install libraries which only happens when
dnl libtool is enabled

if test x$use_libtool != xno -a x$install_includes = xyes; then
   INCLUDE_INSTALL_TARGET="install-includes"
   INCLUDE_UNINSTALL_TARGET="uninstall-includes"
else
   INCLUDE_INSTALL_TARGET=""
   INCLUDE_UNINSTALL_TARGET=""
fi
AC_SUBST(INCLUDE_INSTALL_TARGET)
AC_SUBST(INCLUDE_UNINSTALL_TARGET)

dnl --------------------------------------------------
dnl Bacula OP Sys determination (see aclocal.m4)
dnl --------------------------------------------------
BA_CHECK_OPSYS

dnl -----------------------------------------------------------
dnl Bacula OPSys Distribution determination (see aclocal.m4)
dnl ----------------------------------------------------------
BA_CHECK_OPSYS_DISTNAME

dnl --------------------------------------------------
dnl Suppport for gettext (translations)
dnl By default, $datarootdir is ${prefix}/share
dnl --------------------------------------------------
AM_GNU_GETTEXT([external])

dnl ------------------------------------------------------------------
dnl If the user has not set --prefix, we set our default to nothing.
dnl In this case, if the user has not set --sysconfdir, we set it
dnl to the package default of /etc/bacula.  If either --prefix or
dnl --sysconfdir is set, we leave sysconfdir alone except to eval it.
dnl If the user has not set --libdir, we set it to the package
dnl default of /usr/lib. If either --prefix or --libdir is set,
dnl we leave libdir alone except to eval it. If the user has not set
dnl --includedir, we set it to the package default of /usr/include.
dnl If either --prefix or --includedir is set, we leave includedir
dnl alone except to eval it
dnl ------------------------------------------------------------------
os_name=`uname -s 2>/dev/null`
if test x${prefix} = xNONE ; then
   if test `eval echo ${sysconfdir}` = NONE/etc ; then
      sysconfdir=/etc/bacula
   fi

   if test `eval echo ${libdir}` = NONE/lib ; then
      case ${os_name} in
      Linux)
	 os_processor=`uname -p 2>/dev/null`
	 case ${os_processor} in
	 x86_64)
	    libdir=/usr/lib64
	    ;;
	 *)
	    libdir=/usr/lib
	    ;;
	 esac
	 ;;
      *)
	 libdir=/usr/lib
	 ;;
      esac
   fi

   if test `eval echo ${includedir}` = NONE/include ; then
      includedir=/usr/include
   fi

   if test `eval echo ${datarootdir}` = NONE/share ; then
      datarootdir=/usr/share
   fi
   prefix=
fi

dnl -------------------------------------------------------------------------
dnl  If the user has not set --exec-prefix, we default to ${prefix}
dnl -------------------------------------------------------------------------
if test x${exec_prefix} = xNONE ; then
   exec_prefix=${prefix}
fi

sysconfdir=`eval echo ${sysconfdir}`
datarootdir=`eval echo ${datarootdir}`
docdir=`eval echo ${docdir}`
htmldir=`eval echo ${htmldir}`
libdir=`eval echo ${libdir}`
includedir=`eval echo ${includedir}`
localedir=`eval echo ${datarootdir}/locale`
AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir")

dnl ------------------------------------------------------------------
dnl If the user has not set --sbindir, we set our default as /sbin
dnl ------------------------------------------------------------------
if test x$sbindir = x'${exec_prefix}/sbin' ; then
   sbindir=${exec_prefix}/sbin
fi
sbindir=`eval echo ${sbindir}`

dnl -------------------------------------------------------------------------
dnl  If the user has not set --mandir, we default to /usr/share/man
dnl -------------------------------------------------------------------------
if test x$mandir = x'${datarootdir}/man' ; then
   mandir=/usr/share/man
fi

dnl -------------------------------------------------------------------------
dnl  If the user has not set --htmldir, we default to /usr/share/doc/bacula/html
dnl -------------------------------------------------------------------------
if test x$htmldir = x'/usr/share/doc/bacula/' ; then
   htmldir=`eval echo ${docdir}html`
fi

dnl -------------------------------------------------------------------------
dnl  If the user has not set --docdir, we default to /usr/share/doc/bacula
dnl -------------------------------------------------------------------------
if test x$docdir = x'/usr/share/doc/' ; then
   docdir=`eval echo ${docdir}bacula`
fi


AC_PATH_PROGS(MSGFMT, msgfmt, no)
if test "$MSGFMT" = "no"
then
   echo 'msgfmt program not found, disabling NLS !'
   USE_NLS=no
   USE_INCLUDED_LIBINTL=no
#else
   AM_GNU_GETTEXT
fi

support_smartalloc=yes
support_readline=yes
support_lzo=yes
support_s3=yes
support_conio=yes
support_bat=no
support_tls=no
support_crypto=no
support_static_tools=no
support_static_fd=no
support_static_sd=no
support_static_dir=no
support_static_cons=no
build_client_only=no
build_dird=yes
build_stored=yes
db_backends=""
batch_insert_db_backends=""
support_lockmgr=no

dnl --------------------------------------------------------------------------
dnl CHECKING COMMAND LINE OPTIONS
dnl --------------------------------------------------------------------------

dnl -------------------------------------------
dnl bat (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(bat,
   AC_HELP_STRING([--enable-bat], [enable build of bat Qt4/5 GUI @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4/5 GUI support enabled])
	  support_bat=yes
       fi
   ]
)

BAT_DIR=
if test x$support_bat = xyes; then
dnl look for Qt4
   abc=`$PKG_CONFIG QtGui`
   pkg=$?
   if test $pkg = 0; then
      BAT_DIR=src/qt-console
   else
dnl look for Qt5
     abc=`$PKG_CONFIG Qt5Gui`
     pkg=$?
     if test $pkg = 0; then
	BAT_DIR="src/qt-console src/qt-console/tray-monitor"
     else
	AC_MSG_ERROR(Unable to find either Qt4 or Qt5 installation needed by bat)
     fi
   fi
fi

AC_SUBST(BAT_DIR)
AC_SUBST(QWT_INC)
AC_SUBST(QWT_LDFLAGS)
AC_SUBST(QWT_LIB)
AC_SUBST(QWT)

dnl -------------------------------------------
dnl smartalloc (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(smartalloc,
   AC_HELP_STRING([--enable-smartalloc], [enable smartalloc debugging support @<:@default=no@:>@]),
   [
       if test x$enableval = xno; then
	  support_smartalloc=no
       fi
   ]
)

if test x$support_smartalloc = xyes; then
   AC_DEFINE(SMARTALLOC, 1, [Set if you want Smartalloc enabled])
fi

dnl -------------------------------------------
dnl Lock Manager (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(lockmgr,
   AC_HELP_STRING([--enable-lockmgr], [enable lock manager support @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  support_lockmgr=yes
       fi
   ]
)

if test x$support_lockmgr = xyes; then
   AC_DEFINE(USE_LOCKMGR, 1, [Set if you want Lock Manager enabled])
fi


dnl -------------------------------------------
dnl static-tools (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static-tools,
   AC_HELP_STRING([--enable-static-tools], [enable static tape tools @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  if test x$use_libtool = xyes; then
	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
  please rerun configure with --disable-libtool])
	  fi
	  support_static_tools=yes
       fi
   ]
)

TTOOL_LDFLAGS=
if test x$support_static_tools = xyes; then
   TTOOL_LDFLAGS="-static"
fi
AC_SUBST(TTOOL_LDFLAGS)

dnl -------------------------------------------
dnl static-fd	 (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static-fd,
   AC_HELP_STRING([--enable-static-fd], [enable static File daemon @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  if test x$use_libtool = xyes; then
	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
  please rerun configure with --disable-libtool])
	  fi
	  support_static_fd=yes
       fi
   ]
)

STATIC_FD=
if test x$support_static_fd = xyes; then
   STATIC_FD="static-bacula-fd"
fi
AC_SUBST(STATIC_FD)

dnl -------------------------------------------
dnl static-sd	 (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static-sd,
   AC_HELP_STRING([--enable-static-sd], [enable static Storage daemon @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  if test x$use_libtool = xyes; then
	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
  please rerun configure with --disable-libtool])
	  fi
	  support_static_sd=yes
       fi
   ]
)

STATIC_SD=
if test x$support_static_sd = xyes; then
   STATIC_SD="static-bacula-sd"
fi
AC_SUBST(STATIC_SD)

dnl -------------------------------------------
dnl static-dir	 (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static-dir,
   AC_HELP_STRING([--enable-static-dir], [enable static Director @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  if test x$use_libtool = xyes; then
	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
  please rerun configure with --disable-libtool])
	  fi
	  support_static_dir=yes
       fi
   ]
)

STATIC_DIR=
if test x$support_static_dir = xyes; then
   STATIC_DIR="static-bacula-dir"
fi
AC_SUBST(STATIC_DIR)

dnl -------------------------------------------
dnl static-cons  (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static-cons,
   AC_HELP_STRING([--enable-static-cons], [enable static Console @<:@default=no@:>@]),
   [
       if test x$enableval = xyes; then
	  if test x$use_libtool = xyes; then
	     AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
  please rerun configure with --disable-libtool])
	  fi
	  support_static_cons=yes
       fi
   ]
)

STATIC_CONS=
if test x$support_static_cons = xyes; then
   STATIC_CONS="static-bconsole"
fi
AC_SUBST(STATIC_CONS)

dnl -------------------------------------------
dnl client_only  (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(client-only,
   AC_HELP_STRING([--enable-client-only], [build client (File daemon) only @<:@default=no@:>@]),
   [
      if test x$enableval = xyes; then
         build_client_only=yes
         db_backends="None"
         DB_BACKENDS="none"
      fi
   ]
)
if test x$build_client_only = xno; then
   ALL_DIRS="subdirs"
   AC_DEFINE(HAVE_CLIENT_ONLY, 1, [Set if we build only client])
else
   ALL_DIRS=""
fi
AC_SUBST(ALL_DIRS)

dnl -------------------------------------------
dnl director  (default on)
dnl -------------------------------------------
AC_ARG_ENABLE(build-dird,
   AC_HELP_STRING([--enable-build-dird], [enable building of dird (Director) @<:@default=yes@:>@]),
   [
      if test x$enableval = xno; then
         build_dird=no
      fi
   ]
)

DIRD_DIR="src/dird"
DIR_TOOLS="DIRTOOLS"
# DIR_PLUGIN_DIR="src/plugins/dir"

if test x$build_dird = xyes; then
   DIRD_DIR="src/dird"
   DIR_TOOLS="DIRTOOLS"
else
   DIRD_DIR=""
   DIR_TOOLS="NODIRTOOLS"
fi

AC_SUBST(DIRD_DIR)
AC_SUBST(DIR_TOOLS)
# AC_SUBST(DIR_PLUGIN_DIR)

dnl -------------------------------------------
dnl stored  (default on)
dnl -------------------------------------------
AC_ARG_ENABLE(build-stored,
   AC_HELP_STRING([--enable-build-stored], [enable building of stored (Storage daemon) @<:@default=yes@:>@]),
   [
      if test x$enableval = xno; then
	 build_stored=no
      fi
   ]
)
if test x$build_stored = xyes; then
   STORED_DIR="src/stored"
else
   STORED_DIR=""
fi
AC_SUBST(STORED_DIR)

dnl ---------------------------------------------------
dnl Check for conio (Bacula readline substitute)(
dnl ---------------------------------------------------
dnl this allows you to turn it completely off
AC_ARG_ENABLE(conio,
   AC_HELP_STRING([--disable-conio], [disable conio support @<:@default=no@:>@]),
   [
       if test x$enableval = xno; then
	  support_conio=no
       fi
   ]
)


dnl ---------------------------------------------------
dnl Check for IPv6 support
dnl ---------------------------------------------------
dnl this allows you to turn it completely off
support_ipv6=yes
AC_ARG_ENABLE(ipv6,
   AC_HELP_STRING([--enable-ipv6], [enable ipv6 support @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  support_ipv6=no
       fi
   ]
)

if test x$support_ipv6 = xyes; then
    AC_TRY_LINK([ #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>], [struct in6_addr t=in6addr_any; t.s6_addr[0] = 0;],
      [support_in6addr_any=yes], [support_in6addr_any=no])

   if test x$support_in6addr_any = xno ; then
       in6addr_any="const struct in6_addr in6addr_any"
   else
       in6addr_any="1"
   fi

   AC_TRY_LINK([ #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>], [$in6addr_any; struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
      [support_ipv6=yes], [support_ipv6=no])
fi

if test x$support_ipv6 = xyes; then
   AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])

   if test x$support_in6addr_any = xno ; then
      AC_DEFINE(NEED_IN6ADDR_ANY,1,[Whether to have in6addr_any support])
   fi
fi

TERM_LIB=""
AC_CHECK_HEADER(curses.h, [
    AC_CHECK_LIB(tinfo, tgetent, [ TERM_LIB="-ltinfo" ], [
      AC_CHECK_LIB(ncurses, tgetent, [ TERM_LIB="-lncurses" ], [
	AC_CHECK_LIB(termcap, tgetent, [ TERM_LIB="-ltermcap" ])
    ])
  ])
  ],
  [  AC_CHECK_HEADERS(curses.h)
     AC_CHECK_HEADER(term.h,
       [ AC_CHECK_LIB(curses, tgetent,
	 [ TERM_LIB="-lcurses" ] )
       ])
  ])


got_conio="no"
if test x$support_conio = xyes; then
   if test x$TERM_LIB != x; then
      CONS_LIBS=$TERM_LIB
      CONS_OBJ="conio.o"
      CONS_SRC="conio.c"
      got_conio="yes"
      support_readline=no
      AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
   else
      echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "
   fi
fi


dnl ---------------------------------------------------
dnl Check for readline support/directory (default off)
dnl ---------------------------------------------------
dnl this allows you to turn it completely off
AC_ARG_ENABLE(readline,
   AC_HELP_STRING([--disable-readline], [disable readline support @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  support_readline=no
       fi
   ]
)

got_readline="no"
READLINE_SRC=
if test x$support_readline = xyes; then
   AC_ARG_WITH(readline,
      AC_HELP_STRING([--with-readline@<:@=DIR@:>@], [specify readline library directory]),
      [
	  case "$with_readline" in
	  no)
	     :
	     ;;
	  yes|*)
	     if test -f ${with_readline}/readline.h; then
		CONS_INC="-I${with_readline}"
		CONS_LDFLAGS="-L$with_readline"
	     elif test -f ${with_readline}/include/readline/readline.h; then
		CONS_INC="-I${with_readline}/include/readline"
		CONS_LDFLAGS="-L${with_readline}/lib"
		with_readline="${with_readline}/include/readline"
	     else
		with_readline="/usr/include/readline"
	     fi

	     AC_CHECK_HEADER(${with_readline}/readline.h,
		[
		    AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
		    CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
		    got_readline="yes"
		], [
		    echo " "
		    echo "readline.h not found. readline turned off ..."
		    echo " "
		]
	     )
	     ;;
	  esac
      ],[
	 dnl check for standard readline library
	 AC_CHECK_HEADER(/usr/include/readline/readline.h,
	    [
		AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
		got_readline="yes"
		CONS_INC="-I/usr/include/readline"
		CONS_LIBS="-lreadline ${TERM_LIB}"
	    ], [
		dnl Did not find standard library, so try Bacula's default
		AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h,
		    [
			AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
			got_readline="yes"
			CONS_INC="-I${TOP_DIR}/depkgs/readline"
			CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
			CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
			PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
		    ], [
			echo " "
			echo "readline.h not found. readline turned off ..."
			echo " "
		    ]
		)
	    ]
	 )
      ]
   )
fi

AC_SUBST(CONS_INC)
AC_SUBST(CONS_OBJ)
AC_SUBST(CONS_SRC)
AC_SUBST(CONS_LIBS)
AC_SUBST(CONS_LDFLAGS)
AC_SUBST(READLINE_SRC)

dnl Minimal stuff for readline Makefile configuration
MAKE_SHELL=/bin/sh
AC_SUBST(MAKE_SHELL)
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr)
AC_CHECK_FUNCS(lstat lchown lchmod futimes fchmod fchown lutimes)
AC_CHECK_FUNCS(nanosleep nl_langinfo)
AC_CHECK_FUNCS(be64toh htobe64)
AC_CHECK_HEADERS(varargs.h)

dnl End of readline/conio stuff
dnl -----------------------------------------------------------------------

dnl
dnl Find where sockets are (especially for Solaris)
dnl Do this before the TCP Wrappers test since tcp wrappers
dnl uses the socket library and some linkers are stupid.
dnl
AC_CHECK_FUNC(socket,
    AC_MSG_RESULT(using libc's socket),
    AC_CHECK_LIB(xnet,socket)
    AC_CHECK_LIB(socket,socket)
    AC_CHECK_LIB(inet,socket))

dnl -----------------------------------------------------------
dnl Check whether user wants TCP wrappers support (default off)
dnl -----------------------------------------------------------
TCPW_MSG="no"
WRAPLIBS=""
AC_ARG_WITH(tcp-wrappers,
   AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
   [
       if test "x$withval" != "xno" ; then
	  saved_LIBS="$LIBS"
	  LIBS="$saved_LIBS -lwrap"
	  AC_SEARCH_LIBS(nanosleep, [rt])
	  AC_MSG_CHECKING(for libwrap)
	  AC_TRY_LINK(
	     [
	       #include <sys/types.h>
	       #include <tcpd.h>
	       int deny_severity = 0;
	       int allow_severity = 0;
	       struct request_info *req;
	     ], [
		hosts_access(req);
	     ], [
		 AC_MSG_RESULT(yes)
		 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
		 TCPW_MSG="yes"
		 LIBS="$saved_LIBS"
		 WRAPLIBS="-lwrap"
	     ], [
		 LIBS="$saved_LIBS -lwrap -lnsl"
		 WRAPLIBS="$saved_LIBS -lwrap -lnsl"
		 AC_TRY_LINK(
		   [
		       #include <sys/types.h>
		       #include <tcpd.h>
		       int deny_severity = 0;
		       int allow_severity = 0;
		       struct request_info *req;
		   ], [
		       hosts_access(req);
		   ], [
		      AC_MSG_RESULT(yes)
		      AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
		      TCPW_MSG="yes"
		      LIBS="$saved_LIBS"
		      WRAPLIBS="-lwrap"
		   ], [
		      AC_MSG_ERROR([*** libwrap missing])
		   ]
		)
	     ]
	  )
       fi
   ]
)

TOKYOCABINET_LIBS=
TOKYOCABINET_INC=

AC_SUBST(TOKYOCABINET_LIBS)
AC_SUBST(TOKYOCABINET_INC)


dnl -----------------------------------------------------------
dnl Check whether OpenSSL is available
dnl -----------------------------------------------------------
AC_MSG_CHECKING([for OpenSSL])
dnl The following uses quadrigraphs:
dnl '@<:@' = '['
dnl '@:>@' = ']'
AC_ARG_WITH(openssl,
    AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
    [
	with_openssl_directory=${withval}
    ]
)

if test "x$with_openssl_directory" != "xno"; then
   OPENSSL_LIBS="-lssl -lcrypto"
   OPENSSL_INC=""

   if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
      #
      # Make sure the $with_openssl_directory also makes sense
      #
      if test -d "$with_openssl_directory/lib" -a -d "$with_openssl_directory/include"; then
	 OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
	 OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
      fi
   fi

   saved_LIBS="${LIBS}"
   saved_CFLAGS="${CFLAGS}"
   LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
   CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"

   AC_TRY_LINK(
      [
	  #include <openssl/ssl.h>
      ], [
	   CRYPTO_set_id_callback(NULL);
      ], [
	  support_tls="yes"
	  support_crypto="yes"
      ], [
	  support_tls="no"
	  support_crypto="no"
      ]
   )
   AC_TRY_LINK(
      [
         #include <openssl/ssl.h>
      ], [
         SSL_CTX_set_psk_client_callback(NULL, NULL);
         SSL_CTX_set_psk_server_callback(NULL, NULL);
      ], [
         support_tls_psk="yes"
      ], [
         support_tls_psk="no"
      ]
   )
   AC_TRY_LINK(
      [
	  #include <openssl/evp.h>
      ], [
	  EVP_sha512();
      ], [
	  ac_cv_openssl_sha2="yes"
      ], [
	  ac_cv_openssl_sha2="no"
      ]
   )

   dnl Solaris disables greater than 128+ bit encryption in their OpenSSL
   dnl implementation, presumably for export reasons. If 192bit AES
   dnl is available, we assume that we're running with a 'non-export'
   dnl openssl library.
   AC_TRY_LINK(
      [
	  #include <openssl/evp.h>
      ], [
	  EVP_aes_192_cbc();
      ], [
	  ac_cv_openssl_export="no"
      ], [
	  ac_cv_openssl_export="yes"
      ]
   )
   AC_TRY_LINK(
      [
         #include <openssl/fips.h>
      ], [
         FIPS_mode_set(1);
      ], [
         AC_DEFINE(HAVE_FIPS)
          AC_MSG_RESULT([checking for FIPS... yes])
      ], [
         AC_MSG_RESULT([checkint for FIPS... no])
      ]
   )

   AC_TRY_LINK(
      [
         #include <openssl/opensslv.h>
      ], [
         OPENSSL_VERSION_TEXT;
      ], [
         AC_DEFINE(HAVE_OPENSSL_VERSION_TEXT)
      ], [
      ]
   )
   AC_MSG_RESULT([$support_tls])
   if test "$support_tls_psk" = "yes"; then
      AC_DEFINE(HAVE_TLS_PSK, 1, [Define if TLS PSK support should be enabled])
   fi
   if test "$support_tls" = "yes"; then
      AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
      AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
      AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
   fi

   if test "$ac_cv_openssl_sha2" = "yes"; then
      AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
   fi

   if test "$ac_cv_openssl_export" = "yes"; then
      AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
   fi

   if test "$support_crypto" = "yes"; then
      AC_CHECK_LIB(crypto, EVP_PKEY_encrypt_old, AC_DEFINE(HAVE_OPENSSLv1, 1, [Set if have OpenSSL version 1.x]))
   fi

   LIBS="${saved_LIBS}"
   CFLAGS="${saved_CFLAGS}"
else
   support_tls="no"
   support_crypto="no"
   AC_MSG_RESULT([$support_tls])
fi

if test "$support_tls" = "no" -o "$support_crypto" = "no"; then
   OPENSSL_LIBS=""
   OPENSSL_INC=""
fi

AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_INC)

dnl -----------------------------------------------------------
dnl dlopen is needed for plugins
dnl -----------------------------------------------------------
AC_SEARCH_LIBS(dlopen, [dl])

dnl -----------------------------------------------------------
dnl check for macOS IOKit
dnl -----------------------------------------------------------
IOKITLIBS=""
if test x${HAVE_DARWIN_OS_TRUE} = x; then
   AC_CHECK_HEADER(IOKit/pwr_mgt/IOPMLib.h,
      IOKITLIBS="-framework IOKit"
   )
fi
AC_SUBST(IOKITLIBS)

dnl ------------------------------------------
dnl Where to place working dir
dnl ------------------------------------------
working_dir=`eval echo /opt/bacula/working`
AC_ARG_WITH(working-dir,
   AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
   [
       if test "x$withval" != "xno" ; then
	 working_dir=$withval
       fi
   ]
)

AC_SUBST(working_dir)

dnl ------------------------------------------------------------------
dnl If the user has not set archivedir, we set our default as /tmp
dnl ------------------------------------------------------------------
archivedir=/tmp
AC_ARG_WITH(archivedir,
   AC_HELP_STRING([--with-archivedir=PATH], [specify path of SD archive directory]),
   [
       if test "x$withval" != "xno" ; then
	  archivedir=$withval
       fi
   ]
)

AC_SUBST(archivedir)

dnl ------------------------------------------------------------------
dnl Allow the user to specify the daemon resource name default hostname
dnl ------------------------------------------------------------------
basename=`hostname`
AC_ARG_WITH(basename,
   AC_HELP_STRING([--with-basename=RESNAME], [specify base resource name for daemons]),
   [
       if test "x$withval" != "xno" ; then
	  basename=$withval
       fi
   ]
)

AC_SUBST(basename)

dnl ------------------------------------------------------------------
dnl Allow the user to override the hostname (default = machine hostname)
dnl ------------------------------------------------------------------
hostname=`uname -n | cut -d '.' -f 1`
if test x${hostname} = x ; then
  hostname="localhost"
fi
dnl Make sure hostname is resolved
ping -c 1 $hostname 2>/dev/null 1>/dev/null
if test ! $? = 0; then
  hostname="localhost"
fi
AC_ARG_WITH(hostname,
   AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
   [
       if test "x$withval" != "xno" ; then
	 hostname=$withval
       fi
   ]
)

AC_SUBST(hostname)


dnl ------------------------------------------
dnl Where to place scriptdir (script files)
dnl ------------------------------------------
scriptdir=`eval echo ${sysconfdir}`
AC_ARG_WITH(scriptdir,
   AC_HELP_STRING([--with-scriptdir=PATH], [specify path of Bacula scripts directory]),
   [
       if test "x$withval" != "xno" ; then
	  scriptdir=$withval
       fi
   ]
)

AC_SUBST(scriptdir)


dnl ------------------------------------------
dnl Where to place bsrdir (bsr files)
dnl ------------------------------------------
bsrdir=`eval echo /opt/bacula/bsr`
AC_ARG_WITH(bsrdir,
   AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
   [
       if test "x$withval" != "xno" ; then
	  bsrdir=$withval
       fi
   ]
)

AC_SUBST(bsrdir)

dnl ------------------------------------------
dnl Where to place logdir
dnl ------------------------------------------
logdir=`eval echo /opt/bacula/log`
AC_ARG_WITH(logdir,
   AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
   [
       if test "x$withval" != "xno" ; then
	  logdir=$withval
       fi
   ]
)

AC_SUBST(logdir)


# ------------------------------------------
# Where to place plugindir (plugin files)
# ------------------------------------------
plugindir=`eval echo ${libdir}`
AC_ARG_WITH(plugindir,
   AC_HELP_STRING([--with-plugindir=PATH], [specify path of Bacula plugins directory]),
   [
       if test "x$withval" != "xno" ; then
	  plugindir=$withval
       fi
   ]
)

AC_SUBST(plugindir)

dnl ------------------------------------------
dnl Where to send dump email
dnl ------------------------------------------

dnl ------------------------------------------
dnl Where to send dump email
dnl ------------------------------------------
dump_email=root@localhost
AC_ARG_WITH(dump-email,
   AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
   [
       if test "x$withval" != "xno" ; then
	  dump_email=$withval
       fi
   ]
)

AC_SUBST(dump_email)

dnl ------------------------------------------
dnl Where to send job email
dnl ------------------------------------------
job_email=root@localhost
AC_ARG_WITH(job-email,
   AC_HELP_STRING([--with-job-email=EMAIL], [job output email address]),
   [
       if test "x$withval" != "xno" ; then
	  job_email=$withval
       fi
   ]
)

AC_SUBST(job_email)

dnl ------------------------------------------
dnl Where to find smtp host
dnl ------------------------------------------
smtp_host=localhost
AC_ARG_WITH(smtp_host,
   AC_HELP_STRING([--with-smtp-host=HOST], [SMTP mail host address]),
   [
       if test "x$withval" != "xno" ; then
	  smtp_host=$withval
       fi
   ]
)

AC_SUBST(smtp_host)

dnl ------------------------------------
dnl Where to place pid files
dnl ------------------------------------
piddir=/var/run
AC_ARG_WITH(pid-dir,
   AC_HELP_STRING([--with-pid-dir=PATH], [specify location of Bacula pid files]),
   [
       if test "x$withval" != "xno" ; then
	  piddir=$withval
       fi
   ]
)

AC_DEFINE_UNQUOTED(_PATH_BACULA_PIDDIR, "$piddir")
AC_SUBST(piddir)

dnl ------------------------------------
dnl Where to place subsys "lock file"
dnl ------------------------------------
subsysdir=/var/run/subsys
if test -d /var/run/subsys; then
   subsysdir=/var/run/subsys
elif test -d /var/lock/subsys; then
   subsysdir=/var/lock/subsys
else
   subsysdir=/var/run/subsys
fi
AC_ARG_WITH(subsys-dir,
   AC_HELP_STRING([--with-subsys-dir=PATH], [specify location of Bacula subsys file]),
   [
       if test "x$withval" != "xno" ; then
	  subsysdir=$withval
       fi
   ]
)

AC_SUBST(subsysdir)

dnl ------------------------------------
dnl Where to start assigning ports
dnl ------------------------------------
baseport=9101
AC_ARG_WITH(baseport,
   AC_HELP_STRING([--with-baseport=PORT], [specify base port address for daemons]),
   [
       if test "x$withval" != "xno" ; then
	  baseport=$withval
       fi
   ]
)

AC_SUBST(baseport)
dir_port=`expr $baseport`
fd_port=`expr $baseport + 1`
sd_port=`expr $fd_port + 1`

AC_SUBST(dir_port)
AC_SUBST(fd_port)
AC_SUBST(sd_port)

dnl ------------------------------------------
dnl Generate passwords
dnl ------------------------------------------
dir_password=
AC_ARG_WITH(dir-password,
   AC_HELP_STRING([--with-dir-password=PASSWORD], [specify Director's password]),
   [
       if test "x$withval" != "xno" ; then
	  dir_password=$withval
       fi
   ]
)

if test "x$dir_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 33`
   else
      key=`openssl rand -base64 33`
   fi
   dir_password=$key
fi

fd_password=
AC_ARG_WITH(fd-password,
   AC_HELP_STRING([--with-fd-password=PASSWORD], [specify Client's password]),
   [
       if test "x$withval" != "xno" ; then
	  fd_password=$withval
       fi
   ]
)

if test "x$fd_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 37`
   else
      key=`openssl rand -base64 33`
   fi
   fd_password=$key
fi

sd_password=
AC_ARG_WITH(sd-password,
   AC_HELP_STRING([--with-sd-password=PASSWORD], [specify Storage daemon's password]),
   [
       if test "x$withval" != "xno" ; then
	  sd_password=$withval
       fi
   ]
)

if test "x$sd_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 41`
   else
      key=`openssl rand -base64 33`
   fi
   sd_password=$key
fi

mon_dir_password=
AC_ARG_WITH(mon-dir-password,
   AC_HELP_STRING([--with-mon-dir-password=PASSWORD], [specify Director's password used by the monitor]),
   [
       if test "x$withval" != "xno" ; then
	  mon_dir_password=$withval
       fi
   ]
)

if test "x$mon_dir_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 33`
   else
      key=`openssl rand -base64 33`
   fi
   mon_dir_password=$key
fi

mon_fd_password=
AC_ARG_WITH(mon-fd-password,
   AC_HELP_STRING([--with-mon-fd-password=PASSWORD], [specify Client's password used by the monitor]),
   [
       if test "x$withval" != "xno" ; then
	  mon_fd_password=$withval
       fi
   ]
)

if test "x$mon_fd_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 37`
   else
      key=`openssl rand -base64 33`
   fi
   mon_fd_password=$key
fi

mon_sd_password=
AC_ARG_WITH(mon-sd-password,
   AC_HELP_STRING([--with-mon-sd-password=PASSWORD], [specify Storage daemon's password used by the monitor]),
   [
       if test "x$withval" != "xno" ; then
	  mon_sd_password=$withval
       fi
   ]
)

if test "x$mon_sd_password" = "x" ; then
   if test "x$OPENSSL" = "xnone" ; then
      key=`autoconf/randpass 41`
   else
      key=`openssl rand -base64 33`
   fi
   mon_sd_password=$key
fi

AC_SUBST(dir_password)
AC_SUBST(fd_password)
AC_SUBST(sd_password)
AC_SUBST(mon_dir_password)
AC_SUBST(mon_fd_password)
AC_SUBST(mon_sd_password)

dnl
dnl Pickup any database name
dnl
db_name=bacula
AC_ARG_WITH(db_name,
   AC_HELP_STRING([--with-db-name=DBNAME], [specify database name @<:@default=bacula@:>@]),
   [
       if test "x$withval" != "x" ; then
	  db_name=$withval
       fi
   ]
)
AC_SUBST(db_name)

db_user=bacula
AC_ARG_WITH(db_user,
   AC_HELP_STRING([--with-db-user=UNAME], [specify database user @<:@default=bacula@:>@]),
   [
       if test "x$withval" != "x" ; then
	  db_user=$withval
       fi
   ]
)
AC_SUBST(db_user)

db_password=
AC_ARG_WITH(db_password,
   AC_HELP_STRING([--with-db-password=PWD], [specify database password @<:@default=*none*@:>@]),
   [
       if test "x$withval" != "x" ; then
	  db_password=$withval
       fi
   ]
)
AC_SUBST(db_password)

dnl
dnl Pickup a database port
dnl
db_port=" "
AC_ARG_WITH(db_port,
   AC_HELP_STRING([--with-db-port=DBPORT], [specify a database port @<:@default=null@:>@]),
   [
       if test "x$withval" != "x" ; then
	  db_port=$withval
       fi
   ]
)
AC_SUBST(db_port)

dnl
dnl Pickup MySQL SSL options for database user connection
dnl
db_ssl_options=
AC_ARG_WITH(db_ssl_options,
   AC_HELP_STRING([--with-db-ssl-options=DBSSLOPTIONS], [specify SSL options for database user connection @<:@default=null@:>@]),
   [
       if test "x$withval" != "x" ; then
	 db_ssl_options=$withval
       fi
   ]
)
AC_SUBST(db_ssl_options)

#
# Handle users and groups for each daemon
#
dir_user=
AC_ARG_WITH(dir_user,
   AC_HELP_STRING([--with-dir-user=USER], [specify user for Director daemon]),
   [
       if test "x$withval" != "x" ; then
	   dir_user=$withval
       fi
   ]
)

dir_group=
AC_ARG_WITH(dir_group,
   AC_HELP_STRING([--with-dir-group=GROUP], [specify group for Director daemon]),
   [
       if test "x$withval" != "x" ; then
	  dir_group=$withval
       fi
   ]
)

sd_user=
AC_ARG_WITH(sd_user,
   AC_HELP_STRING([--with-sd-user=USER], [specify user for Storage daemon]),
   [
       if test "x$withval" != "x" ; then
	  sd_user=$withval
       fi
   ]
)

sd_group=
AC_ARG_WITH(sd_group,
   AC_HELP_STRING([--with-sd-group=GROUP], [specify group for Storage daemon]),
   [
       if test "x$withval" != "x" ; then
	  sd_group=$withval
       fi
   ]
)

fd_user=
AC_ARG_WITH(fd_user,
   AC_HELP_STRING([--with-fd-user=USER], [specify user for File daemon]),
   [
       if test "x$withval" != "x" ; then
	  fd_user=$withval
       fi
   ]
)

fd_group=
AC_ARG_WITH(fd_group,
   AC_HELP_STRING([--with-fd-group=GROUP], [specify group for File daemon]),
   [
       if test "x$withval" != "x" ; then
	  fd_group=$withval
       fi
   ]
)

AC_SUBST(dir_user)
AC_SUBST(dir_group)
AC_SUBST(sd_user)
AC_SUBST(sd_group)
AC_SUBST(fd_user)
AC_SUBST(fd_group)

dnl
dnl allow setting default executable permissions
dnl
SBINPERM=0750
AC_ARG_WITH(sbin-perm,
   AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0750@:>@]),
   [
       if test "x$withval" != "x" ; then
	  SBINPERM=$withval
       fi
   ]
)

AC_SUBST(SBINPERM)

dnl ------------------------------------------
dnl Python Cython detection
dnl ------------------------------------------
CYTHON=cython
CYTHON_LIBS=
CYTHON_INC=
AC_ARG_WITH(cython,
   AC_HELP_STRING([--with-cython=cython], [Cython path]),
   [
       if test "x$withval" != "xno" ; then
       	  CYTHON=$withval
       fi
   ]
)

$CYTHON -h > /dev/null 2> /dev/null
if test $? = 0; then
   if echo $CYTHON | grep cython3 > /dev/null; then
      PYTHON=python3
      CYTHON="$CYTHON -3"
   else
      PYTHON=python
      CYTHON="$CYTHON -2"
   fi
   # Thanks to Python, in 3.8 the new --embed flag is necessary
   # but it break any previous version. So, let's do it 2 times
   CYTHON_LIBS=`${PYTHON}-config --ldflags --embed 2>/dev/null`
   if test $? != 0; then
      CYTHON_LIBS=`${PYTHON}-config --ldflags 2>/dev/null`
   fi
   CYTHON_INC=`${PYTHON}-config --cflags 2>/dev/null`
else
   CYTHON=
fi

AC_SUBST(CYTHON)
AC_SUBST(CYTHON_LIBS)
AC_SUBST(CYTHON_INC)

dnl -------------------------------------------
dnl enable batch attribute DB insert (default on)
dnl -------------------------------------------
support_batch_insert=yes
AC_ARG_ENABLE(batch-insert,
   AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  support_batch_insert=no
       fi
   ]
)

if test x$support_batch_insert = xyes; then
   AC_DEFINE(USE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
fi

dnl ------------------------------------------------
dnl Bacula check for various SQL database engines
dnl ------------------------------------------------

dnl
dnl Set uncomment_dbi by default to '#' if DBI is enabled this will get reset
dnl
uncomment_dbi="#"

BA_CHECK_POSTGRESQL_DB

BA_CHECK_MYSQL_DB

BA_CHECK_SQLITE3_DB

dnl -------------------------------------------
dnl If no batch insert backend are enable set
dnl variable to None
dnl -------------------------------------------
if test -z "${batch_insert_db_backends}"; then
   batch_insert_db_backends="None"
fi

dnl -------------------------------------------
dnl Make sure at least one database backend is found
dnl -------------------------------------------
if test "x${db_backends}" = "x" ; then
   echo " "
   echo " "
   echo "You have not specified either --enable-client-only or one of the"
   echo "supported databases: MySQL, PostgreSQL, or SQLite3."
   echo "This is not permitted. Please reconfigure."
   echo " "
   echo "Aborting the configuration ..."
   echo " "
   echo " "
   exit 1
fi

dnl -------------------------------------------
dnl See how many catalog backends are configured.
dnl -------------------------------------------
case `echo $DB_BACKENDS | wc -w | sed -e 's/^ *//'` in
   1)
      DEFAULT_DB_TYPE="${DB_BACKENDS}"
      if test x$use_libtool = xno; then
	 SHARED_CATALOG_TARGETS=""
      else
	 SHARED_CATALOG_TARGETS="libbaccats-${DEFAULT_DB_TYPE}.la"
      fi
      ;;
   *)
      dnl ------------------------------------------------
      dnl Set the default backend to the first backend found
      dnl ------------------------------------------------
      DEFAULT_DB_TYPE=`echo ${DB_BACKENDS} | cut -d' ' -f1`

      dnl ------------------------------------------------
      dnl For multiple backend we need libtool support.
      dnl ------------------------------------------------
      if test x$use_libtool = xno; then
	 echo " "
	 echo " "
	 echo "You have specified two or more of the"
	 echo "supported databases: MySQL, PostgreSQL, or SQLite3."
	 echo "This is not permitted when not using libtool Please reconfigure."
	 echo " "
	 echo "Aborting the configuration ..."
	 echo " "
	 echo " "
	 exit 1
      fi

      SHARED_CATALOG_TARGETS=""
      for db_type in ${DB_BACKENDS}
      do
	 if test -z "${SHARED_CATALOG_TARGETS}"; then
	    SHARED_CATALOG_TARGETS="libbaccats-${db_type}.la"
	 else
	    SHARED_CATALOG_TARGETS="${SHARED_CATALOG_TARGETS} libbaccats-${db_type}.la"
	 fi
      done
      ;;
esac

dnl -------------------------------------------
dnl Unset DB_LIBS when using libtool as we link the
dnl shared library using the right database lib no need to
dnl set DB_LIBS which is only used for non shared versions
dnl of the backends.
dnl -------------------------------------------
if test x$use_libtool = xyes; then
   DB_LIBS=""
fi

AC_SUBST(uncomment_dbi)
AC_SUBST(DB_BACKENDS)
AC_SUBST(DB_LIBS)
AC_SUBST(DEFAULT_DB_TYPE)
AC_SUBST(SHARED_CATALOG_TARGETS)

AC_DEFINE(PROTOTYPES)

support_bee=no
extra_prefix=org
nb=`ls src/*/bee_* 2>/dev/null| wc -l`
if test $nb -gt 1; then
   support_bee=yes
   extra_prefix=bee
fi

AC_ARG_ENABLE(bee,
   AC_HELP_STRING([--disable-bee], [disable BEE support @<:@default=auto@:>@]),
   [
       if test x$enableval = xyes; then
         support_bee=yes
          extra_prefix=bee
       elif test x$enableval = xno; then
         support_bee=no
          extra_prefix=org
       fi
   ]
)

if test $support_bee = no
then
    AC_DEFINE(COMMUNITY, 1, [Set if COMMUNITY exists])
fi

dnl BEE source files
EXTRA_CATS_SRCS=`cd src/cats ; ls ${extra_prefix}_*.c      2> /dev/null | xargs echo`
EXTRA_FILED_SRCS=`cd src/filed ; ls ${extra_prefix}_*.c    2> /dev/null | xargs echo`
EXTRA_LIB_SRCS=`cd src/lib ; ls ${extra_prefix}_*.c        2> /dev/null | xargs echo`
EXTRA_DIRD_SRCS=`cd src/dird ; ls ${extra_prefix}_*.c      2> /dev/null | xargs echo`
EXTRA_STORED_SRCS=`cd src/stored ; ls ${extra_prefix}_stored_*.c  2> /dev/null | xargs echo`
EXTRA_BLS_SRCS=`cd src/stored ; ls ${extra_prefix}_bls_*.c  2> /dev/null | xargs echo`
EXTRA_LIBSD_SRCS=`cd src/stored ; ls ${extra_prefix}_lib*.c  2> /dev/null | xargs echo`
EXTRA_FINDLIB_SRCS=`cd src/findlib ; ls ${extra_prefix}_*.c  2> /dev/null | xargs echo`

AC_SUBST(EXTRA_CATS_SRCS)
AC_SUBST(EXTRA_FILED_SRCS)
AC_SUBST(EXTRA_LIB_SRCS)
AC_SUBST(EXTRA_DIRD_SRCS)
AC_SUBST(EXTRA_STORED_SRCS)
AC_SUBST(EXTRA_BLS_SRCS)
AC_SUBST(EXTRA_FINDLIB_SRCS)
AC_SUBST(EXTRA_LIBSD_SRCS)

dnl --------------------------------------------------------------------------
dnl Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
dnl
if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
   if test -z "$CCOPTS"; then
      CCOPTS='-g -O2 -Wall'
   fi
   CFLAGS="$CCOPTS"
fi

dnl A few others
AC_EXEEXT

dnl See if we can use 64 bit file addresses
largefile_support="no"
AC_BAC_LARGEFILE

AC_PATH_XTRA

dnl --------------------------------------------------------------------------
dnl CHECKING FOR HEADER FILES
dnl --------------------------------------------------------------------------
AC_CHECK_HEADERS( \
   assert.h \
   fcntl.h \
   grp.h \
   pwd.h \
   libc.h \
   limits.h \
   stdarg.h \
   stdlib.h \
   stdint.h \
   inttypes.h \
   string.h \
   strings.h \
   termios.h \
   termcap.h \
   term.h \
   unistd.h \
   sys/bitypes.h \
   sys/byteorder.h \
   sys/ioctl.h \
   sys/select.h \
   sys/socket.h \
   sys/sockio.h \
   sys/stat.h \
   sys/time.h \
   sys/types.h \
   arpa/nameser.h \
   mtio.h \
   sys/mtio.h \
   sys/tape.h \
   regex.h \
   attr/attributes.h \
   attr/xattr.h \
)
AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_TIMEZONE

dnl --------------------------------------------------------------------------
dnl Check for utime.h structure
dnl --------------------------------------------------------------------------
AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	      #include <utime.h>
	  ], [
	      struct utimbuf foo
	  ], [
	      ba_cv_header_utime_h=yes
	  ], [
	      ba_cv_header_utime_h=no
	  ]
       )
   ]
)
test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])

dnl --------------------------------------------------------------------------
dnl Check for socklen_t
dnl --------------------------------------------------------------------------
AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	      #include <sys/socket.h>
	  ], [
	      socklen_t x
	  ], [
	     ba_cv_header_socklen_t=yes
	  ], [
	     ba_cv_header_socklen_t=no
	  ]
       )
   ]
)
test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists])

dnl --------------------------------------------------------------------------
dnl Check for ioctl request type
dnl --------------------------------------------------------------------------
AC_LANG(C++)
AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <unistd.h>
	      #include <sys/types.h>
	      #include <sys/ioctl.h>
	  ], [
	      int (*d_ioctl)(int fd, unsigned long int request, ...);
	      d_ioctl = ::ioctl;
	  ], [
	     ba_cv_header_ioctl_req_t=yes
	  ], [
	     ba_cv_header_ioctl_req_t=no
	  ]
       )
   ]
)
test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int])

dnl Note: it is more correct to use AC_LANG(C++) but some of the older
dnl   *BSD systems still use old style C prototypes, which are wrong with
dnl   compiled with a C++ compiler.
AC_LANG(C)

dnl --------------------------------------------------------------------------
dnl Check for typeof()
dnl --------------------------------------------------------------------------
AC_LANG_PUSH(C++)
AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
   [
      AC_TRY_RUN(
         [
            main(){char *a = 0; a = (typeof a)a;}
         ], [
            ba_cv_have_typeof=yes
         ], [
            ba_cv_have_typeof=no
         ], [
            ba_cv_have_typeof=no
         ]
      )
   ]
)
if test $ba_cv_have_typeof = yes; then
   AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
   AC_DEFINE([TYPEOF_FUNC], typeof, [Define to nonstandard `typeof` supported by compiler])
else
AC_CACHE_CHECK(for __typeof, ba_cv_have_utypeof,
   [
      AC_TRY_RUN(
         [
            main(){char *a = 0; a = (__typeof a)a;}
         ], [
            ba_cv_have_utypeof=yes
         ], [
            ba_cv_have_utypeof=no
         ], [
            ba_cv_have_utypeof=no
         ]
      )
   ]
)
if test $ba_cv_have_utypeof = yes; then
   AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
   AC_DEFINE([TYPEOF_FUNC], __typeof, [Define to nonstandard `typeof` supported by compiler])
fi
fi

AC_LANG_POP(C++)

AC_C_CONST

AC_C_BIGENDIAN([AC_DEFINE([HAVE_BIG_ENDIAN], [1], [Big Endian])], [AC_DEFINE([HAVE_LITTLE_ENDIAN], [1], [Little Endian])])

dnl --------------------------------------------------------------------------
dnl CHECKING FOR FILESYSTEM TYPE
dnl --------------------------------------------------------------------------
AC_MSG_CHECKING(how to get filesystem type)
fstype=no
# The order of these tests is important.
AC_TRY_CPP(
   [
       #include <sys/statvfs.h>
       #include <sys/fstyp.h>
   ],
   AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4
)
if test $fstype = no; then
   AC_TRY_CPP(
      [
	  #include <sys/statfs.h>
	  #include <sys/fstyp.h>
      ],
      AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3
   )
fi
if test $fstype = no; then
   AC_TRY_CPP(
      [
	  #include <sys/statfs.h>
	  #include <sys/vmount.h>
      ],
      AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX
   )
fi
if test $fstype = no; then
   AC_TRY_CPP(
      [
	  #include <mntent.h>
      ],
      AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD
   )
fi
if test $fstype = no; then
   AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
fi
if test $fstype = no; then
   AC_TRY_CPP(
      [
	  #include <sys/mount.h>
	  #include <sys/fs_types.h>
      ],
      AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix
   )
fi
AC_MSG_RESULT($fstype)

AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )

AC_CHECK_DECLS([O_CLOEXEC],,[AC_DEFINE([O_CLOEXEC],[0], [Defined to 0 if not provided])],
[[
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
]])

AC_CHECK_DECLS([FD_CLOEXEC],,[AC_DEFINE([FD_CLOEXEC],[0], [Defined to 0 if not provided])],
[[
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
]])

AC_CHECK_DECLS([SOCK_CLOEXEC],,[AC_DEFINE([SOCK_CLOEXEC],[0],[Defined to 0 if not provided])],
[[
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]])

AC_CACHE_CHECK(for close on exec modifier for fopen(), ac_cv_feature_stream_cloexec_flag,
   [if test $ac_cv_have_decl_O_CLOEXEC = yes ; then
	if test $ac_cv_have_decl_SOCK_CLOEXEC = yes ; then
	    ac_cv_feature_stream_cloexec_flag="e"
	fi
    fi])

if test "x$ac_cv_feature_stream_cloexec_flag" = "xe" ; then
   AC_DEFINE(HAVE_STREAM_CLOEXEC,[0],[Defined to 0 if not provided])
fi

AC_DEFINE_UNQUOTED([STREAM_CLOEXEC], "$ac_cv_feature_stream_cloexec_flag", [fopen() modifier for setting close on exec flag])

AC_CHECK_FUNC(accept4, [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if you have the 'accept4' function.])])

CLOUD_DRIVERS=
AC_SUBST(CLOUD_DRIVERS)

CLOUD_INSTALL_TARGETS=
AC_SUBST(CLOUD_INSTALL_TARGETS)

dnl ---------------------------------------------------
dnl Check for S3 support/directory (default on)
dnl ---------------------------------------------------
dnl this allows you to turn it completely off

AC_ARG_ENABLE(s3,
   AC_HELP_STRING([--disable-s3], [disable S3 support @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  support_s3=no
       fi
   ]
)

S3_INC=
S3_LIBS=
S3_LDFLAGS=
have_libs3=no

if test x$support_s3 = xyes; then
   AC_ARG_WITH(s3,
      AC_HELP_STRING([--with-s3@<:@=DIR@:>@], [specify s3 library directory]),
      [
	  case "$with_s3" in
	  no)
	     :
	     ;;
	  yes|*)
	     if test -f ${with_s3}/include/libs3.h; then
		S3_INC="-I${with_s3}/include"
		S3_LDFLAGS="-L${with_s3}/lib"
		with_s3="${with_s3}/include"
	     else
		with_s3="/usr/include"
	     fi

	     AC_CHECK_HEADER(${with_s3}/libs3.h,
		[
		    AC_DEFINE(HAVE_LIBS3, 1, [Define to 1 if you have libs3])
		    S3_LIBS="${S3_LDFLAGS} -ls3"
		    have_libs3="yes"
                    CLOUD_DRIVERS="${CLOUD_DRIVERS} s3-driver"
                    CLOUD_INSTALL_TARGETS="${CLOUD_INSTALL_TARGETS} install-s3-cloud"
		], [
		    echo " "
		    echo "libs3.h not found. s3 turned off ..."
		    echo " "
		]
	     )
	     ;;
	  esac
      ],[
	 AC_CHECK_HEADER(libs3.h,
	 [
	    AC_CHECK_LIB(s3, S3_initialize,
	    [
	      S3_LIBS="-ls3"
	      AC_DEFINE(HAVE_LIBS3,1,[Define to 1 if you have libs3])
	      have_libs3=yes
              CLOUD_DRIVERS="${CLOUD_DRIVERS} s3-driver"
              CLOUD_INSTALL_TARGETS="${CLOUD_INSTALL_TARGETS} install-s3-cloud"
	   ])
	 ])
      ])
fi

AC_SUBST(S3_INC)
AC_SUBST(S3_LIBS)

AC_LANG_PUSH(C++)
AC_CHECK_FUNCS(backtrace)
AC_LANG_POP(C++)

dnl --------------------------------------------------------------------------
dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
dnl --------------------------------------------------------------------------
AC_TYPE_SIGNAL
SIGNAL_CHECK
AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(dev_t, unsigned long)
AC_CHECK_TYPE(daddr_t, long)
AC_CHECK_TYPE(major_t, int)
AC_CHECK_TYPE(minor_t, int)
AC_CHECK_TYPE(ssize_t, int)
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TM
AC_C_CONST
AC_C_RESTRICT

AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short int, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long int, 4)
AC_CHECK_SIZEOF(long long int, 8)
AC_CHECK_SIZEOF(int *, 4)

dnl Check for sys/types.h types
AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      u_int a; a = 1;
	  ], [
	      ac_cv_have_u_int="yes"
	  ], [
	      ac_cv_have_u_int="no"
	  ]
       )
   ]
)
if test "x$ac_cv_have_u_int" = "xyes" ; then
   AC_DEFINE(HAVE_U_INT)
   have_u_int=1
fi

AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      intmax_t a; a = 1;
	  ], [
	      ac_cv_have_intmax_t="yes"
	  ], [
	      AC_TRY_COMPILE(
		 [
		     #include <stdint.h>
		 ], [
		     intmax_t a; a = 1;
		 ], [
		     ac_cv_have_intmax_t="yes"
		 ], [
		     ac_cv_have_intmax_t="no"
		 ]
	      )
	  ]
       )
   ]
)
if test "x$ac_cv_have_intmax_t" = "xyes" ; then
   AC_DEFINE(HAVE_INTMAX_T)
   have_intmax_t=1
fi

AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      u_intmax_t a; a = 1;
	  ], [
	      ac_cv_have_u_intmax_t="yes"
	  ], [
	      AC_TRY_COMPILE(
		 [
		     #include <stdint.h>
		 ], [
		    u_intmax_t a; a = 1;
		 ], [
		    ac_cv_have_u_intmax_t="yes"
		 ], [
		    ac_cv_have_u_intmax_t="no"
		 ]
	      )
	  ]
       )
   ]
)
if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
   AC_DEFINE(HAVE_U_INTMAX_T)
   have_u_intmax_t=1
fi

AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      int8_t a; int16_t b; int32_t c; a = b = c = 1;
	  ], [
	      ac_cv_have_intxx_t="yes"
	  ], [
	      ac_cv_have_intxx_t="no"
	  ]
       )
   ]
)
if test "x$ac_cv_have_intxx_t" = "xyes" ; then
   AC_DEFINE(HAVE_INTXX_T)
   have_intxx_t=1
fi

AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      int64_t a; a = 1;
	  ], [
	      ac_cv_have_int64_t="yes"
	  ], [
	      ac_cv_have_int64_t="no"
	  ]
       )
   ]
)
if test "x$ac_cv_have_int64_t" = "xyes" ; then
   AC_DEFINE(HAVE_INT64_T)
   have_int64_t=1
fi

AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;
	  ], [
	     ac_cv_have_u_intxx_t="yes"
	  ], [
	     ac_cv_have_u_intxx_t="no"
	  ]
       )
   ]
)
if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
   AC_DEFINE(HAVE_U_INTXX_T)
   have_u_intxx_t=1
fi

AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/types.h>
	  ], [
	      u_int64_t a; a = 1;
	  ], [
	     ac_cv_have_u_int64_t="yes"
	  ], [
	     ac_cv_have_u_int64_t="no"
	  ]
       )
   ]
)
if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
   AC_DEFINE(HAVE_U_INT64_T)
   have_u_int64_t=1
fi

if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
then
   AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
   AC_TRY_COMPILE(
      [
	  #include <sys/bitypes.h>
      ], [
	  int8_t a; int16_t b; int32_t c;
	  u_int8_t e; u_int16_t f; u_int32_t g;
	  a = b = c = e = f = g = 1;
      ], [
	  AC_DEFINE(HAVE_U_INTXX_T)
	  AC_DEFINE(HAVE_INTXX_T)
	  AC_DEFINE(HAVE_SYS_BITYPES_H)
	  AC_MSG_RESULT(yes)
      ], [
	  AC_MSG_RESULT(no)
      ]
   )
fi

if test -z "$have_u_intxx_t" ; then
   AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t,
      [
	  AC_TRY_COMPILE(
	     [
		 #include <sys/types.h>
	     ], [
		 uint8_t a; uint16_t b;
		 uint32_t c; a = b = c = 1;
	     ], [
		ac_cv_have_uintxx_t="yes"
	     ], [
		ac_cv_have_uintxx_t="no"
	     ]
	  )
      ]
   )
   if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
      AC_DEFINE(HAVE_UINTXX_T)
   fi
fi

if (test -z "$have_u_int64_t" || test -z "$have_int64_t" && \
    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
then
   AC_MSG_CHECKING([for int64_t and u_int64_t types in sys/bitypes.h])
   AC_TRY_COMPILE(
      [
	  #include <sys/bitypes.h>
      ], [
	  int64_t a; u_int64_t b;
	  a = b = 1;
      ], [
	  AC_DEFINE(HAVE_U_INT64_T)
	  AC_DEFINE(HAVE_INT64_T)
	  AC_MSG_RESULT(yes)
      ], [
	  AC_MSG_RESULT(no)
      ]
   )
fi

if (test -z "$have_uintxx_t" && \
    test "x$ac_cv_header_sys_bitypes_h" = "xyes")
then
   AC_MSG_CHECKING([for uintXX_t types in sys/bitypes.h])
   AC_TRY_COMPILE(
      [
	  #include <sys/bitypes.h>
      ], [
	  uint8_t a; uint16_t b;
	  uint32_t c; a = b = c = 1;
      ], [
	  AC_DEFINE(HAVE_UINTXX_T)
	  AC_MSG_RESULT(yes)
      ], [
	  AC_MSG_RESULT(no)
      ]
   )
fi

dnl --------------------------------------------------------------------------
dnl CHECKING FOR REQUIRED LIBRARY FUNCTIONS
dnl --------------------------------------------------------------------------
AC_CHECK_FUNCS( \
   fork \
   getcwd \
   gethostname \
   getpid \
   gettimeofday \
   setpgid \
   setpgrp \
   setsid \
   signal \
   strerror \
   strncmp \
   strncpy \
   vfprintf \
   ,,
   [echo 'configure: cannot find needed function.'; exit 1]
)

AC_CHECK_DECL(
    F_CLOSEM,
    AC_DEFINE(HAVE_FCNTL_F_CLOSEM, 1, [Set if you have 'F_CLOSEM' fcntl flag]),
    ,
    [#include <fcntl.h>]
)

AC_CHECK_DECL(
    FS_NODUMP_FL,
    AC_DEFINE(HAVE_NODUMP, 1, [Set if nodump can be turned on]),
    ,
    [#include <linux/fs.h>]
)

AC_CHECK_DECL(
    F_SETLK,
    AC_DEFINE(HAVE_FCNTL_LOCK, 1, [Set if fcntl supports file locking]),
    ,
    [#include <fcntl.h>]
)

AC_CHECK_FUNC(closefrom, [AC_DEFINE(HAVE_CLOSEFROM, 1, [Define to 1 if you have the 'closefrom' function.])])
AC_CHECK_FUNCS(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE, 1, [Set if have getpagesize])])
AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_trim])])

AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
AC_CHECK_FUNCS(posix_fadvise)
AC_CHECK_FUNCS(posix_fallocate)
AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(realpath)
AC_CHECK_FUNCS(getrlimit)
AC_CHECK_FUNCS(getpwent_r)

AC_CHECK_FUNCS(chflags)

AC_TRY_LINK([
int f(int b) {
  return __builtin_bswap32(b);
}
],[int a = f(10);], [AC_DEFINE([HAVE_BSWAP32], 1, [Define to 1 if you have the '__builtin_bswap32' function ])])

AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)

AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
   [
       AC_TRY_LINK(
	  [
	      #include <stdarg.h>
	      void use_va_copy(va_list args){va_list args2; va_copy(args2,args); va_end(args2);}
	      void call_use_va_copy(int junk,...){va_list args; va_start(args,junk); use_va_copy(args); va_end(args);}
	  ], [
	      call_use_va_copy(1,2,3)
	  ], [
	      ba_cv_va_copy=yes
	  ], [
	      ba_cv_va_copy=no
	  ]
       )
   ]
)
test $ba_cv_va_copy = yes && AC_DEFINE(HAVE_VA_COPY, 1, [Set if va_copy exists])

dnl --------------------------------------------------------------------------
dnl CHECKING FOR THREAD SAFE FUNCTIONS
dnl --------------------------------------------------------------------------
AC_CHECK_FUNCS(localtime_r readdir_r strerror_r gethostbyname_r)

# If resolver functions are not in libc check for -lnsl or -lresolv.
AC_CHECK_FUNC(gethostbyname_r,
    AC_MSG_RESULT(using libc's resolver),
    AC_CHECK_LIB(nsl,gethostbyname_r)
    AC_CHECK_LIB(resolv,gethostbyname_r))

AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
AC_CHECK_FUNCS(getnameinfo, [AC_DEFINE(HAVE_GETNAMEINFO)])

dnl Check for poll() function
AC_CHECK_FUNCS(poll, [AC_DEFINE(HAVE_POLL)])

dnl ----------------------------
dnl check sa_len of sockaddr
dnl ----------------------------
AC_CACHE_CHECK(for struct sockaddr has a sa_len field, ac_cv_struct_sockaddr_sa_len,
   [
       AC_TRY_COMPILE(
	  [
	      #include <sys/socket.h>
	  ], [
	      struct sockaddr s; s.sa_len;
	  ], [
	     ac_cv_struct_sockaddr_sa_len=yes
	  ], [ac_cv_struct_sockaddr_sa_len=no
	  ]
       )
   ]
)

if test $ac_cv_struct_sockaddr_sa_len = yes; then
  AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
fi

dnl ----------------------------
dnl check sockaddr_storage
dnl ----------------------------
AC_CACHE_CHECK(for struct sockaddr_storage, ac_cv_struct_sockaddr_storage,
   [
       AC_TRY_COMPILE(
         [
             #include <sys/socket.h>
         ], [
             struct sockaddr_storage s; 
         ], [
            ac_cv_struct_sockaddr_storage=yes
         ], [ac_cv_struct_sockaddr_storage=no
         ]
       )
   ]
)

if test $ac_cv_struct_sockaddr_storage = yes; then
  AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [Define if struct sockaddr_storage exists])
fi

dnl
dnl check for working getaddrinfo()
dnl
dnl Note that if the system doesn't have gai_strerror(), we
dnl can't use getaddrinfo() because we can't get strings
dnl describing the error codes.
dnl
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,
   [
       AC_TRY_RUN(
	  [
	      #include <netdb.h>
	      #include <string.h>
	      #include <sys/types.h>
	      #include <sys/socket.h>

	      int main(void) {
		  struct addrinfo hints, *ai;
		  int error;

		  memset(&hints, 0, sizeof(hints));
		  hints.ai_family = AF_UNSPEC;
		  hints.ai_socktype = SOCK_STREAM;
		  error = getaddrinfo("127.0.0.1", NULL, &hints, &ai);
		  if (error) {
		      return(1);
		  }
		  if (ai->ai_addr->sa_family != AF_INET) {
		      return(1);
		  }
		  return(0);
	      }
	  ],[
	      ac_cv_working_getaddrinfo="yes"
	  ],[
	      ac_cv_working_getaddrinfo="no"
	  ],[
	      ac_cv_working_getaddrinfo="yes"
	  ]
       )
   ]
)
AC_CHECK_FUNC(gai_strerror, [AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.])])

if test "$ac_cv_working_getaddrinfo" = "yes"; then
  if test "$ac_cv_func_gai_strerror" != "yes"; then
    ac_cv_working_getaddrinfo="no"
  else
    AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if getaddrinfo exists and works])
  fi
fi

AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
AC_FUNC_GETMNTENT
AC_CHECK_FUNCS(getmntinfo, [AC_DEFINE(HAVE_GETMNTINFO)])
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_SETPGRP 	    dnl check for BSD setpgrp.
# AC_FUNC_FNMATCH    dnl use local version

AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])

AC_CHECK_LIB(sun, getpwnam)

AC_CHECK_HEADERS(zlib.h)
AC_CHECK_LIB(z, deflate, [ZLIBS="-lz"])
have_zlib=no
if test x$ZLIBS = x-lz; then
   AC_DEFINE(HAVE_LIBZ)
   have_zlib=yes
fi
AC_SUBST(ZLIBS)

dnl
dnl Check if we have AFS on this system
dnl
AFS_CFLAGS=""
AFS_LIBS=""
support_afs=auto
AC_ARG_ENABLE(afs,
   AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]),
   [
       if test x$enableval = xyes; then
	  support_afs=yes
       elif test x$enableval = xno; then
	  support_afs=no
       fi
   ]
)

have_afs=no
if test x$support_afs = xyes -o x$support_afs = xauto; then
   AC_ARG_WITH(afsdir,
      AC_HELP_STRING([--with-afsdir@<:@=DIR@:>@], [Directory holding AFS includes/libs]),
      with_afsdir=$withval
   )

   dnl
   dnl Search in standard places, or --with-afsdir not specified
   dnl
   if test x$with_afsdir = x; then
      for root in /usr /usr/local; do
	 if test -d ${root}/include/afs/ ; then
	    with_afsdir=${root}
	    break
	 fi
	 if test -d ${root}/include/openafs/afs/ ; then
	    with_afsdir=${root}
	    break
	 fi
      done
   fi

   if test -d ${with_afsdir}/include/afs/ ; then
      AFS_CFLAGS="-I${with_afsdir}/include"
   else
      if test -d ${with_afsdir}/include/openafs/afs/ ; then
	 AFS_CFLAGS="-I${with_afsdir}/include/openafs"
      fi
   fi

   saved_CFLAGS="${CFLAGS}"
   saved_CPPFLAGS="${CPPFLAGS}"
   CFLAGS="${AFS_CFLAGS} ${saved_CFLAGS}"
   CPPFLAGS="${AFS_CFLAGS} ${saved_CPPFLAGS}"

   AC_CHECK_HEADERS(afs/afsint.h)
   AC_TRY_CPP(
       [
	  #include <afs/afsint.h>
	  #include <afs/venus.h>
       ],
       AC_DEFINE(HAVE_AFS_VENUS_H,1,[Define to 1 if you have the <afs/venus.h> header file.])
   )

   CFLAGS="${saved_CFLAGS}"
   CPPFLAGS="${saved_CPPFLAGS}"

   dnl
   dnl See if we can find a libsys with the pioctl symbol in there
   dnl
   AC_MSG_CHECKING(for pioctl in AFS libsys)
   for dir in ${with_afsdir}/lib \
	      ${with_afsdir}/lib/afs \
	      ${with_afsdir}/lib/openafs \
	      ${with_afsdir}/lib64 \
	      ${with_afsdir}/lib64/afs \
	      ${with_afsdir}/lib64/openafs
   do
      for arch_type in .a .so
      do
	 A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} 2>/dev/null | grep pioctl`
	 pkg=$?
	 if test $pkg = 0; then
	    have_afs=yes
	    AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util${arch_type}"
	    break
	 fi
      done
   done

   if test $have_afs = yes; then
      AC_MSG_RESULT(yes)
   else
      AC_MSG_RESULT(no)
   fi

   if test x$support_afs = xyes -a $have_afs != yes; then
      AC_MSG_ERROR([afs support explicitly enabled but no supported afs implementation found,
  please either load the afs libraries or rerun configure without --enable-afs])
   else
      if test $have_afs = yes; then
	 AC_DEFINE(HAVE_AFS,1,[Define to 1 if your system has AFS support])
	 AC_DEFINE(HAVE_AFS_ACL,1,[Andrew FileSystem ACL support])
      fi
   fi
fi
AC_SUBST(AFS_CFLAGS)
AC_SUBST(AFS_LIBS)

AC_SUBST(ANDROID_QT_QMAKE)
AC_SUBST(ANDROID_QT_APK_MAKE)
AC_SUBST(ANDROID_QT_BUILD_LIBS)
AC_SUBST(ANDROID_API)

dnl ---------------------------------------------------
dnl Check for lzo support/directory (default on)
dnl ---------------------------------------------------
dnl this allows you to turn it completely off

AC_ARG_ENABLE(lzo,
   AC_HELP_STRING([--disable-lzo], [disable lzo support @<:@default=yes@:>@]),
   [
       if test x$enableval = xno; then
	  support_lzo=no
       fi
   ]
)

LZO_INC=
LZO_LIBS=
LZO_LDFLAGS=

have_lzo="no"
if test x$support_lzo = xyes; then
   AC_ARG_WITH(lzo,
      AC_HELP_STRING([--with-lzo@<:@=DIR@:>@], [specify lzo library directory]),
      [
	  case "$with_lzo" in
	  no)
	     :
	     ;;
	  yes|*)
	     if test -f ${with_lzo}/include/lzo/lzoconf.h; then
		LZO_INC="-I${with_lzo}/include"
		LZO_LDFLAGS="-L${with_lzo}/lib"
		with_lzo="${with_lzo}/include"
	     else
		with_lzo="/usr/include"
	     fi

	     AC_CHECK_HEADER(${with_lzo}/lzo/lzoconf.h,
		[
		    AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have LZO compression])
		    LZO_LIBS="${LZO_LDFLAGS} -llzo2"
		    have_lzo="yes"
		], [
		    echo " "
		    echo "lzoconf.h not found. lzo turned off ..."
		    echo " "
		]
	     )
	     ;;
	  esac
      ],[
	 AC_CHECK_HEADER(lzo/lzoconf.h,
	 [
	    AC_CHECK_HEADER(lzo/lzo1x.h,
	    [
	       AC_CHECK_LIB(lzo2, lzo1x_1_compress,
	       [
		 LZO_LIBS="-llzo2"
		 AC_DEFINE(HAVE_LZO,1,[Define to 1 if you have LZO compression])
		 have_lzo=yes
	       ])
	    ])
	 ])
      ])
fi

AC_SUBST(LZO_INC)
AC_SUBST(LZO_LIBS)

dnl ---------------------------------------------------
dnl Check for ACSLS support and libraries
dnl ---------------------------------------------------
acsls_support=yes
have_acsls="no"
AC_ARG_ENABLE(acsls,
   AC_HELP_STRING([--disable-acsls], [disable ACSLS support @<:@default=yes@:>@]),
   [
      if test x$enableval = xno; then
         acsls_support=no
      fi
   ]
)

ACSLS_LIBDIR=
ACSLS_OS_DEFINE=
ACSLS_BUILD_TARGET=

AC_SUBST(ACSLS_LIBDIR)
AC_SUBST(ACSLS_OS_DEFINE)
AC_SUBST(ACSLS_BUILD_TARGET)


dnl
dnl Check for ACL support and libraries
dnl
support_acl=auto
AC_ARG_ENABLE(acl,
   AC_HELP_STRING([--disable-acl], [disable acl support @<:@default=auto@:>@]),
   [
       if test x$enableval = xyes; then
	  support_acl=yes
       elif test x$enableval = xno; then
	  support_acl=no
       fi
   ]
)

have_acl=no
have_extended_acl=no
if test x$support_acl = xyes -o x$support_acl = xauto; then
   AC_CHECK_HEADER(sys/acl.h, [ AC_DEFINE(HAVE_SYS_ACL_H,1,[Defines if your system have the sys/acl.h header file])] , )

   dnl
   dnl First check for acl_get_file in libc
   dnl
   AC_CHECK_FUNC(acl_get_file,
   [
      have_acl=yes
   ])

   dnl
   dnl Check for acl_get_file in libacl (Linux)
   dnl
   if test $have_acl = no; then
      AC_CHECK_LIB(acl, acl_get_file,
      [
	have_acl=yes
	if test $have_afs = yes; then
	 dnl
	 dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!!
	 dnl
	    if test -d /usr/lib64/; then
	       FDLIBS="-L/usr/lib64 -lacl $FDLIBS"
	    else
	       FDLIBS="-L/usr/lib -lacl $FDLIBS"
	    fi
	 else
	    FDLIBS="-lacl $FDLIBS"
	 fi
      ])
   fi

   dnl
   dnl Check for acl_get_file in libpacl (OSF1)
   dnl and if ACL_TYPE_DEFAULT_DIR is defined.
   dnl
   if test $have_acl = no -a x${HAVE_OSF1_OS_TRUE} = x; then
      AC_CHECK_LIB(pacl, acl_get_file,
      [
	 have_acl=yes
	 FDLIBS="-lpacl $FDLIBS"
      ])

      AC_MSG_CHECKING(for ACL_TYPE_DEFAULT_DIR in acl.h include file)
      grep ACL_TYPE_DEFAULT_DIR /usr/include/sys/acl.h > /dev/null 2>&1
      if test $? = 0; then
	 AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type])
	 AC_MSG_RESULT(yes)
      else
	 AC_MSG_RESULT(no)
      fi
   fi

   dnl
   dnl On OSX check for availability of ACL_TYPE_EXTENDED
   dnl
   if test $have_acl = yes -a x${HAVE_DARWIN_OS_TRUE} = x; then
      AC_MSG_CHECKING(for ACL_TYPE_EXTENDED in acl.h include file)
      grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1
      if test $? = 0; then
	 AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type])
	 AC_MSG_RESULT(yes)
      else
	 AC_MSG_RESULT(no)
      fi
   fi

   dnl
   dnl On FreeBSD check for availability of ACL_TYPE_NFS4
   dnl
   if test $have_acl = yes -a \
      x${HAVE_FREEBSD_OS_TRUE} = x; then
      AC_MSG_CHECKING(for ACL_TYPE_NFS4 in acl.h include file)
      grep ACL_TYPE_NFS4 /usr/include/sys/acl.h > /dev/null 2>&1
      if test $? = 0; then
    AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type])
    AC_MSG_RESULT(yes)
      else
    AC_MSG_RESULT(no)
      fi
   fi

   dnl
   dnl Check for acltotext and acl_totext (Solaris)
   dnl
   if test $have_acl = no -a \
      x${HAVE_SUN_OS_TRUE} = x; then
      AC_CHECK_LIB(sec, acltotext,
    [
	have_acl=yes
	FDLIBS="-lsec $FDLIBS"

	AC_CHECK_LIB(sec, acl_totext,
      [
	  have_extended_acl=yes
      ]
	)
    ]
      )
   fi

   dnl
   dnl Check for acl_get and aclx_get (AIX)
   dnl
   if test $have_acl = no -a \
	   x${HAVE_AIX_OS_TRUE} = x; then
      AC_CHECK_FUNC(acl_get,
	 [
	     have_acl=yes

	     AC_CHECK_FUNC(aclx_get,
		[
		    have_extended_acl=yes
		]
	     )
	 ]
      )
   fi

ACLOBJS=
   if test x$support_acl = xyes -a $have_acl != yes; then
      AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found,
  please either load the acl libraries or rerun configure without --enable-acl])
   else
      if test $have_acl = yes; then
	 AC_DEFINE([HAVE_ACL],1,[Normal acl support])
	 dnl
	 dnl Prepare obj building
	 dnl
	 if test x${HAVE_LINUX_OS_TRUE} = x; then
	    ACLOBJS="bacl.c bacl_linux.c"
	 fi
	 if test x${HAVE_SUN_OS_TRUE} = x; then
	    ACLOBJS="bacl.c bacl_solaris.c"
	 fi
	 if test x${HAVE_FREEBSD_OS_TRUE} = x; then
	    ACLOBJS="bacl.c bacl_freebsd.c"
	 fi
	 if test x${HAVE_DARWIN_OS_TRUE} = x; then
	    ACLOBJS="bacl.c bacl_osx.c"
	 fi
      fi
      if test $have_extended_acl = yes; then
	 AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support])
      fi
   fi
fi
AC_SUBST(ACLOBJS)

dnl
dnl Check for XATTR support
dnl
support_xattr=auto
AC_ARG_ENABLE(xattr,
   AC_HELP_STRING([--disable-xattr], [disable xattr support @<:@default=auto@:>@]),
   [
       if test x$enableval = xyes; then
	  support_xattr=yes
       elif test x$enableval = xno; then
	  support_xattr=no
       fi
   ]
)

have_xattr=no
if test x$support_xattr = xyes -o x$support_xattr = xauto; then
   dnl
   dnl First check for *BSD support
   dnl When running on a BSD variant
   dnl
   if test x${HAVE_FREEBSD_OS_TRUE} = x -o \
	   x${HAVE_NETBSD_OS_TRUE} = x -o \
	   x${HAVE_OPENBSD_OS_TRUE} = x; then
      AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , )
      AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , )
      AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link,
	 [
	     have_xattr=yes
	     AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the 'extattr_get_link' function.])
	     AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the 'extattr_set_link' function.])
	     AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the 'extattr_list_link' function.])
	 ]
      )

      if test $have_xattr = no; then
	 AC_CHECK_FUNCS(extattr_get_file extattr_set_file extattr_list_file,
	    [
		have_xattr=yes
		AC_DEFINE([HAVE_EXTATTR_GET_FILE],1,[Define to 1 if you have the 'extattr_get_file' function.])
		AC_DEFINE([HAVE_EXTATTR_SET_FILE],1,[Define to 1 if you have the 'extattr_set_file' function.])
		AC_DEFINE([HAVE_EXTATTR_LIST_FILE],1,[Define to 1 if you have the 'extattr_list_file' function.])
	    ]
	 )
      fi

      if test $have_xattr = yes; then
	 have_extattr_string_in_libc=no
	 AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace,
	    [
		have_extattr_string_in_libc=yes
		AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
		AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
	    ]
	 )

	 dnl
	 dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil
	 dnl
	 if test $have_extattr_string_in_libc = no; then
	    AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace,
	       [
		   AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
		   AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
		   FDLIBS="-lutil $FDLIBS"
	       ]
	    )
	 fi
      fi
   fi

   dnl
   dnl If we failed to find *BSD support try the AIX implementation of extented attributes (EA)
   dnl When running on AIX
   dnl
   if test $have_xattr = no -a \
	   x${HAVE_AIX_OS_TRUE} = x; then
      AC_CHECK_HEADER(sys/ea.h, [ AC_DEFINE(HAVE_SYS_EA_H,1,[Defines if your system have the sys/ea.h header file])] , )
      AC_CHECK_FUNCS(llistea lgetea lsetea,
	 [
	     have_xattr=yes
	     AC_DEFINE([HAVE_LLISTEA],1,[Define to 1 if you have the 'llistea' function.])
	     AC_DEFINE([HAVE_LGETEA],1,[Define to 1 if you have the 'lgetea' function.])
	     AC_DEFINE([HAVE_LSETEA],1,[Define to 1 if you have the 'lsetea' function.])
	 ]
      )

      if test $have_xattr = no; then
	 AC_CHECK_FUNCS(listea getea setea,
	    [
		have_xattr=yes
		AC_DEFINE([HAVE_LISTEA],1,[Define to 1 if you have the 'listea' function.])
		AC_DEFINE([HAVE_GETEA],1,[Define to 1 if you have the 'getea' function.])
		AC_DEFINE([HAVE_SETEA],1,[Define to 1 if you have the 'setea' function.])
	    ]
	 )
      fi
   fi

   dnl
   dnl If we failed to find AIX support try the TRU64 implementation of extented attributes
   dnl when running on a TRU64 OS.
   dnl
   if test $have_xattr = no -a \
	   x${HAVE_OSF1_OS_TRUE} = x; then
      AC_CHECK_HEADER(sys/proplist.h, [ AC_DEFINE(HAVE_SYS_PROPLIST_H,1,[Defines if your system have the sys/proplist.h header file])] , )
      AC_CHECK_FUNCS(getproplist get_proplist_entry sizeof_proplist_entry add_proplist_entry setproplist,
	 [
	     have_xattr=yes
	     AC_DEFINE([HAVE_GETPROPLIST],1,[Define to 1 if you have the 'getproplist' function.])
	     AC_DEFINE([HAVE_GET_PROPLIST_ENTRY],1,[Define to 1 if you have the 'get_proplist_entry' function.])
	     AC_DEFINE([HAVE_SIZEOF_PROPLIST_ENTRY],1,[Define to 1 if you have the 'sizeof_proplist_entry' function.])
	     AC_DEFINE([HAVE_ADD_PROPLIST_ENTRY],1,[Define to 1 if you have the 'add_proplist_entry' function.])
	     AC_DEFINE([HAVE_SETPROPLIST],1,[Define to 1 if you have the 'setproplist' function.])
	 ]
      )
   fi

   dnl
   dnl If we failed to find TRU64 support try the SOLARIS implementation of extented and extensible attributes
   dnl when running on a Solaris.
   dnl
   if test $have_xattr = no -a \
      x${HAVE_SUN_OS_TRUE} = x; then
      AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , )
      AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , )
      AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , )

      AC_CHECK_FUNCS(openat attropen unlinkat fchownat futimesat linkat,
	 [
	    have_xattr=yes
	    AC_DEFINE([HAVE_OPENAT],1,[Define to 1 if you have the 'openat' function.])
	    AC_DEFINE([HAVE_ATTROPEN],1,[Define to 1 if you have the 'attropen' function.])
	    AC_DEFINE([HAVE_UNLINKAT],1,[Define to 1 if you have the 'unlinkat' function.])
	    AC_DEFINE([HAVE_FCHOWNAT],1,[Define to 1 if you have the 'fchownat' function.])
	    AC_DEFINE([HAVE_FUTIMESAT],1,[Define to 1 if you have the 'futimesat' function.])
	    AC_DEFINE([HAVE_LINKAT],1,[Define to 1 if you have the 'linkat' function.])
	 ]
      )

      if test $have_xattr = yes; then
	 AC_CHECK_LIB(nvpair, nvlist_next_nvpair,
	    [
	       AC_DEFINE([HAVE_NVLIST_NEXT_NVPAIR],1,[Define to 1 if you have the 'nvlist_next_nvpair' function.])
	       FDLIBS="-lnvpair $FDLIBS"
	    ]
	 )
      fi
   fi

   dnl
   dnl If we failed to find Solaris support try the generic xattr support code
   dnl
   if test $have_xattr = no; then
      AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , )
      AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr,
	 [
	     have_xattr=yes
	     AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the 'llistxattr' function.])
	     AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the 'lgetxattr' function.])
	     AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the 'lsetxattr' function.])
	 ]
      )

      if test $have_xattr = no; then
	 AC_CHECK_FUNCS(listxattr getxattr setxattr,
	    [
		have_xattr=yes
		AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the 'listxattr' function.])
		AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the 'getxattr' function.])
		AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the 'setxattr' function.])
	    ]
	 )
      fi
   fi

XATTROBJS=
   if test x$support_xattr = xyes -a $have_xattr != yes; then
      AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found,
  please either load the xattr libraries or rerun configure without --enable-xattr])
   else
      if test $have_xattr = yes; then
	 AC_DEFINE([HAVE_XATTR],1,[Extended Attributes support])
	 dnl
	 dnl Prepare obj building
	 dnl
	 if test x${HAVE_LINUX_OS_TRUE} = x; then
	    XATTROBJS="bxattr.c bxattr_linux.c"
	 fi
	 if test x${HAVE_SUN_OS_TRUE} = x; then
	    XATTROBJS="bxattr.c bxattr_solaris.c"
	 fi
	 if test x${HAVE_FREEBSD_OS_TRUE} = x; then
	    XATTROBJS="bxattr.c bxattr_freebsd.c"
	 fi
	 if test x${HAVE_DARWIN_OS_TRUE} = x; then
	    XATTROBJS="bxattr.c bxattr_osx.c"
	 fi
      fi
   fi
fi
AC_SUBST(XATTROBJS)

dnl
dnl Check if we have AFS on this system
dnl
AFS_CFLAGS=""
AFS_LIBS=""
support_afs=auto
AC_ARG_ENABLE(afs,
   AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]),
   [
       if test x$enableval = xyes; then
     support_afs=yes
       elif test x$enableval = xno; then
     support_afs=no
       fi
   ]
)

dnl
dnl Check if we have GPFS on this system
dnl
GPFS_CFLAGS=""
GPFS_LDFLAGS=""
support_gpfs=auto
AC_ARG_ENABLE(gpfs,
   AC_HELP_STRING([--disable-gpfs], [disable gpfs support @<:@default=auto@:>@]),
   [
      if test x$enableval = xyes; then
         support_gpfs=yes
      elif test x$enableval = xno; then
         support_gpfs=no
      fi
   ]
)

dnl
dnl Check if ACL engine enabled
dnl
have_gpfs=no
have_gpfslib=no
GPFSLIB=""
if test x$have_acl = xno -a x$have_xattr = xno; then
   if test x$support_gpfs = xyes; then
      AC_MSG_WARN(ACL and XATTR engine disabled - disable dependent GPFS support.)
   fi
else
   if test x$support_gpfs = xyes -o x$support_gpfs = xauto; then
      AC_ARG_WITH(gpfsdir,
         AC_HELP_STRING([--with-gpfsdir@<:@=DIR@:>@], [Directory holding GPFS includes/libs]),
         with_gpfsdir=$withval
      )

      saved_CFLAGS="${CFLAGS}"
      saved_CPPFLAGS="${CPPFLAGS}"
      saved_LDFLAGS="${LDFLAGS}"

      if test x$with_gpfsdir != x; then
         GPFS_CFLAGS="-I${with_gpfsdir}/include"
         CFLAGS="${GPFS_CFLAGS} ${saved_CFLAGS}"
         CPPFLAGS="${GPFS_CFLAGS} ${saved_CPPFLAGS}"
         LDFLAGS="-L${with_gpfsdir}/lib  ${saved_LDFLAGS}"
      fi

      AC_CHECK_HEADER(gpfs.h,
      [
        have_gpfs=yes
      ])

      AC_CHECK_LIB(gpfs, gpfs_getacl,
      [
        have_gpfslib=yes
      ])

      if test x$with_gpfsdir != x; then
         CFLAGS="${saved_CFLAGS}"
         CPPFLAGS="${saved_CPPFLAGS}"
         LDFLAGS="${saved_LDFLAGS}"
      fi
      if test x$have_gpfslib = xyes; then
         if test -f ${with_gpfsdir}/lib/libgpfs.so; then
            GPFSLIB=`realpath ${with_gpfsdir}/lib/libgpfs.so`
            AC_DEFINE_UNQUOTED(GPFSLIB_CUSTOM_PATH, ["${GPFSLIB}"], [GPFSLIB custom path])
         fi
      fi
      if test x$have_gpfs = xyes; then
            AC_DEFINE(HAVE_GPFS, 1, [Define to 1 if your system has GPFS support])
            AC_DEFINE(HAVE_GPFS_ACL, 1, [GPFS ACL support])
            AC_DEFINE(HAVE_GPFS_XATTR, 1, [GPFS XATTR support])
      fi
   fi
   AC_SUBST(GPFS_CFLAGS)
fi



dnl
dnl Check for pthread libraries
dnl
PTHREAD_LIB=""
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
   [
       AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
	  [
	      AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
		 [
		     AC_CHECK_FUNC(pthread_create)
		 ]
	      )
	  ]
       )
   ]
)

dnl
dnl Check for LDAP libraries
dnl
LDAP_LIBS=""
LDAP_LDFLAGS=""
LDAP_INC=""
LDAP_TARGET=""
LDAP_TARGET_INSTALL=""
ldap_support=no
ldap_start_tls_support=no
AC_ARG_WITH(ldap,
   AC_HELP_STRING([--with-ldap@<:@=DIR@:>@], [enable LDAP support]),
   [
      case "$with_ldap" in
      no)
         :
         ;;
      yes|*)
         if test -f ${with_ldap}/include/ldap.h; then
            LDAP_INC="-I${with_ldap}/include"
            LDAP_LDFLAGS="-L${with_ldap}/lib"
            with_ldap="${with_ldap}/include"
         else
            with_ldap="/usr/include"
         fi
         AC_CHECK_HEADER(${with_ldap}/ldap.h,
         [
            AC_DEFINE(HAVE_LDAP, 1, [Define to 1 if you have ldap])
            AC_CHECK_LIB(ldap, ldap_init,
               [ AC_CHECK_LIB(lber, ber_bvfree,
                  [
                     ldap_support=yes
                     LDAP_LIBS="-lldap -llber"
                  ],
                  [ AC_CHECK_FUNC(ber_bvfree,
                     [
                        ldap_support=yes
                        LDAP_LIBS="-lldap -llber"
                     ]
                  )]
               )], [ AC_CHECK_FUNC(ldap_init) ])
            AC_CHECK_FUNC(ldap_start_tls,
               [ ldap_start_tls_support=yes ],
               [ AC_CHECK_LIB(ldap, ldap_start_tls,
                  [
                     ldap_start_tls_support=yes
                     AC_DEFINE(HAVE_LDAP_START_TLS, 1, [Define to 1 if you have ldap_start_tls])
                  ])
               ])
         ], [ AC_MSG_NOTICE("ldap.h not found. LDAP turned off ...") ])
         ;;
      esac
   ]
)
AC_SUBST(LDAP_LDFLAGS)
AC_SUBST(LDAP_INC)
AC_SUBST(LDAP_LIBS)

dnl
dnl Enable/Disable plugin support
dnl

dnl Docker Plugin
support_docker=auto
AC_ARG_ENABLE(docker-plugin,
   AC_HELP_STRING([--disable-docker-plugin], [disable Docker plugin support @<:@default=auto@:>@]),
   [
      if test x$enableval = xyes; then
         support_docker=yes
      elif test x$enableval = xno; then
         support_docker=disabled
      fi
   ]
)
if test x$support_docker = xyes -o x$support_docker = xauto; then
   AC_CHECK_PROG(docker_bin, docker, yes, no, "/usr/bin/")
   if test x$docker_bin = xyes; then
      support_docker=yes
      FD_PLUGIN_DIR="${FD_PLUGIN_DIR} src/plugins/fd/docker"
      FD_PLUGIN_INSTALL="${FD_PLUGIN_INSTALL} install-docker"
   else
      if test x$support_docker = xyes; then
         echo " "
         echo "You enabled a Docker Plugin build but 'docker' command not found."
         echo " "
         exit 1
      fi
      support_docker=no
   fi
fi

dnl kubernetes Plugin
support_k8s=auto
AC_ARG_ENABLE(kubernetes-plugin,
   AC_HELP_STRING([--disable-kubernetes-plugin], [disable Kubernetes plugin support @<:@default=auto@:>@]),
   [
      if test x$enableval = xyes; then
         support_kubernetes=yes
         FD_PLUGIN_INSTALL="${FD_PLUGIN_INSTALL} install-kubernetes"
      elif test x$enableval = xno; then
         support_kubernetes=disabled
      fi
   ]
)
if test x$support_kubernetes = xyes -o x$support_kubernetes = xauto; then
      FD_PLUGIN_DIR="${FD_PLUGIN_DIR} src/plugins/fd/kubernetes-backend"
fi

dnl cdp Plugin
support_cdp=auto
AC_ARG_ENABLE(cdp-plugin,
   AC_HELP_STRING([--disable-cdp-plugin], [disable CDP plugin support @<:@default=auto@:>@]),
   [
      if test x$enableval = xyes; then
         support_cdp=yes
         FD_PLUGIN_INSTALL="${FD_PLUGIN_INSTALL} install-cdp"
         TOOLS_INSTALL="${TOOLS_INSTALL} install-cdp"
      elif test x$enableval = xno; then
         support_cdp=disabled
      fi
   ]
)

AC_SUBST(FD_PLUGIN_DIR)
AC_SUBST(FD_PLUGIN_INSTALL)
AC_SUBST(TOOLS_INSTALL)

dnl
dnl Bacula Pluggable Authentication Modules - Director Plugins
dnl

dnl Director LDAP Auth Plugin
support_ldap_bpam=auto
AC_ARG_ENABLE(ldap-bpam,
   AC_HELP_STRING([--disable-ldap-bpam], [disable LDAP BPAM support @<:@default=auto@:>@]),
   [
      if test x$enableval = xyes; then
         support_ldap_bpam=yes
      elif test x$enableval = xno; then
         support_ldap_bpam=disabled
      fi
   ]
)
if test x$support_ldap_bpam = xyes -o x$support_ldap_bpam = xauto; then
   if test x$ldap_support = xyes; then
      support_ldap_bpam=yes
      BPAM_LDAP_TARGET="ldap-dir.la ldaptest"
      BPAM_LDAP_TARGET_INSTALL="all install-ldap install-ldaptest"
   else
      if test x$support_ldap_bpam = xyes; then
         AC_MSG_ERROR("Director LDAP Plugin enabled but no required libraries found. Please check for LDAP library support and set a proper --with-ldap=... parameter.")
      fi
      support_ldap_bpam=no
   fi
fi
if test x$support_ldap_bpam = xyes; then
   DIR_PLUGIN_DIR="${DIR_PLUGIN_DIR} src/plugins/dir/ldap"
fi

AC_SUBST(BPAM_LDAP_TARGET)
AC_SUBST(BPAM_LDAP_TARGET_INSTALL)

AC_SUBST(DIR_PLUGIN_DIR)

dnl Check for headers, functions and libraries required to support
dnl keeping readall capabilities
dnl
AC_CHECK_HEADERS(sys/prctl.h sys/capability.h)
AC_CHECK_FUNCS(prctl setreuid)
AC_CHECK_LIB([cap], [cap_set_proc], [CAP_LIBS="-lcap"], [CAP_LIBS=])
if test x$CAP_LIBS = x-lcap; then
   AC_DEFINE(HAVE_LIBCAP, 1, [Define if you have libcap])
fi
AC_SUBST(CAP_LIBS)

AC_SUBST(FDLIBS)
AC_DEFINE(FDLIBS)

CFLAGS=${CFLAGS--O}

if test x$have_gcc = xyes ; then
   CPPFLAGS="$CPPFLAGS -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti"
   CFLAGS="$CFLAGS -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti"
fi
LDFLAGS=${LDFLAGS--O}
CPPFLAGS="$CPPFLAGS"
CFLAGS="$CFLAGS"
AC_SUBST(DEBUG)
AC_SUBST(DINCLUDE)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(X_CFLAGS)
AC_SUBST(DEFS)
AC_SUBST(LIBS)
AC_SUBST(DLIB)
AC_SUBST(X_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(WCFLAGS)
AC_SUBST(WLDFLAGS)
AC_SUBST(WRAPLIBS)

dnl extra configurable objects
OBJLIST=
AC_SUBST(OBJLIST)

lld="lld"
llu="llu"

WCFLAGS=
WLDFLAGS=

dnl
dnl Finally we set appropriate distribution specific
dnl  variables and defaults
dnl
PSCMD="ps -e"
WIN32=
MACOSX=
COMPRESS_MANPAGES=yes

case "$DISTNAME" in
aix)
   DISTVER=`uname -r`
   PSCMD="ps -e -o pid,comm"
   PFILES="${PFILES} platforms/aix/Makefile"
   TAPEDRIVE="/dev/rmt0.1"
  ;;
alpha)
   DISTVER=`uname -r`
   PTHREAD_LIB="-lpthread -lexc"
   if test "${CC}" = "gcc" ; then
      lld="lld"
      llu="llu"
   else
      lld="ld"
      llu="lu"
   fi
   TAPEDRIVE="/dev/nrmt0"
  ;;
bsdi)
   DISTVER=`uname -a |awk '{print $3}'`
   TAPEDRIVE="/dev/nrmt0"
   PTHREAD_LIB="-pthread"
   CFLAGS="${CFLAGS} -pthread"
   PSCMD="ps -ax -o pid,command"
   lld="qd"
   llu="qu"
   PFILES="${PFILES} \
       platforms/bsdi/Makefile \
       platforms/bsdi/bacula-fd \
       platforms/bsdi/bacula-sd \
       platforms/bsdi/bacula-dir"
   largefile_support="yes"
  ;;
cygwin)
   DISTVER=`uname -a |awk '{print $3}'`
   TAPEDRIVE="/dev/nrst0"
   WIN32=win32
   WCFLAGS="-mwindows"
   WLDFLAGS="-mwindows"
  ;;
darwin)
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   MACOSX=macosx
   PFILES="${PFILES} \
      platforms/darwin/Makefile"
  ;;
osx)
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   MACOSX=macosx
  ;;
debian)
   if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
      DISTNAME="ubuntu"
   fi
   DISTVER=`cat /etc/debian_version`
   if test -f /etc/lsb-release ; then
      . /etc/lsb-release
      if test "x$DISTRIB_ID" != "x" ; then
	 DISTNAME=$DISTRIB_ID
      fi
      if test "x$DISTRIB_RELEASE" != "x" ; then
	 DISTVER=$DISTRIB_RELEASE
      fi
   fi
   if test "$DISTNAME" = "Ubuntu" ; then
      DISTNAME="ubuntu"
   fi
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   if test "$DISTNAME" = "ubuntu" ; then
      PFILES="${PFILES} \
	 platforms/ubuntu/Makefile \
	 platforms/ubuntu/bacula-fd \
	 platforms/ubuntu/bacula-sd \
	 platforms/ubuntu/bacula-dir"
   else
      PFILES="${PFILES} \
	 platforms/debian/Makefile \
	 platforms/debian/bacula-fd \
	 platforms/debian/bacula-sd \
	 platforms/debian/bacula-dir"
   fi
  ;;
freebsd)
   DISTVER=`uname -a |awk '{print $3}'`
   VER=`echo $DISTVER | cut -c 1`
   if test x$VER = x4 ; then
      PTHREAD_LIB="${PTHREAD_LIBS:--pthread}"
      CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS:--pthread}"
   fi
   lld="qd"
   llu="qu"
   TAPEDRIVE="/dev/nrsa0"
   PSCMD="ps -ax -o pid,command"
   PFILES="${PFILES} \
       platforms/freebsd/Makefile \
       platforms/freebsd/bacula-fd \
       platforms/freebsd/bacula-sd \
       platforms/freebsd/bacula-dir"
   largefile_support="yes"
  ;;
hurd)
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/hurd/Makefile \
       platforms/hurd/bacula-fd \
       platforms/hurd/bacula-sd \
       platforms/hurd/bacula-dir"
  ;;
hpux)
   PSCMD="UNIX95=1; ps -e -o pid,comm"
   CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/rmt/0hnb"
   PTHREAD_LIB="-lpthread"
   AC_DEFINE([_INCLUDE_LONGLONG])
  ;;
irix)
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/rmt/0cbn"
   PSCMD="ps -e -o pid,comm"
   PFILES="${PFILES} \
       platforms/irix/Makefile \
       platforms/irix/bacula-fd \
       platforms/irix/bacula-sd \
       platforms/irix/bacula-dir"
  ;;
netbsd)
   DISTVER=`uname -a |awk '{print $3}'`
   lld="qd"
   llu="qu"
   TAPEDRIVE="/dev/nrst0"
   PSCMD="ps -ax -o pid,command"
   PTHREAD_LIB="-pthread"
   CFLAGS="${CFLAGS} -pthread"
  ;;
openbsd)
   DISTVER=`uname -a |awk '{print $3}'`
   lld="qd"
   llu="qu"
   TAPEDRIVE="/dev/nrst0"
   PSCMD="ps -ax -o pid,command"
   PTHREAD_LIB="-pthread"
   CFLAGS="${CFLAGS} -pthread"
   PFILES="${PFILES} \
       platforms/openbsd/Makefile \
       platforms/openbsd/bacula-fd \
       platforms/openbsd/bacula-sd \
       platforms/openbsd/bacula-dir"
  ;;
redhat)
   if test -f /etc/whitebox-release ; then
      f=/etc/whitebox-release
   else
      f=/etc/redhat-release
   fi
   if test `cat $f | grep release |\
	 cut -f 3 -d ' '`x = "Enterprise"x ; then
      DISTVER="Enterprise "`cat $f | grep release |\
	  cut -f 6 -d ' '`
   else
       DISTVER=`cat /etc/redhat-release | grep release |\
	   cut -f 5 -d ' '`
   fi
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/redhat/Makefile \
       platforms/redhat/bacula-fd \
       platforms/redhat/bacula-sd \
       platforms/redhat/bacula-dir
       "
  ;;
mandrake)
   DISTVER=`cat /etc/mandrake-release | grep release |\
      cut -f 5 -d ' '`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/mandrake/Makefile \
       platforms/mandrake/bacula-fd \
       platforms/mandrake/bacula-sd \
       platforms/mandrake/bacula-dir \
       "
  ;;
gentoo)
   DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/gentoo/Makefile \
    platforms/gentoo/bacula-init \
       platforms/gentoo/bacula-fd \
       platforms/gentoo/bacula-sd \
       platforms/gentoo/bacula-dir"
  ;;
slackware)
   DISTVER=`cat /etc/slackware-version`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/slackware/Makefile \
       platforms/slackware/rc.bacula-fd \
       platforms/slackware/rc.bacula-sd \
       platforms/slackware/rc.bacula-dir\
       platforms/slackware/functions.bacula"
  ;;
solaris)
   DISTVER=`uname -r`
   TAPEDRIVE="/dev/rmt/0cbn"
   PSCMD="ps -e -o pid,comm"
   PFILES="${PFILES} \
       platforms/solaris/Makefile \
       platforms/solaris/bacula-fd \
       platforms/solaris/bacula-sd \
       platforms/solaris/bacula-dir"
   COMPRESS_MANPAGES=
   case ${DISTVER} in
   5.5|5.6)
      AC_DEFINE(HAVE_OLD_SOCKOPT)
      AC_DEFINE(USE_THR_SETCONCURRENCY)
      ;;
   5.7|5.8)
      AC_DEFINE(USE_THR_SETCONCURRENCY)
      ;;
   5.10)
      AC_DEFINE(HAVE_SOLARIS10, 1, [Set if building on Solaris 10])
      ;;
   *)
      ;;
   esac
   LIBS="$LIBS -lresolv -lrt"
  ;;
suse)
   DISTVER=`cat /etc/SuSE-release |grep VERSION|\
       cut -f 3 -d ' '`
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/suse/Makefile \
       platforms/suse/bacula-fd \
       platforms/suse/bacula-sd \
       platforms/suse/bacula-dir \
       platforms/suse/bacula"
  ;;
suse5)
   DISTNAME=suse
   DISTVER=5.x
   TAPEDRIVE="/dev/nst0"
   PSCMD="ps -e -o pid,command"
   PFILES="${PFILES} \
       platforms/suse/Makefile \
       platforms/suse/bacula-fd \
       platforms/suse/bacula-sd \
       platforms/suse/bacula-dir"
  ;;
unknown)
   DISTVER=unknown
   TAPEDRIVE="/dev/nst0"
  ;;
*)
  echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
  ;;
esac

dnl -------------------------------------------
dnl systemd (default off)
dnl -------------------------------------------
AC_MSG_CHECKING(for systemd support)
AC_ARG_WITH(systemd,
   AC_HELP_STRING([--with-systemd@<:@=UNITDIR@:>@], [Include systemd support. UNITDIR is where systemd system .service files are located, default is to ask systemctl.]),
   [
       if test "$withval" != "no"; then
	   if test "$withval" = "yes"; then
	       SYSTEMD_UNITDIR="/lib/systemd/system"
	   else
	       dnl Use user supplied path
	       SYSTEMD_UNITDIR="${withval}"
	   fi

	   PFILES="${PFILES} \
		   platforms/systemd/Makefile \
		   platforms/systemd/bacula.conf \
		   platforms/systemd/bacula-dir.service \
		   platforms/systemd/bacula-fd.service \
		   platforms/systemd/bacula-sd.service"
	   AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd support should be enabled])
	   AC_MSG_RESULT(yes)
	   support_systemd="yes"
       else
	   AC_MSG_RESULT(no)
	   support_systemd="no"
       fi
   ],[
       support_systemd="no"
       AC_MSG_RESULT(no)
   ]
)
AC_SUBST(SYSTEMD_UNITDIR)

AC_SUBST(hostname)

LIBS="$PTHREAD_LIB $LIBS"

AC_DEFINE_UNQUOTED(lld, "$lld")
AC_DEFINE_UNQUOTED(llu, "$llu")
AC_SUBST(TAPEDRIVE)
AC_SUBST(PSCMD)
AC_SUBST(WIN32)
AC_SUBST(MACOSX)
AC_SUBST(DISTNAME)
AC_SUBST(DISTVER)
AC_SUBST(COMPRESS_MANPAGES)

dnl common parts of the Makefile
MCOMMON=./autoconf/Make.common
AC_SUBST_FILE(MCOMMON)

dnl Insanity check
if test "x${subsysdir}" = "x${sbindir}" ; then
   echo " "
   echo " "
   echo "You have set both --sbindir and --with-subsys-dir"
   echo "  equal to: ${subsysdir} "
   echo "This is not permitted. Please reconfigure."
   echo " "
   echo "Aborting configuration ..."
   echo " "
   echo " "
   exit 1
fi

AC_CONFIG_FILES([
   autoconf/Make.common \
   Makefile \
   manpages/Makefile \
   scripts/btraceback \
   scripts/bconsole \
   scripts/bacula \
   scripts/bacula-ctl-dir \
   scripts/bacula-ctl-fd \
   scripts/bacula-ctl-sd \
   scripts/devel_bacula \
   scripts/Makefile \
   scripts/logrotate \
   scripts/mtx-changer \
   scripts/disk-changer \
   scripts/logwatch/Makefile \
   scripts/logwatch/logfile.bacula.conf \
   scripts/bat.desktop \
   scripts/bat.desktop.xsu \
   scripts/bat.desktop.consolehelper \
   scripts/bat.console_apps \
   scripts/bacula-tray-monitor.desktop \
   scripts/kubernetes-bacula-backup/Dockerfile \
   src/Makefile \
   src/host.h \
   src/console/Makefile \
   src/console/bconsole.conf \
   src/qt-console/bat.conf \
   src/qt-console/bat.pro \
   src/qt-console/bat.pro.mingw32 \
   src/qt-console/bat.pro.mingw64 \
   src/qt-console/install_conf_file \
   src/qt-console/tray-monitor/tray-monitor.conf \
   src/qt-console/tray-monitor/bacula-tray-monitor.conf \
   src/qt-console/tray-monitor/tray-monitor.pro \
   src/qt-console/tray-monitor/tray-monitor.pro.mingw32 \
   src/qt-console/tray-monitor/tray-monitor.pro.mingw64 \
   src/qt-console/tray-monitor/install_conf_file \
   src/dird/Makefile \
   src/dird/bacula-dir.conf \
   src/lib/Makefile \
   src/stored/Makefile \
   src/stored/bacula-sd.conf \
   src/filed/Makefile \
   src/filed/bacula-fd.conf \
   src/cats/Makefile \
   src/cats/make_catalog_backup.pl \
   src/cats/make_catalog_backup \
   src/cats/delete_catalog_backup \
   src/cats/create_postgresql_database \
   src/cats/update_postgresql_tables \
   src/cats/make_postgresql_tables \
   src/cats/grant_postgresql_privileges \
   src/cats/drop_postgresql_tables \
   src/cats/drop_postgresql_database \
   src/cats/create_mysql_database \
   src/cats/update_mysql_tables \
   src/cats/make_mysql_tables \
   src/cats/grant_mysql_privileges \
   src/cats/drop_mysql_tables \
   src/cats/drop_mysql_database \
   src/cats/create_sqlite3_database \
   src/cats/update_sqlite3_tables \
   src/cats/make_sqlite3_tables \
   src/cats/grant_sqlite3_privileges \
   src/cats/drop_sqlite3_tables \
   src/cats/drop_sqlite3_database \
   src/cats/sqlite \
   src/cats/mysql \
   src/cats/create_bacula_database \
   src/cats/update_bacula_tables \
   src/cats/grant_bacula_privileges \
   src/cats/make_bacula_tables \
   src/cats/drop_bacula_tables \
   src/cats/drop_bacula_database \
   src/cats/install-default-backend \
   src/findlib/Makefile \
   src/tools/Makefile \
   src/tools/cdp-client/Makefile \
   src/plugins/fd/Makefile.inc \
   src/plugins/sd/Makefile \
   src/plugins/dir/Makefile.inc \
   src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/baculabackupimage.py \
   po/Makefile.in \
   updatedb/update_mysql_tables \
   updatedb/update_sqlite3_tables \
   updatedb/update_postgresql_tables \
   updatedb/update_mysql_tables_9_to_10 \
   updatedb/update_sqlite3_tables_9_to_10 \
   updatedb/update_postgresql_tables_9_to_10 \
   updatedb/update_mysql_tables_10_to_11 \
   updatedb/update_sqlite3_tables_10_to_11 \
   updatedb/update_postgresql_tables_10_to_11 \
   updatedb/update_mysql_tables_11_to_12 \
   updatedb/update_sqlite3_tables_11_to_12 \
   updatedb/update_postgresql_tables_11_to_12 \
   updatedb/update_postgresql_tables_1021_to_1022 \
   updatedb/update_postgresql_tables_1022_to_1023 \
   updatedb/update_postgresql_tables_1023_to_1024 \
   updatedb/update_mysql_tables_1020_to_1021 \
   updatedb/update_mysql_tables_1021_to_1022 \
   updatedb/update_mysql_tables_1022_to_1023 \
   updatedb/update_mysql_tables_1023_to_1024 \
   examples/nagios/check_bacula/Makefile \
   platforms/rpms/redhat/bacula.spec \
   platforms/rpms/redhat/bacula-bat.spec \
   platforms/rpms/redhat/bacula-docs.spec \
   platforms/rpms/redhat/bacula-mtx.spec \
   platforms/rpms/suse/bacula.spec \
   platforms/rpms/suse/bacula-bat.spec \
   platforms/rpms/suse/bacula-docs.spec \
   platforms/rpms/suse/bacula-mtx.spec \
   $PFILES
])
AC_OUTPUT

if test "${support_bat}" = "yes" ; then
   if test "x$QMAKE" = "xnone"; then
      AC_MSG_ERROR([Could not find qmake $PATH. Check your Qt installation])
   fi

   cd src/qt-console
   echo "Creating bat Makefile"
   touch bat
   chmod 755 bat
   rm -f Makefile
   rm -rf moc32 obj32 moc64 obj64 ui32 ui64
   $QMAKE
   ${MAKE:-make} clean

   cd tray-monitor
   echo "Creating tray-monitor Makefile"
   rm -f Makefile
   rm -rf moc32 obj32 moc64 obj64 ui32 ui64
   $QMAKE
   ${MAKE:-make} clean
   $QMAKE
   ${MAKE:-make} clean
   cd ${BUILD_DIR}
fi

dnl
dnl if CC is gcc, we can rebuild the dependencies (since the depend rule
dnl requires gcc).  If it's not, don't rebuild dependencies
dnl
if test X"$GCC" = "Xyes" ; then
  echo "Doing make of dependencies"
  ${MAKE:-make} depend
fi

cd src/qt-console
chmod 755 install_conf_file build-depkgs-qt-console
cd tray-monitor
chmod 755 install_conf_file
cd ${BUILD_DIR}

cd scripts
chmod 755 bacula btraceback mtx-changer
chmod 755 bconsole disk-changer devel_bacula logrotate
cd ..

c=updatedb
chmod 755 $c/update_mysql_tables_10_to_11   $c/update_sqlite3_tables_10_to_11
chmod 755 $c/update_postgresql_tables_10_to_11
chmod 755 $c/update_mysql_tables_11_to_12   $c/update_sqlite3_tables_11_to_12
chmod 755 $c/update_postgresql_tables_11_to_12


c=src/cats

chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database

chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database

chmod 755 $c/create_sqlite3_database   $c/update_sqlite3_tables  $c/make_sqlite3_tables
chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables	 $c/drop_sqlite3_database

chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database

chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
chmod 755 $c/sqlite
chmod 755 $c/mysql

chmod 755 $c/install-default-backend

chmod 755 src/win32/build-depkgs-mingw32 src/win32/build-depkgs-mingw-w64

if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
   largefile_support="yes"
fi

dnl Only try to find out the version number of the compiler when we know its some kind of GCC compiler
if test X"$GCC" = "Xyes" ; then
   dnl
   dnl A whole lot of hand springs to get the compiler version.
   dnl	This is because gcc changed the output in version 3.0
   dnl
   CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 3 -d ' '`
   if test "x${CCVERSION}" = "x" ; then
      CCVERSION=`${CC} --version | tr '\n' ' ' | cut -f 1 -d ' '`
   fi
   CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '`
   if test x"${CXXVERSION}" = x ; then
      CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '`
   fi
fi

# clean up any old junk
echo " "
echo "Cleaning up"
echo " "
${MAKE:-make} clean

echo "
Configuration on `date`:

   Host:                      ${host}${post_host} -- ${DISTNAME} ${DISTVER}
   Bacula version:            ${BACULA} ${VERSION} (${DATE})
   Source code location:      ${srcdir}
   Install binaries:          ${sbindir}
   Install libraries:         ${libdir}
   Install config files:      ${sysconfdir}
   Scripts directory:         ${scriptdir}
   Archive directory:         ${archivedir}
   Working directory:         ${working_dir}
   PID directory:             ${piddir}
   Subsys directory:          ${subsysdir}
   Man directory:             ${mandir}
   Data directory:            ${datarootdir}
   Plugin directory:          ${plugindir}
   C Compiler:                ${CC} ${CCVERSION}
   C++ Compiler:              ${CXX} ${CXXVERSION}
   Compiler flags:            ${WCFLAGS} ${CFLAGS}
   Linker flags:              ${WLDFLAGS} ${LDFLAGS}
   Libraries:                 ${LIBS}
   Statically Linked Tools:   ${support_static_tools}
   Statically Linked FD:      ${support_static_fd}
   Statically Linked SD:      ${support_static_sd}
   Statically Linked DIR:     ${support_static_dir}
   Statically Linked CONS:    ${support_static_cons}
   Database backends:         ${db_backends}
   Database port:             ${db_port}
   Database name:             ${db_name}
   Database user:             ${db_user}
   Database SSL options:      ${db_ssl_options}

   Job Output Email:          ${job_email}
   Traceback Email:           ${dump_email}
   SMTP Host Address:         ${smtp_host}

   Director Port:             ${dir_port}
   File daemon Port:          ${fd_port}
   Storage daemon Port:       ${sd_port}

   Director User:             ${dir_user}
   Director Group:            ${dir_group}
   Storage Daemon User:       ${sd_user}
   Storage DaemonGroup:       ${sd_group}
   File Daemon User:          ${fd_user}
   File Daemon Group:         ${fd_group}

   Large file support:        $largefile_support
   Bacula conio support:      ${got_conio} ${CONS_LIBS}
   readline support:          ${got_readline} ${PRTREADLINE_SRC}
   TCP Wrappers support:      ${TCPW_MSG} ${WRAPLIBS}
   TLS support:               ${support_tls}
   Encryption support:        ${support_crypto}
   ZLIB support:              ${have_zlib}
   LZO support:               ${have_lzo}
   S3 support:                ${have_libs3}
   enable-smartalloc:         ${support_smartalloc}
   enable-lockmgr:            ${support_lockmgr}
   bat support:               ${support_bat}
   client-only:               ${build_client_only}
   build-dird:                ${build_dird}
   build-stored:              ${build_stored}
   Plugin support:            ${have_plugins}
   LDAP support:              ${ldap_support}
   LDAP StartTLS support:     ${ldap_start_tls_support}
   AFS support:               ${have_afs}
   ACL support:               ${have_acl}
   XATTR support:             ${have_xattr}
   GPFS support:              ${have_gpfs} ${GPFSLIB}
   systemd support:           ${support_systemd} ${SYSTEMD_UNITDIR}
   Batch insert enabled:      ${batch_insert_db_backends}

   Plugins:
   - Docker:                  ${support_docker}
   - Kubernetes:              ${support_kubernetes}
   - LDAP BPAM:               ${support_ldap_bpam}
   - CDP:                     ${support_cdp}
  " > config.out

# create a small shell script useful for support with
# configure options and config.out info
cat > scripts/bacula_config << EOF
#!/bin/sh
cat << __EOC__
$ $0 $ac_configure_args
EOF
cat config.out >> scripts/bacula_config
echo __EOC__ >> scripts/bacula_config
chmod 755 scripts/bacula_config

cat config.out