File: CMakeLists.txt

package info (click to toggle)
adios 1.13.1-16
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 23,248 kB
  • sloc: ansic: 133,236; f90: 8,791; sh: 7,806; python: 7,480; xml: 3,793; makefile: 3,002; cpp: 2,340; java: 626; sed: 16; perl: 8
file content (2548 lines) | stat: -rw-r--r-- 90,278 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
cmake_minimum_required(VERSION 2.8.0)

#move here bedore project, otherwise SET(CMAKE_INSTALL_PREFIX < install_path>) will not work
if(NOT CMAKE_INSTALL_PREFIX)
  # if CMAKE_INSTALL_PREFIX isn't set, try to get it from the INSTALL_PREFIX environment variable
  set(CMAKE_INSTALL_PREFIX $ENV{INSTALL_PREFIX} CACHE PATH "Prefix prepended to install directories" FORCE)
endif()

project(ADIOS_PROJECT)

SET_PROPERTY(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)

#set(LANGUAGE "" CACHE FILEPATH "")  #C/CXX/Fortran

#enable_language(${LANGUAGE})
#message(STATUS "CMAKE_${LANGUAGE}_COMPILER_WORKS = ${CMAKE_${LANGUAGE}_COMPILER_WORKS}")

include_directories(${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_BINARY_DIR})
#message("${PROJECT_SOURCE_DIR}")

#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})

#if(NOT CMAKE_INSTALL_PREFIX)
#  set(CMAKE_INSTALL_PREFIX $ENV{INSTALL_PREFIX} CACHE PATH "Prefix prepended to install directories" FORCE)
#endif()

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix})
set(bindir ${exec_prefix}/bin)
#set(datadir ${prefix}/share)
set(libdir ${exec_prefix}/lib)
set(includedir ${prefix}/include)
set(sysconfdir ${prefix}/etc)

#set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
find_package(PythonInterp)
#message(STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}")
#message(STATUS "PYTHONINTERP_FOUND = ${PYTHONINTERP_FOUND}")
#message(STATUS "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}")
#message(STATUS "PYTHON_VERSION_MAJOR = ${PYTHON_VERSION_MAJOR}")
if (NOT PYTHONINTERP_FOUND OR NOT ${PYTHON_VERSION_MAJOR} GREATER 1)
    message(FATAL_ERROR "Python 2.x or 3.x is required to build ADIOS.")
else()
    message(STATUS "Python ${PYTHON_VERSION_STRING} will be used in building ADIOS")
endif()



if(DEFINED ENV{MACRODEFFLAG})
  set(MACRODEFFLAG $ENV{MACRODEFFLAG})
else()
  set(MACRODEFFLAG "-D")
endif()
message(STATUS "MACRODEFFLAG = ${MACRODEFFLAG}")

set(LIBS "")
set(CPPFLAGS "$ENV{CPPFLAGS}")
set(CFLAGS "$ENV{CFLAGS}")
if(DEFINED ENV{EXTRA_CFLAGS})
    set(EXTRA_CFLAGS "$ENV{EXTRA_CFLAGS}")
endif()
if(DEFINED ENV{EXTRA_LIBS})
    set(EXTRA_LIBS "$ENV{EXTRA_LIBS}")
endif()
######## file moved from initial_cache.cmake to indicate external library is used(ON) or not (OFF)######
if(DEFINED ENV{BUILD_WRITE})
  if("$ENV{BUILD_WRITE}" STREQUAL "")
    set(BUILD_WRITE ON CACHE BOOL "")
  else()
    set(BUILD_WRITE $ENV{BUILD_WRITE})
  endif()
  if(BUILD_WRITE)
    set(BUILD_WRITE ON CACHE BOOL "")
  else()
    set(BUILD_WRITE OFF CACHE BOOL "")
  endif()
else()
  set(BUILD_WRITE ON CACHE BOOL "")
endif()

if(DEFINED ENV{BUILD_FORTRAN})
  if("$ENV{BUILD_FORTRAN}" STREQUAL "")
    set(BUILD_FORTRAN ON CACHE BOOL "")
  else()
    set(BUILD_FORTRAN $ENV{BUILD_FORTRAN})
  endif()
  if(BUILD_FORTRAN)
    set(BUILD_FORTRAN ON CACHE BOOL "")
  else()
    set(BUILD_FORTRAN OFF CACHE BOOL "")
  endif()
else()
  set(BUILD_FORTRAN ON CACHE BOOL "")
endif()

if(DEFINED ENV{adios_timers})
  if("$ENV{adios_timers}" STREQUAL "")
    set(ADIOS_TIMERS 0)
  elseif("$ENV{adios_timers}" STREQUAL "ON")
    set(ADIOS_TIMERS 1)
  elseif("$ENV{adios_timers}" STREQUAL "on")
    set(ADIOS_TIMERS 1)
  elseif("$ENV{adios_timers}" STREQUAL "OFF")
    set(ADIOS_TIMERS 0)
  elseif("$ENV{adios_timers}" STREQUAL "off")
    set(ADIOS_TIMERS 0)
  else()
    set(ADIOS_TIMERS 0)
  endif()
  if(ADIOS_TIMERS)
    set(SKEL_HAVE_ADIOS_TIMING True)
  else()
    set(SKEL_HAVE_ADIOS_TIMING False)
  endif()
else()
  # default is on if not specified
  set(ADIOS_TIMERS 1)
  set(SKEL_HAVE_ADIOS_TIMING True)
endif()

if(DEFINED ENV{adios_timer_events})
  if("$ENV{adios_timer_events}" STREQUAL "")
    set(ADIOS_TIMER_EVENTS 0)
  elseif("$ENV{adios_timer_events}" STREQUAL "ON")
    set(ADIOS_TIMER_EVENTS 1)
  elseif("$ENV{adios_timer_events}" STREQUAL "on")
    set(ADIOS_TIMER_EVENTS 1)
  elseif("$ENV{adios_timer_events}" STREQUAL "OFF")
    set(ADIOS_TIMER_EVENTS 0)
  elseif("$ENV{adios_timer_events}" STREQUAL "off")
    set(ADIOS_TIMER_EVENTS 0)
  else()
    set(ADIOS_TIMER_EVENTS 0)
  endif()
else()
  #default is off if not specified
  set(ADIOS_TIMER_EVENTS 0)
endif()

if(DEFINED ENV{bgq})
  if("$ENV{bgq}" STREQUAL "")
    set(HAVE_BGQ 0)
    set(BGQ OFF CACHE BOOL "")
  elseif("$ENV{bgq}" STREQUAL "ON")
    set(HAVE_BGQ 1)
    set(BGQ ON CACHE BOOL "")
  elseif("$ENV{bgq}" STREQUAL "on")
    set(HAVE_BGQ 1)
    set(BGQ ON CACHE BOOL "")
  elseif("$ENV{bgq}" STREQUAL "OFF")
    set(HAVE_BGQ 0)
    set(BGQ OFF CACHE BOOL "")
  elseif("$ENV{bgq}" STREQUAL "Off")
    set(HAVE_BGQ 0)
    set(BGQ OFF CACHE BOOL "")
  else()
    set(HAVE_BGQ 0)
    set(BGQ OFF CACHE BOOL "")
  endif()
else()
  set(HAVE_BGQ 0)
  set(BGQ OFF CACHE BOOL "")
endif()

if(DEFINED ENV{research_transports})
  if("$ENV{research_transports}" STREQUAL "")
    set(RESEARCH_TRANSPORTS 0)
    message("research_transports is NOT enabled")
  elseif("$ENV{research_transports}" STREQUAL "OFF")
    set(RESEARCH_TRANSPORTS 0)
    message("research_transports is NOT enabled")
  elseif("$ENV{research_transports}" STREQUAL "off")
    set(RESEARCH_TRANSPORTS 0)
    message("research_transports is NOT enabled")
  elseif("$ENV{research_transports}" STREQUAL "on")
    set(RESEARCH_TRANSPORTS 1)
    message("research_transports is enabled")
  elseif("$ENV{research_transports}" STREQUAL "ON")
    set(RESEARCH_TRANSPORTS 1)
    message("research_transports is enabled")
  else()
    set(RESEARCH_TRANSPORTS 0)
    message("research_transports is NOT enabled")
  endif()
else()
  set(RESEARCH_TRANSPORTS 0)
  message("research_transports is NOT enabled")
endif()

set(MXML_DIR $ENV{MXML_DIR}  CACHE FILEPATH "path to mxml dir")

set(DATATAP OFF CACHE BOOL "")

set(NSSI OFF CACHE BOOL "")

if(DEFINED ENV{SEQ_NC_DIR})
  if("$ENV{SEQ_NC_DIR}" STREQUAL "")
    set(NETCDF OFF CACHE BOOL "")
  else()
    set(NETCDF ON CACHE BOOL "")
    set(NETCDF_DIR "$ENV{SEQ_NC_DIR}" CACHE FILEPATH "path to suquential NETCDF dir")
  endif()
else()
  set(NETCDF OFF CACHE BOOL "")
endif()

if(DEFINED ENV{PAR_NC_DIR})
  if("$ENV{PAR_NC_DIR}" STREQUAL "")
    set(NC4PAR OFF CACHE BOOL "")
  else()
    set(NC4PAR ON CACHE BOOL "")
    set(NC4PAR_DIR "$ENV{PAR_NC_DIR}" CACHE FILEPATH "path to parallel NETCDFdir")
  endif()
else()
  set(NC4PAR OFF CACHE BOOL "")
endif()

#if(DEFINED ENV{PAR_NC_DIR} AND DEFINED ENV{PAR_NC_CLIB})
#  set(NC4PAR ON CACHE BOOL "")
#  set(NC4PAR_DIR $ENV{PAR_NC_DIR} CACHE FILEPATH "")
#  set(NC4PAR_CPPFLAGS "-I${NC4PAR_DIR}/include")
#  set(NC4PAR_LIBS $ENV{PAR_NC_CLIB} CACHE STRING "parallel netcdf")
#else()
#  set(NC4PAR OFF CACHE BOOL "")
#endif()

#if(DEFINED ENV{SEQ_NC_DIR} AND DEFINED ENV{SEQ_NC_CLIB})
#  set(NETCDF ON CACHE BOOL "")
#  set(NETCDF_DIR $ENV{SEQ_NC_DIR} CACHE FILEPATH "")
#  set(NETCDF_CPPFLAGS "-I${NETCDF_DIR}/include")
#  set(NETCDF_LIBS $ENV{SEQ_NC_CLIB} CACHE STRING "")
#else()
#  set(NETCDF OFF CACHE BOOL "")
#endif()

#if(DEFINED ENV{PAR_HDF5_DIR} AND DEFINED ENV{PAR_HDF5_CLIB})
#  set(PHDF5 ON CACHE BOOL "")
#  set(PHDF5_DIR $ENV{PAR_HDF5_DIR} CACHE FILEPATH "path to parallel hdf5 dir")
#  set(PHDF5_FLAGS "-I${PHDF5_DIR}/include")
#  set(PHDF5_LIBS $ENV{PAR_HDF5_CLIB} CACHE STRING "parallel hdf5")
#else()
#  set(PHDF5 OFF CACHE BOOL "")
#endif()

if(DEFINED ENV{PAR_HDF5_DIR})
  if("$ENV{PAR_HDF5_DIR}" STREQUAL "")
    set(PHDF5 OFF CACHE BOOL "")
  else()
    set(PHDF5 ON CACHE BOOL "")
    set(PHDF5_DIR $ENV{PAR_HDF5_DIR} CACHE FILEPATH "path to parallel hdf5 dir")
    set(PHDF5_FLAGS "-I${PHDF5_DIR}/include")
#   set(PHDF5_LIBS $ENV{PAR_HDF5_CLIB} CACHE STRING "parallel hdf5")
  endif()
else()
  set(PHDF5 OFF CACHE BOOL "")
endif()

if(DEFINED ENV{PORTALS_DIR})
  if("$ENV{PORTALS_DIR}" STREQUAL "")
    set(PORTALS OFF CACHE BOOL "")
  else()
    set(PORTALS_DIR "$ENV{PROTALS_DIR}" CACHE STRING "path to protals")
    set(PORTALS ON CACHE BOOL "")
  endif()
elseif(DEFINED ENV{PORTALS})
  if("$ENV{PORTALS}" STREQUAL "")
    set(PORTALS OFF CACHE BOOL "")
  else()
    set(PORTALS_DIR "$ENV{PROTALS}" CACHE STRING "path to protals")
    set(PORTALS ON CACHE BOOL "")
  endif()
else()
  set(PORTALS OFF CACHE BOOL "")
endif()

if(DEFINED ENV{DATASPACES_INCDIR})
  if("${DATASPACES_INCDIR}" STREQUAL "")
    set(DATASPACES OFF CACHE BOOL "")
  else()
    set(DATASPACES_INCDIR "$ENV{DATASPACES_INCDIR}" CACHE INTERNAL "Internal variable")
  endif()
else()
  set(DATASPACES OFF CACHE BOOL "")
endif()
if(DEFINED ENV{DATASPACES_LIBDIR})
  if("${DATASPACES_LIBDIR}" STREQUAL "")
    set(DATASPACES OFF CACHE BOOL "" FORCE)
  else()
    set(DATASPACES_LIBDIR $ENV{DATASPACES_LIBDIR} CACHE INTERNAL "Internal variable")
  endif()
else()
  set(DATASPACES OFF CACHE BOOL "" FORCE)
endif()
if(DEFINED DATASPACES_INCDIR)
  if(DEFINED DATASPACES_LIBDIR)
    set(DATASPACES ON CACHE BOOL "" FORCE)
    set(DATASPACES_INCDIR "$ENV{DATASPACES_INCDIR}" CACHE STRING "" FORCE)
    set(DATASPACES_LIBDIR $ENV{DATASPACES_LIBDIR} CACHE STRING "" FORCE)
  endif()
endif()
if("${DATASPACES}" STREQUAL "OFF")
  if(DEFINED ENV{DATASPACES_DIR})
    if(NOT "$ENV{DATASPACES_DIR}" STREQUAL "")
      set(DATASPACES ON CACHE BOOL "" FORCE)
      set(DATASPACES_DIR $ENV{DATASPACES_DIR} CACHE FILEPATH "path to dataspaces dir")
    endif()
#  set(DATASPACES_LIBS "-L$ENV{DATASPACES_DIR}/libs -ldspaces -ldscommon
#  -ldar" CACHE STRING "dataspace libs")
  else()
    if(NOT "$ENV{DATASPACES}" STREQUAL "")
      set(DATASPACES_DIR $ENV{DATASPACES} CACHE FILEPATH "path to dataspaces dir")
      set(DATASPACES ON CACHE BOOL "" FORCE)
    endif()
  endif()
endif()

if(DEFINED ENV{CRAY_PMI_DIR})
  set(CRAY_PMI_DIR $ENV{CRAY_PMI_DIR})
  if(CRAY_PMI_DIR)
    set(CRAY_PMI ON CACHE BOOL "")
    set(CRAY_PMI_LIBS_PATH "${CRAY_PMI_DIR}/lib64" CACHE STRING "")
    set(CRAY_PMI_CPPFLAGS "-I${CRAY_PMI_DIR}/include" CACHE STRING "")
  else()
    set(CRAY_PMI OFF CACHE BOOL "")
  endif()
else()
  set(CRAY_PMI OFF CACHE BOOL "")
endif()

if(DEFINED ENV{CRAY_UGNI_DIR})
  set(CRAY_UGNI_DIR $ENV{CRAY_UGNI_DIR})
  if(CRAY_UGNI_DIR)
    set(CRAY_UGNI ON CACHE BOOL "")
    set(CRAY_UGNI_LIBS_PATH "${CRAY_UGNI_DIR}/lib64" CACHE STRING "")
    set(CRAY_UGNI_CPPFLAGS "-I${CRAY_UGNI_DIR}/include")
  else()
    set(CRAY_UGNI OFF CACHE BOOL "")
  endif()
else()
  set(CRAY_UGNI OFF CACHE BOOL "")
endif()

if(DATASPACES)
  set(DIMES ON CACHE BOOL "")
else()
  set(DIMES OFF CACHE BOOL "")
endif()

if(DEFINED ENV{FLEXPATH_INCDIR})
  if("${FLEXPATH_INCDIR}" STREQUAL "")
    set(FLEXPATH OFF CACHE BOOL "")
  else()
    set(FLEXPATH_INCDIR "$ENV{FLEXPATH_INCDIR}" CACHE INTERNAL "Internal variable")
  endif()
else()
  set(FLEXPATH OFF CACHE BOOL "")
endif()
if(DEFINED ENV{FLEXPATH_LIBDIR})
  if("${FLEXPATH_LIBDIR}" STREQUAL "" FORCE)
    set(FLEXPATH OFF CACHE BOOL "")
  else()
    set(FLEXPATH_LIBDIR $ENV{FLEXPATH_LIBDIR} CACHE INTERNAL "Internal variable")
  endif()
else()
  set(FLEXPATH OFF CACHE BOOL "" FORCE)
endif()
if(DEFINED FLEXPATH_INCDIR)
  if(DEFINED FLEXPATH_LIBDIR)
    set(FLEXPATH ON CACHE BOOL "" FORCE)
    set(FLEXPATH_INCDIR "$ENV{FLEXPATH_INCDIR}" CACHE STRING "" FORCE)
    set(FLEXPATH_LIBDIR $ENV{FLEXPATH_LIBDIR} CACHE STRING "" FORCE)
  endif()
endif()
if("${FLEXPATH}" STREQUAL "OFF")
  if(DEFINED ENV{FLEXPATH_DIR})
    if(NOT "$ENV{FLEXPATH_DIR}" STREQUAL "")
      set(FLEXPATH ON CACHE BOOL "" FORCE)
      set(FLEXPATH_DIR $ENV{FLEXPATH_DIR} CACHE FILEPATH "path to flexpath dir")
    endif()
  else()
    if(NOT "$ENV{FLEXPATH}" STREQUAL "")
      set(FLEXPATH_DIR $ENV{FLEXPATH} CACHE FILEPATH "path to flexpath dir")
      set(FLEXPATH ON CACHE BOOL "" FORCE)
    endif()
  endif()
endif()

if(DEFINED ENV{FASTBIT_DIR})
  if(NOT "$ENV{FASTBIT_DIR}" STREQUAL "")
    set(FASTBIT ON CACHE BOOL "")
    set(FASTBIT_DIR "$ENV{FASTBIT_DIR}" CACHE FILEPATH "path to fastbit dir")
  else()
    set(FASTBIT OFF CACHE BOOL "")
  endif()
else()
  if(NOT "$ENV{FASTBIT}" STREQUAL "")
    set(FASTBIT_DIR $ENV{FASTBIT} CACHE FILEPATH "path to fastbit dir")
    set(FASTBIT ON CACHE BOOL "" FORCE)
  endif()
endif()

#if(DEFINED ENV{SEQ_HDF5_DIR} AND DEFINED ENV{SEQ_HDF5_CLIB})
#  set(HDF5 ON CACHE BOOL "")
#  set(HDF5_DIR "$ENV{SEQ_HDF5_DIR}" CACHE FILEPATH "path to hdf5 dir")
#  set(HDF5_FLAGS "-I${HDF5_DIR}/include")
#  set(HDF5_LIBS "$ENV{SEQ_HDF5_CLIB}" CACHE FILEPATH "sequential hdf5")
#else()
#  set(HDF5 OFF CACHE BOOL "")
#endif()

if(DEFINED ENV{SEQ_HDF5_DIR})
  if("$ENV{SEQ_HDF5_DIR}" STREQUAL "")
    set(HDF5 OFF CACHE BOOL "")
  else()
    set(HDF5 ON CACHE BOOL "" FORCE)
    set(HDF5_DIR "$ENV{SEQ_HDF5_DIR}" CACHE FILEPATH "path to hdf5 dir")
    set(HDF5_FLAGS "-I${HDF5_DIR}/include")
#    set(HDF5_LIBS "$ENV{SEQ_HDF5_CLIB}" CACHE FILEPATH "sequential hdf5")
  endif()
else()
  set(HDF5 OFF CACHE BOOL "")
endif()

set(DMALLOC OFF CACHE BOOL "")

if(DEFINED ENV{LUSTRE_DIR})
  set(LUSTRE_DIR "$ENV{LUSTRE_DIR}" CACHE FILEPATH "path to lustre dir")
  set(LUSTRE ON CACHE BOOL "")
else()
  set(LUSTRE OFF CACHE BOOL "")
endif()

if(DEFINED ENV{GLIB_DIR})
  if("$ENV{GLIB_DIR}" STREQUAL "")
    set(GLIB OFF CACHE BOOL "")
  else()
    set(GLIB ON CACHE BOOL "")
    set(GLIB_DIR "$ENV{GLIB_DIR}")
  endif()
elseif(DEFINED ENV{GLIB})
  if("$ENV{GLIB}" STREQUAL "")
    set(GLIB OFF CACHE BOOL "")
  else()
    set(GLIB ON CACHE BOOL "")
    set(GLIB_DIR "$ENV{GLIB}")
  endif()
endif()

if(GLIB)
  if(DEFINED ENV{FGR_DIR})
    if("$ENV{FGR_DIR}" STREQUAL "")
      set(FGR OFF CACHE BOOL "")
    else()
      set(FGR ON CACHE BOOL "")
      set(FGR_DIR "$ENV{FGR_DIR}")
    endif()
  elseif(DEFINED ENV{FGR})
    if("$ENV{FGR}" STREQUAL "")
      set(FGR OFF CACHE BOOL "")
    else()
      set(FGR ON CACHE BOOL "")
      set(FGR_DIR "$ENV{FGR}")
    endif()
  endif()
else()
  set(FGR OFF CACHE BOOL "")
endif()

if(DEFINED ENV{BZIP2_DIR})
  if("$ENV{BZIP2_DIR}" STREQUAL "")
    set(BZIP2 OFF CACHE BOOL "")
  else()
    set(BZIP2 ON CACHE BOOL "")
    set(BZIP2_DIR "$ENV{BZIP2_DIR}")
  endif()
elseif(DEFINED ENV{BZIP2})
  if("$ENV{BZIP2}" STREQUAL "")
    set(BZIP2 OFF CACHE BOOL "")
  else()
    set(BZIP2 ON CACHE BOOL "")
    set(BZIP2_DIR "$ENV{BZIP2}")
  endif()
endif()

if(DEFINED ENV{LZ4_DIR})
  if("$ENV{LZ4_DIR}" STREQUAL "")
    set(LZ4 OFF CACHE BOOL "")
  else()
    set(LZ4 ON CACHE BOOL "")
    set(LZ4_DIR "$ENV{LZ4_DIR}")
  endif()
elseif(DEFINED ENV{LZ4})
  if("$ENV{LZ4}" STREQUAL "")
    set(LZ4 OFF CACHE BOOL "")
  else()
    set(LZ4 ON CACHE BOOL "")
    set(LZ4_DIR "$ENV{LZ4}")
  endif()
endif()

if(DEFINED ENV{BLOSC_DIR})
  if("$ENV{BLOSC_DIR}" STREQUAL "")
    set(BLOSC OFF CACHE BOOL "")
  else()
    set(BLOSC ON CACHE BOOL "")
    set(BLOSC_DIR "$ENV{BLOSC_DIR}")
  endif()
elseif(DEFINED ENV{BLOSC})
  if("$ENV{BLOSC}" STREQUAL "")
    set(BLOSC OFF CACHE BOOL "")
  else()
    set(BLOSC ON CACHE BOOL "")
    set(BLOSC_DIR "$ENV{BLOSC}")
  endif()
endif()

if(DEFINED ENV{SZIP_DIR})
  if("$ENV{SZIP_DIR}" STREQUAL "")
    set(SZIP OFF CACHE BOOL "")
  else()
    set(SZIP ON CACHE BOOL "")
    set(SZIP_DIR $ENV{SZIP_DIR})
  endif()
elseif(DEFINED ENV{SZIP})
  if(NOT "$ENV{SZIP}" STREQUAL "")
    set(SZIP OFF CACHE BOOL "")
  else()
    set(SZIP_DIR $ENV{SZIP})
    set(SZIP ON CACHE BOOL "")
  endif()
endif()

if(DEFINED ENV{MGARD_DIR})
  if("$ENV{MGARD_DIR}" STREQUAL "")
    set(MGARD OFF CACHE BOOL "")
  else()
    set(MGARD ON CACHE BOOL "")
    set(MGARD_DIR "$ENV{MGARD_DIR}")
  endif()
elseif(DEFINED ENV{MGARD})
  if("$ENV{MGARD}" STREQUAL "")
    set(MGARD OFF CACHE BOOL "")
  else()
    set(MGARD ON CACHE BOOL "")
    set(MGARD_DIR "$ENV{MGARD}")
  endif()
endif()

if(DEFINED ENV{ZCHECKER_DIR})
  if("$ENV{ZCHECKER_DIR}" STREQUAL "")
    set(ZCHECKER OFF CACHE BOOL "")
  else()
    set(ZCHECKER ON CACHE BOOL "")
    set(ZCHECKER_DIR "$ENV{ZCHECKER_DIR}")
  endif()
elseif(DEFINED ENV{ZCHECKER})
  if("$ENV{ZCHECKER}" STREQUAL "")
    set(ZCHECKER OFF CACHE BOOL "")
  else()
    set(ZCHECKER ON CACHE BOOL "")
    set(ZCHECKER_DIR "$ENV{ZCHECKER}")
  endif()
endif()

if(DEFINED ENV{ISOBAR_DIR})
  if("$ENV{ISOBAR_DIR}" STREQUAL "")
    set(ISOBAR OFF CACHE BOOL "")
  else()
    set(ISOBAR ON CACHE BOOL "")
    set(ISOBAR_DIR $ENV{ISOBAR_DIR})
  endif()
elseif(DEFINED ENV{ISOBAR})
  if("$ENV{ISOBAR}" STREQUAL "")
    set(ISOBAR OFF CACHE BOOL "")
  else()
    set(ISOBAR ON CACHE BOOL "")
    set(ISOBAR_DIR $ENV{ISOBAR})
  endif()
endif()

if(DEFINED ENV{APLOD_DIR})
  if("$ENV{APLOD_DIR}" STREQUAL "")
    set(APLOD OFF CACHE BOOL "")
  else()
    set(APLOD ON CACHE BOOL "")
    set(APLOD_DIR $ENV{APLOD_DIR})
  endif()
elseif(DEFINED ENV{APLOD})
  if("$ENV{APLOD}" STREQUAL "")
    set(APLOD OFF CACHE BOOL "")
  else()
    set(APLOD ON CACHE BOOL "")
    set(${APLOD_DIR} $ENV{APLOD})
  endif()
endif()

if(DEFINED ENV{ALACRITY_DIR})
  if("$ENV{ALACRITY_DIR}" STREQUAL "")
    set(ALACRITY OFF CACHE BOOL "")
  else()
    set(ALACRITY ON CACHE BOOL "")
    set(ALACRITY_DIR $ENV{ALACRITY_DIR})
  endif()
elseif(DEFINED ENV{ALACRITY})
  if("$ENV{ALACRITY}" STREQUAL "")
    set(ALACRITY OFF CACHE BOOL "")
  else()
    set(ALACRITY ON CACHE BOOL "")
    set(ALACRITY_DIR $ENV{ALACRITY})
  endif()
endif()

if(DEFINED ENV{ZFP_DIR})
  if("$ENV{ZFP_DIR}" STREQUAL "")
    set(ZFP OFF CACHE BOOL "")
  else()
    set(ZFP ON CACHE BOOL "")
    set(ZFP_DIR "$ENV{ZFP_DIR}")
  endif()
elseif(DEFINED ENV{ZFP})
  if("$ENV{ZFP}" STREQUAL "")
    set(ZFP OFF CACHE BOOL "")
  else()
    set(ZFP ON CACHE BOOL "")
    set(ZFP_DIR "$ENV{ZFP}")
  endif()
else()
    set(BUILD_ZFP ON CACHE BOOL "")
    set(ZFP ON CACHE BOOL "")
    set(ZFP_DIR ${PROJECT_SOURCE_DIR}/src/zfp/zfp-0.5.0)
endif()

if(DEFINED ENV{SZ_DIR})
  if("$ENV{SZ_DIR}" STREQUAL "")
    set(SZ OFF CACHE BOOL "")
  else()
    set(SZ ON CACHE BOOL "")
    set(SZ_DIR $ENV{SZ_DIR})
  endif()
elseif(DEFINED ENV{SZ})
  if(NOT "$ENV{SZ}" STREQUAL "")
    set(SZ OFF CACHE BOOL "")
  else()
    set(SZ_DIR $ENV{SZ})
    set(SZ ON CACHE BOOL "")
  endif()
endif()


###################### end of external library is used(ON) or not (OFF) ##############################


#################################### start generating config.h #######################################
set(BUILD_WITH_CMAKE 1)

include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckLibraryExists)

# Define to dummy `main' function (if any) required to link to the Fortran
# libraries.

# Define if F77 and FC dummy `main' functions are identical.

# Define to a macro mangling the given C identifier (in lower and upper case),
# which must not contain underscores, for linking with Fortran.
set(FC_FUNC FC_GLOBAL)

# As FC_FUNC, but for C identifiers containing underscores.
set(FC_FUNC_ FC_GLOBAL_)
# Define to 1 if your Fortran compiler doesn't accept -c and -o together.

# Define to 1 if you have the <Attributes.h> header file.
CHECK_INCLUDE_FILES(Attributes.h HAVE_ATTRIBUTES_H)

# Define to 1 if you have the `nanosleep' function.
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)

# Define to 1 if you have the `gettimeofday' function.
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)

# Define to 1 if you have the `clock_gettime' function.
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)

# Define to 1 if you have the `clock_get_time' function. On OSX.
CHECK_FUNCTION_EXISTS(clock_get_time HAVE_CLOCK_GET_TIME)

# Check if clockid_t type exist
include(CheckTypeSize)
CHECK_TYPE_SIZE("clockid_t" CLOCKID_T)

# Define if you have CRAY_PMI.
set(HAVE_CRAY_PMI 0)
if(CRAY_PMI)
  find_library(CRAY_PMI_LIBS NAMES pmi PATHS ${CRAY_PMI_LIBS_PATH})
  if(CRAY_PMI_LIBS)
    set(HAVE_CRAY_PMI 1)
#  set(LIBS "${LIBS} ${CRAY_PMI_LIBS}")
#    set(CPPFLAGS "${CPPFLAGS} ${CRAY_PMI_CPPFLAGS}")
  endif()
endif()

# Define if you have CRAY_UGNI.
set(HAVE_CRAY_UGNI 0)
if(CRAY_UGNI)
  find_library(CRAY_UGNI_LIBS NAMES ugni PATHS ${CRAY_UGNI_LIBS_PATH})
  if(CRAY_UGNI_LIBS)
    set(HAVE_CRAY_UGNI 1)
#   set(LIBS "${LIBS} ${CRAY_UGNI_LIBS}")
#    set(CPPFLAGS "${CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  endif()
endif()

# Define to 1 if you have <infiniband/verbs.h>.
CHECK_INCLUDE_FILES(infiniband/verbs.h HAVE_IBVERBS_H)

CHECK_FUNCTION_EXISTS(ibv_alloc_pd HAVE_IBVERBS)

# Define if you have the Infiniband.
set(HAVE_INFINIBAND 0)
if(HAVE_IBVERBS_H AND HAVE_IBVERBS)
  set(HAVE_INFINIBAND 1)
  set(INFINIBAND ON CACHE BOOL "")
  set(INFINIBAND_LIBS "-libverbs")
#  set(LIBS "${LIBS} ${INFINIBAND_LIBS}")
endif()

CHECK_FUNCTION_EXISTS(PtlInit HAVE_PTLINIT)

# Define to 1 if you have <portals3.h>.
#set(HAVE_PORTALS3_H 0)
CHECK_INCLUDE_FILES(portals3.h HAVE_PORTALS3_H)

# Define to 1 if you have <portals/portals3.h>.
#set(HAVE_PORTALS_PORTALS3_H 0)
CHECK_INCLUDE_FILES(portals/portals3.h HAVE_PORTALS_PORTALS3_H)

# Define to 1 if you have the <p3nal_utcp.h> header file.
CHECK_INCLUDE_FILES(p3nal_utcp.h HAVE_P3NAL_UTCP_H)

# Define to 1 if you have the <p3rt/p3rt.h> header file.
CHECK_INCLUDE_FILES(p3rt/p3rt.h HAVE_P3RT_P3RT_H)

# Define if you have the Portals.
if(PORTALS)
  set(PORTALS_LIBS "-L${PORTALS_DIR}/lib")
#  set(LIBS "${LIBS} ${PORTALS_LIBS}")
  set(PORTALS_CPPFLAGS "-I${PORTALS_DIR}/include")
  if(HAVE_PORTALS3_H)
    set(HAVE_PORTALS 1)
    set(PORTALS_CFLAGS "${PORTALS_CFLAGS} ${EXTRA_CFLAGS}")
    set(CFLAGS "${CFLAGS} ${PORTALS_CFLAGS}")
    set(PORTALS_CPPFLAGS "${PORTALS_CPPFLAGS} ${EXTRA_CPPFLAGS}")
#    set(CPPFLAGS "${CPPFLAGS} ${PORTALS_CPPFLAGS}")
  elseif(HAVE_PORTALS_PORTALS3_H)
    set(HAVE_PORTALS 1)
    set(PORTALS_CFLAGS "${PORTALS_CFLAGS} ${EXTRA_CFLAGS}")
    set(CFLAGS "${CFLAGS} ${PORTALS_CFLAGS}")
    set(PORTALS_CPPFLAGS "${PORTALS_CPPFLAGS} ${EXTRA_CPPFLAGS}")
#    set(CPPFLAGS "${CPPFLAGS} ${PORTALS_CPPFLAGS}")
 endif()
#else()
#  find_package(TPLPortals)
#  if(TPLPortals_FOUND)
#    set(PORTALS ON CACHE BOOL "" FORCE)
#    set(HAVE_PORTALS 1)
#    set(PORTALS_CPPFLAGS "${TPLPortals_INCLUDE_DIRS}")
#    set(CPPFLAGS "${CPPFLAGS} ${PORTALS_CPPFLAGS}")
#    set(PORTALS_LIBS "${TPLPortals_LIBRARIES}")
#    set(LIBS "${LIBS} ${PORTALS_LIBS}")
#  else()
#    set(HAVE_PORTALS 0)
#  endif()
endif()


# Define to 1 if you have the <dataspaces.h> header file.
set(HAVE_DATASPACES_H 0)
if(DATASPACES)
  if(DEFINED DATASPACES_INCDIR)
    if("${DATASPACES_INCDIR}" STREQUAL "")
      set(DATASPACES_INCDIR "$ENV{DATASPACES_DIR}/include")
    endif()
  else()
    set(DATASPACES_INCDIR "$ENV{DATASPACES_DIR}/include")
  endif()
#  message(STATUS "DATASPACES_INCDIR is: ${DATASPACES_INCDIR}")
  find_path(DATASPACES_INCLUDE_DIR NAMES dataspaces.h PATHS ${DATASPACES_INCDIR})
  if(DATASPACES_INCLUDE_DIR)
    set(HAVE_DATASPACES_H 1)
    set(DATASPACES_CPPFLAGS "-I${DATASPACES_INCLUDE_DIR}")
#include_directories(${DATASPACES_INCLUDE_DIR})
  endif()
endif()

# Define if you have the DATASPACES.
set(HAVE_DATASPACES 0)
if(HAVE_DATASPACES_H)
#  set(CPPFLAGS "${CPPFLAGS} ${DATASPACES_CPPFLAGS}")
  if(DEFINED DATASPACES_LIBDIR)
    if("${DATASPACES_LIBDIR}" STREQUAL "")
#      set(HAVE_DATASPACES 0)
#    else()
      set(DATASPACES_LIBDIR "$ENV{DATASPACES_DIR}/lib")
    endif()
  else()
    set(DATASPACES_LIBDIR "$ENV{DATASPACES_DIR}/lib")
  endif()

  # 1.6.2 has a config file
  set(DATASPACES_BINDIR "$ENV{DATASPACES_DIR}/bin")
  #message("DATASPACES: look for dspaces_config")
  find_program (DSPACES_CONFIG NAMES dspaces_config 
                PATHS "$ENV{DATASPACES_DIR}/bin" NO_DEFAULT_PATH)

  if(DSPACES_CONFIG)
    #message("DATASPACES: run dspaces_config")
    execute_process(COMMAND ${DSPACES_CONFIG} "-l"
        OUTPUT_VARIABLE dspaces_config_out
        RESULT_VARIABLE dspaces_config_ret
        OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    #message("DATASPACES: return value = ${dspaces_config_ret}")
    #message("DATASPACES: output = ${dspaces_config_out}")
    if(dspaces_config_ret EQUAL 0)
        string(REPLACE " " ";" dspaces_config_list ${dspaces_config_out})
    #message("DATASPACES: list = ${dspaces_config_list}")
        set(dspaces_libs)
        set(dspaces_lib_hints)
        set(dspaces_lib_flags)
        foreach(OPT IN LISTS dspaces_config_list)
            if(OPT MATCHES "^-L(.*)")
                list(APPEND dspaces_lib_hints "${CMAKE_MATCH_1}")
            elseif(OPT MATCHES "^-l(.*)")
                list(APPEND dspaces_libs "${CMAKE_MATCH_1}")
            else()
                list(APPEND dspaces_lib_flags "${OPT}")
            endif()
        endforeach()
        set(HAVE_DATASPACES 1)
    endif()
    #message("DATASPACES: hints = ${dspaces_lib_hints}")
    #message("DATASPACES: libs = ${dspaces_libs}")
    #message("DATASPACES: flags = ${dspaces_lib_flags}")
    set(DATASPACES_LIBS)
    foreach(lib IN LISTS dspaces_libs)
      find_library(dspaces_${lib}_LIBRARY NAME ${lib} HINTS ${dspaces_lib_hints})
      if(dspaces_${lib}_LIBRARY)
          list(APPEND DATASPACES_LIBS ${dspaces_${lib}_LIBRARY})
      else()
        list(APPEND DATASPACES_LIBS ${lib})
      endif()
    endforeach()

  elseif(HAVE_INFINIBAND)
    set(DATASPACES_LIBS1 "${DATASPACES_LIBS1}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS1 NAMES libdspaces.a PATHS ${DATASPACES_LIBDIR})
    find_library(DATASPACES_LIBS2 NAMES libdscommon.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS2 "${DATASPACES_LIBS2}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS3 NAMES libdart.a  PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS3 "${DATASPACES_LIBS3}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS4 NAMES rdmacm  PATHS ${DATASPACES_LIBDIR} /usr/lib64)
    set(DATASPACES_LIBS4 "${DATASPACES_LIBS4}" CACHE INTERNAL "Internal variable")
    if(DATASPACES_LIBS1 AND DATASPACES_LIBS2 AND DATASPACES_LIBS3 AND DATASPACES_LIBS4)
      set(DATASPACES_LIBS ${DATASPACES_LIBS1} ${DATASPACES_LIBS2} ${DATASPACES_LIBS3} ${DATASPACES_LIBS4})
      set(DATASPACES_LIBS ${DATASPACES_LIBS} CACHE STRING "")
      set(HAVE_DATASPACES 1)
#      set(LIBS "${LIBS} ${DATASPACES_LIBS}")
    else()
      set(DATASPACES OFF CACHE BOOL "do not find supporting library" FORCE)
    endif()
  elseif(HAVE_PORTALS)
    find_library(DATASPACES_LIBS1 NAMES libdart2.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS1 "${DATASPACES_LIBS1}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS2 NAMES libspaces.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS2 "${DATASPACES_LIBS2}" CACHE INTERNAL "Internal variable")
    if(DATASPACES_LIBS1 AND DATASPACES_LIBS2)
      set(DATASPACES_LIBS ${DATASPACES_LIBS1} ${DATASPACES_LIBS2})
      set(DATASPACES_LIBS ${DATASPACES_LIBS} CACHE STRING "")
      set(HAVE_DATASPACES 1)
#      set(LIBS "${LIBS} ${DATASPACES_LIBS}")
    else()
      set(DATASPACES OFF CACHE BOOL "do not find supporting library" FORCE)
    endif()
  elseif(HAVE_CRAY_PMI AND HAVE_CRAY_UGNI)
    find_library(DATASPACES_LIBS1 NAMES libdspaces.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS1 "${DATASPACES_LIBS1}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS2 NAMES libdscommon.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS2 "${DATASPACES_LIBS2}" CACHE INTERNAL "Internal variable")
    find_library(DATASPACES_LIBS3 NAMES libdart.a PATHS ${DATASPACES_LIBDIR})
    set(DATASPACES_LIBS3 "${DATASPACES_LIBS3}" CACHE INTERNAL "Internal variable")
    if(DATASPACES_LIBS1 AND DATASPACES_LIBS2 AND DATASPACES_LIBS3)
      set(DATASPACES_LIBS ${DATASPACES_LIBS1} ${DATASPACES_LIBS2} ${DATASPACES_LIBS3})
      set(DATASPACES_LIBS ${DATASPACES_LIBS} CACHE STRING "")
      set(HAVE_DATASPACES 1)
#      set(LIBS "${LIBS} ${DATASPACES_LIBS}")
     else()
      set(DATASPACES OFF CACHE BOOL "do not find supporting library" FORCE)
    endif()
  else()
    set(HAVE_DATASPACES 0)
    set(DATASPACES OFF CACHE BOOL "do not find supporting library" FORCE)
  endif()
endif()

# Define to 1 if you have the <dimes.h> header file.
set(HAVE_DIMES_H 0)
if(HAVE_DATASPACES_H)
  find_path(DIMES_INCLUDE_DIR NAMES dimes_interface.h PATHS ${DATASPACES_INCDIR})
  if(DIMES_INCLUDE_DIR)
    set(HAVE_DIMES_H 1)
  endif()
endif()

# Define if you have the DIMES.
set(HAVE_DIMES 0)
if(HAVE_DIMES_H)
  if(HAVE_INFINIBAND)
    set(DIMES OFF CACHE BOOL "" FORCE)
    message("DIMES currently NOT supported for Infiniband!")
  elseif(HAVE_PORTALS)
    set(DIMES OFF CACHE BOOL "" FORCE)
    message("DIMES currently NOT supported for Cray Portals!")
  else()
    set(HAVE_DIMES 1)
    set(DIMES_LIBS ${DATASPACES_LIBS})
    set(DIMES_CFLAGS ${DATASPACES_CFLAGS})
    set(DIMES_CPPFLAGS ${DATASPACES_CPPFLAGS})
  endif()
endif()

# Define to 1 if you have the <dlfcn.h> header file.
CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H)

# Define if you have DMALLOC.
set(HAVE_DMALLOC 0)

# Define to 1 if you have the <dmalloc.h> header file.
CHECK_INCLUDE_FILES(dmalloc.h HAVE_DMALLOC_H)

# Define to 1 if you have the `fdatasync' function.
CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC)

set(HAVE_FLEXPATH 0)
set(NO_FLEXPATH 1)
set(HAVE_FLEXPATH_H 0)
if(FLEXPATH)
  # 4.2.1 has a config file
  set(FLEXPATH_BINDIR "$ENV{FLEXPATH_DIR}/bin")
  # message("FLEXPATH: look for evpath_config")
  find_program (EVPATH_CONFIG NAMES evpath_config 
                PATHS "$ENV{FLEXPATH_DIR}/bin" NO_DEFAULT_PATH)

  if(EVPATH_CONFIG)
    # message("FLEXPATH: run evpath_config")
    execute_process(COMMAND ${EVPATH_CONFIG} "-l"
        OUTPUT_VARIABLE evpath_config_out
        RESULT_VARIABLE evpath_config_ret
        OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    # message("FLEXPATH: return value = ${evpath_config_ret}")
    # message("FLEXPATH: output = ${evpath_config_out}")
    if(evpath_config_ret EQUAL 0)
        string(REPLACE " " ";" evpath_config_list ${evpath_config_out})
    # message("FLEXPATH: list = ${evpath_config_list}")
        set(evpath_libs)
        set(evpath_lib_hints)
        set(evpath_lib_flags)
        foreach(OPT IN LISTS evpath_config_list)
            if(OPT MATCHES "^-L(.*)")
                list(APPEND evpath_lib_hints "${CMAKE_MATCH_1}")
            elseif(OPT MATCHES "^-l(.*)")
                list(APPEND evpath_libs "${CMAKE_MATCH_1}")
            else()
                list(APPEND evpath_libs "${OPT}")
            endif()
        endforeach()
        set(HAVE_FLEXPATH 1)
    endif()
    # message("FLEXPATH: hints = ${evpath_lib_hints}")
    # message("FLEXPATH: libs = ${evpath_libs}")
    # message("FLEXPATH: flags = ${evpath_lib_flags}")
    set(FP_LIBS)
    foreach(lib IN LISTS evpath_libs)
      find_library(evpath_${lib}_LIBRARY NAME ${lib} HINTS ${evpath_lib_hints})
      if(evpath_${lib}_LIBRARY)
          list(APPEND FP_LIBS ${evpath_${lib}_LIBRARY})
      else()
        list(APPEND FP_LIBS ${lib})
      endif()
    endforeach()
    set(HAVE_FLEXPATH 1)
    set(NO_FLEXPATH 0)
    set(FP_LIBS "${FP_LIBS}" CACHE STRING "")
    set(FP_CPPFLAGS "-I${FLEXPATH_DIR}/include")
    message("-- Found FLEXPATH: ${FP_LIBS}")
    message("-- FLEXPATH cppflags = ${FP_CPPFLAGS}")

  else(EVPATH_CONFIG)

    if(DEFINED FLEXPATH_INCDIR)
        if("${FLEXPATH_INCDIR}" STREQUAL "")
        set(FLEXPATH_INCDIR "$ENV{FLEXPATH_DIR}/include")
        endif()
    else()
        set(FLEXPATH_INCDIR "$ENV{FLEXPATH_DIR}/include")
    endif()
    find_path(FLEXPATH_INCLUDE_DIR1 NAMES evpath.h PATHS ${FLEXPATH_INCDIR})
    set(FLEXPATH_INCLUDE_DIR1 "${FLEXPATH_INCLUDE_DIR1}" CACHE INTERNAL "Internal variable")
    find_path(FLEXPATH_INCLUDE_DIR2 NAMES ffs.h PATHS ${FLEXPATH_INCDIR})
    set(FLEXPATH_INCLUDE_DIR2 "${FLEXPATH_INCLUDE_DIR2}" CACHE INTERNAL "Internal variable")
    find_path(FLEXPATH_INCLUDE_DIR3 NAMES atl.h PATHS ${FLEXPATH_INCDIR})
    set(FLEXPATH_INCLUDE_DIR3 "${FLEXPATH_INCLUDE_DIR3}" CACHE INTERNAL "Internal variable")
    find_path(FLEXPATH_INCLUDE_DIR4 NAMES dill.h PATHS ${FLEXPATH_INCDIR})
    set(FLEXPATH_INCLUDE_DIR4 "${FLEXPATH_INCLUDE_DIR4}" CACHE INTERNAL "Internal variable")
    find_path(FLEXPATH_INCLUDE_DIR5 NAMES cercs_env.h PATHS ${FLEXPATH_INCDIR})
    set(FLEXPATH_INCLUDE_DIR5 "${FLEXPATH_INCLUDE_DIR5}" CACHE INTERNAL "Internal variable")
    if(FLEXPATH_INCLUDE_DIR1 AND FLEXPATH_INCLUDE_DIR2 AND FLEXPATH_INCLUDE_DIR3 AND FLEXPATH_INCLUDE_DIR4 AND FLEXPATH_INCLUDE_DIR5)
        set(HAVE_FLEXPATH_H 1)
        set(FLEXPATH_INCLUDE_DIR ${FLEXPATH_INCDIR})
    endif()
    if(DEFINED FLEXPATH_LIBDIR)
        if("${FLEXPATH_LIBDIR}" STREQUAL "")
            set(FLEXPATH_LIBDIR "$ENV{FLEXPATH_DIR}/lib")
        endif()
    else()
        set(FLEXPATH_LIBDIR "$ENV{FLEXPATH_DIR}/lib")
    endif()
    find_library(FLEXPATH_LIBS1 NAMES evpath PATHS ${FLEXPATH_LIBDIR})
    set(FLEXPATH_LIBS1 "${FLEXPATH_LIBS1}" CACHE INTERNAL "Internal variable")
    find_library(FLEXPATH_LIBS2 NAMES ffs PATHS ${FLEXPATH_LIBDIR})
    set(FLEXPATH_LIBS2 "${FLEXPATH_LIBS2}" CACHE INTERNAL "Internal variable")
    find_library(FLEXPATH_LIBS3 NAMES atl PATHS ${FLEXPATH_LIBDIR})
    set(FLEXPATH_LIBS3 "${FLEXPATH_LIBS3}" CACHE INTERNAL "Internal variable")
    find_library(FLEXPATH_LIBS4 NAMES dill PATHS ${FLEXPATH_LIBDIR})
    set(FLEXPATH_LIBS4 "${FLEXPATH_LIBS4}" CACHE INTERNAL "Internal variable")
    find_library(FLEXPATH_LIBS5 NAMES cercs_env PATHS ${FLEXPATH_LIBDIR})
    set(FLEXPATH_LIBS5 "${FLEXPATH_LIBS5}" CACHE INTERNAL "Internal variable")
    if(FLEXPATH_LIBS1 AND FLEXPATH_LIBS2 AND FLEXPATH_LIBS3 AND FLEXPATH_LIBS4 AND FLEXPATH_LIBS5 AND HAVE_FLEXPATH_H)
        set(HAVE_FLEXPATH 1)
        set(NO_FLEXPATH 0)
        set(FP_LIBS ${FLEXPATH_LIBS1} ${FLEXPATH_LIBS2} ${FLEXPATH_LIBS3} ${FLEXPATH_LIBS4} ${FLEXPATH_LIBS5})
        set(FP_LIBS "${FP_LIBS}" CACHE STRING "")
        set(FP_CPPFLAGS "-I${FLEXPATH_INCLUDE_DIR}")
#       set(FP_CFLAGS ${FP_CPPFLAGS})
#       include_directories(${FLEXPATH_INCLUDE_DIR})
        message("-- Found FLEXPATH: ${FP_LIBS}")
        message("-- FLEXPATH cppflags = ${FP_CPPFLAGS}")
    else()
        set(FLEXPATH OFF CACHE BOOL "do not find supporting library" FORCE)
        message("-- FLEXPATH was not found")
    endif()
  endif(EVPATH_CONFIG)
endif()

if(HAVE_FLEXPATH)
  set(HAVE_ICEE 1)
else()
  set(HAVE_ICEE 0)
endif()

set(HAVE_FASTBIT 0)
if(FASTBIT)
  set(FASTBIT_INCDIR "${FASTBIT_DIR}/include/fastbit")
  set(FASTBIT_LIBDIR "${FASTBIT_DIR}/lib")
  find_path(FASTBIT_INCLUDE_DIR NAMES iapi.h PATHS ${FASTBIT_INCDIR})
  if(NOT FASTBIT_INCLUDE_DIR)
    message("Cannot find iapi.h from the FastBit lib. Make sure it has been
    properly installed at the path specified ${FASTBIT_DIR}")
  else()
    set(HAVE_IAPI_H 1)
  endif()
  find_library(FASTBIT_LIB NAMES fastbit PATHS ${FASTBIT_LIBDIR})
  if(FASTBIT_INCLUDE_DIR AND FASTBIT_LIB)
    set(HAVE_FASTBIT 1)
    set(FASTBIT_CPPFLAGS "-I${FASTBIT_INCDIR}")
    set(FASTBIT_LIBS ${FASTBIT_LIB} -lstdc++ CACHE STRING "")
  else()
    set(FASTBIT OFF CACHE BOOL "" FORCE)
  endif()
endif()

set(HAVE_MPI 0)

# Define if you have the MPI library.
if(BUILD_FORTRAN)
  find_package(MPI COMPONENTS Fortran)
  if(MPI_FOUND)
#    if(MPI_LIBRARIES AND MPI_INCLUDE_PATH)
      message(STATUS "find MPI")
      set (HAVE_MPI 1)
#      set(MPILIBS ${MPI_LIBRARIES})
#include_directories(${MPI_INCLUDE_PATH})
#      set(LIBS ${MPILIBS})
  endif(MPI_FOUND)
else()
  find_package(MPI)
  if(MPI_FOUND)
#    if(MPI_LIBRARIES AND MPI_INCLUDE_PATH)
      message(STATUS "find MPI")
      set (HAVE_MPI 1)
#      set(MPILIBS ${MPI_LIBRARIES})
#    set(MPILIBS ${MPILIBS})
#include_directories(${MPI_INCLUDE_PATH})
#      set(LIBS ${MPILIBS})
  endif(MPI_FOUND)
endif(BUILD_FORTRAN)

# Define to 1 if you have the <hdf5.h> header file.
if(HDF5)
   set(HAVE_HDF5 1)
#    link_directories(${HDF5_DIR}/lib)
   set(HDF5_LIBS $ENV{SEQ_HDF5_LIBS} CACHE STRING "" FORCE)

  find_path(HDF5_INCLUDE_DIR hdf5.h ${HDF5_DIR}/include)
  if(HDF5_INCLUDE_DIR)
    set(HAVE_HDF5_H 1)
#    include_directories(${HDF5_INCLUDE_DIR})
#    set(CPPFLAGS "${CPPFLAGS} ${HDF5_FLAGS}")
#      set(LIBS "${LIBS} ${HDF5_LIBS}")
  else()
    set(HAVE_HDF5_H 0)
  endif()
else()
  set(HAVE_HDF5 0)
  set(HAVE_HDF5_H 0)
endif(HDF5)

# Define to 1 if you have the <inttypes.h> header file.
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)

# Define to 1 if you have the `rt' library (-lrt).
set(HAVE_LIBRT 0)

# Define if you have LUSTRE.
if(LUSTRE)
  set(LUSTRE_DIR "$ENV{LUSTRE_DIR}" CACHE STRING "")
  if(LUSTRE_DIR)
    find_library(LUSTRE_LIBS NAMES lustreapi PATHS "${LUSTRE_DIR}")
    if(LUSTRE_LIBS)
      message(STATUS "find LUSTRE library")
      set(HAVE_LUSTRE 1)
    endif()
  else()
    set(HAVE_LUSTRE 0)
  endif(LUSTRE_DIR)
else()
  set(HAVE_LUSTRE 0)
endif(LUSTRE)

# Define to 1 if you have the <memory.h> header file.
CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H)

set(HAVE_MXML 0)
if (MXML_DIR)
  # Use a preinstalled MXML library pointed by the user
  # Define to 1 if you have the <mxml.h> header file.
  find_path(MXML_INCLUDE_DIR NAMES mxml.h PATHS ${MXML_DIR}/include)
  if(NOT MXML_INCLUDE_DIR-NOTFOUND)
    message(STATUS "find mxml header")
    set(HAVE_MXML_H 1)
  endif(NOT MXML_INCLUDE_DIR-NOTFOUND)

  # Define if you have the MXML.
  # MXML: /sw/analysis-x64/mxml/2.6/centos5.5_pgi10./9
  find_library(MXML_LIBS NAMES mxml PATHS ${MXML_DIR}/lib)
  if(MXML_LIBS)
    message(STATUS "find mxml library")
  endif()
  if(MXML_LIBS AND HAVE_MXML_H)
    set(HAVE_MXML 1)
  endif()
endif(MXML_DIR)

if (NOT HAVE_MXML)
  # Build the supplied mxml directory
  message(STATUS "MXML will be built for ADIOS in ./src/mxml")
  set(HAVE_MXML 1)
  set(BUILD_MXML 1)
  set(MXML_LIBS "")
  set(MXML_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/mxml/mxml-2.9)
  message(STATUS "Checking type long long int")
  try_compile(HAVE_LONG_LONG ${PROJECT_BINARY_DIR}/src/mxml SOURCES ${PROJECT_SOURCE_DIR}/src/mxml/cmake_try_longlong.c)
endif (NOT HAVE_MXML)


# Define if you have NETCDF.
if(NETCDF)
  find_path(NETCDF_INCLUDE_DIR NAMES netcdf.h PATHS ${NETCDF_DIR}/include)
  if(NETCDF_INCLUDE_DIR)
# Define to 1 if you have the <netcdf.h> header file.
    set(HAVE_NETCDF_H 1)
#    include_directories(${NETCDF_INCLUDE_DIR})
    set(NETCDF_CPPFLAGS "-I${NETCDF_INCLUDE_DIR}")
#    set(CPPFLAGS "${CPPFLAGS} ${NETCDF_CPPFLAGS}")
  else()
    set(HAVE_NETCDF_H 0)
  endif()
else()
  set(HAVE_NETCDF_H 0)
endif()

if(HAVE_NETCDF_H)
  set(NETCDF_LIBS $ENV{SEQ_NC_LIBS} CACHE STRING "")
  set(HAVE_NETCDF 1)
else()
  set(HAVE_NETCDF 0)
endif()

#if(NETCDF)
#  if(NETCDF_LIBS AND NETCDF_CPPFLAGS)
#    set(HAVE_NETCDF 1)
#    find_path(NETCDF_INCLUDE_DIR netcdf.h ${NETCDF_DIR}/include)
#    if(NETCDF_INCLUDE_DIR)
#      set(HAVE_NETCDF_H 1)
#      include_directories(${NETCDF_INCLUDE_DIR})
#      set(CPPFLAGS "${CPPFLAGS} ${NETCDF_CPPFLAGS}")
##      set(LIBS "${LIBS} ${NETCDF_LIBS}")
#    else()
#      set(HAVE_NETCDF_H 0)
#      set(HAVE_NETCDF 0)
#    endif()
#  else()
#    set(HAVE_NETCDF 0)
#  endif()
#else()
#  set(HAVE_NETCDF 0)
#  set(HAVE_NETCDF_H 0)
#endif(NETCDF)

# Define if you have NC4PAR.
if(NC4PAR)
  find_path(NC4PAR_INCLUDE_DIR NAMES netcdf.h PATHS ${NC4PAR_DIR}/include)
  if(NC4PAR_INCLUDE_DIR)
    set(HAVE_NC4PAR_H 1)
#include_directories(${NC4PAR_INCLUDE_DIR})
    set(NC4PAR_CPPFLAGS "-I${NC4PAR_INCLUDE_DIR}")
#    set(CPPFLAGS "${CPPFLAGS} ${NC4PAR_CPPFLAGS}")
  else()
    set(HAVE_NC4PAR_H 0)
  endif()
else()
  set(HAVE_NC4PAR_H 0)
endif()

if(HAVE_NC4PAR_H)
  set(NC4PAR_LIBS $ENV{PAR_NC_LIBS} CACHE STRING "")
#    set(LIBS "${LIBS} ${NC4PAR_LIBS}")
  set(HAVE_NC4PAR 1)
else()
  set(HAVE_NC4PAR 0)
endif()

#if(NC4PAR)
#  if(NC4PAR_LIBS AND NC4PAR_CPPFLAGS)
#    set(HAVE_NC4PAR 1)
#    find_path(NC4PAR_INCLUDE_DIR netcdf.h ${NC4PAR_DIR}/include)
#    if(NC4PAR_INCLUDE_DIR)
#      set(HAVE_NC4PAR_H 1)
#      include_directories(${NC4PAR_INCLUDE_DIR})
#      set(CPPFLAGS "${CPPFLAGS} ${NC4PAR_CPPFLAGS}")
#      set(LIBS "${LIBS} ${NC4PAR_LIBS}")
#    else()
#      set(HAVE_NC4PAR_H 0)
#      set(HAVE_NC4PAR 0)
#    endif()
#  else()
#    set(HAVE_NC4PAR 0)
#  endif()
#else()
#  set(HAVE_NC4PAR 0)
#  set(HAVE_NC4PAR_H 0)
#endif(NC4PAR)


# Use NC4PAR for bp2ncd if no sequential NETCDF was found
if(HAVE_NC4PAR)
  if(NOT HAVE_NETCDF)
    set(NETCDF_CPPFLAGS "${NC4PAR_CPPFLAGS}")
    set(NETCDF_CFLAGS "${NC4PAR_CFLAGS}")
    set(NETCDF_LIBS "${NC4PAR_LIBS}")
    set(HAVE_NETCDF 1)
    set(USE_PARALLEL_COMPILER 1)
    message(STATUS "Use NC4PAR for sequential NETCDF tools")
  endif()
endif()

# Define if you have NSSI.
set(HAVE_NSSI 0)

# Define if you have the Pablo.
set(HAVE_PABLO 0)

# Define if you have PHDF5.
if(PHDF5)
  set(PHDF5_LIBS $ENV{PAR_HDF5_LIBS} CACHE STRING "paralllel hdf5 libs")
  set(HAVE_PHDF5 1)
  find_path(PHDF5_INCLUDE_DIR hdf5.h ${PHDF5_DIR}/include)
  if(PHDF5_INCLUDE_DIR)
    set(HAVE_PHDF5_H 1)
#include_directories(${PHDF5_INCLUDE_DIR})
#    set(CPPFLAGS "${CPPFLAGS} ${PHDF5_FLAGS}")
#      set(LIBS "${LIBS} ${PHDF5_LIBS}")
  else()
    set(HAVE_PHDF5_H 0)
  endif()
else()
  set(HAVE_PHDF5_H 0)
  set(HAVE_PHDF5 0)
endif(PHDF5)

# Use PHDF5 for bp2h5 if no sequential HDF5 was found
if(HAVE_PHDF5)
  if(NOT HAVE_HDF5)
    set(HDF5_FLAGS "${PHDF5_FLAGS}")
    set(HDF5_LIBS "${PHDF5_LIBS}")
    set(HAVE_HDF5 1)
#    include_directories(${PHDF5_INCLUDE_DIR})
    set(USE_PARALLEL_COMPILER 1)
#    set(CPPFLAGS "${CPPFLAGS} ${PHDF5_FLAGS}")
#    set(LIBS "${LIBS} ${PHDF5_LIBS}")
    message(STATUS "Use PHDF5 for sequential HDF5 tools")
  endif()
endif()


# Define if you have POSIX threads libraries and header files.
set(HAVE_PTHREAD 0)
find_package(Threads)
if(Threads_FOUND)
  set(HAVE_PTHREAD 1)
  #INCLUDE_DIRECTORIES(${Threads_INCLUDE_PATH})
endif(Threads_FOUND)

# Define to 1 if you have the `pthread_yield' function.
CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD)

# Define to 1 if you have the `PtlACEntry' function.
CHECK_FUNCTION_EXISTS(PtlACEntry HAVE_PTLACENTRY)
#set(HAVE_PTLACENTRY 0)

# Define to 1 if you have the `PtlErrorStr' function.
CHECK_FUNCTION_EXISTS(PtlErrorStr HAVE_PTLERRORSTR)

# Define to 1 if you have the `PtlEventKindStr' function.
CHECK_FUNCTION_EXISTS(PtlEventKindStr HAVE_PTLEVENTKINDSTR)

# Define to 1 if you have the `PtlGetJid' function.
CHECK_FUNCTION_EXISTS(PtlGetJid HAVE_PTLGETJID)

# Define to 1 if you have the `PtlNIFailStr' function.
CHECK_FUNCTION_EXISTS(PtlNIFailStr HAVE_PTLNIFAILSTR)

# Define to 1 if the system has the type `ptl_eq_handler_t'.
set(HAVE_PTL_EQ_HANDLER_T 0)

# Define if you have PTL_NOACK_REQ.
set(HAVE_PTL_NOACK_REQ 0)

# Define if you have PTL_NO_ACK_REQ.
set(HAVE_PTL_NO_ACK_REQ 0)

# Define to 1 if the system has the type `ptl_time_t'.
set(HAVE_PTL_TIME_T 0)

# Define to 1 if you have the `sched_yield' function.
CHECK_FUNCTION_EXISTS(sched_yield HAVE_SCHED_YIELD)

# Define to 1 if you have the <stdint.h> header file.
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)

# Define to 1 if you have the <stdlib.h> header file.
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)

# Define to 1 if you have the `strerror' function.
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)

# Define to 1 if cpp supports the ANSI  stringizing operator.
set(HAVE_STRINGIZE 0)

# Define to 1 if you have the <strings.h> header file.
CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)

# Define to 1 if you have the <string.h> header file.
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)

# Define to 1 if you have the `strncpy' function.
CHECK_FUNCTION_EXISTS(strncpy HAVE_STRNCPY)

# Define to 1 if you have the `strdup' function.
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)

# Define to 1 if you have the `strndup' function.
CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)

# Define to 1 if you have the `snprintf' function.
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)

# Define to 1 if you have the `vsnprintf' function.
CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)

# Define to 1 if you have the <sys/stat.h> header file.
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)

# Define to 1 if you have the <sys/types.h> header file.
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)

# Define to 1 if you have the <unistd.h> header file.
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)

# Datatap is disabled
set(NO_DATATAP 1)

set(HAVE_ZLIB 0)
set(HAVE_ZLIB_H 0)
#CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H)
#find_library(ZLIB_LIBS NAMES libz.a PATHS ${ZIP_DIR}/lib)
#if(HAVE_ZLIB_H AND ZLIB_LIBS)

set(HAVE_ZLIB 0)
set(HAVE_ZLIB_H 0)
find_package(ZLIB)
if(ZLIB_FOUND)
  set(HAVE_ZLIB 1)
  set(HAVE_ZLIB_H 1)
#include_directories(${ZLIB_INCLUDE_DIRS})
  set(ZLIB_LIBS ${ZLIB_LIBRARIES})
  set(ZLIB_CPPFLAGS "-I${ZLIB_INCLUDE_DIRS}")
#  set(CPPFLAGS "${CPPFLAGS} ${ZLIB_CPPFLAGS}")
  set(ZLIB ON CACHE BOOL "")
else()
   set(ZLIB OFF CACHE BOOL "")
endif()

set(HAVE_GLIB 0)
if(GLIB)
  find_path(GLIB_INCLUDE_DIR1 NAMES glib.h PATHS ${GLIB_DIR}/include/glib-2.0/)
  set(GLIB_INCLUDE_DIR1 "${GLIB_INCLUDE_DIR1}" CACHE INTERNAL "Internal variable")
  find_path(GLIB_INCLUDE_DIR2 NAMES glibconfig.h PATHS ${GLIB_DIR}/lib/glib-2.0/include)
  set(GLIB_INCLUDE_DIR2 "${GLIB_INCLUDE_DIR2}" CACHE INTERNAL "Internal variable")
  set(GLIB_INCLUDE_DIR "${GLIB_INCLUDE_DIR1} ${GLIB_INCLUDE_DIR2}" CACHE FILEPATH "")
  find_library(GLIB_LIBS NAMES glib-2.0 PATHS ${GLIB_DIR}/lib NO_DEFAULT_PATH)
  if(GLIB_INCLUDE_DIR1 AND GLIB_INCLUDE_DIR2 AND GLIB_LIBS)
    set(HAVE_GLIB 1)
    set(GLIB_CPPFLAGS "-I${GLIB_INCLUDE_DIR1} -I${GLIB_INCLUDE_DIR2}")
  else()
    set(GLIB OFF CACHE BOOL "" FORCE)
  endif()
endif()

set(HAVE_FGR 0)
if(FGR)
  if(HAVE_GLIB)
    find_path(FGR_INCLUDE_DIR NAMES fgr.h PATHS ${FGR_DIR}/include)
    find_library(FGR_LIBS NAMES fgr PATHS ${FGR_DIR}/lib)
    if(FGR_INCLUDE_DIR AND FGR_LIBS)
      set(HAVE_FGR 1)
      set(FGR_CPPFLAGS "-I${FGR_INCLUDE_DIR}")
    else()
      set(FGR OFF CACHE BOOL "" FORCE)
    endif()
  else()
    set(FGR OFF CACHE BOOL "" FORCE)
  endif()
endif()

set(HAVE_LZ4 0)
if(LZ4)
  find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATHS ${LZ4_DIR}/include)
  if(LZ4_INCLUDE_DIR)
    set(HAVE_LZ4_H 1)
  endif()
  find_library(LZ4_LIBS NAMES lz4 PATHS ${LZ4_DIR}/lib)
  if(LZ4_INCLUDE_DIR AND LZ4_LIBS)
    set(HAVE_LZ4 1)
    set(LZ4_CPPFLAGS "-I${LZ4_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_BLOSC 0)
if(BLOSC)
  find_path(BLOSC_INCLUDE_DIR NAMES blosc.h PATHS ${BLOSC_DIR}/include)
  if(BLOSC_INCLUDE_DIR)
    set(HAVE_BLOSC_H 1)
  endif()
  find_library(BLOSC_LIBS NAMES blosc PATHS ${BLOSC_DIR}/lib)
  if(BLOSC_INCLUDE_DIR AND BLOSC_LIBS)
    set(HAVE_BLOSC 1)
    set(BLOSC_CPPFLAGS "-I${BLOSC_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_BZIP2 0)
if(BZIP2)
  find_path(BZIP2_INCLUDE_DIR NAMES bzlib.h PATHS ${BZIP2_DIR}/include)
  if(BZIP2_INCLUDE_DIR)
    set(HAVE_BZLIB_H 1)
  endif()
  find_library(BZIP2_LIBS NAMES bz2 PATHS ${BZIP2_DIR}/lib)
  if(BZIP2_INCLUDE_DIR AND BZIP2_LIBS)
    set(HAVE_BZIP2 1)
    set(BZIP2_CPPFLAGS "-I${BZIP2_INCLUDE_DIR}")
#include_directories(${BZIP2_INCLUDE_DIR})
#    set(CPPFLAGS "${CPPFLAGS} ${BZIP2_CPPFLAGS}")
  endif()
endif()

set(HAVE_SZIP 0)
if(SZIP)
  find_path(SZIP_INCLUDE_DIR NAMES szlib.h PATHS ${SZIP_DIR}/include)
  if(SZIP_INCLUDE_DIR)
    set(HAVE_SZLIB_H 1)
  endif()
  find_library(SZIP_LIBS NAMES libsz.a PATHS ${SZIP_DIR}/lib)
  if(SZIP_INCLUDE_DIR AND SZIP_LIBS)
    set(HAVE_SZIP 1)
    set(SZIP_CPPFLAGS "-I${SZIP_INCLUDE_DIR}")
#include_directories(${SZIP_INCLUDE_DIR})
#    set(CPPFLAGS "${CPPFLAGS} ${SZIP_CPPFLAGS}")
  endif()
endif()

set(HAVE_ISOBAR 0)
if(ISOBAR)
  find_path(ISOBAR_INCLUDE_DIR NAMES isobar.h PATHS ${ISOBAR_DIR}/include)
  if(ISOBAR_INCLUDE_DIR)
    set(HAVE_ISOBAR_H 1)
  endif()
  find_library(ISOBAR_LIBS NAMES isobar PATHS ${ISOBAR_DIR}/lib)
  if(ISOBAR_INCLUDE_DIR AND ISOBAR_LIBS)
    set(HAVE_ISOBAR 1)
    set(ISOBAR_CPPFLAGS "-I${ISOBAR_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_APLOD 0)
if(APLOD)
  find_path(APLOD_INCLUDE_DIR NAMES aplod.h PATHS ${APLOD_DIR}/include)
  if(APLOD_INCLUDE_DIR)
    set(HAVE_APLOD_H 1)
  endif()
  find_library(APLOD_LIBS NAMES aplod PATHS ${APLOD_DIR}/lib)
  if(APLOD_INCLUDE_DIR AND APLOD_LIBS)
    set(HAVE_APLOD 1)
    set(APLOD_CPPFLAGS "-I${APLOD_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_ALACRITY 0)
if(ALACRITY)
  find_path(ALACRITY_INCLUDE_DIR NAMES alacrity.h PATHS ${ALACRITY_DIR}/include)
  find_library(ALACRITY_LIB NAMES alacrity PATHS ${ALACRITY_DIR}/lib)
  find_library(RIDCOMPRESS_LIB NAMES ridcompress PATHS ${ALACRITY_DIR}/lib)
  if(ALACRITY_INCLUDE_DIR AND ALACRITY_LIB AND RIDCOMPRESS_LIB)
    set(HAVE_ALACRITY 1)
    set(ALACRITY_CPPFLAGS "-I${ALACRITY_INCLUDE_DIR}")
    set(ALACRITY_LIBS ${ALACRITY_LIB} ${RIDCOMPRESS_LIB} -lstdc++ CACHE STRING "")
  endif()
endif()

set(HAVE_ZFP 0)
if(ZFP)
  find_path(ZFP_INCLUDE_DIR NAMES zfp.h PATHS ${ZFP_DIR}/inc ${ZFP_DIR}/include)
  if(ZFP_INCLUDE_DIR)
    set(HAVE_ZFP_H 1)
  endif()
  if (BUILD_ZFP)
    set(HAVE_ZFP 1)
    set(ZFP_CPPFLAGS "${MACRODEFFLAG}ZFP -I${ZFP_INCLUDE_DIR}")
    message(STATUS "ZFP will be built for ADIOS in ./src/zfp")
  else(BUILD_ZFP)
    find_library(ZFP_LIBS NAMES zfp PATHS ${ZFP_DIR}/lib)
    if(ZFP_INCLUDE_DIR AND ZFP_LIBS)
      set(HAVE_ZFP 1)
      set(ZFP_CPPFLAGS "${MACRODEFFLAG}ZFP -I${ZFP_INCLUDE_DIR}")
    endif()
    message(STATUS "ZFP will be used from ${ZFP_DIR}")
  endif(BUILD_ZFP)
else(ZFP)
  message(STATUS "ZFP is turned off")
endif(ZFP)

set(HAVE_ZCHECKER 0)
if(ZCHECKER)
  find_path(ZCHECKER_INCLUDE_DIR NAMES zc.h PATHS ${ZCHECKER_DIR}/include)
  if(ZCHECKER_INCLUDE_DIR)
    set(HAVE_ZC_H 1)
  endif()
  find_library(ZCHECKER_LIBS NAMES zc PATHS ${ZCHECKER_DIR}/lib)
  if(ZCHECKER_INCLUDE_DIR AND ZCHECKER_LIBS)
    set(HAVE_ZCHECKER 1)
    set(ZCHECKER_CPPFLAGS "-I${ZCHECKER_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_SZ 0)
set(HAVE_SZ_H 0)
if(SZ)
  find_path(SZ_INCLUDE_DIR NAMES sz.h PATHS ${SZ_DIR}/include)
  if(SZ_INCLUDE_DIR)
    set(HAVE_SZ_H 1)
  endif()
  find_library(SZ_LIB1 NAMES libSZ.a PATHS ${SZ_DIR}/lib)
  find_library(SZ_LIB2 NAMES libzlib.a PATHS ${SZ_DIR}/lib)
  set(SZ_LIBS ${SZ_LIB1} ${SZ_LIB2} CACHE FILEPATH "SZ libraries")
  unset(SZ_LIB1 CACHE)
  unset(SZ_LIB2 CACHE)
  if(SZ_INCLUDE_DIR AND SZ_LIBS)
    set(HAVE_SZ 1)
    set(SZ_CPPFLAGS "-I${SZ_INCLUDE_DIR}")
  endif()
endif()

set(HAVE_MGARD 0)
if(MGARD)
  find_path(MGARD_INCLUDE_DIR NAMES mgard_capi.h PATHS ${MGARD_DIR}/include)
  if(MGARD_INCLUDE_DIR)
    set(HAVE_MGARD_CAPI_H 1)
  endif()
  find_library(MGARD_LIBS NAMES mgard PATHS ${MGARD_DIR}/lib)
  if(MGARD_INCLUDE_DIR AND MGARD_LIBS)
    set(HAVE_MGARD 1)
    set(MGARD_CPPFLAGS "-I${MGARD_INCLUDE_DIR}")
  endif()
endif()

# Define to 1 if your C compiler doesn't accept -c and -o together.

# Name of package
set(PACKAGE adios)

# Define to the address where bug reports for this package should be sent.

# Define to the full name of this package.

# Define to the full name and version of this package.

# Define to the one symbol short name of this package.

# Define to the version of this package.

# Define to the necessary symbol if this constant uses a non-standard name on
# your system.

# ADIOS timing is enable

# Define to 1 if you have the ANSI C header files.

# Need to use MPI compiler for sequential utils

# Major version number
set(VERSION_MAJOR 1)

# Minor version number
set(VERSION_MINOR 13)

# Micro version number
set(VERSION_MICRO 1)

# Version number of package
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO})

# svn revision number
#set(VERSION_SVNREV 2007)

# Define HAVE_MPI_FALSE because it is used in generating the adios_config script
if(HAVE_MPI)
    set(HAVE_MPI_FALSE "#")
else(HAVE_MPI)
    set(HAVE_MPI_FALSE "")
endif(HAVE_MPI)

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${PROJECT_BINARY_DIR}/config.h)
################################ end of generating config.h ###############################

#####################start processing src/public/adios_version.h.in #####################
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/public/adios_version.h.in
               ${CMAKE_CURRENT_BINARY_DIR}/src/public/adios_version.h @ONLY)
#####################end of processing src/public/adios_version.h #####################

################################ start of Fortran processing ##############################
if(BUILD_FORTRAN)
enable_language(Fortran)
message(STATUS "CMAKE_Fortran_COMPILER_WORKS =${CMAKE_Fortran_COMPILER_WORKS}")

include(FortranCInterface)
FortranCInterface_HEADER(${CMAKE_CURRENT_BINARY_DIR}/FC.h MACRO_NAMESPACE "FC_")
#FortranCInterface_VERIFY(CXX)
endif()
################################ end of Fortran processing ##############################
find_library(M_LIBS m)

# Generate flags for adios lib creation which depends on the packages we found
# ADIOSLIB_* for compiling libadios.a and libadiosf.a, and linking codes with those
# ADIOSLIB_SEQ_* for compiling libadios_nompi.a and libadiosf_nompi.a with dummy MPI
# ADIOSLIB_INT_* for codes using libadios_internal_nompi.a (like bp2ncd, bp2h5, bpdump etc)
# ADIOSREADLIB_* for codes using libadiosread.a, libadiosreadf.a
# ADIOSREADLIB_SEQ_* for codes using libadiosread_nompi.a
# adios_config will contain flags for users' code linking based on these flags
# EXTRA flags are used for compiling adios stuff, which need not go into adios_config for user codes
set(ADIOSLIB_EXTRA_CPPFLAGS "${MACRODEFFLAG}_FILE_OFFSET_BITS=64 ${MACRODEFFLAG}_LARGEFILE_SOURCE ${MACRODEFFLAG}_LARGEFILE64_SOURCE ${MACRODEFFLAG}_GNU_SOURCE ${CPPFLAGS}")
#message("${ADIOSLIB_EXTRA_CPPFLAGS}")
set(ADIOSLIB_LDADD "")
set(ADIOSLIB_CFLAGS "")
set(ADIOSLIB_CPPFLAGS "")
#message("ADIOSLIB_CPPFLAGS is ${ADIOSLIB_CPPFLAGS}")
set(ADIOSLIB_SEQ_CPPFLAGS "${MACRODEFFLAG}_NOMPI")
set(ADIOSLIB_SEQ_CFLAGS "")
set(ADIOSLIB_SEQ_LDADD "")
set(ADIOSLIB_INT_CPPFLAGS "${MACRODEFFLAG}_NOMPI")
set(ADIOSLIB_INT_CFLAGS "")
set(ADIOSLIB_INT_LDADD "")
set(ADIOSREADLIB_CPPFLAGS "")
set(ADIOSREADLIB_CFLAGS "")
set(ADIOSREADLIB_LDADD "")
set(ADIOSREADLIB_SEQ_CPPFLAGS "${MACRODEFFLAG}_NOMPI")
set(ADIOSREADLIB_SEQ_CFLAGS "")
set(ADIOSREADLIB_SEQ_LDADD "")

if(NOT NO_DATATAP)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${DT_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${DT_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${DT_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${DT_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${DT_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${DT_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${DT_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${DT_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${DT_LIBS})
endif()

if(HAVE_DATASPACES)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${DATASPACES_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${DATASPACES_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${DATASPACES_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${DATASPACES_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${DATASPACES_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${DATASPACES_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${DATASPACES_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${DATASPACES_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${DATASPACES_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${DATASPACES_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${DATASPACES_LIBS})
endif()

if(HAVE_DIMES)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${DIMES_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${DIMES_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${DIMES_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${DIMES_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${DIMES_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${DIMES_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${DIMES_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${DIMES_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${DIMES_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${DIMES_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${DIMES_LIBS})
endif()

if(HAVE_FLEXPATH)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${FP_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${FP_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${FP_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${FP_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${FP_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${FP_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${FP_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${FP_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${FP_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${FP_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${FP_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${FP_LIBS})
endif(HAVE_FLEXPATH)

if(HAVE_NSSI)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${NSSI_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${NSSI_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${NSSI_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${NSSI_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${NSSI_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${NSSI_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${NSSI_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${NSSI_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${NSSI_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${NSSI_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${NSSI_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${NSSI_LIBS})
endif()

if(HAVE_NC4PAR)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${NC4PAR_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${NC4PAR_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${NC4PAR_LIBS})
endif()

if(HAVE_PHDF5)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${PHDF5_FLAGS}")
#  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${PHDF5_FLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${PHDF5_LIBS})
endif()

if(HAVE_PORTALS)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${PORTALS_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${PORTALS_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${PORTALS_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${PORTALS_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${PORTALS_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${PORTALS_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${PORTALS_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${PORTALS_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${PORTALS_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${PORTALS_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${PORTALS_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${PORTALS_LIBS})
endif()

if(HAVE_INFINIBAND)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${INFINIBAND_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${INFINIBAND_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${INFINIBAND_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${INFINIBAND_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${INFINIBAND_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${INFINIBAND_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${INFINIBAND_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${INFINIBAND_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${INFINIBAND_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${INFINIBAND_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${INFINIBAND_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${INFINIBAND_LIBS})
endif()

if(HAVE_CRAY_PMI)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${CRAY_PMI_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${CRAY_PMI_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${CRAY_PMI_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${CRAY_PMI_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${CRAY_PMI_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${CRAY_PMI_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${CRAY_PMI_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${CRAY_PMI_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${CRAY_PMI_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${CRAY_PMI_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${CRAY_PMI_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${CRAY_PMI_LIBS})
endif()

if(HAVE_CRAY_UGNI)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${CRAY_UGNI_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${CRAY_UGNI_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${CRAY_UGNI_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${CRAY_UGNI_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${CRAY_UGNI_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${CRAY_UGNI_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${CRAY_UGNI_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${CRAY_UGNI_LIBS})
endif()

if(HAVE_NETCDF)
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${NETCDF_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${NETCDF_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${NETCDF_LIBS})
endif()

if(HAVE_HDF5)
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${HDF5_FLAGS}")
#  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${HDF5_FLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${HDF5_LIBS})
endif()

if(HAVE_DMALLOC)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${MACRODEFFLAG}DMALLOC ${DMALLOC_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${DMALLOC_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${DMALLOC_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${DMALLOC_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${DMALLOC_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${DMALLOC_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${DMALLOC_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${DMALLOC_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${DMALLOC_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${DMALLOC_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${DMALLOC_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${DMALLOC_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${DMALLOC_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${DMALLOC_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${DMALLOC_LIBS})
endif()

if(HAVE_LUSTRE)
#  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${LUSTRE_CPPFLAGS}")
#  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${LUSTRE_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${LUSTRE_LIBS})
#  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${LUSTRE_CPPFLAGS}")
#  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${LUSTRE_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${LUSTRE_LIBS})
endif()

if(HAVE_FGR)
    set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${FGR_CPPFLAGS}")
    set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${FGR_CFLAGS}")
    set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${FGR_LIBS})
    set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${FGR_CPPFLAGS}")
    set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${FGR_CFLAGS}")
    set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${FGR_LIBS})
endif()

if(HAVE_GLIB)
    set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${GLIB_CPPFLAGS}")
    set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${GLIB_CFLAGS}")
    set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${GLIB_LIBS})
    set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${GLIB_CPPFLAGS}")
    set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${GLIB_CFLAGS}")
    set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${GLIB_LIBS})
endif()

if(HAVE_ZLIB)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DZLIB ${ZLIB_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${ZLIB_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${ZLIB_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DZLIB ${ZLIB_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${ZLIB_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ZLIB_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DZLIB ${ZLIB_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${ZLIB_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ZLIB_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DZLIB ${ZLIB_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${ZLIB_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ZLIB_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DZLIB ${ZLIB_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${ZLIB_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ZLIB_LIBS})
endif()

if(HAVE_LZ4)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DLZ4 ${LZ4_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${LZ4_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${LZ4_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DLZ4 ${LZ4_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${LZ4_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${LZ4_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DLZ4 ${LZ4_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${LZ4_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${LZ4_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DLZ4 ${LZ4_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${LZ4_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${LZ4_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DLZ4 ${LZ4_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${LZ4_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${LZ4_LIBS})
endif()

if(HAVE_BLOSC)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DBLOSC ${BLOSC_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${BLOSC_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${BLOSC_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DBLOSC ${BLOSC_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${BLOSC_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${BLOSC_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DBLOSC ${BLOSC_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${BLOSC_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${BLOSC_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DBLOSC ${BLOSC_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${BLOSC_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${BLOSC_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DBLOSC ${BLOSC_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${BLOSC_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${BLOSC_LIBS})
endif()

if(HAVE_BZIP2)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DBZIP2 ${BZIP2_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${BZIP2_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${BZIP2_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DBZIP2 ${BZIP2_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${BZIP2_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${BZIP2_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DBZIP2 ${BZIP2_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${BZIP2_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${BZIP2_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DBZIP2 ${BZIP2_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${BZIP2_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${BZIP2_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DBZIP2 ${BZIP2_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${BZIP2_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${BZIP2_LIBS})
endif()

if(HAVE_SZIP)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DSZIP ${SZIP_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${SZIP_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${SZIP_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DSZIP ${SZIP_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${SZIP_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${SZIP_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DSZIP ${SZIP_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${SZIP_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${SZIP_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DSZIP ${SZIP_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${SZIP_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${SZIP_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} -DSZIP ${SZIP_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${SZIP_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${SZIP_LIBS})
endif()

if(HAVE_ISOBAR)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DISOBAR ${ISOBAR_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${ISOBAR_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${ISOBAR_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DISOBAR ${ISOBAR_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${ISOBAR_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ISOBAR_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DISOBAR ${ISOBAR_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${ISOBAR_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ISOBAR_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DISOBAR ${ISOBAR_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${ISOBAR_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ISOBAR_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DISOBAR ${ISOBAR_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${ISOBAR_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ISOBAR_LIBS})
endif()

if(HAVE_APLOD)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DAPLOD ${APLOD_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${APLOD_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${APLOD_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DAPLOD ${APLOD_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${APLOD_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${APLOD_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DAPLOD ${APLOD_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${APLOD_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${APLOD_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DAPLOD ${APLOD_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${APLOD_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${APLOD_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DAPLOD ${APLOD_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${APLOD_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${APLOD_LIBS})
endif()

if(HAVE_ALACRITY)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DALACRITY ${ALACRITY_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${ALACRITY_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${ALACRITY_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DALACRITY ${ALACRITY_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${ALACRITY_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ALACRITY_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DALACRITY ${ALACRITY_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${ALACRITY_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ALACRITY_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DALACRITY ${ALACRITY_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${ALACRITY_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ALACRITY_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DALACRITY ${ALACRITY_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${ALACRITY_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ALACRITY_LIBS})
endif()

if(HAVE_ZFP)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${ZFP_CPPFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${ZFP_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${ZFP_CPPFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ZFP_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${ZFP_CPPFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ZFP_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${ZFP_CPPFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ZFP_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${ZFP_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ZFP_LIBS})
endif()

if(HAVE_ZCHECKER)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${ZCHECKER_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${ZCHECKER_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${ZCHECKER_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${ZCHECKER_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${ZCHECKER_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ZCHECKER_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${ZCHECKER_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${ZCHECKER_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ZCHECKER_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${ZCHECKER_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${ZCHECKER_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ZCHECKER_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${ZCHECKER_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${ZCHECKER_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ZCHECKER_LIBS})
endif()

if(HAVE_SZ)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${SZ_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${SZ_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${SZ_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${SZ_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${SZ_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${SZ_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${SZ_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${SZ_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${SZ_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${SZ_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${SZ_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${SZ_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} ${SZ_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${SZ_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${SZ_LIBS})
endif()

if(HAVE_MGARD)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} ${MGARD_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${MGARD_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${MGARD_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} ${MGARD_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${MGARD_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${MGARD_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} ${MGARD_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${MGARD_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${MGARD_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} ${MGARD_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${MGARD_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${MGARD_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} ${MGARD_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${MGARD_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${MGARD_LIBS})
endif()

if(HAVE_FASTBIT)
  set(ADIOSLIB_CPPFLAGS "${ADIOSLIB_CPPFLAGS} -DFASTBIT ${FASTBIT_CPPFLAGS}")
  set(ADIOSLIB_CFLAGS "${ADIOSLIB_CFLAGS} ${FASTBIT_CFLAGS}")
  set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${FASTBIT_LIBS})
  set(ADIOSLIB_SEQ_CPPFLAGS "${ADIOSLIB_SEQ_CPPFLAGS} -DFASTBIT ${FASTBIT_CPPFLAGS}")
  set(ADIOSLIB_SEQ_CFLAGS "${ADIOSLIB_SEQ_CFLAGS} ${FASTBIT_CFLAGS}")
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${FASTBIT_LIBS})
  set(ADIOSLIB_INT_CPPFLAGS "${ADIOSLIB_INT_CPPFLAGS} -DFASTBIT ${FASTBIT_CPPFLAGS}")
  set(ADIOSLIB_INT_CFLAGS "${ADIOSLIB_INT_CFLAGS} ${FASTBIT_CFLAGS}")
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${FASTBIT_LIBS})
  set(ADIOSREADLIB_CPPFLAGS "${ADIOSREADLIB_CPPFLAGS} -DFASTBIT ${FASTBIT_CPPFLAGS}")
  set(ADIOSREADLIB_CFLAGS "${ADIOSREADLIB_CFLAGS} ${FASTBIT_CFLAGS}")
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${FASTBIT_LIBS})
  set(ADIOSREADLIB_SEQ_CPPFLAGS "${ADIOSREADLIB_SEQ_CPPFLAGS} -DFASTBIT ${FASTBIT_CPPFLAGS}")
  set(ADIOSREADLIB_SEQ_CFLAGS "${ADIOSREADLIB_SEQ_CFLAGS} ${FASTBIT_CFLAGS}")
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${FASTBIT_LIBS})
endif()


set(ADIOSLIB_LDADD ${ADIOSLIB_LDADD} ${M_LIBS})
set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${M_LIBS})
set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${M_LIBS})
set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${M_LIBS})
set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${M_LIBS})
############################### srart of top CMakeLists.txt ###############################
#install(PROGRAMS adios_config DESTINATION ${bindir})

#if(HAVE_NSSI)
#install(PROGRAMS scripts/create.nssi.config.sh DESTINATION ${bindir})
#install(PROGRAMS scripts/kill.nssi.staging.sh DESTINATION ${bindir})
#install(PROGRAMS scripts/start.nssi.staging.sh DESTINATION  ${bindir})
#endif(HAVE_NSSI)



#add_definitions(-DO_LARGEFILE=0)

get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
message(STATUS "${_LANGUAGES_}")

#####################start processing adios_config.flags.in #####################
set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

string(REGEX REPLACE ";" " " ADIOSLIB_LDADD_M "${ADIOSLIB_LDADD}")
string(REGEX REPLACE ";" " " ADIOSREADLIB_LDADD_M "${ADIOSREADLIB_LDADD}")
string(REGEX REPLACE ";" " " ADIOSREADLIB_SEQ_LDADD_M "${ADIOSREADLIB_SEQ_LDADD}")
string(REGEX REPLACE ";" " " ADIOSLIB_SEQ_LDADD_M "${ADIOSLIB_SEQ_LDADD}")
string(REGEX REPLACE ";" " " ADIOSLIB_INT_LDADD_M "${ADIOSLIB_INT_LDADD}")

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/adios_config.flags.cmake ${CMAKE_CURRENT_BINARY_DIR}/adios_config.flags @ONLY)
#####################end of processing adios_config.flags.in #####################
#####################start processing adios_config.flags.in #####################
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/adios_config.makesrc.in ${CMAKE_CURRENT_BINARY_DIR}/adios_config @ONLY)
#####################end of processing adios_config.flags.in #####################
install(FILES ${CMAKE_BINARY_DIR}/adios_config.flags DESTINATION ${sysconfdir})
install(PROGRAMS ${CMAKE_BINARY_DIR}/adios_config DESTINATION ${bindir})
install(FILES ${PROJECT_SOURCE_DIR}/scripts/FindADIOS.cmake DESTINATION ${sysconfdir})
#install(FILES ${PROJECT_SOURCE_DIR}/adios_git_status DESTINATION ${sysconfdir})


################ Add EXTRA_LIBS to LIBS now, e.g. internal mxml library not needed for linking ###########

if (NOT BUILD_MXML)
  set(ADIOSLIB_LDADD     ${ADIOSLIB_LDADD}     ${MXML_LIBS})
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${MXML_LIBS})
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${MXML_LIBS})
endif()

if (NOT BUILD_ZFP)
  set(ADIOSLIB_LDADD     ${ADIOSLIB_LDADD}     ${ZFP_LIBS})
  set(ADIOSLIB_SEQ_LDADD ${ADIOSLIB_SEQ_LDADD} ${ZFP_LIBS})
  set(ADIOSLIB_INT_LDADD ${ADIOSLIB_INT_LDADD} ${ZFP_LIBS})
  set(ADIOSREADLIB_LDADD ${ADIOSREADLIB_LDADD} ${ZFP_LIBS})
  set(ADIOSREADLIB_SEQ_LDADD ${ADIOSREADLIB_SEQ_LDADD} ${ZFP_LIBS})
endif()

add_subdirectory(src)
add_subdirectory(utils)
add_subdirectory(tests)
add_subdirectory(examples)
############################### end of top CMakeLists.txt ###############################

message("*********************************")
message("${PACKAGE} configured as follows:")
message("*********************************")
message("")
if(BUILD_WRITE)
  message("  - Build both the Write and Read libraries")
else()
  message("  - Build only the Read libraries")
endif()
if(BUILD_FORTRAN)
  message("  - Build both the C and Fortran libraries")
else()
  message("  - Build only the C libraries (no Fortran)")
endif()
message("")
message("  - General Compile FLAGS")
message("      - CC  = $ENV{CC}")
message("      - CXX = $ENV{CXX}")
message("      - FC  = $ENV{FC}")
message("      - CPPFLAGS = ${CPPFLAGS}")
message("      - CFLAGS   = ${CFLAGS}")
message("      - CXXFLAGS = ${CXXFLAGS}")
message("      - FCFLAGS  = ${FCFLAGS}")
message("      - LIBS     = ${LIBS}")
message("      - MPILIBS  = ${MPILIBS}")
message("")

if(ADIOS_TIMERS)
 message("  - ADIOS Timers Enabled")
else()
  message("  - ADIOS Timers Disabled")
endif()

if(ADIOS_TIMER_EVENTS)
 message("  - ADIOS Timer Events Enabled")
else()
  message("  - ADIOS Timer Events Disabled")
endif()

if(BUILD_MXML)
  message("  - MXML -- Build with ADIOS")
else(BUILD_MXML)
  if(HAVE_MXML)
    message("  - MXML")
    message("      - MXML INCLUDE DIR = ${MXML_INCLUDE_DIR}")
    message("      - MXML_LIBS = ${MXML_LIBS}")
    message("")
  else(HAVE_MXML)
    message("  - No MXML")
  endif(HAVE_MXML)
endif(BUILD_MXML)

if(HAVE_LUSTRE)
  message("  - LUSTRE")
  message("      - LUSTRE_CFLAGS = ${LUSTRE_CFLAGS}")
  message("      - LUSTRE_CPPFLAGS = ${LUSTRE_CPPFLAGS}")
  message("      - LUSTRE_LIBS = ${LUSTRE_LIBS}")
  message("")
else()
  message("  - No LUSTRE")
endif()

if(HAVE_FGR)
    message("  - FGR")
    message("      - FGR_CFLAGS = ${FGR_CFLAGS}")
    message("      - FGR_CPPFLAGS = ${FGR_CPPFLAGS}")
    message("      - FGR_LIBS = ${FGR_LIBS}")
else()
  message("  - No FGR")
endif()

if(HAVE_GLIB)
  message("  - GLIB")
  message("      - GLIB_CFLAGS = ${GLIB_CFLAGS}")
  message("      - GLIB_CPPFLAGS = ${GLIB_CPPFLAGS}")
  message("      - GLIB_LIBS = ${GLIB_LIBS}")
else()
  message("  - No GLIB")
endif()

message("  - Networking library for staging methods:")
if(HAVE_PORTALS)
  message("    - PORTALS")
  message("      - PORTALS_CFLAGS = ${PORTALS_CFLAGS}")
  message("      - PORTALS_CPPFLAGS = ${PORTALS_CPPFLAGS}")
  message("      - PORTALS_LIBS = ${PORTALS_LIBS}")
  message("")
endif()

if(HAVE_INFINIBAND)
  message("    - INFINIBAND")
  message("      - INFINIBAND_CFLAGS = ${INFINIBAND_CFLAGS}")
  message("      - INFINIBAND_CPPFLAGS = ${INFINIBAND_CPPFLAGS}")
  message("      - INFINIBAND_LIBS = ${INFINIBAND_LIBS}")
  message("")
endif()

if(HAVE_CRAY_PMI AND HAVE_CRAY_UGNI)
  message("    - CRAY uGNI with PMI")
  message("      - CFLAGS = ${CRAY_PMI_CFLAGS} ${CRAY_UGNI_CFLAGS}")
  message("      - CPPFLAGS = ${CRAY_PMI_CPPFLAGS} ${CRAY_UGNI_CPPFLAGS}")
  message("      - LIBS = ${CRAY_PMI_LIBS} ${CRAY_UGNI_LIBS}")
  message("")
endif()

if(HAVE_DCMF)
  message("    - IBM DCMF")
  message("      - DCMF_CFLAGS = ${DCMF_CFLAGS}")
  message("      - DCMF_CPPFLAGS = ${DCMF_CPPFLAGS}")
  message("      - DCMF_LIBS = ${DCMF_LIBS}")
  message("")
endif()

if(HAVE_DATASPACES)
  message("  - DATASPACES transport method")
  message("      - DATASPACES_CFLAGS = ${DATASPACES_CFLAGS}")
  message("      - DATASPACES_CPPFLAGS = ${DATASPACES_CPPFLAGS}")
  message("      - DATASPACES_LIBS = ${DATASPACES_LIBS}")
  message("")
else()
  message("  - No DATASPACES to build DATASPACES transport method")
endif()

if(HAVE_DIMES)
  message("  - DIMES transport method")
  message("      - DIMES_CFLAGS = ${DIMES_CFLAGS}")
  message("      - DIMES_CPPFLAGS = ${DIMES_CPPFLAGS}")
  message("      - DIMES_LIBS = ${DIMES_LIBS}")
  message("")
else()
  message("  - No DIMES to build DIMES transport method")
endif()

if(HAVE_PHDF5)
  message("  - PHDF5")
  message("      - PHDF5_CFLAGS = ${PHDF5_CFLAGS}")
  message("      - PHDF5_CPPFLAGS = ${PHDF5_FLAGS}")
  message("      - PHDF5_LIBS = ${PHDF5_LIBS}")
  message("")
else()
  message("  - No PHDF5 to build PHDF5 transport method")
endif()

if(HAVE_HDF5)
  message("  - HDF5")
  message("      - HDF5_CFLAGS = ${HDF5_CFLAGS}")
  message("      - HDF5_FLAGS = ${HDF5_FLAGS}")
  message("      - HDF5_LIBS = ${HDF5_LIBS}")
  message("")
else()
  message("  - No HDF5")
endif()

if(HAVE_NC4PAR)
  message("  - NetCDF 4 Parallel")
  message("      - NC4PAR_CFLAGS = ${NC4PAR_CFLAGS}")
  message("      - NC4PAR_CPPFLAGS = ${NC4PAR_CPPFLAGS}")
  message("      - NC4PAR_LIBS = ${NC4PAR_LIBS}")
  message("")
else()
  message("  - No NETCDF 4 Parallel to build NC4 transport method")
endif()

if(HAVE_NETCDF)
  message("  - NetCDF")
  message("      - NETCDF_CFLAGS = ${NETCDF_CFLAGS}")
  message("      - NETCDF_CPPFLAGS = ${NETCDF_CPPFLAGS}")
  message("      - NETCDF_LIBS = ${NETCDF_LIBS}")
  message("")
else()
  message("  - No NetCDF")
endif()

if(HAVE_FLEXPATH)
  message("  - FLEXPATH")
  message("      - FP_CFLAGS = ${FP_CFLAGS}")
  message("      - FP_CPPFLAGS = ${FP_CPPFLAGS}")
  message("      - FP_LIBS = ${FP_LIBS}")
  message("")
else()
  message("  - No FLEXPATH to build FLEXPATH transport method")
endif()

if(HAVE_ICEE)
  message("  - ICEE")
  message("      - FP_CFLAGS = ${FP_CFLAGS}")
  message("      - FP_CPPFLAGS = ${FP_CPPFLAGS}")
  message("      - FP_LIBS = ${FP_LIBS}")
  message("")
else()
  message("  - No ICEE to build ICEE transport method")
endif()

if(HAVE_ZLIB)
  message("  - ZLIB")
  message("      - ZLIB_CFLAGS = ${ZLIB_CFLAGS}")
  message("      - ZLIB_CPPFLAGS = ${ZLIB_CPPFLAGS}")
  message("      - ZLIB_LIBS = ${ZLIB_LIBS}")
  message("")
else()
  message("  - No ZLIB to build ZLIB transform method")
endif()

if(HAVE_LZ4)
  message("  - LZ4")
  message("      - LZ4_CFLAGS = ${LZ4_CFLAGS}")
  message("      - LZ4_CPPFLAGS = ${LZ4_CPPFLAGS}")
  message("      - LZ4_LIBS = ${LZ4_LIBS}")
  message("")
else()
  message("  - No LZ4 to build LZ4 transform method")
endif()

if(HAVE_BLOSC)
  message("  - BLOSC")
  message("      - BLOSC_CFLAGS = ${BLOSC_CFLAGS}")
  message("      - BLOSC_CPPFLAGS = ${BLOSC_CPPFLAGS}")
  message("      - BLOSC_LIBS = ${BLOSC_LIBS}")
  message("")
else()
  message("  - No BLOSC to build BLOSC transform method")
endif()

if(HAVE_BZIP2)
  message("  - BZIP2")
  message("      - BZIP2_CFLAGS = ${BZIP2_CFLAGS}")
  message("      - BZIP2_CPPFLAGS = ${BZIP2_CPPFLAGS}")
  message("      - BZIP2_LIBS = ${BZIP2_LIBS}")
  message("")
else()
  message("  - No BZIP2 to build BZIP2 transform method")
endif()

if(HAVE_SZIP)
  message("  - SZIP")
  message("      - SZIP_CFLAGS = ${SZIP_CFLAGS}")
  message("      - SZIP_CPPFLAGS = ${SZIP_CPPFLAGS}")
  message("      - SZIP_LIBS = ${SZIP_LIBS}")
  message("")
else()
  message("  - No SZIP to build SZIP transform method")
endif()

if(HAVE_ISOBAR)
  message("  - ISOBAR")
  message("      - ISOBAR_CFLAGS = ${ISOBAR_CFLAGS}")
  message("      - ISOBAR_CPPFLAGS = ${ISOBAR_CPPFLAGS}")
  message("      - ISOBAR_LIBS = ${ISOBAR_LIBS}")
  message("")
else()
  message("  - No ISOBAR to build ISOBAR transform method")
endif()

if(HAVE_APLOD)
  message("  - APLOD")
  message("      - APLOD_CFLAGS = ${APLOD_CFLAGS}")
  message("      - APLOD_CPPFLAGS = ${APLOD_CPPFLAGS}")
  message("      - APLOD_LIBS = ${APLOD_LIBS}")
message("")
else()
  message("  - No APLOD to build APLOD transform method")
endif()

if(HAVE_FASTBIT)
  message("  - FASTBIT")
  message("      - FASTBIT_CFLAGS = ${FASTBIT_CFLAGS}")
  message("      - FASTBIT_CPPFLAGS = ${FASTBIT_CPPFLAGS}")
  message("      - FASTBIT_LIBS = ${FASTBIT_LIBS}")
  message("")
else()
  message("  - No FASTBIT to build FASTBIT query method")
endif()

if(HAVE_ALACRITY)
  message("  - ALACRITY")
  message("      - ALACRITY_CFLAGS = ${ALACRITY_CFLAGS}")
  message("      - ALACRITY_CPPFLAGS = ${ALACRITY_CPPFLAGS}")
  message("      - ALACRITY_LIBS = ${ALACRITY_LIBS}")
  message("")
else()
  message("  - No ALACRITY to build ALACRITY transform & query method")
endif()

if(BUILD_ZFP)
  message("  - ZFP is built with ADIOS")
elseif (HAVE_ZFP)
    message("  - ZFP")
    message("      - ZFP_CPPFLAGS = ${ZFP_CPPFLAGS}")
    message("      - ZFP_LIBS = ${ZFP_LIBS}")
    message("")
else()
    message("  - No ZFP to build ZFP transform method")
endif()

if(HAVE_SZ)
  message("  - SZ")
  message("      - SZ_CFLAGS = ${SZ_CFLAGS}")
  message("      - SZ_CPPFLAGS = ${SZ_CPPFLAGS}")
  message("      - SZ_LIBS = ${SZ_LIBS}")
  message("")
else()
  message("  - No SZ to build SZ transform method")
endif()

if(HAVE_MGARD)
  message("  - MGARD")
  message("      - MGARD_CFLAGS = ${MGARD_CFLAGS}")
  message("      - MGARD_CPPFLAGS = ${MGARD_CPPFLAGS}")
  message("      - MGARD_LIBS = ${MGARD_LIBS}")
  message("")
else()
  message("  - No MGARD to build MGARD transform method")
endif()

if(HAVE_ZCHECKER)
  message("  - ZCHECKER")
  message("      - ZCHECKER_CFLAGS = ${ZCHECKER_CFLAGS}")
  message("      - ZCHECKER_CPPFLAGS = ${ZCHECKER_CPPFLAGS}")
  message("      - ZCHECKER_LIBS = ${ZCHECKER_LIBS}")
  message("")
else()
  message("  - No Z-Checker to build ZCHECKER transform method")
endif()

if(HAVE_BGQ)
  message("  - BGQ METHOD is enabled")
else()
  message("  - BGQ METHOD is disabled")
endif()

message("")
message("  - Install path = ${prefix}")
message("")