File: configure.ac

package info (click to toggle)
nordugrid-arc 4.2.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 31,848 kB
  • ctags: 19,588
  • sloc: cpp: 161,134; sh: 16,820; php: 15,352; perl: 15,150; python: 4,732; makefile: 3,953; ansic: 1,128; xml: 352; java: 238; sed: 16
file content (2742 lines) | stat: -rw-r--r-- 99,698 bytes parent folder | download
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.56)
AC_INIT([nordugrid-arc],m4_normalize(m4_include(VERSION)),[http://bugzilla.nordugrid.org/])

dnl serial-tests is not recognized before 1.12, and required after 1.13
m4_define([serial_tests], [
    m4_esyscmd([case `${AUTOMAKE:-automake} --version | head -n 1` in
      *1.11.*|*1.10.*|*1.9.*);;
      *) echo serial-tests;;
      esac])
])

AM_INIT_AUTOMAKE([foreign 1.9 tar-pax] serial_tests)
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])

baseversion=`echo $VERSION | sed 's/[[^0-9.]].*//'`
preversion=`echo $VERSION | sed 's/^[[0-9.]]*//'`

if test "x$baseversion" = "x" ; then
   baseversion=$VERSION
   preversion=""
fi

if test "x$preversion" = "x" ; then
   fedorarelease="1"
   fedorasetupopts="-q"
   debianversion="$baseversion"
else
   fedorarelease="0.$preversion"
   fedorasetupopts="-q -n %{name}-%{version}$preversion"
   debianversion="$baseversion~$preversion"
fi

AC_SUBST(baseversion)
AC_SUBST(preversion)
AC_SUBST(fedorarelease)
AC_SUBST(fedorasetupopts)
AC_SUBST(debianversion)

# This macro was introduced in autoconf 2.57g? but we currently only require 2.56
m4_ifdef([AC_CONFIG_MACRO_DIR], [AC_CONFIG_MACRO_DIR([m4])])

m4_pattern_allow([AC_PATH_PROG])
m4_pattern_allow([AC_MSG_WARN])

AC_PROG_CXX
AC_PROG_CC_STDC
AC_PROG_CPP
AC_GNU_SOURCE
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AC_CHECK_PROG(PERL, perl, perl, :)

# EL-5 compatibility.  $(mkdir_p) is now obsolete.
test -n "$MKDIR_P" || MKDIR_P="$mkdir_p"
AC_SUBST([MKDIR_P])

dnl --with-docdir since older autoconf (<2.60) does not support --docdir
AC_ARG_WITH([docdir],
AC_HELP_STRING([--with-docdir=DIR],
  [Install documentation in DIR [[default: ${datadir}/doc]]]),
  [case $withval in
    yes|no)
      AC_MSG_ERROR([Invalid DIR])
      ;;
    *)
      docdir="$withval"
      ;;
  esac
],
[
  if test -z "$docdir"; then
    docdir='${datadir}/doc/${PACKAGE}'
  fi
])
AC_SUBST(docdir)

# Use arc for "pkgdir" instead of nordugrid-arc (@PACKAGE@)
pkgdatadir='${datadir}/arc'
pkgincludedir='${includedir}/arc'
pkglibdir='${libdir}/arc'
pkglibexecdir='${libexecdir}/arc'

AC_SUBST(pkgdatadir)
AC_SUBST(pkgincludedir)
AC_SUBST(pkglibdir)
AC_SUBST(pkglibexecdir)

ARC_API
ARC_RELATIVE_PATHS

AC_ARG_WITH(sysv-scripts-location,
  AC_HELP_STRING([--with-sysv-scripts-location=<PATH>], [Location of the SYSV init scripts. [[autodetect]]]),
  [ initddir="$withval" ],
  [
    initddir=
    case "${host}" in
      *linux* | *kfreebsd* | *gnu* )
        for i in init.d rc.d/init.d rc.d; do
          if test -d "/etc/$i" -a ! -h "/etc/$i" ; then
            initddir="$sysconfdir/$i"
            break
          fi
        done

        if test -z "$initddir"; then
          AC_MSG_WARN(could not find a suitable location for the SYSV init scripts - not installing)
        fi
        ;;
    esac
  ]
)
AM_CONDITIONAL([SYSV_SCRIPTS_ENABLED],[test "x$initddir" != "x"])
AC_MSG_RESULT($initddir)
AC_SUBST(initddir)

AC_ARG_WITH(cron-scripts-prefix,
  AC_HELP_STRING([--with-cron-scripts-prefix=<PATH>], [Specify the location of the cron directory. [[SYSCONFDIR/cron.d]]]),
  [ cronddir="$withval" ],
  [ cronddir="$sysconfdir/cron.d" ]
)
AC_SUBST(cronddir)

# gettext
AM_GNU_GETTEXT([external])
# Using Autoconf 2.60 or later you will get a warning during configure:
#  config.status: WARNING:  'po/Makefile.in.in' seems to ignore the --datarootdir setting
# This warning can be removed by bumping the gettext version requirement below from 0.12 to at least 0.15
# See more: info Autoconf "Changed Directory Variables"
AM_GNU_GETTEXT_VERSION([0.12])
[[ -r $srcdir/po/POTFILES.in ]] || touch $srcdir/po/POTFILES.in

# Portable 64bit file offsets
AC_SYS_LARGEFILE

# pkg-config needed for many checks
AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
        AC_MSG_ERROR([ *** pkg-config not found])
else
        pkgconfigdir=${libdir}/pkgconfig
        AC_SUBST(pkgconfigdir)
fi

# Default enable/disable switches
#  Features
enables_ldap=yes
enables_mysql=no
enables_swig_python=yes
enables_swig_java=yes
# Features directly related to components
enables_cppunit=yes
enables_java=yes
enables_junit=yes
enables_python=yes
enables_altpython=yes
enables_pylint=yes
enables_mock_dmc=no
enables_lfc=yes
enables_gfal=no
enables_xrootd=yes
enables_gacl=yes
enables_argus=no
enables_xmlsec1=yes
enables_dbjstore=yes
#  Libraries and plugins
# Currently no fine-grained choice is supported.
# Also this variable is used to check if source
# build is needed at all because no component can
# be built without HED.
enables_hed=yes
#  Services
enables_a_rex_service=yes
enables_gridftpd_service=yes
enables_ldap_service=yes
enables_giis_service=yes
enables_cache_service=yes
enables_datadelivery_service=yes
enables_ldap_monitor=yes
enables_ws_monitor=yes
#  Clients
enables_compute_client=yes
enables_credentials_client=yes
enables_echo_client=yes
enables_data_client=yes
enables_jura_client=yes
enables_saml_client=yes
enables_wsrf_client=yes
enables_unicore_client=no
enables_emies_client=yes
#  Documentation
enables_doc=yes
# ACIX cache index
enables_acix=yes

# Handle group enable/disable switches
AC_ARG_ENABLE(all, AC_HELP_STRING([--disable-all], [disables all buildable components. Can be overwritten with --enable-* for group or specific component. It is also possible to use --enable-all to overwrite defaults.]),
[
enables_a_rex_service=$enableval
enables_gridftpd_service=$enableval
enables_ldap_service=$enableval
enables_giis_service=$enableval
enables_ldap_monitor=$enableval
enables_ws_monitor=$enableval
enables_cache_service=$enableval
enables_datadelivery_service=$enableval
enables_compute_client=$enableval
enables_credentials_client=$enableval
enables_echo_client=$enableval
enables_data_client=$enableval
enables_jura_client=$enableval
enables_saml_client=$enableval
enables_wsrf_client=$enableval
enables_unicore_client=$enableval
enables_emies_client=$enableval
enables_hed=$enableval
enables_java=$enableval
enables_junit=$enableval
enables_python=$enableval
enables_altpython=$enableval
enables_pylint=$enableval
enables_gacl=$enableval
enables_mock_dmc=$enableval
enables_lfc=$enableval
enables_gfal=$enableval
enables_xrootd=$enableval
enables_xmlsec1=$enableval
enables_argus=$enableval
enables_cppunit=$enableval
enables_doc=$enableval
enabled_acix=$enableval
enables_dbjstore=$enableval
],
[])

AC_ARG_ENABLE(all-clients, AC_HELP_STRING([--disable-all-clients], [disables all buildable client components. Can be overwritten with --enable-* for specific component. It is also possible to use --enable-all-clients to overwrite defaults and --enable-all.]),
[
enables_compute_client=$enableval
enables_credentials_client=$enableval
enables_echo_client=$enableval
enables_data_client=$enableval
enables_jura_client=$enableval
enables_saml_client=$enableval
enables_wsrf_client=$enableval
enables_unicore_client=$enableval
enables_emies_client=$enableval
enables_doc=$enableval
],
[])

AC_ARG_ENABLE(all-data-clients, AC_HELP_STRING([--disable-all-data-clients], [disables all buildable client components providing data handling abilities. Can be overwritten with --enable-* for specific component. It is also possible to use --enable-all-data-clients to overwrite defaults, --enable-all and --enable-all-clients.]),
[
enables_data_client=$enableval
],
[])

AC_ARG_ENABLE(all-services, AC_HELP_STRING([--disable-all-services], [disables all buildable service componets. Can be overwritten with --enable-* for specific component. It is also possible to use --enable-all-services to overwrite defaults and --enable-all.]),
[
enables_a_rex_service=$enableval
enables_gridftpd_service=$enableval
enables_ldap_service=$enableval
enables_giis_service=$enableval
enables_ldap_monitor=$enableval
enables_cache_service=$enableval
enables_datadelivery_service=$enableval
enabled_acix=$enableval
],
[])


# Be pedantic about compiler warnings.
AC_ARG_ENABLE(pedantic-compile, AC_HELP_STRING([--enable-pedantic-compile], [add pedantic compiler flags]),
[enables_pedantic_compile="yes"], [enables_pedantic_compile="no"])
if test "x$enables_pedantic_compile" = "xyes"; then
  # This check need to be enhanced. It won't work in case of cross-compilation
  # and if path to compiler is explicitely specified.
  if test x"$CXX" = x"g++"; then
    # GNU C/C++ flags
    AM_CXXFLAGS="-Wall -Wextra -Werror -Wno-sign-compare -Wno-unused"
    SAVE_CPPFLAGS=$CPPFLAGS
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
    CPPFLAGS="$CPPFLAGS -Wno-unused-result"
    AC_TRY_COMPILE([],[], [
        AM_CXXFLAGS="$AM_CXXFLAGS -Wno-unused-result"
      ], [
        AC_MSG_NOTICE([compilation flag -Wno-unused-result is not supported])
      ]
    )
    AC_LANG_RESTORE
    CPPFLAGS=$SAVE_CPPFLAGS
  else
    # TODO: set generic flags for generic compiler
    AM_CXXFLAGS=""
  fi
  AC_SUBST(AM_CXXFLAGS)
fi
AM_CONDITIONAL([PEDANTIC_COMPILE], [test "x$enables_pedantic_compile" = "xyes"])


# Enable/disable switches for third-party.

#  Swig
AC_ARG_ENABLE(swig-python, AC_HELP_STRING([--disable-swig-python], [disable SWIG python bindings]),
[enables_swig_python=$enableval],[])
AC_ARG_ENABLE(swig-java, AC_HELP_STRING([--disable-swig-java], [disable SWIG java bindings]),
[enables_swig_java=$enableval],[])
AC_ARG_ENABLE(swig, AC_HELP_STRING([--disable-swig], [disable all bindings through SWIG]),
[enables_swig_python=$enableval
 enables_swig_java=$enableval],[])
if test "$enables_swig_python" = "yes" || test "$enables_swig_java" = "yes"; then
  AC_CHECK_PROGS(SWIG, swig)
  if test "x$SWIG" = "x"; then
    enables_swig="no"
  else
    swigver=`$SWIG -version 2>&1 | grep Version | sed 's/.* //'`
    swigver1=`echo $swigver | cut -d. -f1`
    swigver2=`echo $swigver | cut -d. -f2`
    swigver3=`echo $swigver | cut -d. -f3`
    if test $swigver1 -lt 1 || ( test $swigver1 -eq 1 && ( \
       test $swigver2 -lt 3 || ( test $swigver2 -eq 3 && ( \
       test $swigver3 -lt 25 ) ) ) ) ; then
      AC_MSG_NOTICE([swig is too old (< 1.3.25)])
      SWIG=""
      enables_swig="no"
    elif test $swigver1 -eq 1 && test $swigver2 -eq 3 && test $swigver3 -eq 38 ; then
      AC_MSG_NOTICE([swig version 1.3.38 has bug which prevents it from being used for this software. Please upgrade or downgrade.])
      SWIG=""
      enables_swig="no"
    else
      SWIG2="no"
      if test $swigver1 -ge 2
      then
        SWIG2="yes"
      fi
      AC_SUBST(SWIG2)
      SWIG_PYTHON_NAMING="SwigPy"
      # In SWIG version 1.3.37 naming was changed from "PySwig" to "SwigPy".
      if test $swigver1 -lt 1 || ( test $swigver1 -eq 1 && ( \
         test $swigver2 -lt 3 || ( test $swigver2 -eq 3 && ( \
         test $swigver3 -lt 37 ) ) ) ) ; then
        SWIG_PYTHON_NAMING="PySwig"
      fi
      AC_SUBST(SWIG_PYTHON_NAMING)
    fi
  fi
else
  SWIG=""
fi
AM_CONDITIONAL([SWIG_ENABLED],[test "x$enables_swig" = "xyes"])

AC_ARG_ENABLE(hed, AC_HELP_STRING([--disable-hed], [disable building HED libraries and plugins. Do not do that unless You do not want to build anything. Even in that case better use --disable-all.]),
[enables_hed=$enableval],[])

#  Java
dnl Check if Java is explicitly disabled.
if test "$enables_hed" = "yes"; then
JAVAC_FLAGS=
JDK_CFLAGS=
AC_ARG_ENABLE(java, AC_HELP_STRING([--disable-java], [disable Java components]),
[enables_java=$enableval
 enables_swig_java=$enableval],[])
if test "$enables_java" = "yes"; then
  AC_ARG_WITH(jdk, AC_HELP_STRING([--with-jdk=(JDK)], [path to JDK. If unset the system JDK will be used]))

  JPATH=
  if test "x$with_jdk" != "x"; then
    # User specified JDK!
    JPATH=$with_jdk
  else
    # Look for system JDK.
    for i in /usr/lib/jvm/java-*-openjdk* /usr/lib/jvm/java-*-icedtea* /usr/lib/jvm/java-*-gcj* /usr/lib/jvm/java-*-sun* /usr/lib/gcc/*-redhat-linux/*; do
      if test -f $i/include/jni.h; then
        JPATH=$i
        break
      fi
    done
  fi

  if test "x$JPATH" != "x"; then
    JDK_CFLAGS="-I$JPATH/include"

    # Any extra includes? Look for them.
    JAVA_EXTRA_INCLUDE=
    case "${host}" in
      *-pc-mingw32 | *-pc-cygwin)
        JAVA_EXTRA_INCLUDE="win32"
        ;;
      *linux* | *kfreebsd* | *gnu* )
        JAVA_EXTRA_INCLUDE="linux"
        ;;
      *solaris*)
        JAVA_EXTRA_INCLUDE="solaris"
        ;;
    esac
    if test "x$JAVA_EXTRA_INCLUDE" != "x" && test -d $JPATH/include/$JAVA_EXTRA_INCLUDE; then
      JDK_CFLAGS="$JDK_CFLAGS $JDK_CFLAGS/$JAVA_EXTRA_INCLUDE"
    fi

    SAVE_CPPFLAGS=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS $JDK_CFLAGS"
    AC_CHECK_HEADERS(jni.h,[jni_h="yes"],[jni_h="no"])
    CPPFLAGS=$SAVE_CPPFLAGS

    AC_PATH_PROGS(JAVA, java gij, , $JPATH/bin:/usr/bin)
    AC_PATH_PROGS(JAVAC, javac gcj ecj, , $JPATH/bin:/usr/bin)
    AC_PATH_PROGS(JAR, fastjar jar, , $JPATH/bin:/usr/bin)
    break
  fi

  if test "x$with_jdk" = "x" && test "x$JDK_CFLAGS" = "x"; then
    # If JDK was not found in any of the above locations try system locations.
    AC_CHECK_HEADERS(jni.h JavaVM/jni.h,[jni_h="yes"; break],[jni_h="no"])
    AC_CHECK_PROGS(JAVA, java gij)
    AC_CHECK_PROGS(JAVAC, javac gcj ecj)
    AC_CHECK_PROGS(JAR, fastjar jar)
  fi

  # Set absolute limit on Java heap size allocation instead of letting
  # the java virtual machine and compiler (on Linux) allocate a quarter
  # of the total memory.
  JAVA_VM_FLAGS="-Xms50M -Xmx50M"
  JAVAC_VM_FLAGS="-J-Xms50M -J-Xmx50M"

  JAR_JFLAGS=""
  # Old versions of fastjar does not ignore -J options
  if test "x$JAR" != "x" && test "x`basename $JAR`" = "xjar"; then
      JAR_JFLAGS="$JAVAC_VM_FLAGS"
  fi

  if test "x$JAVAC" != "x" && test "x`basename $JAVAC`" = "xgcj"; then
    JAVAC_FLAGS="-C -fsource=1.5 -ftarget=1.5 --classpath=."
  elif test "x$JAVAC" != "x" && test "x`basename $JAVAC`" = "xjavac"; then
    JAVAC_FLAGS="$JAVAC_VM_FLAGS -source 1.5 -target 1.5 -cp ."
  fi

  if test "x$JAVA" != "x" && test "x`basename $JAVA`" = "xjava"; then
    JAVA_FLAGS="$JAVA_VM_FLAGS"
  fi

  # Check if version is 1.5 (Iterable was first introduced in 1.5)
  echo "public abstract class TestIterable implements Iterable< Object > {}" > TestIterable.java
  if $JAVAC $JAVAC_FLAGS TestIterable.java >/dev/null 2>&1; then
    java_is_15_or_above="yes"
  fi
  rm -f TestIterable.java TestIterable.class

  if test "x$JAVAC" = "x"; then
    AC_MSG_NOTICE([Missing Java compiler - skipping Java components])
    enables_java="no"
  elif test "x$JAR" = "x"; then
    AC_MSG_NOTICE([Missing Java archiver - skipping Java components])
    enables_java="no"
  elif test "x$jni_h" != "xyes"; then
    AC_MSG_NOTICE([Missing Java headers - skipping Java components])
    enables_java="no"
  else
    AC_MSG_NOTICE([Java available: $JAVAC])
  fi

  if test "x$enables_java" != "xyes"; then
    AC_MSG_NOTICE([Missing Java - skipping Java bindings])
    enables_swig_java="no"
  elif ! test -f java/arc_wrap.cpp && test "x$enables_swig_java" != "xyes"; then
    AC_MSG_NOTICE([Missing pre-compiled Java wrapper and SWIG - skipping Java bindings])
    enables_swig_java="no"
  fi

fi
fi

AC_MSG_NOTICE([Java enabled: $enables_java])
AC_MSG_NOTICE([Java SWIG binding enabled: $enables_swig_java])
AM_CONDITIONAL([JAVA_ENABLED],[test "x$enables_java" = "xyes"])
AM_CONDITIONAL([JAVA_SWIG_ENABLED],[test "x$enables_swig_java" = "xyes"])
AM_CONDITIONAL([JAVA_IS_15_OR_ABOVE], [test "x$java_is_15_or_above" = "xyes"])

AC_SUBST(JAVA)
AC_SUBST(JAR_JFLAGS)
AC_SUBST(JAVA_FLAGS)
AC_SUBST(JAVAC_FLAGS)
AC_SUBST(JDK_CFLAGS)

AC_ARG_WITH([jnidir],
AC_HELP_STRING([--with-jnidir=DIR],
  [Install jar in DIR [[default: ${libdir}/java]]]),
  [case $withval in
    yes|no)
      AC_MSG_ERROR([Invalid DIR])
      ;;
    *)
      jnidir="$withval"
      ;;
  esac
],
[
  if test -z "$jnidir"; then
    jnidir='${libdir}/java'
  fi
])
AC_SUBST(jnidir)

AC_ARG_WITH([jninativedir],
AC_HELP_STRING([--with-jninativedir=DIR],
  [Install jar in DIR [[default: ${pkglibdir}]]]),
  [case $withval in
    yes|no)
      AC_MSG_ERROR([Invalid DIR])
      ;;
    *)
      jninativedir="$withval"
      ;;
  esac
],
[
  if test -z "$jninativedir"; then
    jninativedir='${pkglibdir}'
  fi
])
AC_SUBST(jninativedir)

# Try to find junit - used for unit testing of Java bindings.
dnl Check if JUnit is explicitly disabled.
if test "$enables_hed" = "yes"; then
AC_ARG_ENABLE(junit, AC_HELP_STRING([--disable-junit], [disable unit testing of Java bindings]),
[enables_junit=$enableval],[])
if test "$enables_java" = "yes" && test "$enables_junit" = "yes"; then
  if ! test -f /usr/share/java/junit.jar; then
    enables_junit="no"
  fi
else
  enables_junit="no"
fi
fi
AM_CONDITIONAL([JUNIT_ENABLED], [test "x$enables_junit" = "xyes"])
AC_MSG_NOTICE([Java unit testing enabled: $enables_junit])


# Python
if test "$enables_hed" = "yes"; then
AC_ARG_ENABLE(python,
  AC_HELP_STRING([--disable-python], [disable Python components]),
  [enables_python=$enableval
   enables_swig_python=$enableval], [])

if test "$enables_python" = "yes"; then
  AC_ARG_WITH(python, AC_HELP_STRING([--with-python=(PYTHON)],
    [specify python program from PATH]))

  # We do not look for python binary when cross-compiling
  # but we need to make the variable non-empty
  if test "${build}" = "${host}"; then
    AC_CHECK_PROGS(PYTHON, $with_python python)
  else
    PYTHON=python
  fi

  if test "X$PYTHON" != "X"; then
    PYNAME=`basename $PYTHON`
    PKG_CHECK_MODULES(PYTHON, $PYNAME, [
    PYTHON_VERSION=`$PKG_CONFIG --modversion $PYNAME`
    PYTHON_MAJOR=`echo $PYTHON_VERSION|cut -f1 -d.`
    ],[
    PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[[:3]])'`
    PYTHON_MAJOR=`$PYTHON -c 'import sys; print(sys.version_info[[0]])'`
    PYTHON_CFLAGS=-I`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())'`
    PY_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('LIBS'))" | sed s/None//`
    PY_SYSLIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('SYSLIBS'))" | sed s/None//`
    PY_LIBDEST=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('LIBDEST'))" | sed s/None//`
    PYTHON_LIBS="$PY_LIBS $PY_SYSLIBS"
    SAVE_LDFLAGS=$LDFLAGS
    LDFLAGS="$PYTHON_LIBS $LDFLAGS"
    AC_CHECK_LIB([python$PYTHON_VERSION], [Py_Initialize],[
        AC_MSG_NOTICE([No additional path to python library needed])
        PYTHON_LIBS="-lpython$PYTHON_VERSION $PYTHON_LIBS"],[
        LDFLAGS="-L$PY_LIBDEST/config $LDFLAGS"
        # check a different symbol or else configure will used cached value
        AC_CHECK_LIB([python$PYTHON_VERSION], [Py_Finalize],[
            AC_MSG_NOTICE([Adding path to python library])
            PYTHON_LIBS="-L$PY_LIBDEST/config -lpython$PYTHON_VERSION $PYTHON_LIBS"],[
            PYTHON_LIBS=""])])
    LDFLAGS=$SAVE_LDFLAGS
    ])
    AC_SUBST(PYTHON_VERSION)
    AC_SUBST(PYTHON_CFLAGS)
    AC_SUBST(PYTHON_LIBS)

    if test "${build}" = "${host}"; then
        PYTHON_SOABI=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('SOABI'))" | sed s/None//`
    else
        PYTHON_SOABI=""
    fi
    AC_SUBST(PYTHON_SOABI)

    AC_ARG_WITH(python-site-arch, AC_HELP_STRING([--with-python-site-arch=directory], [Direcory where Python modules will be installed - defaults is to query the Python binary]))
    if test "X$PYTHON_SITE_ARCH" = "X"; then
      if test "${build}" = "${host}"; then
        PYTHON_SITE_ARCH=`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,"${prefix}"))'`
      else
        PYTHON_SITE_ARCH="${libdir}/python${PYTHON_VERSION}/site-packages"
      fi
    fi
    AC_SUBST(PYTHON_SITE_ARCH)

    AC_ARG_WITH(python-site-lib, AC_HELP_STRING([--with-python-site-lib=directory], [Direcory where Python modules will be installed - defaults is to query the Python binary]))
    if test "X$PYTHON_SITE_LIB" = "X"; then
      if test "${build}" = "${host}"; then
        PYTHON_SITE_LIB=`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,"${prefix}"))'`
      else
        PYTHON_SITE_LIB="${libdir}/python${PYTHON_VERSION}/site-packages"
      fi
    fi
    AC_SUBST(PYTHON_SITE_LIB)

    SAVE_LDFLAGS=$LDFLAGS
    SAVE_CPPFLAGS=$CPPFLAGS
    LDFLAGS="$LDFLAGS $PYTHON_LIBS"
    CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"

    AC_CHECK_HEADER(Python.h, [pythonh="yes"], [pythonh="no"])

    AC_TRY_COMPILE([#include <Python.h>], [Py_InitializeEx(0)],[
        AC_MSG_NOTICE([Python includes functionality of skipping initialization registration of signal handlers])
        AC_DEFINE(HAVE_PYTHON_INITIALIZE_EX,,[Define if you have Py_InitializeEx function])
        enables_python_service="yes"
    ],[
        AC_MSG_NOTICE([Python does not include functionality of skipping initialization registration of signal handlers, since its version is below 2.4])
        enables_python_service="no"
    ])

    LDFLAGS=$SAVE_LDFLAGS
    CPPFLAGS=$SAVE_CPPFLAGS
  fi

  if test "X$PYTHON" = "X"; then
    AC_MSG_NOTICE([Missing Python - skipping Python components])
    enables_python=no
  elif test "X$PYTHON_LIBS" = "X"; then
    AC_MSG_NOTICE([Missing Python library - skipping Python components])
    enables_python=no
  elif test "X$pythonh" != "Xyes"; then
    AC_MSG_NOTICE([Missing Python header - skipping Python components])
    enables_python=no
  elif test "X$PYTHON_SITE_ARCH" = "X" || test "X$PYTHON_SITE_LIB" = "X"; then
    AC_MSG_NOTICE([Missing python site packages location - skipping Python components])
    enables_python=no
  else
    AC_MSG_NOTICE([Python available: $PYTHON_VERSION])
  fi

  if test "x$enables_python" != "xyes"; then
    AC_MSG_NOTICE([Missing Python - skipping Python bindings])
    enables_swig_python=no
  elif ! test -f python/arc_wrap.cpp && test "x$enables_swig_python" != "xyes"; then
    AC_MSG_NOTICE([Missing pre-compiled Python wrapper and SWIG - skipping Python bindings])
    enables_swig_python=no
  fi

fi
fi

AC_MSG_NOTICE([Python enabled: $enables_python])
AC_MSG_NOTICE([Python SWIG bindings enabled: $enables_swig_python])

AM_CONDITIONAL([PYTHON_ENABLED],[test "x$enables_python" = "xyes"])
AM_CONDITIONAL([PYTHON3], [test "x$enables_python" = "xyes" && test "x$PYTHON_MAJOR" = "x3"])
AM_CONDITIONAL([PYTHON_SWIG_ENABLED],[test "x$enables_swig_python" = "xyes"])
AM_CONDITIONAL([PYTHON_SERVICE],[test "x$enables_python" = "xyes" &&
                                 test "x$enables_python_service" = "xyes"])

# Alternative Python
if test "$enables_hed" = "yes"; then
AC_ARG_ENABLE(altpython,
  AC_HELP_STRING([--disable-altpython], [enable alternative Python binding]),
  [enables_altpython=$enableval], [])

if test "$enables_altpython" = "yes"; then
  AC_ARG_WITH(altpython, AC_HELP_STRING([--with-altpython=(PYTHON)],
    [specify alternative python program from PATH]))

  AC_CHECK_PROGS(ALTPYTHON, $with_altpython)

  if test "X$ALTPYTHON" != "X"; then
    ALTPYNAME=`basename $ALTPYTHON`
    PKG_CHECK_MODULES(ALTPYTHON, $ALTPYNAME, [
    ALTPYTHON_VERSION=`$PKG_CONFIG --modversion $ALTPYNAME`
    ALTPYTHON_MAJOR=`echo $ALTPYTHON_VERSION|cut -f1 -d.`
    ],[
    ALTPYTHON_VERSION=`$ALTPYTHON -c 'import sys; print(sys.version[[:3]])'`
    ALTPYTHON_MAJOR=`$ALTPYTHON -c 'import sys; print(sys.version_info[[0]])'`
    ALTPYTHON_CFLAGS=-I`$ALTPYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())'`
    ALTPY_LIBS=`$ALTPYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('LIBS'))" | sed s/None//`
    ALTPY_SYSLIBS=`$ALTPYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('SYSLIBS'))" | sed s/None//`
    ALTPY_LIBDEST=`$ALTPYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('LIBDEST'))" | sed s/None//`
    ALTPYTHON_LIBS="$ALTPY_LIBS $ALTPY_SYSLIBS"
    SAVE_LDFLAGS=$LDFLAGS
    LDFLAGS="$ALTPYTHON_LIBS $LDFLAGS"
    AC_CHECK_LIB([python$ALTPYTHON_VERSION], [Py_Initialize],[
        AC_MSG_NOTICE([No additional path to python library needed])
        ALTPYTHON_LIBS="-lpython$ALTPYTHON_VERSION $ALTPYTHON_LIBS"],[
        LDFLAGS="-L$ALTPY_LIBDEST/config $LDFLAGS"
        # check a different symbol or else configure will used cached value
        AC_CHECK_LIB([python$ALTPYTHON_VERSION], [Py_Finalize],[
            AC_MSG_NOTICE([Adding path to python library])
            ALTPYTHON_LIBS="-L$ALTPY_LIBDEST/config -lpython$ALTPYTHON_VERSION $ALTPYTHON_LIBS"],[
            ALTPYTHON_LIBS=""])])
    LDFLAGS=$SAVE_LDFLAGS
    ])
    AC_SUBST(ALTPYTHON_VERSION)
    AC_SUBST(ALTPYTHON_CFLAGS)
    AC_SUBST(ALTPYTHON_LIBS)

    ALTPYTHON_SOABI=`$ALTPYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('SOABI'))" | sed s/None//`
    AC_SUBST(ALTPYTHON_SOABI)

    AC_ARG_WITH(altpython-site-arch, AC_HELP_STRING([--with-altpython-site-arch=directory], [Direcory where Python modules will be installed - defaults is to query the Python binary]))
    if test "X$ALTPYTHON_SITE_ARCH" = "X"; then
      ALTPYTHON_SITE_ARCH=`$ALTPYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,"${prefix}"))'`
    fi
    AC_SUBST(ALTPYTHON_SITE_ARCH)

    AC_ARG_WITH(altpython-site-lib, AC_HELP_STRING([--with-altpython-site-lib=directory], [Direcory where Python modules will be installed - defaults is to query the Python binary]))
    if test "X$ALTPYTHON_SITE_LIB" = "X"; then
      ALTPYTHON_SITE_LIB=`$ALTPYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,"${prefix}"))'`
    fi
    AC_SUBST(ALTPYTHON_SITE_LIB)

    SAVE_LDFLAGS=$LDFLAGS
    SAVE_CPPFLAGS=$CPPFLAGS
    LDFLAGS="$LDFLAGS $ALTPYTHON_LIBS"
    CPPFLAGS="$CPPFLAGS $ALTPYTHON_CFLAGS"

    AC_CHECK_HEADER(Python.h, [altpythonh="yes"], [altpythonh="no"])

    LDFLAGS=$SAVE_LDFLAGS
    CPPFLAGS=$SAVE_CPPFLAGS
  fi

  if test "X$ALTPYTHON" = "X"; then
    AC_MSG_NOTICE([Missing alternative Python - skipping alternative Python])
    enables_altpython=no
  elif test "X$ALTPYTHON_LIBS" = "X"; then
    AC_MSG_NOTICE([Missing alternative Python library - skipping alternative Python bindings])
    enables_altpython=no
  elif test "X$altpythonh" != "Xyes"; then
    AC_MSG_NOTICE([Missing alternative Python header - skipping alternative Python bindings])
    enables_altpython=no

  elif test "X$ALTPYTHON_SITE_ARCH" = "X" || test "X$ALTPYTHON_SITE_LIB" = "X"; then
    AC_MSG_NOTICE([Missing python site packages location - skipping Python bindings])
    enables_altpython=no
  else
    AC_MSG_NOTICE([Alternative Python available: $ALTPYTHON_VERSION])
  fi

  if test "x$enables_altpython" != "xyes"; then
    AC_MSG_NOTICE([Missing alternative Python - skipping alternative Python bindings])
    enables_altpython=no
  elif ! test -f python/arc_wrap.cpp && test "x$enables_swig_python" != "xyes"; then
    AC_MSG_NOTICE([Missing pre-compiled Python wrapper and SWIG - skipping alternative Python bindings])
    enables_altpython=no
  fi

fi
fi

AC_MSG_NOTICE([Alternative Python enabled: $enables_altpython])

AM_CONDITIONAL([ALTPYTHON_ENABLED],[test "x$enables_altpython" = "xyes"])
AM_CONDITIONAL([ALTPYTHON3], [test "x$enables_altpython" = "xyes" && test "x$ALTPYTHON_MAJOR" = "x3"])


# check for pylint
dnl Check if pylint is explicitly disabled.
if test "$enables_hed" = "yes"; then
AC_ARG_ENABLE(pylint, AC_HELP_STRING([--disable-pylint], [disable python example checking using pylint]),
[enables_pylint=$enableval],[])
  AC_CHECK_PROGS(PYLINT, pylint)
  if test "x$PYLINT" = "x"; then
    enables_pylint="no"
  else
    PYLINT_VERSION=`$PYLINT --version 2> /dev/null | sed -n 's/^pylint \([[0-9.]]*\).*/\1/p'`
    PYLINT_VERSION_MAJOR=`echo $PYLINT_VERSION | cut -d. -f1`
    PYLINT_VERSION_MINOR=`echo $PYLINT_VERSION | cut -d. -f2`
    # Version prior to 0.13.0 doesn't seem to support the --errors-only flag.
    # In version 0.20.0 when specifying --errors-only, convention warnings (C) are treated like errors.
    if test $PYLINT_VERSION_MAJOR -eq 0 && test $PYLINT_VERSION_MINOR -ge 13 && test $PYLINT_VERSION_MINOR -ne 20; then
      enables_pylint="yes"
      AC_MSG_NOTICE([pylint version $PYLINT_VERSION found - version ok])
    elif test $PYLINT_VERSION_MAJOR -ge 1; then
      enables_pylint="yes"
      AC_MSG_NOTICE([pylint version $PYLINT_VERSION found - version ok])
    else
      enables_pylint="no"
      AC_MSG_NOTICE([pylint version $PYLINT_VERSION found - bad version])
    fi
  fi
fi
AM_CONDITIONAL([PYLINT_ENABLED], [test "x$enables_pylint" = "xyes"])
AC_MSG_NOTICE([Python example checking with pylint enabled: $enables_pylint])


# check gthread
if test "$enables_hed" = "yes"; then
PKG_CHECK_MODULES(GTHREAD, [gthread-2.0 >= 2.4.7])
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
fi

# check glibmm
# check for giomm which became a part of glibmm as of version 2.16
if test "$enables_hed" = "yes"; then
"$PKG_CONFIG" giomm-2.4
if test "$?" = '1'; then
  PKG_CHECK_MODULES(GLIBMM, [glibmm-2.4 >= 2.4.7])
else
  PKG_CHECK_MODULES(GLIBMM, [giomm-2.4])
  AC_DEFINE(HAVE_GIOMM,, [define if giomm is supported in glibmm])
fi
AC_SUBST(GLIBMM_CFLAGS)
AC_SUBST(GLIBMM_LIBS)
SAVE_CPPFLAGS=$CPPFLAGS
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
CPPFLAGS="$CPPFLAGS $GLIBMM_CFLAGS"
AC_CHECK_HEADER([glibmm/optioncontext.h], [
  AC_TRY_COMPILE([#include <glibmm/optioncontext.h>],
    [Glib::OptionContext ctx; ctx.set_summary("summary")], [
      AC_DEFINE(HAVE_GLIBMM_OPTIONCONTEXT_SET_SUMMARY,,
        [define if glibmm has Glib::OptionContext::set_summary()])
      AC_MSG_NOTICE([using glibmm command line parsing])
    ], [
      AC_MSG_NOTICE([using getopt_long command line parsing])
    ]
  )
  AC_TRY_COMPILE([#include <glibmm/optioncontext.h>],
    [Glib::OptionContext ctx; ctx.get_help();],[
      AC_DEFINE(HAVE_GLIBMM_OPTIONCONTEXT_GET_HELP,,
        [define if glibmm has Glib::OptionContext::get_help()])
    ], [
    ]
  )
])
AC_TRY_COMPILE([#include <glibmm.h>],[Glib::SignalChildWatch watch = Glib::signal_child_watch();],[glibmm_childwatch=yes],[glibmm_childwatch=no])
if test "$glibmm_childwatch" = yes; then
  AC_DEFINE(HAVE_GLIBMM_CHILDWATCH,,[define if glibmm have support for controling state of children processes])
else
  AC_MSG_NOTICE([WARNING: glibmm has no API for controlling children processes - result of external processes may be inconsistent])
fi
AC_TRY_COMPILE([#include <glibmm.h>],[Glib::ModuleFlags flags = Glib::MODULE_BIND_LOCAL;],[glibmm_bind_local=yes],[glibmm_bind_local=no])
if test "$glibmm_bind_local" = yes; then
  AC_DEFINE(HAVE_GLIBMM_BIND_LOCAL,,[define if glibmm have support local symbol resolution in shared libraries])
else
  AC_MSG_NOTICE([WARNING: glibmm has no way to limit scope of symbols of shared libraries. Make sure external libraries used by plugins have no conflicting symbols. HINT: use Globus compiled against system OpenSSL library.])
fi
AC_TRY_COMPILE([#include <glibmm/miscutils.h>],[Glib::getenv("");],[glibmm_getenv=yes],[glibmm_getenv=no])
if test "$glibmm_getenv" = yes; then
  AC_DEFINE(HAVE_GLIBMM_GETENV,,[define if glibmm have getenv operations])
else
  AC_MSG_NOTICE([WARNING: glibmm has no support for getenv. Usage of libc getenv is unsafe in multi-threaded applications.])
fi
AC_TRY_COMPILE([#include <glibmm/miscutils.h>],[Glib::setenv("", "");],[glibmm_setenv=yes],[glibmm_setenv=no])
if test "$glibmm_setenv" = yes; then
  AC_DEFINE(HAVE_GLIBMM_SETENV,,[define if glibmm have setenv operations])
else
  AC_MSG_NOTICE([WARNING: glibmm has no support for setenv. Usage of libc setenv may be unsafe in multi-threaded applications.])
fi
AC_TRY_COMPILE([#include <glibmm/miscutils.h>],[Glib::unsetenv("");],[glibmm_unsetenv=yes],[glibmm_unsetenv=no])
if test "$glibmm_unsetenv" = yes; then
  AC_DEFINE(HAVE_GLIBMM_UNSETENV,,[define if glibmm have unsetenv operations])
else
  AC_MSG_NOTICE([WARNING: glibmm has no support for unsetenv. Usage of libc unsetenv may be unsafe in multi-threaded applications.])
fi
AC_LANG_RESTORE
CPPFLAGS=$SAVE_CPPFLAGS
fi

# check libxml
if test "$enables_hed" = "yes"; then
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= 2.4.0])
AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_LIBS)
fi

# check openssl
if test "$enables_hed" = "yes"; then
PKG_CHECK_MODULES(OPENSSL, [openssl >= 0.9.7a])
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
"$PKG_CONFIG" openssl
if test "$?" = '1'; then
    if test "x$OPENSSL_BIN" != "x"; then
        OPENSSL_VERSION=`$OPENSSL_BIN version | cut -d' ' -f2`
        AC_MSG_NOTICE([Found OpenSSL version $OPENSSL_VERSION])
        OPENSSL_V1=`echo $OPENSSL_VERSION | cut -d'.' -f2`
        OPENSSL_V2=`echo $OPENSSL_VERSION | cut -d'.' -f3 | tr -d [[:alpha:]]`
        OPENSSL_V3=`echo $OPENSSL_VERSION | cut -d'.' -f3 | tr -d [[:digit:]] | od -td1 | awk 'NR==1{print $2}'`
        OPENSSL_PROXY=no
        if test "$OPENSSL_V1" -ge "9" && test "$OPENSSL_V2" -ge "7" && test "$OPENSSL_V3" -ge "102"; then
            OPENSSL_PROXY=yes
            AC_MSG_NOTICE([Found OpenSSL with PROXY support])
        else
            AC_MSG_NOTICE([WARNING: OpenSSL does not contain PROXY support])
        fi
        OPENSSL_X509_VERIFY_PARAM=no
        if test "$OPENSSL_V1" -ge "9" && test "$OPENSSL_V2" -ge "8"; then
            OPENSSL_X509_VERIFY_PARAM=yes
            AC_MSG_NOTICE([Found OpenSSL with X509_VERIFY_PARAM])
        else
            AC_MSG_NOTICE([WARNING: OpenSSL does not contain X509_VERIFY_PARAM])
        fi
        OPENSSL_OLDRSA=yes
        if test "$OPENSSL_V1" -ge "9" && test "$OPENSSL_V2" -ge "8" && test "x$OPENSSL_V3" != "x"; then
            AC_MSG_NOTICE([No old RSA])
            OPENSSL_OLDRSA=no
        fi
    else
        AC_ERROR([Cannot determine OpenSSL version!])
    fi
else
    OPENSSL_PROXY=no
    "$PKG_CONFIG" --exists 'openssl >= 0.9.7g'
    if test "$?" = '0' ; then
            OPENSSL_PROXY=yes
            AC_MSG_NOTICE([Found OpenSSL with PROXY support])
    else
            AC_MSG_NOTICE([WARNING: OpenSSL does not contain PROXY support])
    fi
    OPENSSL_X509_VERIFY_PARAM=no
    "$PKG_CONFIG" --exists 'openssl >= 0.9.8'
    if test "$?" = '0' ; then
            OPENSSL_X509_VERIFY_PARAM=yes
            AC_MSG_NOTICE([Found OpenSSL with X509_VERIFY_PARAM])
    else
            AC_MSG_NOTICE([WARNING: OpenSSL does not contain X509_VERIFY_PARAM])
    fi
    OPENSSL_OLDRSA=yes
    "$PKG_CONFIG" --exists 'openssl >= 0.9.8'
    if test "$?" = '0' ; then
            AC_MSG_NOTICE([No old RSA])
            OPENSSL_OLDRSA=no
    fi
fi
fi

#check mozilla nss
enables_nss=yes
NSS_INSTALLED=no
dnl Check if nss lib is explicitly enabled, default is disable.
AC_ARG_ENABLE(nss, AC_HELP_STRING([--disable-nss], [disable use of the mozilla nss library]),[enables_nss="$enableval"],[])
if test "$enables_nss" = "yes"; then
  PKG_CHECK_MODULES(NSS, [nss >= 3.10], [NSS_INSTALLED=yes] , [
    AC_MSG_WARN([Cannot locate nss lib])
    NSS_INSTALLED=no
    enables_nss=no
  ])
  if test "x$NSS_INSTALLED" = "xyes" ; then
    AC_DEFINE(HAVE_NSS,,[define if NSS is enabled and available])
  fi
fi
AC_SUBST(NSS_CFLAGS)
AC_SUBST(NSS_LIBS)
AM_CONDITIONAL([NSS_ENABLED], test x$NSS_INSTALLED = xyes)

#check emi common authentiation library
enables_canlxx=no
AC_ARG_ENABLE(canlxx, AC_HELP_STRING([--enable-canlxx], [enable use of EMI common authentication libraries]), [enables_canlxx="$enableval"], [])
if test "x$enables_canlxx" = "xyes"; then
  AC_ARG_WITH(canlxx,
    AC_HELP_STRING([--with-canlxx=PATH], [CANL++ installation path]),
    [
      if test "x$PKG_CONFIG_PATH" != "x"; then
        PKG_CONFIG_PATH="$withval/lib/pkgconfig:$PKG_CONFIG_PATH"
      else
        PKG_CONFIG_PATH="$withval/lib/pkgconfig"
      fi
    ]
  )
  AC_MSG_NOTICE([PKG_CONFIG_PATH for CANL++ is: $PKG_CONFIG_PATH])
  PKG_CHECK_MODULES(CANLXX, [canl-c++], [], [
    AC_MSG_NOTICE([Failed to find EMI common authentication libraries])
    enables_canlxx=no
  ])
fi
if test "x$enables_canlxx" = "xyes" ; then
  AC_DEFINE(HAVE_CANLXX,,[define if CANL++ is enabled and available])
fi
AC_SUBST(CANLXX_CFLAGS)
AC_SUBST(CANLXX_LIBS)
AM_CONDITIONAL(CANLXX_ENABLED, test "x$enables_canlxx" = "xyes")

# check cppunit
if test "$enables_hed" = "yes"; then
AC_ARG_ENABLE(cppunit, AC_HELP_STRING([--disable-cppunit], [disable cppunit-based UNIT testing of code]),[enables_cppunit=$enableval],[])
if test "$enables_cppunit" = "yes"; then
  PKG_CHECK_MODULES(CPPUNIT, [cppunit],[],
    [AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
    if test "x$CPPUNIT_CONFIG" = "xno"; then
        AC_MSG_WARN([cppunit-config not found - no UNIT testing will be performed])
        CPPUNIT_CFLAGS=
        CPPUNIT_LIBS=
        enables_cppunit="no"
    else
        CPPUNIT_CFLAGS="`$CPPUNIT_CONFIG --cflags`"
        CPPUNIT_LIBS="`$CPPUNIT_CONFIG --libs`"
    fi])
  if test "x$CPPUNIT_CONFIG" != "xno" || test "x$CPPUNIT_PKG_ERRORS" != "x"
  then
    TEST_DIR=test
  else
    enables_cppunit=no
    TEST_DIR=
  fi
fi
AC_SUBST(CPPUNIT_CFLAGS)
AC_SUBST(CPPUNIT_LIBS)
AC_SUBST(TEST_DIR)
else
  enables_cppunit="no"
fi

##############################
#
# Check xmlsec1
#
#############################
MACOSX=""
case "${host}" in
  *darwin*)
    MACOSX="yes"
    ;;
esac

if test "x$MACOSX" = "xyes"; then
  AC_DEFINE(_MACOSX,,[Define if compiling for MacOSX])
fi
AM_CONDITIONAL([MACOSX], [ test "x$MACOSX" = "xyes"])

if test "$enables_hed" = "yes"; then
XMLSEC_MIN_VERSION="1.2.4"
XMLSEC_OPENSSL_MIN_VERSION="1.2.4"
XMLSEC_CONFIG="${XMLSEC1_CONFIG:-xmlsec1-config}"
XMLSEC_CFLAGS=""
XMLSEC_LIBS=""
XMLSEC_INSTALLED=no
dnl Check if xmlsec1 is explicitly disabled, default is enable.
AC_ARG_ENABLE(xmlsec1, AC_HELP_STRING([--disable-xmlsec1], [disable features which need xmlsec1 library]),[enables_xmlsec1=$enableval],[])
if test "x$enables_xmlsec1" = "xyes"; then
  AC_ARG_WITH(xmlsec1, [  --with-xmlsec1=(PATH)  xmlsec1 location])
  if test "x$with_xmlsec1" = "x" ; then
    PKG_CHECK_MODULES(XMLSEC, [xmlsec1 >= $XMLSEC_MIN_VERSION],
        [XMLSEC_INSTALLED=yes], [XMLSEC_INSTALLED=no])
    if test "x$XMLSEC_INSTALLED" = "xyes" ; then
      PKG_CHECK_MODULES(XMLSEC_OPENSSL, [xmlsec1-openssl >= $XMLSEC_OPENSSL_MIN_VERSION],
          [XMLSEC_INSTALLED=yes],[XMLSEC_INSTALLED=no])
    fi

    # Find number of backslashes in XMLSEC_CFLAGS
    n=$(echo $XMLSEC_CFLAGS|sed 's/.*-DXMLSEC_CRYPTO=\([[^ ]]*\).*/\1/'|tr -d '[[A-Za-z0-1\n"]]'| wc -c)

    # Fixes due to bugs in pkg-config and/or xmlsec1 
    #
    # 0: Indicates a bug in pkg-config which removes the escaping of the quotes
    # 2: Correct value with escaped quotes
    # 6: Old xmlsec1 version which used 3 back-slashes to escape quotes
    #    See eg. https://bugzilla.redhat.com/show_bug.cgi?id=675334

    # Make sure that the quotes are escaped with single backslash
    if test $n = 0 -o $n = 6; then 
      AC_MSG_NOTICE([Working around bad combination of pkgconfig and xmlsec1 with $n back-slashes])
      XMLSEC_CFLAGS=$(echo $XMLSEC_CFLAGS|sed 's/\(.*-DXMLSEC_CRYPTO=\)\\*"\([[^ \\"]]*\)\\*" \(.*\)/\1\\"\2\\" \3/')
      XMLSEC_OPENSSL_CFLAGS=$(echo $XMLSEC_OPENSSL_CFLAGS|sed 's/\(.*-DXMLSEC_CRYPTO=\)\\*"\([[^ \\"]]*\)\\*" \(.*\)/\1\\"\2\\" \3/')
    fi

  fi

  if test "x$XMLSEC_INSTALLED" = "xno" -a "x$MACOSX" != "xyes"; then
      AC_MSG_CHECKING(for xmlsec1 libraries >= $XMLSEC_MIN_VERSION)
      if test "x$with_xmlsec1" != "x" ; then
        XMLSEC_CONFIG=$with_xmlsec1/bin/$XMLSEC_CONFIG
      fi
      "$XMLSEC_CONFIG" --version 2>/dev/null 1>/dev/null
      if test "$?" != '0' ; then
        AC_MSG_WARN(Could not find xmlsec1 anywhere; The xml security related functionality will not be compiled)
      else
        vers=`$XMLSEC_CONFIG --version 2>/dev/null | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
        minvers=`echo $XMLSEC_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
        if test "$vers" -ge "$minvers" ; then
          XMLSEC_LIBS="`$XMLSEC_CONFIG --libs`"
          XMLSEC_CFLAGS="`$XMLSEC_CONFIG --cflags`"
          #check the xmlsec1-openssl here
          if test "x$PKG_CONFIG_PATH" != "x"; then
            PKG_CONFIG_PATH="$with_xmlsec1/lib/pkgconfig:$PKG_CONFIG_PATH"
          else
            PKG_CONFIG_PATH="$with_xmlsec1/lib/pkgconfig"
          fi
          PKG_CHECK_MODULES(XMLSEC_OPENSSL, [xmlsec1-openssl >= $XMLSEC_OPENSSL_MIN_VERSION],
              [XMLSEC_INSTALLED=yes],[XMLSEC_INSTALLED=no])
        else
          AC_MSG_WARN(You need at least xmlsec1 $XMLSEC_MIN_VERSION for this version of arc1)
        fi
      fi
  elif test "x$XMLSEC_INSTALLED" = "xno" -a "x$MACOSX" = "xyes"; then
    #MACOSX has no "ldd" which is needed by xmlsec1-config, so here simply we use PKG_CHECK_MODULES
    if test "x$PKG_CONFIG_PATH" != "x"; then
      PKG_CONFIG_PATH="$with_xmlsec1/lib/pkgconfig:$PKG_CONFIG_PATH"
    else
      PKG_CONFIG_PATH="$with_xmlsec1/lib/pkgconfig"
    fi
    PKG_CHECK_MODULES(XMLSEC, [xmlsec1 >= $XMLSEC_MIN_VERSION],
        [XMLSEC_INSTALLED=yes], [XMLSEC_INSTALLED=no])
    if test "x$XMLSEC_INSTALLED" = "xyes" ; then
      PKG_CHECK_MODULES(XMLSEC_OPENSSL, [xmlsec1-openssl >= $XMLSEC_OPENSSL_MIN_VERSION],
          [XMLSEC_INSTALLED=yes],[XMLSEC_INSTALLED=no])
    fi
  fi

  AC_SUBST(XMLSEC_CFLAGS)
  AC_SUBST(XMLSEC_LIBS)
  AC_SUBST(XMLSEC_OPENSSL_CFLAGS)
  AC_SUBST(XMLSEC_OPENSSL_LIBS)

  #AC_SUBST(XMLSEC_CONFIG)
  #AC_SUBST(XMLSEC_MIN_VERSION)
  enables_xmlsec1="$XMLSEC_INSTALLED"
fi
else
  enables_xmlsec1="no"
fi

#########################
#
# Check libmysqlclient
#
#########################
MYSQL_INSTALLED=no
if test "$enables_hed" = "yes"; then
MYSQL_CONFIG="mysql_config"
MYSQL_CFLAGS=""
MYSQL_LIBS=""
dnl Check if libmysqlclient is explicitly enabled, default is disable.
AC_ARG_ENABLE(mysql, AC_HELP_STRING([--enable-mysql], [enable use of the MySQL client library]),[enables_mysql="$enableval"],[])
# Ask user for path to libmysqlclient
if test "x$enables_mysql" = "xyes"; then
  AC_ARG_WITH(mysql, [  --with-mysql=(PATH) prefix of MySQL installation. e.g. /usr/local or /usr])
  AC_MSG_CHECKING(for mysql client library)
  if test "x$with_mysql" != "x" ; then
      MYSQL_CONFIG=$with_mysql/bin/$MYSQL_CONFIG
  fi
  if ! $MYSQL_CONFIG --version > /dev/null 2>&1 ; then
      AC_MSG_ERROR(Could not find mysql C library anywhere (see config.log for details).)
  fi
  MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
  MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
  MYSQL_INSTALLED="yes"

  AC_SUBST(MYSQL_LIBS)
  AC_SUBST(MYSQL_CFLAGS)
  enables_mysql=$MYSQL_INSTALLED
fi
AC_MSG_NOTICE([MySQL client library enabled: $MYSQL_INSTALLED])
fi
AM_CONDITIONAL([MYSQL_LIBRARY_ENABLED],[test "x$MYSQL_INSTALLED" = "xyes"])

# Check ldap-monitor
AC_ARG_ENABLE(ldap_monitor, AC_HELP_STRING([--enable-ldap-monitor], [enable use of the ldap monitor]),[enables_ldap_monitor="$enableval"],[])
if test "x$enables_ldap_monitor" = "xyes"; then
  AC_ARG_WITH(ldap_monitor, [  --with-ldap-monitor=(PATH) where to install the monitor, eg /var/www/ldap-monitor or /usr/share/arc/ldap-monitor])
  AC_MSG_CHECKING(for ldap-monitor installation path)
  if test "x$with_ldap_monitor" != "x" ; then
      ldap_monitor_prefix=$with_ldap_monitor
  else
      ldap_monitor_prefix=${datadir}/arc/ldap-monitor
  fi
  AC_MSG_RESULT([$ldap_monitor_prefix])
  AC_SUBST(ldap_monitor_prefix)
fi

# Check ws-monitor
AC_ARG_ENABLE(ws_monitor, AC_HELP_STRING([--enable-ws-monitor], [enable use of the ws monitor]),[enables_ws_monitor="$enableval"],[])
if test "x$enables_ws_monitor" = "xyes"; then
  AC_ARG_WITH(ws_monitor, [  --with-ws-monitor=(PATH) where to install the monitor, eg /var/www/ws-monitor or /usr/share/arc/ws-monitor])
  AC_MSG_CHECKING(for ws-monitor installation path)
  if test "x$with_ws_monitor" != "x" ; then
      ws_monitor_prefix=$with_ws_monitor
  else
      ws_monitor_prefix=${datadir}/arc/ws-monitor
  fi
  AC_MSG_RESULT([$ws_monitor_prefix])
  AC_SUBST(ws_monitor_prefix)
fi

# check zlib
ZLIB_CFLAGS=
ZLIB_LDFLAGS=
ZLIB_LIBS=
if test "$enables_hed" = "yes"; then
SAVE_CPPFLAGS=$CPPFLAGS
SAVE_LDFLAGS=$LDFLAGS
AC_ARG_WITH(zlib,
  AC_HELP_STRING([--with-zlib=PATH], [where zlib is installed]),
    [ if test -d "$withval"; then
        ZLIB_CFLAGS="${CPPFLAGS} -I$withval/include"
        ZLIB_LDFLAGS="${LDFLAGS} -L$withval/lib"
      fi
    ]
)
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
AC_CHECK_HEADER([zlib.h],[ZLIB_CFLAGS="$ZLIB_CFLAGS"],AC_MSG_ERROR([unable to find zlib header files]))
AC_CHECK_LIB([z],[deflateInit2_],[ZLIB_LIBS="$ZLIB_LDFLAGS -lz"],AC_MSG_ERROR([unable to link with zlib library]))
CPPFLAGS=$SAVE_CPPFLAGS
LDFLAGS=$SAVE_LDFLAGS
fi
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)

# check gridsite
GRIDSITE_CFLAGS=""
GRIDSITE_LDFLAGS=""
AC_ARG_WITH(gridsite,
  AC_HELP_STRING([--with-gridsite=PATH], [where gridsite is installed]),
  [
    if test ! "x$with_gridsite" = "x"; then
      GRIDSITE_LOCATION="$with_gridsite"
      GRIDSITE_CFLAGS="-I$GRIDSITE_LOCATION/include"
      if test -d "$GRIDSITE_LOCATION/lib64"; then
        GRIDSITE_LDFLAGS="-L$GRIDSITE_LOCATION/lib64"
      else
        GRIDSITE_LDFLAGS="-L$GRIDSITE_LOCATION/lib"
      fi
    fi
  ]
)
SAVE_LIBS=$LIBS
SAVE_CPPFLAGS=$CPPFLAGS
SAVE_LDFLAGS=$LDFLAGS
CPPFLAGS="$CPPFLAGS $GRIDSITE_CFLAGS"
LDFLAGS="$LDFLAGS $GRIDSITE_LDFLAGS"
if test "x$enables_gacl" = "xyes"; then
  AC_CHECK_HEADER([gridsite.h],, enables_gacl="no")
fi
if test "x$enables_gacl" = "xyes"; then
  AC_CHECK_LIB([gridsite], [GRSTgaclInit], [GRIDSITE_LIBS="$GRIDSITE_LDFLAGS -lgridsite"], enables_gacl="no")
fi
LIBS=$SAVE_LIBS
CPPFLAGS=$SAVE_CPPFLAGS
LDFLAGS=$SAVE_LDFLAGS
AM_CONDITIONAL(GACL_ENABLED, test "x$enables_gacl" = "xyes")
if test "x$enables_gacl" = "xyes"; then
   AC_DEFINE(HAVE_GACL,, [define if gridsite GACL is available])
else
  GRIDSITE_CFLAGS=
  GRIDSITE_LIBS=
fi
AC_SUBST(GRIDSITE_CFLAGS)
AC_SUBST(GRIDSITE_LIBS)

# check ARGUS
ARGUS_CFLAGS=
ARGUS_LIBS=
AC_ARG_ENABLE(argus, AC_HELP_STRING([--enable-argus], [enable use of Argus PEP V2 libraries]),[enables_argus="$enableval"],[])
if test "x$enables_argus" = "xyes"; then
  AC_ARG_WITH(argus,
    AC_HELP_STRING([--with-argus=PATH], [ARGUS PEP installation path]),
    [
      if test "x$PKG_CONFIG_PATH" != "x"; then
        PKG_CONFIG_PATH="$withval/lib/pkgconfig:$PKG_CONFIG_PATH"
      else
        PKG_CONFIG_PATH="$withval/lib/pkgconfig"
      fi
    ]
  )
  PKG_CHECK_MODULES(ARGUS, [libargus-pep >= 2.0.0], [], [
    AC_MSG_NOTICE([Failed to find Argus PEP libraries with version >= 2])
    enables_argus=no
  ])
fi
AC_SUBST(ARGUS_CFLAGS)
AC_SUBST(ARGUS_LIBS)
AM_CONDITIONAL(ARGUS_ENABLED, test "x$enables_argus" = "xyes")

###############################################
#
# Check for Berkeley DB C++
#
###############################################
DBCXX_LIBS=""
DBCXX_CPPFLAGS=

if test "$enables_hed" = "yes"; then

#
# Allow the user to specify db_cxx.h location (we will still check though)
#

dbcxx_include_paths=
AC_ARG_WITH(dbcxx-include,
   [  --with-dbcxx-include=PATH   Specify path to db_cxx.h],
   [
  if test "x$withval" = "xyes" ; then
    AC_MSG_ERROR([--with-dbcxx-include requires PATH argument])
  fi
  if test "x$withval" != "xno" ; then
    dbcxx_include_paths=$withval
  fi
   ]
)

#
# Allow the user to specify DB4 library location (we will still check though)
#

db4_library_path=
AC_ARG_WITH(db4-library-path,
   [  --with-db4-library-path=PATH   Specify path to DB4 library],
   [
  if test "x$withval" = "xyes" ; then
    AC_MSG_ERROR([--with-db4-library-path requires PATH argument])
  fi
  if test "x$withval" != "xno" ; then
    db4_library_path=$withval
  fi
   ]
)

AC_LANG_SAVE
AC_LANG_CPLUSPLUS

#
# If user did not specify location we start by searching at the standard locations
#

if test "x$dbcxx_include_paths" = "x"
then
  AC_MSG_NOTICE([Looking for db_cxx.h in standard locations])
  AC_CHECK_HEADERS(db_cxx.h,HAVE_DBCXX=yes,HAVE_DBCXX=no)
  # If the user did not provide a location we have some good suggestions
  dbcxx_include_paths="/usr/include/db4 /usr/include/db44 /usr/include/db43"
else
  HAVE_DBCXX=no
fi

#
# Now Look for db_cxx.h in non-standard locations
#

if test "$HAVE_DBCXX" = no
then
  for dbcxx_dir in $dbcxx_include_paths
  do
    SAVE_CPPFLAGS=$CPPFLAGS
    DBCXX_CPPFLAGS=-I$dbcxx_dir
    CPPFLAGS="$CPPFLAGS $DBCXX_CPPFLAGS"
    # Disable Autoconf caching
    unset ac_cv_header_db_cxx_h
    AC_MSG_NOTICE([Looking for db_cxx.h in $dbcxx_dir])
    AC_CHECK_HEADERS(db_cxx.h,HAVE_DBCXX=yes,HAVE_DBCXX=no)
    CPPFLAGS=$SAVE_CPPFLAGS
    # If a db_cxx.h was found we break and keep the current value of DBCXX_CPPFLAGS
    if test "$HAVE_DBCXX" = yes
    then
      break
    fi
    DBCXX_CPPFLAGS=
  done
fi
AC_SUBST(DBCXX_CPPFLAGS)

if test "x$db4_library_path" != "x"
then
  db4_library_path="-L$db4_library_path"
fi

if test "$HAVE_DBCXX" = no
then
  DBCXX_LIBS=""
else
  SAVE_LDFLAGS=$LDFLAGS
  SAVE_CXXFLAGS=$CXXFLAGS

  case $host in
    *-*-mingw*)
      CXXFLAGS="-I$dbcxx_dir $CXXFLAGS"
      ;;
    *)
      # pthread needed for RH9
      LDFLAGS="$LDFLAGS -lpthread"
      ;;
  esac

  LDFLAGS="$LDFLAGS $db4_library_path"

  for db_ver in "" -4.7 -4.3 -4.2
  do
    AC_CHECK_LIB(db_cxx$db_ver,main,DBCXX_LIBS="$db4_library_path -ldb_cxx$db_ver",DBCXX_LIBS="")

    if test "$DBCXX_LIBS" = ""
    then
      AC_MSG_WARN([BerkeleyDB library libdb_cxx$db_ver was not found!])
    else
      break
    fi
  done

  if test "$DBCXX_LIBS" = ""
  then
    AC_MSG_WARN([No BerkeleyDB library found!])
  fi

  LDFLAGS=$SAVE_LDFLAGS
  CXXFLAGS=$SAVE_CXXFLAGS
fi

AC_SUBST(DBCXX_LIBS)
if test ! "x$DBCXX_LIBS" = "x"
then
  # Mingw need -I$dbcxx_dir
  AC_DEFINE(HAVE_DBCXX, , [define if Berkeley DB C++ binding is available])
  SAVE_CXXFLAGS=$CXXFLAGS
  CXXFLAGS="-I$dbcxx_dir $CXXFLAGS"
  AC_DBCXX_HAVE_DBDEADLOCKEXCEPTION
  CXXFLAGS=$SAVE_CXXFLAGS
fi
AC_LANG_RESTORE

fi

# DBJSTORE (storing jobs information in BDB)
AC_ARG_ENABLE(dbjstore, AC_HELP_STRING([--disable-dbjstore], [disable storing local jobs information in BDB]),
  [enables_dbjstore=$enableval],[])
if test "$enables_dbjstore" = "yes"; then
  if test "x$DBCXX_LIBS" = "x" ; then
    AC_MSG_NOTICE([For storing jobs in BDB C++ API is needed (dbcxx) - disabling])
    enables_dbjstore="no"
  fi
fi
AC_MSG_NOTICE([Storing jobs in BDB enabled: $enables_dbjstore])
AM_CONDITIONAL([DBJSTORE_ENABLED],[test "x$enables_dbjstore" = "xyes"])
if test "x$enables_dbjstore" = "xyes"; then
  AC_DEFINE(DBJSTORE_ENABLED,, [define if to build job information in BDB storage])
fi

# globus/gpt packages
if test "$enables_hed" = "yes"; then
PKG_CHECK_MODULES(GLOBUS_COMMON, [globus-common], [
GLOBUS_COMMON_VERSION=`$PKG_CONFIG --modversion globus-common`], [
GPT_PKG(globus_common)
])
AC_SUBST(GLOBUS_COMMON_CFLAGS)
AC_SUBST(GLOBUS_COMMON_LIBS)

PKG_CHECK_MODULES(GLOBUS_GSSAPI_GSI, [globus-gssapi-gsi], [
GLOBUS_GSSAPI_GSI_VERSION=`$PKG_CONFIG --modversion globus-gssapi-gsi`], [
GPT_PKG(globus_gssapi_gsi)
])
AC_SUBST(GLOBUS_GSSAPI_GSI_CFLAGS)
AC_SUBST(GLOBUS_GSSAPI_GSI_LIBS)

PKG_CHECK_MODULES(GLOBUS_GSS_ASSIST, [globus-gss-assist], [
GLOBUS_GSS_ASSIST_VERSION=`$PKG_CONFIG --modversion globus-gss-assist`], [
GPT_PKG(globus_gss_assist)
])
AC_SUBST(GLOBUS_GSS_ASSIST_CFLAGS)
AC_SUBST(GLOBUS_GSS_ASSIST_LIBS)

PKG_CHECK_MODULES(GLOBUS_GSI_CALLBACK, [globus-gsi-callback], [
GLOBUS_GSI_CALLBACK_VERSION=`$PKG_CONFIG --modversion globus-gsi-callback`], [
GPT_PKG(globus_gsi_callback)
])
AC_SUBST(GLOBUS_GSI_CALLBACK_CFLAGS)
AC_SUBST(GLOBUS_GSI_CALLBACK_LIBS)

PKG_CHECK_MODULES(GLOBUS_FTP_CLIENT, [globus-ftp-client], [
GLOBUS_FTP_CLIENT_VERSION=`$PKG_CONFIG --modversion globus-ftp-client`], [
GPT_PKG(globus_ftp_client)
])
AC_SUBST(GLOBUS_FTP_CLIENT_CFLAGS)
AC_SUBST(GLOBUS_FTP_CLIENT_LIBS)

PKG_CHECK_MODULES(GLOBUS_FTP_CONTROL, [globus-ftp-control], [
GLOBUS_FTP_CONTROL_VERSION=`$PKG_CONFIG --modversion globus-ftp-control`], [
GPT_PKG(globus_ftp_control)
])
AC_SUBST(GLOBUS_FTP_CONTROL_CFLAGS)
AC_SUBST(GLOBUS_FTP_CONTROL_LIBS)

PKG_CHECK_MODULES(GLOBUS_IO, [globus-io], [
GLOBUS_IO_VERSION=`$PKG_CONFIG --modversion globus-io`], [
GPT_PKG(globus_io)
])
AC_SUBST(GLOBUS_IO_CFLAGS)
AC_SUBST(GLOBUS_IO_LIBS)

PKG_CHECK_MODULES(GLOBUS_GSI_CERT_UTILS, [globus-gsi-cert-utils], [
GLOBUS_GSI_CERT_UTILS_VERSION=`$PKG_CONFIG --modversion globus-gsi-cert-utils`], [
GPT_PKG(globus_gsi_cert_utils)
])
AC_SUBST(GLOBUS_GSI_CERT_UTILS_CFLAGS)
AC_SUBST(GLOBUS_GSI_CERT_UTILS_LIBS)

PKG_CHECK_MODULES(GLOBUS_GSI_CREDENTIAL, [globus-gsi-credential], [
GLOBUS_GSI_CREDENTIAL_VERSION=`$PKG_CONFIG --modversion globus-gsi-credential`], [
GPT_PKG(globus_gsi_credential)
])
AC_SUBST(GLOBUS_GSI_CREDENTIAL_CFLAGS)
AC_SUBST(GLOBUS_GSI_CREDENTIAL_LIBS)

PKG_CHECK_MODULES(GLOBUS_OPENSSL_MODULE, [globus-openssl-module], [
GLOBUS_OPENSSL_MODULE_VERSION=`$PKG_CONFIG --modversion globus-openssl-module`], [
GPT_PKG(globus_openssl_module)
])
AC_SUBST(GLOBUS_OPENSSL_MODULE_CFLAGS)
AC_SUBST(GLOBUS_OPENSSL_MODULE_LIBS)

# Check for new globus thread model selection
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GLOBUS_COMMON_CFLAGS"
LIBS="$LIBS $GLOBUS_COMMON_LIBS"
AC_CHECK_FUNCS(globus_thread_set_model)
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS

# Check for gridftp-v2
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GLOBUS_FTP_CLIENT_CFLAGS"
LIBS="$LIBS $GLOBUS_FTP_CLIENT_LIBS"
AC_CHECK_FUNCS(globus_ftp_client_handleattr_set_gridftp2)
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS

globus_openssl_detected=
PKG_CHECK_MODULES(GLOBUS_OPENSSL, [globus-openssl], [
GLOBUS_OPENSSL_VERSION=`$PKG_CONFIG --modversion globus-openssl`], [
GPT_PKG(globus_openssl)
])
if test ! "x$GLOBUS_OPENSSL_LIBS" = "x" ; then
  globus_openssl_detected=`echo "$GLOBUS_OPENSSL_LIBS" | grep "lssl_$GPT_FLAVOR"`
  if test ! "x$globus_openssl_detected" = "x" ; then
    globus_openssl_detected="yes"
  fi
fi
if test "x$globus_openssl_detected" = "xyes" ; then
AC_MSG_RESULT([
Globus own OpenSSL library detected.
In order to avoid runtime conflicts following components will be disabled:
GridFTP DMC,
SRM DMC,
GSI MCC.
To enable these components use Globus compiled for system OpenSSL.
])
GLOBUS_FTP_CLIENT_VERSION=
GLOBUS_FTP_CONTROL_VERSION=
GLOBUS_IO_VERSION=
GLOBUS_GSSAPI_GSI_VERSION=
fi

if test "x$GLOBUS_IO_VERSION" = "x"; then
  IO_VERSION_MAJOR=0
else
  IO_VERSION_MAJOR=`echo "$GLOBUS_IO_VERSION" | sed 's/^\([[^.]]*\).*/\1/'`;
fi
AC_DEFINE_UNQUOTED(GLOBUS_IO_VERSION,$IO_VERSION_MAJOR,[Globus IO version])

dnl
dnl DEFAULT_GLOBUS_LOCATION
dnl
AC_MSG_CHECKING(for DEFAULT_GLOBUS_LOCATION)
# GLOBUS_LOCATION is set by GPT macros
DEFAULT_GLOBUS_LOCATION="$GLOBUS_LOCATION"
AC_MSG_RESULT($DEFAULT_GLOBUS_LOCATION)
AC_SUBST(DEFAULT_GLOBUS_LOCATION)

#check lcas
DEFAULT_LCAS_LOCATION=/opt/glite
LCAS_LOCATION=
LCAS_CFLAGS=
LCAS_LIBS=
AC_ARG_WITH(lcas-location,
  [  --with-lcas-location=<PATH>        Specify the LCAS installation path. [[/opt/glite]]],
  [
    LCAS_LOCATION=$with_lcas_location
    if test ! -d $LCAS_LOCATION; then
      AC_MSG_WARN([LCAS_LOCATION ($LCAS_LOCATION) does not exist])
      LCAS_LOCATION=
    fi
  ],[
    if test "x$LCAS_LOCATION" = "x"; then
      LCAS_LOCATION=$DEFAULT_LCAS_LOCATION
    fi
    if test ! -d $LCAS_LOCATION; then
      LCAS_LOCATION=
    fi
  ]
)
if test "x$LCAS_LOCATION" != "x"; then
  LCAS_CFLAGS=$LCAS_LOCATION/include/glite/security/lcas
  if test ! -d $LCAS_CFLAGS; then
    LCAS_CFLAGS=$LCAS_LOCATION/include/lcas
    if test ! -d $LCAS_CFLAGS; then
      LCAS_CFLAGS=$LCAS_LOCATION/include
    fi
  fi
  LCAS_CFLAGS=-I$LCAS_CFLAGS
  SAVE_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$LCAS_CFLAGS $GLOBUS_GSSAPI_GSI_CFLAGS"
  AC_CHECK_HEADERS([lcas.h],
    LCAS_LDFLAGS=
    if test -d $LCAS_LOCATION/lib64; then
      LCAS_LDFLAGS="-L$LCAS_LOCATION/lib64 $GLOBUS_GSSAPI_GSI_LIBS"
    else
      LCAS_LDFLAGS="-L$LCAS_LOCATION/lib $GLOBUS_GSSAPI_GSI_LIBS"
    fi
    SAVE_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $LCAS_LDFLAGS"
    AC_CHECK_LIB(lcas,lcas_init, LCAS_LIBS="$LCAS_LDFLAGS -llcas",LCAS_LOCATION="",)
    LDFLAGS=$SAVE_LDFLAGS
    ,
    LCAS_LOCATION=""
  )
  CPPFLAGS=$SAVE_CPPFLAGS
fi
if test "x$LCAS_LOCATION" != "x"; then
  AC_DEFINE(HAVE_LCAS,, [define if lcas is available])
  AC_SUBST(LCAS_LOCATION)
  AC_SUBST(LCAS_CFLAGS)
  AC_SUBST(LCAS_LIBS)
fi

#check lcmaps
DEFAULT_LCMAPS_LOCATION=/opt/glite
LCMAPS_LOCATION=
LCMAPS_CFLAGS=
LCMAPS_LIBS=
AC_ARG_WITH(lcmaps-location,
  [  --with-lcmaps-location=<PATH>        Specify the LCMAPS installation path. [[/opt/glite]]],
  [
    LCMAPS_LOCATION=$with_lcmaps_location
    if test ! -d $LCMAPS_LOCATION; then
      AC_MSG_WARN([LCMAPS_LOCATION ($LCMAPS_LOCATION) does not exist])
      LCMAPS_LOCATION=
    fi
  ],[
    if test "x$LCMAPS_LOCATION" = "x"; then
      LCMAPS_LOCATION=$DEFAULT_LCMAPS_LOCATION
    fi
    if test ! -d $LCMAPS_LOCATION; then
      LCMAPS_LOCATION=
    fi
  ]
)
if test "x$LCMAPS_LOCATION" != "x"; then
  LCMAPS_CFLAGS=$LCMAPS_LOCATION/include/glite/security/lcmaps
  if test ! -d $LCMAPS_CFLAGS; then
    LCMAPS_CFLAGS=$LCMAPS_LOCATION/include/lcmaps
    if test ! -d $LCMAPS_CFLAGS; then
      LCMAPS_CFLAGS=$LCMAPS_LOCATION/include
    fi
  fi
  LCMAPS_CFLAGS=-I$LCMAPS_CFLAGS
  SAVE_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$LCMAPS_CFLAGS $GLOBUS_GSSAPI_GSI_CFLAGS"
  AC_CHECK_HEADERS([lcmaps.h],
    LCMAPS_LDFLAGS=
    if test -d $LCMAPS_LOCATION/lib64; then
      LCMAPS_LDFLAGS="-L$LCMAPS_LOCATION/lib64 $GLOBUS_GSSAPI_GSI_LIBS"
    else
      LCMAPS_LDFLAGS="-L$LCMAPS_LOCATION/lib $GLOBUS_GSSAPI_GSI_LIBS"
    fi
    SAVE_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $LCMAPS_LDFLAGS"
    AC_CHECK_LIB(lcmaps,lcmaps_init, LCMAPS_LIBS="$LCMAPS_LDFLAGS -llcmaps",LCMAPS_LOCATION="",)
    LDFLAGS=$SAVE_LDFLAGS
    ,
    LCMAPS_LOCATION=""
  )
  CPPFLAGS=$SAVE_CPPFLAGS
fi
if test "x$LCMAPS_LOCATION" != "x"; then
  AC_DEFINE(HAVE_LCMAPS,, [define if lcmaps is available])
  AC_SUBST(LCMAPS_LOCATION)
  AC_SUBST(LCMAPS_CFLAGS)
  AC_SUBST(LCMAPS_LIBS)
fi

# Check if mock DMC is enabled
AC_ARG_ENABLE(mock-dmc, AC_HELP_STRING([--enable-mock-dmc], [enable mock DMC, default is disable]),[enables_mock_dmc="$enableval"],[])

# Check for LFC
AC_ARG_ENABLE(lfc, AC_HELP_STRING([--disable-lfc], [disable the LFC support, default is enable]),[enables_lfc="$enableval"],[])
if test "x$enables_lfc" = "xyes"; then
  if test "x$GLOBUS_OPENSSL_MODULE_LIBS" = "x"; then
    AC_MSG_NOTICE([LFC plugin needs GLOBUS_OPENSSL_MODULE component - disabling])
    enables_lfc=no
  fi
fi
if test "x$enables_lfc" = "xyes"; then
  LFC_CFLAGS="-I/usr/include/lfc"
  LFC_LDFLAGS="-ldl"
  AC_ARG_WITH(lfc, [  --with-lfc=(PATH)  LFC location])
  if test ! "x$with_lfc" = "x" ; then
    LFC_LOCATION="$with_lfc"
    LFC_CFLAGS="-I$LFC_LOCATION/include/lfc"
    if test -d $LFC_LOCATION/lib64; then
      LFC_LDFLAGS="-L$LFC_LOCATION/lib64 -ldl"
    else
      LFC_LDFLAGS="-L$LFC_LOCATION/lib -ldl"
    fi
  fi
  SAVE_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $LFC_CFLAGS"
  AC_CHECK_HEADER(lfc_api.h, [], [enables_lfc="no"])
  CPPFLAGS=$SAVE_CPPFLAGS
  SAVE_LDFLAGS=$LDFLAGS
  LDFLAGS="$LDFLAGS $LFC_LDFLAGS"
  AC_CHECK_LIB([lfc], [lfc_apiinit],
               [LFC_LIBS="$LFC_LDFLAGS -llfc"], [enables_lfc="no"])
  # Check if lcgdm is a separate library
  AC_CHECK_LIB([lcgdm], [C__serrno], [LFC_LIBS="$LFC_LIBS -llcgdm"],
  AC_CHECK_LIB([lfc], [C__serrno], [LFC_LIBS="$LFC_LIBS"], [enables_lfc="no"]))
  LDFLAGS=$SAVE_LDFLAGS
fi
AC_SUBST(LFC_CFLAGS)
AC_SUBST(LFC_LIBS)


# Check for GFAL2

AC_ARG_ENABLE(gfal, AC_HELP_STRING([--enable-gfal], [enable the GFAL support, default is disable]),[enables_gfal="$enableval"],[])
if test "x$enables_gfal" = "xyes"; then
  PKG_CHECK_MODULES(GFAL2, gfal_transfer, [], [enables_gfal="no"])
  AC_SUBST(GFAL2_CFLAGS)
  AC_SUBST(GFAL2_LIBS)
fi

# Check for xrootd (c++)

AC_LANG_SAVE
AC_LANG_CPLUSPLUS

AC_ARG_ENABLE(xrootd, AC_HELP_STRING([--disable-xrootd], [disable the xrootd support, default is enable]),[enables_xrootd="$enableval"],[])
if test "x$enables_xrootd" = "xyes"; then
  XROOTD_CPPFLAGS="-I/usr/include/xrootd"
  AC_ARG_WITH(xrootd, [  --with-xrootd=(PATH) Xrootd location])
  if test ! "x$with_xrootd" = "x" ; then
    XROOTD_LOCATION="$with_xrootd"
    XROOTD_CPPFLAGS="-I$XROOTD_LOCATION/include/xrootd"
    if test -d $XROOTD_LOCATION/lib64; then
      XROOTD_LDFLAGS="-L$XROOTD_LOCATION/lib64"
    else
      XROOTD_LDFLAGS="-L$XROOTD_LOCATION/lib"
    fi
  fi
  SAVE_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $XROOTD_CPPFLAGS"
  AC_CHECK_HEADER(XrdPosix/XrdPosixXrootd.hh, [], [enables_xrootd="no"] [#include <iostream>])
  CPPFLAGS=$SAVE_CPPFLAGS
  SAVE_LDFLAGS=$LDFLAGS
  LDFLAGS="$LDFLAGS $XROOTD_LDFLAGS"
  AC_CHECK_LIB([XrdPosix], [_init],
               [XROOTD_LIBS="$XROOTD_LDFLAGS -lXrdPosix"], [enables_xrootd="no"])
  LDFLAGS=$SAVE_LDFLAGS
fi
AC_SUBST(XROOTD_CPPFLAGS)
AC_SUBST(XROOTD_LIBS)
fi

AC_LANG_RESTORE

# Setup conditionals
AM_CONDITIONAL([GLOBUSUTILS_ENABLED], test -n "$GLOBUS_COMMON_VERSION")
AM_CONDITIONAL([GRIDFTP_ENABLED], test -n "$GLOBUS_FTP_CLIENT_VERSION")
AM_CONDITIONAL([MOCK_DMC_ENABLED], test x$enables_mock_dmc = xyes)
AM_CONDITIONAL([LFC_ENABLED], test x$enables_lfc = xyes)
AM_CONDITIONAL([GFAL_ENABLED], test x$enables_gfal = xyes)
AM_CONDITIONAL([XROOTD_ENABLED], test x$enables_xrootd = xyes)
AM_CONDITIONAL([OPENSSL_PROXY_ENABLED], test x$OPENSSL_PROXY = xyes)
AM_CONDITIONAL([OPENSSL_X509_VERIFY_PARAM_ENABLED], test x$OPENSSL_X509_VERIFY_PARAM = xyes)
AM_CONDITIONAL([XMLSEC_ENABLED], test x$XMLSEC_INSTALLED = xyes)
AM_CONDITIONAL([CPPUNIT_ENABLED], test x$enables_cppunit = xyes)

enables_srm_dmc=no
if test "$enables_hed" = "yes"; then
  enables_srm_dmc=yes
fi

if test "$enables_giis_service" = "yes"; then
  if test "$enables_ldap_service" = "no"; then
    enables_ldap_service="yes"
  fi
fi

AM_CONDITIONAL([SRM_DMC_ENABLED],[test "x$enables_srm_dmc" = "xyes"])

enables_gsi_mcc=no
if test "$enables_hed" = "yes"; then
if test ! "x$GLOBUS_GSSAPI_GSI_VERSION" = 'x'; then
  enables_gsi_mcc=yes
fi
fi
AM_CONDITIONAL([GSI_MCC_ENABLED],[test "x$enables_gsi_mcc" = "xyes"])

# Setup defines
if test -n "$GLOBUS_COMMON_VERSION"; then
    AC_DEFINE(HAVE_GLOBUS,,[define if GLOBUS is available])
fi
if test x"$OPENSSL_PROXY" = xyes; then
    AC_DEFINE(HAVE_OPENSSL_PROXY,,[define if OPENSSL has PROXY capabilities])
fi
if test x"$OPENSSL_X509_VERIFY_PARAM" = xyes; then
    AC_DEFINE(HAVE_OPENSSL_X509_VERIFY_PARAM,,[define if OPENSSL has X509_VERIFY_PARAM structure])
fi
if test x"$OPENSSL_OLDRSA" = xyes; then
    AC_DEFINE(HAVE_OPENSSL_OLDRSA,,[define if OPENSSL has old RSA generation interface])
fi
if test x"$XMLSEC_INSTALLED" = xyes; then
    AC_DEFINE(HAVE_XMLSEC,,[define if XMLSEC package is available])
fi

# Setup messages for reporting
enables_gridftp=no
if test -n "$GLOBUS_FTP_CLIENT_VERSION" ; then enables_gridftp=yes; fi
enables_dbcxx=no
if test -n "$DBCXX_LIBS" ; then enables_dbcxx=yes; fi

# Check for LDAP

if test "$enables_hed" = "yes"; then
LDAP=no
AC_ARG_ENABLE(ldap, AC_HELP_STRING([--disable-ldap], [disable the LDAP support - requires OpenLDAP]),[enables_ldap="$enableval"],[])
if test "x$enables_ldap" = "xyes"; then
  AC_CHECK_HEADER(ldap.h, [
    LDAP=yes

    SAVE_LDFLAGS=$LDFLAGS

    case "${host}" in
      *-*-mingw32):
      ;;
      *):
        LDFLAGS=-lpthread
      ;;
    esac
    AC_CHECK_LIB([ldap_r], [ldap_first_message], [
      AC_CHECK_LIB([ldap_r], [ldap_initialize], [
        AC_DEFINE(HAVE_LDAP_INITIALIZE,[],[Define if you have ldap_initialize function])
      ])
      LDAP_LIBS=-lldap_r ], [
      AC_CHECK_LIB([ldap], [ldap_first_message], [
        AC_CHECK_LIB([ldap], [ldap_initialize], [ AC_DEFINE(HAVE_LDAP_INITIALIZE,[],[Define if you have ldap_initialize function])
      ])
      LDAP_LIBS=-lldap ], [
      LDAP=no
    ])
  ])
  AC_CHECK_LIB([lber], [ber_init], [LDAP_LIBS="$LDAP_LIBS -llber"], [])
  AC_SUBST(LDAP_LIBS)
  LDFLAGS=$SAVE_LDFLAGS
  ],

  [
    LDAP=no

    # Try native LDAP on Win32 if OpenLDAP fails
    case "${host}" in
      *-*-mingw32)
    AC_CHECK_HEADER([winldap.h],
    [
      AC_CHECK_LIB([wldap32], [ldap_init],
      [
        LDAP=yes
        LDAP_LIBS="-lwldap32"
        AC_DEFINE(USE_WIN32_LDAP_API,,[Define if using WIN32 LDAP API])
      ])
    ], [], [[#include <windows.h>]]) ;;
    esac

  ])

  enables_ldap="$LDAP"
fi
else
  enables_ldap="no"
fi
AM_CONDITIONAL([LDAP_ENABLED], test x$LDAP = xyes)
if test "x$LDAP" = "xyes"; then
  AC_DEFINE(HAVE_LDAP,[],[Define if OpenLDAP is available])
fi

# Check for the uuid lib
UUID_LIBS=""
if test "$enables_hed" = "yes"; then
AC_CHECK_HEADER(uuid/uuid.h, [
  AC_CHECK_FUNC([uuid_generate], [UUID_LIBS=], [
    AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS=-luuid], [
      AC_MSG_NOTICE([Can't find library containing uuid implementation])
    ])
  ])
], [AC_MSG_NOTICE([Can't find uuid header])])
AC_SUBST(UUID_LIBS)
LIBS="$LIBS $UUID_LIBS"
fi

# Check for dlopen
DLOPEN_LIBS=""
if test "$enables_hed" = "yes"; then
AC_CHECK_FUNC([dlopen], [DLOPEN_LIBS=], [
  AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS=-ldl], [
    AC_MSG_NOTICE([Can't find library containing dlopen implementation])
  ])
])
AC_SUBST(DLOPEN_LIBS)
fi

# check for fsusage
if test "$enables_hed" = "yes"; then
gl_FSUSAGE
fi


if test "$enables_hed" = "yes"; then

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h netdb.h netinet/in.h sasl.h sasl/sasl.h stdint.h stdlib.h string.h sys/file.h sys/socket.h sys/vfs.h unistd.h uuid/uuid.h getopt.h])
AC_CXX_HAVE_SSTREAM

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
# GNU compatible *ALLOC functions are available on Windows
# The test will however fail when cross-compiling with mingw
case "${host}" in
  *-*-mingw32) : ;;
            *)
AC_FUNC_MALLOC
AC_FUNC_REALLOC
;;
esac
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRERROR_R
AC_FUNC_STAT
AC_CHECK_FUNCS([acl dup2 floor ftruncate gethostname getdomainname getpid gmtime_r lchown localtime_r memchr memmove memset mkdir mkfifo regcomp rmdir select setenv socket strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull timegm tzset unsetenv getopt_long_only getgrouplist mkdtemp posix_fallocate readdir_r [mkstemp] mktemp])
AC_CHECK_LIB([resolv], [res_query], [LIBRESOLV=-lresolv], [LIBRESOLV=])
AC_CHECK_LIB([resolv], [__dn_skipname], [LIBRESOLV=-lresolv], [LIBRESOLV=])
AC_CHECK_LIB([nsl], [gethostbyname], [LIBRESOLV="$LIBRESOLV -lnsl"], [])
AC_CHECK_LIB([nsl], [getdomainname])
AC_SUBST(LIBRESOLV)

fi

# check for platfom specific extra libraries and flags

EXTRA_LIBS=""
REGEX_LIBS=""
SOCKET_LIBS=""
WIN32=""
case "${host}" in
  *-*-mingw32)
    WIN32="yes"
    REGEX_LIBS="-lregex"
    SOCKET_LIBS="-lws2_32"
    EXTRA_LIBS="-lole32"
    # its required to libtool generate .dlls on win32 using mingw
    LDFLAGS="$LDFLAGS -no-undefined"
    AC_DEFINE(HAVE_GETDOMAINNAME,,[windows has gethostname method])
    AC_CHECK_PROGS(WINDRES, windres.exe ${host}-windres)
    ;;
  *solaris*)
    SOCKET_LIBS="-lsocket"
    CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
    CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
    ;;
  *)
    AC_DEFINE(HAVE_GETDOMAINNAME,,[let's suppose the unix-alike (except solaris) has gethostname method])
    ;;
esac
AC_SUBST(EXTRA_LIBS)
AC_SUBST(REGEX_LIBS)
AC_SUBST(SOCKET_LIBS)
AM_CONDITIONAL([WIN32], [ test "x$WIN32" = "xyes" ])

case " $LDFLAGS " in
     " -Wl,--no-undefined ") ;;
     " -Wl,-no-undefined ") ;;
     " -Wl,-z -Wl,defs ") ;;
     " -Wl,-z,defs ") ;;
     *)
        case "${host}" in
            *darwin*);;
            *solaris*);;
            *) LDFLAGS="$LDFLAGS -Wl,--no-undefined" ;;
        esac
        ;;
esac

AC_CHECK_PROGS(PDFLATEX, pdflatex)
AC_CHECK_PROGS(DOXYGEN, doxygen)
AC_CHECK_PROGS(DOT, dot)

# Check if user asks to skip documentation build
AC_ARG_ENABLE(doc, AC_HELP_STRING([--disable-doc], [disable building documentation (requires doxygen and pdflatex)]),[enables_doc=$enableval],[])
#if test "x$enables_doc" = "xyes"; then
#  There is no point disabling docs due to missing tools since the pdf
#  files are both in svn and in the dist tarball
#  if test "x$PDFLATEX" = "x"; then
#    enables_doc="no"
#    AC_MSG_NOTICE([WARNING: Missing pdflatex - documentation won't be built])
#  elif test "x$DOXYGEN" = "x"; then
#    enables_doc="no"
#    AC_MSG_NOTICE([WARNING: Missing doxygen - documentation won't be built])
#  elif test "x$DOT" = "x"; then
#    enables_doc="no"
#    AC_MSG_NOTICE([WARNING: Missing dot - documentation won't be built])
#  fi
#fi
AC_MSG_NOTICE([Documentation enabled: $enables_doc])
AM_CONDITIONAL([DOC_ENABLED],[test "x$enables_doc" = "xyes"])

AM_CONDITIONAL([PYDOXYGEN],[test -f python/python/arc/index.xml -o "x$DOXYGEN" != "x"])
AM_CONDITIONAL([ALTPYDOXYGEN],[test -f python/altpython/arc/index.xml -o "x$DOXYGEN" != "x"])

# Check for explicitely and implicitely disabled services
if test "x$WIN32" = "xyes" ; then
  AC_MSG_NOTICE([In WIN32 environment many (all) services are not supported yet])
fi
# A-Rex
AC_ARG_ENABLE(a_rex_service, AC_HELP_STRING([--disable-a-rex-service], [disable building A-Rex service]),
  [enables_a_rex_service=$enableval],[])
if test "$enables_a_rex_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    AC_MSG_NOTICE([A-Rex can't be built for WIN32 environment - disabling])
    enables_a_rex_service="no"
  elif test "x$DBCXX_LIBS" = "x" ; then
    AC_MSG_NOTICE([A-Rex can't be built without C++ API for DB4.x - disabling])
    enables_a_rex_service="no"
  fi
fi
AC_MSG_NOTICE([A-Rex service enabled: $enables_a_rex_service])
AM_CONDITIONAL([A_REX_SERVICE_ENABLED],[test "x$enables_a_rex_service" = "xyes"])

# Gridftpd
AC_ARG_ENABLE(gridftpd_service, AC_HELP_STRING([--disable-gridftpd-service], [disable building Gridftpd service]),
  [enables_gridftpd_service=$enableval],[])
if test "$enables_gridftpd_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    AC_MSG_NOTICE([Gridftpd can not be built for WIN32 environment - disabling])
    enables_gridftpd_service="no"
  fi
  gridftpd_service_globus_pkgs="globus-common globus-io globus-gsi-credential globus-openssl-module globus-ftp-control"
  gridftpd_service_globus_pkgs_missing=""
  for pkg in $gridftpd_service_globus_pkgs
  do
      var=`echo '$'$pkg|tr '[\-a-z]' '[_A-Z]'|sed 's/$/_VERSION/'`
      if test -z "`eval echo $var`"
      then
        gridftpd_service_globus_pkgs_missing="$gridftpd_service_globus_pkgs_missing $pkg"
      fi
  done


  if test -n "$gridftpd_service_globus_pkgs_missing" ; then
    AC_MSG_NOTICE([GridFTP service can not be built (missing development packages for$gridftpd_service_globus_pkgs_missing) - disabling])
    enables_gridftpd_service="no"
  fi

  #check for struct statfs
  AC_CHECK_FUNCS([fstatfs])
  AC_CHECK_HEADERS([sys/param.h sys/statfs.h sys/mount.h sys/vfs.h])dnl
  AC_CHECK_MEMBERS([struct statfs.f_type],,,
    [$ac_includes_default
     #if HAVE_SYS_STATFS_H
     #include <sys/statfs.h>
     #endif
     #if HAVE_SYS_MOUNT_H
     #include <sys/mount.h>
     #endif
     #if HAVE_SYS_VFS_H
     #include <sys/vfs.h>
     #endif])
fi
AC_MSG_NOTICE([Gridftpd service enabled: $enables_gridftpd_service])
AM_CONDITIONAL([GRIDFTPD_SERVICE_ENABLED],[test "x$enables_gridftpd_service" = "xyes"])

# LDAP service
AC_ARG_ENABLE(ldap_service, AC_HELP_STRING([--disable-ldap-service], [disable building LDAP Infosystem Service]),
  [enables_ldap_service=$enableval],[])
if test "$enables_ldap_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    AC_MSG_NOTICE([LDAP infosystem can't be built for WIN32 environment - disabling])
    enables_ldap_service="no"
  fi
fi

AC_MSG_NOTICE([LDAP Infosystem service enabled: $enables_ldap_service])
AM_CONDITIONAL([LDAP_SERVICE_ENABLED],[test "x$enables_ldap_service" = "xyes"])

# GIIS service
AC_ARG_ENABLE(giis_service, AC_HELP_STRING([--disable-giis-service], [disable building GIIS Service]),
  [enables_giis_service=$enableval],[])
if test "$enables_giis_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    AC_MSG_NOTICE([GIIS can't be built for WIN32 environment - disabling])
    enables_giis_service="no"
  fi
  AC_CHECK_HEADERS(lber.h, [],[enables_giis_service=no])
  AC_CHECK_HEADERS(ldap_features.h, [],[enables_giis_service=no])
fi
if test "$enables_ldap_service" = "no"; then
  if test "$enables_giis_service" = "yes"; then
    enables_giis_service="no"
    AC_MSG_NOTICE([WARNING: GIIS service can't be enabled without LDAP Infosys, disabling GIIS])
  fi
fi
AC_MSG_NOTICE([GIIS service enabled: $enables_giis_service])
AM_CONDITIONAL([GIIS_SERVICE_ENABLED],[test "x$enables_giis_service" = "xyes"])

# LDAP monitor
AC_ARG_ENABLE(ldap_monitor, AC_HELP_STRING([--disable-ldap-monitor], [disable building LDAP Monitor]),
  [enables_ldap_monitor=$enableval],[])

AC_MSG_NOTICE([LDAP Monitor enabled: $enables_ldap_monitor])
AM_CONDITIONAL([LDAP_MONITOR_ENABLED],[test "x$enables_ldap_monitor" = "xyes"])

# WS monitor
AC_ARG_ENABLE(ws_monitor, AC_HELP_STRING([--disable-ws-monitor], [disable building WS Monitor]),
  [enables_ws_monitor=$enableval],[])

AC_MSG_NOTICE([WS Monitor enabled: $enables_ws_monitor])
AM_CONDITIONAL([WS_MONITOR_ENABLED],[test "x$enables_ws_monitor" = "xyes"])

# Cache service
AC_ARG_ENABLE(cache_service, AC_HELP_STRING([--disable-cache-service], [disable building cache service]),
  [enables_cache_service=$enableval],[])
if test "$enables_cache_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    enables_cache_service="no"
    AC_MSG_NOTICE([Cache service can't be built for WIN32 environment - disabling])
  elif test ! "x$enables_a_rex_service" = "xyes" ; then
    enables_cache_service="no"
    AC_MSG_NOTICE([Cache service can't be built without A-REX - disabling])
  fi
fi
AC_MSG_NOTICE([Cache service enabled: $enables_cache_service])
AM_CONDITIONAL([CACHE_SERVICE_ENABLED],[test "x$enables_cache_service" = "xyes"])
AM_CONDITIONAL([CACHE_WEBSERVICE_ENABLED],[test "x$enables_cache_service" = "xyes"])

# DataDelivery service
AC_ARG_ENABLE(datadelivery_service, AC_HELP_STRING([--disable-datadelivery-service], [disable building DataDelivery service]),
  [enables_datadelivery_service=$enableval],[])
if test "$enables_datadelivery_service" = "yes"; then
  if test "x$WIN32" = "xyes" ; then
    enables_datadelivery_service="no"
    AC_MSG_NOTICE([DataDelivery service can't be built for WIN32 environment - disabling])
  fi
fi
AC_MSG_NOTICE([DataDelivery service enabled: $enables_datadelivery_service])
AM_CONDITIONAL([DATADELIVERY_SERVICE_ENABLED],[test "x$enables_datadelivery_service" = "xyes"])

# ACIX service
AC_ARG_ENABLE(acix, AC_HELP_STRING([--disable-acix], [disable building ACIX service]),
  [enables_acix=$enableval],[])
dnl AM_PATH_PYTHON([2.4], [], [enables_acix="no"])
if test "x$PYTHON_VERSION" = "x2.2" -o "x$PYTHON_VERSION" = "x2.3"
then
  enables_acix="no"
fi
AC_MSG_NOTICE([ACIX enabled: $enables_acix])
AM_CONDITIONAL([ACIX_ENABLED],[test "x$enables_acix" = "xyes"])

# trial command (from python-twisted-core) is used for acix unittests
AC_CHECK_PROGS(TRIAL, trial)
if test "x$TRIAL" = "x"; then
  AC_MSG_NOTICE([trial not found - ACIX unit tests will be skipped])
fi
# unit tests also require python >=2.6
AM_CONDITIONAL([ACIX_TESTS_ENABLED], [test "x$TRIAL" != "x" && test "x$PYTHON_VERSION" != "x2.4" && test "x$PYTHON_VERSION" != "x2.5"])

# Check for explicitely and implicitely disabled clients
AC_ARG_ENABLE(compute_client, AC_HELP_STRING([--disable-compute-client], [disable building compute (job management) client tools]),
  [enables_compute_client=$enableval],[])
AC_MSG_NOTICE([Compute client tools enabled: $enables_compute_client])
AM_CONDITIONAL([COMPUTE_CLIENT_ENABLED],[test "x$enables_compute_client" = "xyes"])

AC_ARG_ENABLE(credentials_client, AC_HELP_STRING([--disable-credentials-client], [disable building client tools for handling X.509 credentials]),
  [enables_credentials_client=$enableval],[])
AC_MSG_NOTICE([Credentials client tools enabled: $enables_credentials_client])
AM_CONDITIONAL([CREDENTIALS_CLIENT_ENABLED],[test "x$enables_credentials_client" = "xyes"])

AC_ARG_ENABLE(echo_client, AC_HELP_STRING([--disable-echo-client], [disable building client tools for communicationg with Echo service]),
  [enables_echo_client=$enableval],[])
AC_MSG_NOTICE([Echo client tool enabled: $enables_echo_client])
AM_CONDITIONAL([ECHO_CLIENT_ENABLED],[test "x$enables_echo_client" = "xyes"])

AC_ARG_ENABLE(data_client, AC_HELP_STRING([--disable-data-client], [disable building generic client tools for handling data]),
  [enables_data_client=$enableval],[])
AC_MSG_NOTICE([Data client tools enabled: $enables_data_client])
AM_CONDITIONAL([DATA_CLIENT_ENABLED],[test "x$enables_data_client" = "xyes"])

AC_ARG_ENABLE(jura_client, AC_HELP_STRING([--disable-jura-client], [disable building client tool for communicating JURA]),
  [enables_jura_client=$enableval],[])
AC_MSG_NOTICE([JURA client tool enabled: $enables_jura_client])
AM_CONDITIONAL([JURA_CLIENT_ENABLED],[test "x$enables_jura_client" = "xyes"])

AC_ARG_ENABLE(saml_client, AC_HELP_STRING([--disable-saml-client], [disable building client tool for communicating SAML-based VOMS service]),
  [enables_saml_client=$enableval],[])
if test "$enables_saml_client" = "yes"; then
  if test "$enables_xmlsec1" != "yes" ; then
    enables_saml_client="no"
    AC_MSG_NOTICE([SAML client requires xmlsec1 - disabling])
  fi
fi
AC_MSG_NOTICE([SAML client tool enabled: $enables_saml_client])
AM_CONDITIONAL([SAML_CLIENT_ENABLED],[test "x$enables_saml_client" = "xyes"])

AC_ARG_ENABLE(wsrf_client, AC_HELP_STRING([--disable-wsrf-client], [disable building client tools for querying WSRF-enabled services.]),
  [enables_wsrf_client=$enableval],[])
AC_MSG_NOTICE([WSRF client tool enabled: $enables_wsrf_client])
AM_CONDITIONAL([WSRF_CLIENT_ENABLED],[test "x$enables_wsrf_client" = "xyes"])

AC_ARG_ENABLE(unicore_client, AC_HELP_STRING([--enable-unicore-client], [enables building UNICORE-related plugins.]),
  [enables_unicore_client=$enableval],[])
AC_MSG_NOTICE([UNICORE plugin(s) enabled: $enables_unicore_client])
AM_CONDITIONAL([UNICORE_ENABLED],[test "x$enables_unicore_client" = "xyes"])

AC_ARG_ENABLE(emies_client, AC_HELP_STRING([--disable-emies-client], [disables building EMI ES-related client plugins.]),
  [enables_emies_client=$enableval],[])
AC_MSG_NOTICE([EMI ES plugin(s) enabled: $enables_emies_client])
AM_CONDITIONAL([EMIES_ENABLED],[test "x$enables_emies_client" = "xyes"])


# Check for consistency among disabled components
if test "$enables_hed" = "no"; then
  if test "$enables_a_rex_service" = "yes" -o \
          "$enables_cache_service" = "yes" -o \
          "$enables_datadelivery_service" = "yes" -o \
          "$enables_compute_client" = "yes" -o \
          "$enables_credentials_client" = "yes" -o \
          "$enables_echo_client" = "yes" -o \
          "$enables_data_client" = "yes" -o \
          "$enables_jura_client" = "yes" -o \
          "$enables_saml_client" = "yes" -o \
          "$enables_wsrf_client" = "yes" -o \
          ; then
    AC_MSG_ERROR(HED is needed for building any of the client or service tools. Please enable HED by using --enable-hed.)
  fi
fi
AM_CONDITIONAL([HED_ENABLED],[test "x$enables_hed" = "xyes"])

# A-Rex specific hack for backend scripts

pbs_bin_path=/usr/bin
pbs_log_path=/var/spool/pbs/server_logs
tmp_dir=/tmp
gnu_time=/usr/bin/time

case "${host}" in
    *solaris* | *darwin* )
        # hostname -f does not work on Solaris, OS X
        nodename="hostname" ;;
    *)
        nodename="/bin/hostname -f" ;;
esac

arc_location=$prefix

AC_SUBST(arc_location)
AC_SUBST(pbs_bin_path)
AC_SUBST(pbs_log_path)
AC_SUBST(tmp_dir)
AC_SUBST(gnu_time)
AC_SUBST(nodename)

# Shell for the job control scripts

case $host_os in

  solaris* )
      posix_shell='/usr/xpg4/bin/sh'
      ;;
  * )
      posix_shell='/bin/sh'
      ;;
esac

AC_SUBST(posix_shell)

DATE=`date +%Y-%m-%d`
AC_SUBST(DATE)
#DATER=`date -R`
DATER=`date +'%a, %d %b %Y %H:%M:%S %z'`
AC_SUBST(DATER)
SPECDATE=`LANG=C date +"%a %b %d %Y"`
AC_SUBST(SPECDATE)

AH_BOTTOM([#ifdef WIN32
#include <arc/win32.h>
#endif])

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/external/Makefile
                 src/external/cJSON/Makefile
                 src/hed/Makefile
                 src/hed/libs/compute/Makefile
                 src/hed/libs/compute/test/Makefile
                 src/hed/libs/compute/examples/Makefile
                 src/hed/libs/common/Makefile
                 src/hed/libs/common/test/Makefile
                 src/hed/libs/communication/Makefile
                 src/hed/libs/credential/Makefile
                 src/hed/libs/credential/test/Makefile
                 src/hed/libs/credentialmod/Makefile
                 src/hed/libs/crypto/Makefile
                 src/hed/libs/cryptomod/Makefile
                 src/hed/libs/data/Makefile
                 src/hed/libs/data/cache-clean
                 src/hed/libs/data/cache-clean.1
                 src/hed/libs/data/cache-list
                 src/hed/libs/data/cache-list.1
                 src/hed/libs/data/test/Makefile
                 src/hed/libs/data/examples/Makefile
                 src/hed/libs/Makefile
                 src/hed/libs/loader/Makefile
                 src/hed/libs/loader/schema/Makefile
                 src/hed/libs/loader/test/Makefile
                 src/hed/libs/message/Makefile
                 src/hed/libs/message/test/Makefile
                 src/hed/libs/security/Makefile
                 src/hed/libs/security/ArcPDP/Makefile
                 src/hed/libs/security/ArcPDP/attr/Makefile
                 src/hed/libs/security/ArcPDP/policy/Makefile
                 src/hed/libs/security/ArcPDP/alg/Makefile
                 src/hed/libs/security/ArcPDP/fn/Makefile
                 src/hed/libs/credentialstore/Makefile
                 src/hed/libs/wsrf/Makefile
                 src/hed/libs/ws-addressing/Makefile
                 src/hed/libs/ws-security/Makefile
                 src/hed/libs/ws-security/test/Makefile
                 src/hed/libs/infosys/Makefile
                 src/hed/libs/infosys/schema/Makefile
                 src/hed/libs/infosys/test/Makefile
                 src/hed/libs/delegation/Makefile
                 src/hed/libs/delegation/test/Makefile
                 src/hed/libs/ws/Makefile
                 src/hed/libs/xmlsec/Makefile
                 src/hed/libs/globusutils/Makefile
                 src/hed/daemon/Makefile
                 src/hed/daemon/scripts/Makefile
                 src/hed/daemon/schema/Makefile
                 src/hed/daemon/unix/Makefile
                 src/hed/daemon/win32/Makefile
                 src/hed/mcc/Makefile
                 src/hed/mcc/soap/Makefile
                 src/hed/mcc/tcp/Makefile
                 src/hed/mcc/tcp/schema/Makefile
                 src/hed/mcc/http/Makefile
                 src/hed/mcc/http/schema/Makefile
                 src/hed/mcc/tls/Makefile
                 src/hed/mcc/tls/schema/Makefile
                 src/hed/mcc/gsi/Makefile
                 src/hed/mcc/gsi/schema/Makefile
                 src/hed/mcc/msgvalidator/Makefile
                 src/hed/mcc/msgvalidator/schema/Makefile
                 src/hed/acc/Makefile
                 src/hed/acc/ARC0/Makefile
                 src/hed/acc/ARC1/Makefile
                 src/hed/acc/ARC1/test/Makefile
                 src/hed/acc/EMIES/Makefile
                 src/hed/acc/EMIES/arcemiestest.1
                 src/hed/acc/EMIES/schema/Makefile
                 src/hed/acc/CREAM/Makefile
                 src/hed/acc/UNICORE/Makefile
                 src/hed/acc/Broker/Makefile
                 src/hed/acc/Broker/test/Makefile
                 src/hed/acc/PythonBroker/Makefile
                 src/hed/acc/JobDescriptionParser/Makefile
                 src/hed/acc/JobDescriptionParser/test/Makefile
                 src/hed/acc/SER/Makefile
                 src/hed/acc/ldap/Makefile
                 src/hed/acc/TEST/Makefile
                 src/hed/dmc/Makefile
                 src/hed/dmc/file/Makefile
                 src/hed/dmc/gridftp/Makefile
                 src/hed/dmc/http/Makefile
                 src/hed/dmc/ldap/Makefile
                 src/hed/dmc/srm/Makefile
                 src/hed/dmc/srm/srmclient/Makefile
                 src/hed/dmc/lfc/Makefile
                 src/hed/dmc/gfal/Makefile
                 src/hed/dmc/xrootd/Makefile
                 src/hed/dmc/mock/Makefile
                 src/hed/dmc/dq2/Makefile
                 src/hed/dmc/acix/Makefile
                 src/hed/dmc/rucio/Makefile
                 src/hed/profiles/general/general.xml
                 src/hed/shc/Makefile
                 src/hed/shc/arcpdp/Makefile
                 src/hed/shc/arcpdp/schema/Makefile
                 src/hed/shc/xacmlpdp/Makefile
                 src/hed/shc/xacmlpdp/schema/Makefile
                 src/hed/shc/delegationpdp/Makefile
                 src/hed/shc/delegationpdp/schema/Makefile
                 src/hed/shc/gaclpdp/Makefile
                 src/hed/shc/pdpserviceinvoker/Makefile
                 src/hed/shc/pdpserviceinvoker/schema/Makefile
                 src/hed/shc/allowpdp/Makefile
                 src/hed/shc/denypdp/Makefile
                 src/hed/shc/simplelistpdp/Makefile
                 src/hed/shc/simplelistpdp/schema/Makefile
                 src/hed/shc/arcauthzsh/Makefile
                 src/hed/shc/arcauthzsh/schema/Makefile
                 src/hed/shc/usernametokensh/Makefile
                 src/hed/shc/usernametokensh/schema/Makefile
                 src/hed/shc/x509tokensh/Makefile
                 src/hed/shc/x509tokensh/schema/Makefile
                 src/hed/shc/samltokensh/Makefile
                 src/hed/shc/samltokensh/schema/Makefile
                 src/hed/shc/saml2sso_assertionconsumersh/Makefile
                 src/hed/shc/delegationsh/Makefile
                 src/hed/shc/delegationsh/schema/Makefile
                 src/hed/shc/legacy/Makefile
                 src/hed/shc/legacy/schema/Makefile
                 src/hed/identitymap/Makefile
                 src/hed/identitymap/schema/Makefile
                 src/libs/Makefile
                 src/libs/data-staging/Makefile
                 src/libs/data-staging/test/Makefile
                 src/libs/data-staging/examples/Makefile
                 src/services/Makefile
                 src/services/a-rex/Makefile
                 src/services/a-rex/a-rex
                 src/services/a-rex/grid-manager/arc-vomsac-check.8
                 src/services/a-rex/grid-manager/arc-blahp-logger.8
                 src/services/a-rex/grid-manager/gm-jobs.8
                 src/services/a-rex/delegation/Makefile
                 src/services/a-rex/grid-manager/Makefile
                 src/services/a-rex/grid-manager/conf/Makefile
                 src/services/a-rex/grid-manager/files/Makefile
                 src/services/a-rex/grid-manager/jobs/Makefile
                 src/services/a-rex/grid-manager/jobplugin/Makefile
                 src/services/a-rex/grid-manager/loaders/Makefile
                 src/services/a-rex/grid-manager/log/Makefile
                 src/services/a-rex/grid-manager/mail/Makefile
                 src/services/a-rex/grid-manager/misc/Makefile
                 src/services/a-rex/grid-manager/run/Makefile
                 src/services/a-rex/grid-manager/arc-config-check.1
                 src/services/a-rex/infoproviders/Makefile
                 src/services/a-rex/infoproviders/CEinfo.pl
                 src/services/a-rex/infoproviders/se.pl
                 src/services/a-rex/infoproviders/test/Makefile
                 src/services/a-rex/jura/Makefile
                 src/services/a-rex/jura/jura.1
                 src/services/a-rex/jura/ssm/Makefile
                 src/services/a-rex/ldif/Makefile
                 src/services/a-rex/lrms/Makefile
                 src/services/a-rex/lrms/submit_common.sh
                 src/services/a-rex/lrms/scan_common.sh
                 src/services/a-rex/lrms/condor/Makefile
                 src/services/a-rex/lrms/condor/scan-condor-job
                 src/services/a-rex/lrms/condor/cancel-condor-job
                 src/services/a-rex/lrms/condor/submit-condor-job
                 src/services/a-rex/lrms/fork/Makefile
                 src/services/a-rex/lrms/fork/scan-fork-job
                 src/services/a-rex/lrms/fork/submit-fork-job
                 src/services/a-rex/lrms/fork/cancel-fork-job
                 src/services/a-rex/lrms/ll/Makefile
                 src/services/a-rex/lrms/ll/submit-ll-job
                 src/services/a-rex/lrms/ll/cancel-ll-job
                 src/services/a-rex/lrms/ll/scan-ll-job
                 src/services/a-rex/lrms/lsf/Makefile
                 src/services/a-rex/lrms/lsf/submit-lsf-job
                 src/services/a-rex/lrms/lsf/cancel-lsf-job
                 src/services/a-rex/lrms/lsf/scan-lsf-job
                 src/services/a-rex/lrms/pbs/Makefile
                 src/services/a-rex/lrms/pbs/submit-pbs-job
                 src/services/a-rex/lrms/pbs/cancel-pbs-job
                 src/services/a-rex/lrms/pbs/scan-pbs-job
                 src/services/a-rex/lrms/pbs/configure-pbs-env.sh
                 src/services/a-rex/lrms/sge/Makefile
                 src/services/a-rex/lrms/sge/submit-sge-job
                 src/services/a-rex/lrms/sge/scan-sge-job
                 src/services/a-rex/lrms/sge/cancel-sge-job
                 src/services/a-rex/lrms/slurm/Makefile
                 src/services/a-rex/lrms/slurm/submit-SLURM-job
                 src/services/a-rex/lrms/slurm/scan-SLURM-job
                 src/services/a-rex/lrms/slurm/cancel-SLURM-job
                 src/services/a-rex/lrms/dgbridge/Makefile
                 src/services/a-rex/lrms/dgbridge/submit-DGBridge-job
                 src/services/a-rex/lrms/dgbridge/scan-DGBridge-job
                 src/services/a-rex/lrms/dgbridge/cancel-DGBridge-job
                 src/services/a-rex/lrms/boinc/Makefile
                 src/services/a-rex/lrms/boinc/submit-boinc-job
                 src/services/a-rex/lrms/boinc/scan-boinc-job
                 src/services/a-rex/lrms/boinc/cancel-boinc-job
                 src/services/a-rex/urlogger/Makefile
                 src/services/a-rex/schema/Makefile
                 src/services/acix/Makefile
                 src/services/acix/cacheserver/Makefile
                 src/services/acix/cacheserver/test/Makefile
                 src/services/acix/core/Makefile
                 src/services/acix/core/test/Makefile
                 src/services/acix/indexserver/Makefile
                 src/services/acix/indexserver/test/Makefile
                 src/services/cache_service/Makefile
                 src/services/cache_service/arc-cache-service
                 src/services/data-staging/Makefile
                 src/services/data-staging/arc-datadelivery-service
                 src/services/gridftpd/Makefile
                 src/services/gridftpd/gridftpd.init
                 src/services/gridftpd/gridftpd.8
                 src/services/gridftpd/auth/Makefile
                 src/services/gridftpd/conf/Makefile
                 src/services/gridftpd/external/Makefile
                 src/services/gridftpd/external/gacl/Makefile
                 src/services/gridftpd/misc/Makefile
                 src/services/gridftpd/run/Makefile
                 src/services/gridftpd/fileplugin/Makefile
                 src/services/gridftpd/gaclplugin/Makefile
                 src/services/ldap-infosys/Makefile
                 src/services/ldap-infosys/create-bdii-config
                 src/services/ldap-infosys/create-inforeg-config
                 src/services/ldap-infosys/create-slapd-config
                 src/services/ldap-infosys/nordugrid-arc-bdii
                 src/services/ldap-infosys/nordugrid-arc-egiis
                 src/services/ldap-infosys/nordugrid-arc-inforeg
                 src/services/ldap-infosys/nordugrid-arc-ldap-infosys
                 src/services/ldap-infosys/nordugrid-arc-slapd
                 src/services/ldap-infosys/giis/Makefile
                 src/services/ldap-infosys/giis/arc-infoindex-relay.8
                 src/services/ldap-infosys/giis/arc-infoindex-server.8
                 src/services/ldap-monitor/Makefile
                 src/services/ldap-monitor/ldap-monitor
                 src/services/ldap-monitor/README
                 src/services/ldap-monitor/man/Makefile
                 src/services/ldap-monitor/man/ldap-monitor.7
                 src/services/ldap-monitor/includes/Makefile
                 src/services/ldap-monitor/mon-icons/Makefile
                 src/services/ldap-monitor/lang/Makefile
                 src/services/ws-monitor/Makefile
                 src/services/ws-monitor/ws-monitor
                 src/services/ws-monitor/README
                 src/services/ws-monitor/man/Makefile
                 src/services/ws-monitor/man/ws-monitor.7
                 src/services/ws-monitor/includes/Makefile
                 src/services/ws-monitor/mon-icons/Makefile
                 src/services/ws-monitor/lang/Makefile
                 src/services/echo_java/Makefile
                 src/services/echo_python/Makefile
                 src/services/wrappers/Makefile
                 src/services/wrappers/java/Makefile
                 src/services/wrappers/java/schema/Makefile
                 src/services/wrappers/python/Makefile
                 src/services/wrappers/python/schema/Makefile
                 src/clients/Makefile
                 src/clients/data/Makefile
                 src/clients/data/arccp.1
                 src/clients/data/arcls.1
                 src/clients/data/arcrm.1
                 src/clients/data/arcmkdir.1
                 src/clients/data/arcrename.1
                 src/clients/echo/Makefile
                 src/clients/echo/arcecho.1
                 src/clients/credentials/Makefile
                 src/clients/credentials/arcproxy.1
                 src/clients/credentials/arcslcs.1
                 src/clients/saml/Makefile
                 src/clients/saml/saml_assertion_init.1
                 src/clients/compute/Makefile
                 src/clients/compute/arcstat.1
                 src/clients/compute/arcinfo.1
                 src/clients/compute/arcsub.1
                 src/clients/compute/arcclean.1
                 src/clients/compute/arckill.1
                 src/clients/compute/arcget.1
                 src/clients/compute/arccat.1
                 src/clients/compute/arcresub.1
                 src/clients/compute/arcmigrate.1
                 src/clients/compute/arcsync.1
                 src/clients/compute/arcrenew.1
                 src/clients/compute/arcresume.1
                 src/clients/compute/arcacl.1
                 src/clients/compute/arctest.1
                 src/clients/wsrf/arcwsrf.1
                 src/clients/wsrf/Makefile
                 src/tests/Makefile
                 src/tests/echo/Makefile
                 src/tests/echo/perftest.1
                 src/tests/echo/echo_service.xml.example
                 src/tests/echo/schema/Makefile
                 src/tests/policy-delegation/Makefile
                 src/tests/delegation/Makefile
                 src/tests/translator/Makefile
                 src/tests/xpath/Makefile
                 src/tests/arcpolicy/Makefile
                 src/tests/perf/Makefile
                 src/tests/perf/arcperftest.1
                 src/tests/client/Makefile
                 src/utils/hed/wsdl2hed.1
                 src/utils/hed/arcplugin.1
                 src/utils/hed/Makefile
                 src/utils/gridmap/nordugridmap.cron
                 src/utils/gridmap/nordugridmap.8
                 src/utils/gridmap/Makefile
                 src/utils/Makefile
                 src/doc/Makefile
                 src/doc/arc.conf.5
                 swig/Makefile
                 java/Makefile
                 java/test/Makefile
                 java/test/strip_test_file_name_and_run_junit
                 java/examples/Makefile
                 python/Makefile
                 python/Doxyfile.api
                 python/python/Makefile
                 python/python/arc/Makefile
                 python/altpython/Makefile
                 python/altpython/arc/Makefile
                 python/test/Makefile
                 python/test/python/Makefile
                 python/test/altpython/Makefile
                 python/examples/Makefile
                 po/Makefile.in
                 include/Makefile
                 debian/Makefile
                 debian/changelog.deb
                 nordugrid-arc.spec
                 mingw-nordugrid-arc.spec
                 src/hed/daemon/arched.8
                 src/hed/daemon/scripts/arched
                 arcbase.pc
                 nsis/Makefile
                 nsis/arc.nsis
                 src/doxygen/Makefile
])
AC_OUTPUT

AC_MSG_RESULT([
Unit testing:       ${enables_cppunit}
Java binding:       ${enables_swig_java}
Python binding:     ${enables_swig_python} ($PYTHON_VERSION)
Alt.Python binding: ${enables_altpython} ($ALTPYTHON_VERSION)

Available third-party features:

GridFTP:            ${enables_gridftp}
LFC:                ${enables_lfc}
GFAL:               ${enables_gfal}
Xrootd:             ${enables_xrootd}
MYSQL CLIENT LIB:   ${enables_mysql}
LDAP:               ${enables_ldap}
xmlsec1:            ${enables_xmlsec1}
ARGUS:              ${enables_argus}
GACL:               ${enables_gacl}
NSS:                ${enables_nss}
CANL++:             ${enables_canlxx}
BDB C++:            ${enables_dbcxx}

Enabled features:

Local jobs info in BDB: ${enables_dbjstore}

Included components:
HED:                ${enables_hed}

A-REX service:      ${enables_a_rex_service}
GRIDFTPD service:   ${enables_gridftpd_service}
LDAP Info service:  ${enables_ldap_service}
GIIS service:       ${enables_giis_service}
CACHE service:      ${enables_cache_service}
DATADELIVERY service: ${enables_datadelivery_service}
ACIX service:       ${enables_acix}

COMPUTE clients:    ${enables_compute_client}
DATA clients:       ${enables_data_client}
CREDENTIAL clients: ${enables_credentials_client}
ECHO client:        ${enables_echo_client}
JURA client:        ${enables_jura_client}
SAML VOMS client:   ${enables_saml_client}
WSRF client:        ${enables_wsrf_client}

UNICORE client (ACC): ${enables_unicore_client}
EMI ES client (ACC): ${enables_emies_client}
SRM client (DMC):   ${enables_srm_dmc}
GSI channel (MCC):  ${enables_gsi_mcc}

Documentation:      ${enables_doc}

Monitoring:
LDAP Monitor        ${enables_ldap_monitor}
WS Monitor          ${enables_ws_monitor}
])

if test "$enables_hed" = "yes"; then
if test ! "X$OPENSSL_PROXY" = "Xyes"; then
AC_MSG_RESULT([

OpenSSL contains no support for proxy credentials.
You will have to use certificate/private key pairs directly.
Make sure private keys are not protected by password before
using them.
It is advisable to update OpenSSL version to at least 0.9.7g
to avoid this situation.

])
fi
fi