File: configure.ac

package info (click to toggle)
rheolef 7.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 88,076 kB
  • sloc: cpp: 110,259; sh: 16,733; makefile: 5,438; python: 1,391; yacc: 218; javascript: 203; xml: 191; awk: 61; sed: 5
file content (1948 lines) | stat: -rw-r--r-- 75,674 bytes parent folder | download | duplicates (2)
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
dnl
dnl This file is part of Rheolef.
dnl
dnl Copyright (C) 2000-2018 Pierre Saramito 
dnl
dnl Rheolef is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl Rheolef is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Rheolef; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dnl =========================================================================
dnl
dnl configure.in: script source file
dnl
dnl author: Pierre.Saramito@imag.fr
dnl
dnl date: 14 january 1999
dnl
dnl note: enter 'make INSTALL' to extract installation documentation
dnl
dnl documentation "INSTALL" is extracted from this file by selecting 
dnl lines string with "dnl #" :
dnl #The simplest install procedure is as the `root` user:
dnl #
dnl #    ./configure
dnl #    make
dnl #    sudo make install
dnl #
dnl #The `configure` program is a script that runs tests of your system
dnl #and the availability of some required and optional libraries for Rheolef.
dnl #Upon termination, it prints a summary and generates two files:
dnl #`config/config.mk` and `config/config.h`.
dnl #The `make` program then runs the conpilation and
dnl #the `make install` stage copies the produced files.
dnl #By default, the main destination directory is `/usr/local`.
dnl #Commands are installed in `/usr/local/bin`, libraries in `/usr/local/lib`,
dnl #headers in `/usr/local/include` and the documentation in `/usr/local/share`.
dnl #
dnl #Alternative install directory
dnl #=============================
dnl #
dnl #Since the default install prefix is `/usr/local`, it requires to
dnl #be logged as `root` in order to install.
dnl #If you are not the `root` user, or prefer
dnl #an alternative install directory, e.g. `$HOME/sys`, enter:
dnl #
dnl #    ./configure --prefix="$HOME/sys"
dnl #
dnl #In that case, you have to add the following lines at the end
dnl #of your `.profile` or `.bash_profile` file:
dnl #
dnl #    export PATH="$HOME/sys/bin:$PATH"
dnl #    export LD_LIBRARY_PATH="$HOME/sys/lib:$LD_LIBRARY_PATH"
dnl #    export MANPATH="$HOME/sys/man:$MANPATH"
dnl #
dnl #Assuming you are using the `sh` or the `bash` unix interpreter.
dnl #Conversely, if you are using `csh` or `tcsh`, add
dnl #at the bottom of your `.cshrc` file:
dnl #
dnl #    set path = ("$HOME/sys/bin" $path)
dnl #    setenv LD_LIBRARY_PATH "$HOME/sys/lib:$LD_LIBRARY_PATH"
dnl #    setenv MANPATH "$HOME/sys/man:$MANPATH"
dnl #
dnl #If you are unsure about unix interpreter, get the SHELL value:
dnl #
dnl #    echo $SHELL
dnl #
dnl #Then, you have to `source` the modified file, e.g.:
dnl #
dnl #    source ~/.bashrc
dnl #
dnl #HPUX users should replace `LD_LIBRARY_PATH` by `SHLIB_PATH`.
dnl #If you are unsure, get the shared library path variable:
dnl #
dnl #    rheolef-config --shlibpath-var
dnl #
dnl #Check also your installation by compiling a sample
dnl #program with the installed library:
dnl #
dnl #    make installcheck
dnl #
dnl #Since it is a common mistake, you can later, at each time, test
dnl #your run-time environment sanity with:
dnl #
dnl #    rheolef-config --check
dnl #
dnl #Required libraries
dnl #==================
dnl #
dnl #The following required libraries are available as precompiled packages under
dnl #Debian GNU/Linux and Ubuntu systems.
dnl #
dnl #The `boost` library.
dnl #  It provides useful extensions of the c++ standard template library.
dnl #  See http://www.boost.org .
dnl #
dnl #The `eigen` library.
dnl #  It provides efficient c++ linear algebra subroutines.
dnl #  See http://eigen.tuxfamily.org .
dnl #
dnl #Recommended libraries
dnl #=====================
dnl #The following libraries are optional but highly recommended.
dnl #
dnl #The `umfpack` library.
dnl #  It provides a multifrontal sparse direct solver.
dnl #  Rheolef solvers run faster when using this library.
dnl #  See http://faculty.cse.tamu.edu/davis/suitesparse.html .
dnl #
dnl #The `cgal` library.
dnl #  It provide an easy access to efficient and reliable geometric algorithms.
dnl #  With it, Rheolef implements the characteristic method and interpolation from one mesh to another.
dnl #  This library is optional, but allows, when available, extended Rheolef features.
dnl #  See http://www.cgal.org .
dnl #
dnl #Parallel computations
dnl #=====================
dnl #
dnl #With the optional following libraries, Rheolef is able to run in parallel and
dnl #and with distributed memory.
dnl #By default, the Rheolef `configure` script tries to autodetect these
dnl #libraries and be able to run in parallel.
dnl #When these libraries are not found, the distributed features are turned off.
dnl #If your libraries are installed in a non-standard location, you should
dnl #indicate it by a suitable `configure` option. See below for these options.
dnl #
dnl #A `mpi` library.
dnl #  Rheolef bases on `mpi`, the message passing interface standard.
dnl #  A popular implementation is the `openmpi` library.
dnl #  When no `mpi` library is found, the distributed feature is turned off.
dnl #
dnl #The `mumps` library.
dnl #  It is a massively distributed sparse direct solver.
dnl #  The use of implicit numerical schemes leads to the
dnl #  resolution of large sparse linear systems.
dnl #  See http://graal.ens-lyon.fr/MUMPS .
dnl #  When `mumps` is not found, the distributed feature is turned off.
dnl #
dnl #Either the `scotch` or the `metis` library.
dnl #  It provides the distributed mesh partitioning.
dnl #  For `scotch` see http://www.labri.fr/perso/pelegrin/scotch 
dnl #  and for `metis` see http://www.cs.umn.edu/~metis .
dnl #  When neither `scotch` nor `metis` are founded, the distributed feature is turned off.
dnl #
dnl #The `trilinos/ifpack` library.
dnl #  It provides a distributed preconditioner used for iterative solvers.
dnl #  See http://trilinos.sandia.gov .
dnl #  When `trilinos` is not available, a less efficient builtin IC0 preconditioner is used.
dnl #  The `trilinos` support is actually broken, it will be available in a forthcoming version.
dnl #
dnl #Run-time tools
dnl #==============
dnl #
dnl #Using Rheolef suggests the use of the following optional tools
dnl #for pre- and post-processing purpose:
dnl #
dnl #    gmsh
dnl #    gnuplot
dnl #    paraview
dnl #
dnl #None of these tools are required when building and installing Rheolef.
dnl #
dnl #Tools for developpers
dnl #=====================
dnl #
dnl #These tools are required if you build from the development version,
dnl #from the `git` repository:
dnl #
dnl #- Re-generating some source files, as initiated with the `bootstrap` command,
dnl #  requires the `autotools` suite: `autoconf`, `automake` and `libtool`.
dnl #- It requires also `flex` and `bison` for building file format parsers.
dnl #
dnl #Portability issues
dnl #==================
dnl #
dnl #Rheolef is based on standard C++ and the `boost` library.
dnl #Therefore you need a compiler that supports at least the 2011 C++ standards.
dnl #
dnl #Current distributed version of Rheolef has been heavily tested with GNU C++, CLANG C++
dnl #and INTEL C++ on debian, ubuntu, mint, suse and redhat GNU/Linux systems for various
dnl #32 and 64 bits architectures, with massively distributed memories and processes.
dnl #Successful installation from sources on MAC-OS-X systems has been also repported 
dnl #recently.
dnl #
dnl #- The GNU C++ compiler `g++` is a free software
dnl #  available at http://www.gnu.org .
dnl #- The CLANG C++ compiler `clang++` is also a free software
dnl #  available at http://clang.llvm.org .
dnl #- The Intel C++ compiler is a privative software.
dnl #
dnl #So, the Rheolef library is expected to compile without problems
dnl #with one of these compilers.
dnl #If you are running a another compiler and operating system combination,
dnl #please run the non-regression test suite:
dnl #
dnl #    make check
dnl #
dnl #Please, send mails and bug reports to the mailing list mailto:rheolef@grenet.fr .
dnl #
dnl #
dnl #Older Rheolef 5.x versions was tested also on the
dnl #KAI  C++ compiler (KCC-3.2b) and the
dnl #CRAY C++ compiler (CC-3.0.2.0)
dnl #on the following operating systems:
dnl #
dnl #- mac os x (i386-apple-darwin9.8.0), using GNU C++
dnl #- sun solaris 2.8, ultrasparc, using GNU C++
dnl #- compacq OSF1 alpha (V5.1, V4.0), using Compacq C++
dnl #- aix 4.1 ibm sp2, multiprocessor based on rs6000
dnl #- cray unicos t3e, multiprocessor based on 64 bits dec alpha
dnl #- cray unicos c94
dnl #- hpux 9.05 and 10.20, hppa
dnl #- sgi irix 6.3, mips
dnl #- sun solaris 2.5.1, sparc
dnl #
dnl #where
dnl #
dnl #- The KAI C++ is available at http://www.kai.com .
dnl #- The CRAY C++ is available on CRAY platforms.
dnl #
dnl #Nevertheless, the current version has no more been tested
dnl #on these old compilers and systems.
dnl #
dnl #Configure options
dnl #=================
dnl #
dnl #If the required libraries are located in a non-standard directory, please use
dnl #the configure options:
dnl #
dnl #    ./configure --help
dnl #
dnl #and also consider the CXX, CXXFLAGS and LIBS variables, as in the following more complex
dnl #configure command:
dnl #
dnl #    CXX=clang++ CXXFLAGS=-I/misc/include LIBS="-L/misc/lib" ./configure
dnl #
dnl #Finaly, if troubles still persist after the configure step, you can also edit
dnl #directly the config/config.mk and config/config.h files. In these cases please also post
dnl #to the mailling list mailto:rheolef@grenet.fr for any portability problem.
dnl #
dnl #Here are all the supported configure command line options.
dnl #
dnl-------------------------------------------------------------------------
dnl #`-h`, `--help`
dnl #>       Display a summary of command line options and exit
dnl #`--help=short`
dnl #>       Display only options specific to Rheolef and exit
dnl-------------------------------------------------------------------------

dnl-------------------------------------------------------------------------
dnl   avoid config.cache creation (hpux9*: "sh internal 2K buffer overflow")
dnl-------------------------------------------------------------------------

define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl

dnl libtool creates a "conftest" subdir
dnl that persists when entering ^C :

chmod -R a+rwx conftest
rm -rf conftest

dnl-------------------------------------------------------------------------
dnl   init autoconf
dnl-------------------------------------------------------------------------

AC_INIT([rheolef], 7.2)

dnl echo "configure: testing ${srcdir}/config/config.h"
if test -f ${srcdir}/config/config.h; then
  if test -f ${srcdir}/config/config.h.cache && diff ${srcdir}/config/config.h ${srcdir}/config/config.h.cache >/dev/null ; then
    dnl echo "configure: conserving ${srcdir}/config/config.h in cache"
    rm -f ${srcdir}/config/config.h
  else
    dnl echo "configure: putting ${srcdir}/config/config.h in cache"
    mv ${srcdir}/config/config.h ${srcdir}/config/config.h.cache
  fi
dnl else
dnl   echo "configure: no ${srcdir}/config/config.h"
fi

AC_PREREQ([2.69])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])

dnl-------------------------------------------------------------------------
dnl   defines PACKAGE and VERSION
dnl-------------------------------------------------------------------------

PACKAGE="${PACKAGE_NAME}"
VERSION=`cat ${srcdir}/VERSION | sed -e 's/\([[0-9]]*\.[[0-9]]*\)-[[0-9]]*/\1/'`
if test x"${PACKAGE_VERSION}" != x"${VERSION}"; then
  echo "AC INIT: may be initialized with ${PACKAGE} version ${VERSION} instead of ${PACKAGE_VERSION}"
  exit 1
fi
echo "configuring $PACKAGE $VERSION..."
MINOR_VERSION=`echo $VERSION | awk -F. '{print $NF}'`
MAJOR_VERSION=`echo $VERSION | awk -F. '{i=NF-1; print $i}'`
MICRO_VERSION=`cat ${srcdir}/VERSION | sed -e 's/.*-//'`

# if test $MINOR_VERSION -ge 100; then
#    MINOR_VERSION=0
#    echo "** WARNING: VERSION $VERSION"
#    echo "** WARNING: MINOR_VERSION = $MINOR_VERSION should be < 100 (for library version setting)"
#    MAJOR_VERSION=`expr $MAJOR_VERSION + 1`
#    MINOR_VERSION=0
#    VERSION="$MAJOR_VERSION.$MINOR_VERSION"
#    echo "** WARNING: setting VERSION to $VERSION"
#    echo $VERSION > $srcdir/VERSION
#    echo 
# fi

# by default; try to activate distributed features
rheo_use_distributed=yes

dnl-------------------------------------------------------------------------
dnl   checking for autotools
dnl-------------------------------------------------------------------------
dnl automake 1.5 will suppose these checks done

AC_CHECK_PROGS(ACLOCAL, aclocal)
AC_CHECK_PROGS(AUTOHEADER, autoheader)
AC_CHECK_PROGS(AUTOCONF, autoconf)
AC_CHECK_PROGS(AUTOMAKE, automake)
AC_CHECK_PROGS(AMTAR, tar gtar)

dnl-------------------------------------------------------------------------
dnl   init automake
dnl-------------------------------------------------------------------------

AC_CONFIG_SRCDIR([config/install-sh])
AM_INIT_AUTOMAKE

AC_CONFIG_HEADERS([config/acconfig.h])

ACLOCAL_AMFLAGS="-I ${srcdir}/config"
AC_SUBST(ACLOCAL_AMFLAGS)
dnl see also in top Makefile.am: AUTOMAKE_OPTIONS = 1.5 dist-bzip2

dnl-------------------------------------------------------------------------
dnl   set PREFIX directory for installation
dnl-------------------------------------------------------------------------

default_prefix=/usr/local
AC_PREFIX_DEFAULT(${default_prefix})
test x"${prefix}" = x"NONE" && prefix=${default_prefix}

pkgdatadir=${prefix}/share/rheolef
AH_TEMPLATE([PKGDATADIR], Defines the package data directory)
AC_DEFINE_UNQUOTED(PKGDATADIR,"$pkgdatadir")

dnl libdir="${exec_prefix}/lib" by default,
dnl thus, we may eval the string:
test x"${exec_prefix}" = x"NONE" && exec_prefix=${prefix}
command="echo \"$libdir\""
rheolef_libdir=`eval $command`
AH_TEMPLATE([RHEOLEF_LIBDIR], Defines the object code libraries directory)
AC_DEFINE_UNQUOTED(RHEOLEF_LIBDIR,"${rheolef_libdir}")

dnl-------------------------------------------------------------------------
dnl   init C++
dnl-------------------------------------------------------------------------

AC_CANONICAL_HOST

USER_CFLAGS=${CFLAGS-"-O3"}
USER_CXXFLAGS="$CXXFLAGS"

AC_PROG_CC(gcc cc icc cl)
AC_PROG_CPP
AC_PROG_CXX(g++ c++ icpc KCC CC cc++ xlC aCC)
AC_PROG_CXXCPP

# when GNU C/C++ is recognized, force "-O2 -g" => skip it
CFLAGS="${USER_CFLAGS}"
CXXFLAGS="${USER_CXXFLAGS}"

dnl AC_LANG([C++])
AC_LANG(C++)

dnl-------------------------------------------------------------------------
dnl libtool
dnl-------------------------------------------------------------------------
_LT_SET_OPTION([LT_INIT],[disable-fast-install])
m4_warn([obsolete],[_LT_SET_OPTION([LT_INIT],[disable-fast-install])
m4_warn([obsolete],[AC_DISABLE_FAST_INSTALL: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])

AC_ENABLE_SHARED
AC_DISABLE_STATIC([])
LT_INIT

dnl since library interface (headers) are modified at each release
dnl libraries are numbered libxxx.so.421.0.0 if VERSION=4.21
LIBRARY_VERSION=${VERSION}
AC_SUBST(LIBRARY_VERSION)
LIBTOOL_VERSION_INFO="-version-info ${MAJOR_VERSION}:${MINOR_VERSION}:0"
LIBTOOL_RELEASE="-release ${MAJOR_VERSION}.${MINOR_VERSION}"

dnl libtool init has computed the name of the environment variable SHLIBPATH
dnl thus, propagate it:
AC_SUBST(LIBTOOL_VERSION_INFO)
AC_SUBST(LIBTOOL_RELEASE)

dnl-------------------------------------------------------------------------
dnl #`--with-float`=option
dnl #>       Turns on/off the extended arithmetic feature.
dnl #>       The *option* could be either
dnl #>       `float128` (quadruple precision, 32 digits),
dnl #>       or the default `double` (double precision, 16 digits).
dnl-------------------------------------------------------------------------
rheo_float_ext=""
rheo_have_float128="no"
AC_ARG_WITH(float,
    [  --with-float[[=ARG]]            the extended floating arithmetic (default ARG=double, otherwise long-double or float128) ],
    [  case "${withval}" in
          yes|no) rheo_float_ext="";;
          *)      rheo_float_ext=${withval};;
       esac],
    [  rheo_float_ext="" ]
)
if test x"$rheo_float_ext" = x"float128"; then
  rheo_have_float128=yes
elif test x"$rheo_float_ext" = x"long-double"; then
  AC_DEFINE([HAVE_LONG_DOUBLE], [1], [Define to 1 if you use long double as default float type])
  AC_SUBST(QD_EXT)
  QD_EXT=".dd"
elif test x"$rheo_float_ext" = x"double"; then
  rheo_float_ext=""
elif test x"$rheo_float_ext" != x""; then
  rheo_float_ext=""
  echo "ERROR: unsupported --with-float argument: $rheo_float_ext" ; exit 1
fi
dnl-------------------------------------------------------------------------
dnl #`--enable-permissive`
dnl #>       The compiler do not turns all warnings into errors and becomes permissive.
dnl #>       This feature is for code developers and is off by default.
dnl-------------------------------------------------------------------------
rheo_permissive_default=no
AC_ARG_ENABLE(permissive,
    AS_HELP_STRING([--enable-permissive],[the compiler turns to be permissive.  [[default=no]]]),
    [  case "${enableval}" in
          yes | no) rheo_permissive=${enableval};;
          *)        rheo_permissive=yes
       esac],
    [ rheo_permissive=${rheo_permissive_default} ]
)
permissive_opts=""
if test x"${rheo_permissive}" = x"yes"; then
  permissive_opts="-fpermissive"
  SRC2MAN_FLAGS="-nowarning-as-error"
else
  permissive_opts="-Werror"
  SRC2MAN_FLAGS="-warning-as-error"
fi
AC_SUBST(SRC2MAN_FLAGS)
dnl-------------------------------------------------------------------------
dnl have a mac-osx system ?
dnl-------------------------------------------------------------------------
if test -x /usr/bin/hostinfo; then
  rheo_have_mac=true
else
  rheo_have_mac=false
fi
dnl-------------------------------------------------------------------------
dnl is it a well-known C++ compiler ?
dnl-------------------------------------------------------------------------
RHEO_RECOGNIZE_CXX
CXXFLAGS_EXTRA_NOCHECK="${permissive_opts} -Wno-unused -Wno-strict-aliasing -Wno-deprecated-declarations -Wno-narrowing"
if test "$rheo_have_mac" = false; then
  # gnu/binutils "ld" supports this option
  LDFLAGS_EXTRA="-Wl,--as-needed"
else
  # mac-osx "ld" do not support it
  LDFLAGS_EXTRA=""
fi
if test x"${rheo_cxx}" = x"gnu" -o x"${rheo_cxx}" = x"clang"; then
    RHEO_CXX2017
    if test x"${rheo_cxx2017}" = x"yes"; then
      if test x"${rheo_have_float128}" = x"yes"; then
        CXXFLAGS="${CXXFLAGS} -std=gnu++17"
      else
        CXXFLAGS="${CXXFLAGS} -std=c++17"
      fi
    else
      RHEO_CXX2014
      if test x"${rheo_cxx2014}" = x"yes"; then
        if test x"${rheo_have_float128}" = x"yes"; then
          CXXFLAGS="${CXXFLAGS} -std=gnu++17"
        else
          CXXFLAGS="${CXXFLAGS} -std=c++14"
        fi
      else
        RHEO_CXX2011
        if test x"${rheo_cxx2011}" = x"yes"; then
          if test x"${rheo_have_float128}" = x"yes"; then
            CXXFLAGS="${CXXFLAGS} -std=gnu++11"
          else
            CXXFLAGS="${CXXFLAGS} -std=c++11"
          fi
        else
          CXXFLAGS="${CXXFLAGS} -ansi"
        fi
      fi
    fi
fi
if test x"${rheo_cxx}" = x"gnu"; then
    CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_EXTRA_NOCHECK}"
    CXXFLAGS_EXTRA_GNU="-Wno-literal-suffix -Wno-int-in-bool-context"
    if test x"${rheo_permissive}" != x"yes"; then
      CXXFLAGS="-Wall -Weffc++ ${CXXFLAGS} ${CXXFLAGS_EXTRA_GNU}"
    fi
    LDFLAGS="${LDFLAGS} ${LDFLAGS_EXTRA}"
elif test x"${rheo_cxx}" = x"clang"; then
    CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_EXTRA_NOCHECK}"
    CXXFLAGS_EXTRA_CLANG="-Wno-deprecated-register"
    if test x"${rheo_permissive}" != x"yes"; then
      CXXFLAGS="-Wall ${CXXFLAGS} ${CXXFLAGS_EXTRA_CLANG}"
    fi
    LDFLAGS="${LDFLAGS} ${LDFLAGS_EXTRA}"
fi
#echo "CXXFLAGS ${CXXFLAGS}"
dnl-------------------------------------------------------------------------
dnl   for backward compatibility tests (with old rheolef versions)
dnl-------------------------------------------------------------------------
AH_TEMPLATE([MAJOR_VERSION], Defines the package major version)
AC_DEFINE_UNQUOTED(MAJOR_VERSION,${MAJOR_VERSION})

AH_TEMPLATE([MINOR_VERSION], Defines the package minor version)
AC_DEFINE_UNQUOTED(MINOR_VERSION,${MINOR_VERSION})

dnl-------------------------------------------------------------------------
dnl   check some commands
dnl-------------------------------------------------------------------------
dnl x86 specific flags
RHEO_CXX_FLAGS_IEEE

dnl for compile time:
AC_PROG_CPP
RHEO_PROG_GNU_MAKE
dnl-------------------------------------------------------------------------
dnl #`--enable-debian-packaging`
dnl #>       Install files in the debian way 
dnl #>       by respecting the `Debian Policy Manual`.
dnl #>       This is not the default behavior.
dnl-------------------------------------------------------------------------
dnl TODO: suppress this option (to be managed by debian/rules)
pkglibdir="$libdir/$PACKAGE"
AC_SUBST(pkglibdir)
AC_ARG_ENABLE(debian-packaging,
    [  --enable-debian-packaging  Only if you are creating deb packages (default=no) ],
    [  case "${enableval}" in
          yes)  debian_packaging="yes"
	        doc_dir="rheolef-doc"
	       	   ;;
          *)    debian_packaging=""
	        doc_dir="rheolef"
               	   ;;
       esac],
    [  debian_packaging="" 
       doc_dir="rheolef"
    ]
)
AC_SUBST(doc_dir)
AM_CONDITIONAL(HAVE_DEBIAN_PACKAGING, test x"${debian_packaging}" = x"yes")
dnl-------------------------------------------------------------------------
dnl #`--enable-documentation`
dnl #>       By default, both the reference manual and the users guide
dnl #>       documentations are generated when required tools are available.
dnl #>       The required tool for the reference manual is `doxygen`.
dnl #>       The required tools for the users guide are
dnl #>       `pdflatex`, `bibtex`, `makeindex`, `gs`, `pdffonts`, `fig2dev`, `gnuplot`, `cairosvg`. `pdfcrop`
dnl #>       This option allows one to turn off the generation of these
dnl #>       documentation.
dnl-------------------------------------------------------------------------
rheo_have_dox_documentation="yes"
rheo_have_tex_documentation="yes"
show_documentation=""
AC_ARG_ENABLE(documentation,
    AS_HELP_STRING([--enable-documentation],[turn on the generation of documentation (default=yes)]),
    [  case "${enableval}" in
          yes | no) 
             rheo_have_dox_documentation=${enableval}
             rheo_have_tex_documentation=${enableval}
             ;;
          *) 
             rheo_have_dox_documentation="yes"
             rheo_have_tex_documentation="yes"
       esac],
    [
             rheo_have_dox_documentation="yes"
             rheo_have_tex_documentation="yes"
    ]
)
if test x"${rheo_have_dox_documentation}" = x"yes"; then
  dnl for refman unix-man and web pages
  AC_CHECK_PROGS(DOXYGEN, doxygen)

  dnl optional: for refman unix-man index "man -k"
  AC_CHECK_PROGS(MANDB, mandb)
  if test                       \
         x"$DOXYGEN" = x""	\
      -o x"$MANDB"   = x""      \
  ; then
    AC_MSG_RESULT(** WARNING: the reference manual generation is turned off because some tools are missing)
    rheo_have_dox_documentation="no"
  else
    show_documentation="${show_documentation}refman "
  fi
fi
AM_CONDITIONAL(HAVE_DOX_DOCUMENTATION, test x"${rheo_have_dox_documentation}" = x"yes")

if test x"${rheo_have_tex_documentation}" = x"yes"; then
  dnl for pdf usrman documentation
  AC_CHECK_PROGS(PDFLATEX,  pdflatex)
  AC_CHECK_PROGS(BIBTEX,    bibtex)
  AC_CHECK_PROGS(MAKEINDEX, makeindex)
  AC_CHECK_PROGS(GS,        gs)
  AC_CHECK_PROGS(PDFFONTS,  pdffonts)
  AC_CHECK_PROGS(FIG2DEV,   fig2dev)
  AC_CHECK_PROGS(GNUPLOT,   gnuplot)
  AC_CHECK_PROGS(CAIROSVG,  cairosvg)
  AC_CHECK_PROGS(INKSCAPE,  inkscape)
  AC_CHECK_PROGS(PDFCROP,   pdfcrop)
  if test x"$CAIROSVG"  = x"" -a x"$INKSCAPE"  = x""; then
    SVG2PDF=""
  else
    SVG2PDF="true"
  fi
  if test                     \
          x"$PDFLATEX"  = x"" \
       -o x"$BIBTEX"    = x"" \
       -o x"$MAKEINDEX" = x"" \
       -o x"$GNUPLOT"   = x"" \
       -o x"$SVG2PDF"   = x"" \
       -o x"$PDFCROP"   = x"" \
       -o x"$GS"        = x"" \
       -o x"$PDFFONTS"  = x"" \
       -o x"$FIG2DEV"   = x"" \
    ; then
    AC_MSG_RESULT(** WARNING: the users guide generation is turned off because some tools are missing)
    rheo_have_tex_documentation="no"
  else
    show_documentation="${show_documentation}usrman "
  fi
fi
AM_CONDITIONAL(HAVE_TEX_DOCUMENTATION, test x"${rheo_have_tex_documentation}" = x"yes")
if test x"${show_documentation}" = x""; then
  show_documentation="no"
fi
dnl-------------------------------------------------------------------------
dnl check some C system library headers
dnl-------------------------------------------------------------------------
AC_CHECK_HEADERS(symlink.h, break)
AC_CHECK_HEADERS(unistd.h, break)

dnl-------------------------------------------------------------------------
dnl   check C++ compiler features...
dnl-------------------------------------------------------------------------

RHEO_CHECK_ISTREAM_RDBUF
if test x"${rheo_have_istream_rdbuf}" != x"yes"; then
  RHEO_CHECK_IOS_BP
fi
RHEO_CHECK_IOS_SETSTATE
RHEO_CHECK_IOS_BITALLOC

dnl-------------------------------------------------------------------------
dnl   check C++ system library
dnl-------------------------------------------------------------------------

AC_FUNC_ALLOCA
if test x"$ALLOCA" != x""; then
    ALLOCA="\${top_builddir}/config/$ALLOCA"
fi     

AC_CHECK_FUNCS([gettimeofday])
RHEO_CXX_CLOCK_GETTIME
if test "$rheo_have_cxx_clock_gettime" = "yes"; then
  AC_SEARCH_LIBS([clock_gettime], [rt],
    [AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
    [Define to 1 if your system has the clock_gettime function.])])
else
  RHEO_CHECK_GETTIMEOFDAY
  if test x"${rheo_have_gettimeofday}" != x"yes"; then
    RHEO_CHECK_WIERDGETTIMEOFDAY
    if test x"${rheo_have_wierdgettimeofday}" != x"yes"; then
      RHEO_CHECK_BSDGETTIMEOFDAY
    fi
  fi
fi
dnl-------------------------------------------------------------------------
dnl   check C++ math library
dnl-------------------------------------------------------------------------

RHEO_CHECK_ISINF_DOUBLE
RHEO_CHECK_FINITE_DOUBLE
RHEO_CHECK_ABS_DOUBLE
RHEO_CHECK_SQR_DOUBLE

dnl-------------------------------------------------------------------------
dnl   various tools
dnl-------------------------------------------------------------------------
dnl for file format parsers:
RHEO_CHECK_FLEX
AC_CHECK_PROGS(BISON, bison)

dnl get paraview version:
dnl * .vtk output format depends upon paraview version
dnl   since recent paraview >= 5.5 supports high-order elements
dnl * version == 5.7 has an opacity bug: it could be avoided
RHEO_PARAVIEW_GET_VERSION

dnl-------------------------------------------------------------------------
dnl #`--with-bigfloat`=digits10
dnl #>       Turn on Bruno Haible's `cln` arbitrary
dnl #>       precision float library with *digits10* precision,
dnl #>       See http://clisp.cons.org/~haible/packages-cln.html .
dnl #>       Default is off.
dnl #>       The *digits10* argument value is optional and
dnl #>       default value is *digits10*=60.
dnl #>       This feature is still under development.
dnl #`--with-cln`=clndir
dnl #>       Set the home directory for the `cln` library
dnl #>       used by the `--with-bigfloat` previous option.
dnl #>       Default *clndir* is `/usr/local/math`.
dnl-------------------------------------------------------------------------
AH_TEMPLATE([DIGITS10], Define the arbitrary precision)
rheo_digits10=60
rheo_default_bigfloat="no"
AC_ARG_WITH(bigfloat,
    [  --with-bigfloat[[=DIGITS10]]    use bigfloat builtin CLN-based class with DIGITS10 (default=no, DIGITS10=60) ],
    [changequote(%%, %%)dnl
     case "${withval}" in
          yes) with_bigfloat="yes"
               ;;
          no)  with_bigfloat="no"
               ;;
          [0-9]*)  with_bigfloat="yes"
               rheo_digits10="${withval}"
               ;;
          *)   echo "    ERROR: bad value ${withval} for --with-bigfloat"; exit 1
               ;;
     esac
     changequote([, ])dnl
    ],
    [with_bigfloat=${rheo_default_bigfloat}]
)

rheo_dir_cln="/usr"
AC_ARG_WITH(cln,
    [  --with-cln[[=DIR]]              CLN library prefix directory (default=no) ],
    [case "${withval}" in
          yes) with_cln="yes"
               ;;
          no)  with_cln="no"
               ;;
          /*)  with_cln="yes"
               rheo_dir_cln="${withval}"
               ;;
          *)   echo "    ERROR: bad value ${withval} for --with-cln"; exit 1
               ;;
     esac],
    [with_cln=${rheo_default_bigfloat}]
)
# echo with_bigfloat ${with_bigfloat}
# echo with_cln ${with_cln}
if test x"${with_bigfloat}" = x"yes" -o x"${with_cln}" = x"yes"; then
    with_cln="yes"
    RHEO_CHECK_CLN
    # set: rheo_have_cln=..
else
    rheo_have_cln="no"
fi
AM_CONDITIONAL(HAVE_CLN, test x"${with_cln}" = x"yes")
if test x"${rheo_have_cln}" = x"yes"; then
    LDADD_BIGFLOAT="\${top_builddir}/util/bigfloat/libbigfloat.la ${LDADD_CLN}"
    INCLUDES_BIGFLOAT="${INCLUDES_CLN}"
    AC_DEFINE_UNQUOTED(DIGITS10,${rheo_digits10})
fi
# echo rheo_have_cln ${rheo_have_cln}
dnl-------------------------------------------------------------------------
dnl float, continued
dnl-------------------------------------------------------------------------
if test x"$rheo_have_float128" = x"yes"; then
  RHEO_CHECK_FLOAT128
fi
AM_CONDITIONAL(HAVE_FLOAT128, test x"${rheo_have_float128}" = x"yes")
dnl-------------------------------------------------------------------------
dnl set externded arithmetic flag (avoid mpi and cgal, not yet supoported)
dnl-------------------------------------------------------------------------
if test x"${rheo_have_cln}" = x"yes" -o x"${rheo_float_ext}" != x""; then
  with_extended_arithmetic="yes"
else
  with_extended_arithmetic="no"
fi
#echo "rheo_float_ext=$rheo_float_ext"
#echo "with_extended_arithmetic=$with_extended_arithmetic"
dnl-------------------------------------------------------------------------
dnl #`--enable-maintainer-mode`
dnl #>       This option is off by default.
dnl #>       When false, it turns off by default the `ginac` feature (see below).
dnl #>       If you are not a Rheolef library code developper,
dnl #>       you could safely turn it off.
dnl #>       This option is provided for compatibility with the Debian packaging
dnl #>       system `debhelper`.
dnl-------------------------------------------------------------------------
dnl #`--enable-ginac`
dnl #>       This option is off by default.
dnl #>       Ginac is computer algebra system in C++
dnl #>       that is used to automatically generate the C++ code
dnl #>       for some low-order FEM basis (P1, bubble, etc).
dnl #>       If you are not a Rheolef library code developper,
dnl #>       you could safely turn it off.
dnl-------------------------------------------------------------------------
enable_maintainer_mode_default="no"
AC_ARG_ENABLE(maintainer-mode,
    [  --enable-maintainer-mode          for Rheolef developers; default=no) ],
    [  case "${enableval}" in
          yes | no) enable_maintainer_mode=${enableval};;
          *)        enable_maintainer_mode=${enable_maintainer_mode_default};;
       esac],
    [ enable_maintainer_mode=${enable_maintainer_mode_default} ]
)
enable_ginac_default="${enable_maintainer_mode}"
AC_ARG_ENABLE(ginac,
    [  --enable-ginac          GiNaC (for Rheolef developers; default=no) ],
    [  case "${enableval}" in
          yes | no) enable_ginac=${enableval};;
          *)        enable_ginac=${enable_ginac_default};;
       esac],
    [ enable_ginac=${enable_ginac_default} ]
)
if test x"$with_extended_arithmetic" = x"yes"; then
    enable_ginac=no
fi
#echo "enable_ginac=$enable_ginac"
if test x"$enable_ginac" = x"yes"; then
  RHEO_CHECK_GINAC
fi
AM_CONDITIONAL(HAVE_GINAC, test x"${rheo_have_ginac}" = x"yes")
#echo "rheo_have_ginac=$rheo_have_ginac"
dnl-------------------------------------------------------------------------
dnl Check for GMP interface : big float and integers in C++
dnl used by 3D octree (fast point localization in mesh)
dnl-------------------------------------------------------------------------
dnl AC_SUBST(LDADD_GMPXX)
dnl AC_CHECK_HEADERS(gmpxx.h, [LDADD_GMPXX="-lgmpxx"])
dnl-------------------------------------------------------------------------
dnl check for: unsigned long long int (used by geo_tree.h)
dnl-------------------------------------------------------------------------
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
dnl-------------------------------------------------------------------------
dnl #`--with-boost-incdir`=incdir_boost
dnl #>       Specifies the include directory
dnl #>       for the `boost` library.
dnl #>       This library is required by rheolef.
dnl #`--with-boost-libdir`=libdir_boost
dnl #>       Specifies the corresponding library directory.
dnl-------------------------------------------------------------------------
AC_ARG_WITH(boost-incdir,
    [  --with-boost-incdir[[=DIR]]     the boost includes directory (required; default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_incdir_boost=""
	       	   ;;
          *)       rheo_incdir_boost=${withval}
               	   ;;
       esac],
    [  rheo_incdir_boost="" ]
)
AC_ARG_WITH(boost-libdir,
    [  --with-boost-libdir[[=DIR]]     the boost libraries directory (required; default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_boost=""
	       	   ;;
          *)       rheo_libdir_boost=${withval}
               	   ;;
       esac],
    [  rheo_libdir_boost="" ]
)
RHEO_CHECK_BOOST
AM_CONDITIONAL(HAVE_BOOST, test x"${rheo_have_boost}" = x"yes")
if test x"${rheo_have_boost}" = x"yes"; then
  true
else
  AC_MSG_ERROR(required boost library not found)
fi
dnl-------------------------------------------------------------------------
dnl #`--with-eigen-incdir`=incdir_eigen
dnl #>       Specifies the include directory
dnl #>       for the `eigen` library.
dnl #>       This library is required by rheolef.
dnl #`--with-eigen-libdir`=libdir_eigen
dnl #>       Specifies the corresponding library directory.
dnl-------------------------------------------------------------------------
rheo_incdir_eigen_default="/usr/include/eigen3"
AC_ARG_WITH(eigen-incdir,
    [  --with-eigen-incdir[[=DIR]] the eigen includes directory (required; default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_incdir_eigen=""
	       	   ;;
          *)       rheo_incdir_eigen=${withval}
               	   ;;
       esac],
    [  rheo_incdir_eigen="$rheo_incdir_eigen_default" ]
)
AC_ARG_WITH(eigen-libdir,
    [  --with-eigen-libdir[[=DIR]] the eigen libraries directory (required; default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_eigen=""
	       	   ;;
          *)       rheo_libdir_eigen=${withval}
               	   ;;
       esac],
    [  rheo_libdir_eigen="" ]
)
RHEO_CHECK_EIGEN

AM_CONDITIONAL(HAVE_EIGEN, test x"${rheo_have_eigen}" = x"yes")
if test x"${rheo_have_eigen}" = x"yes"; then
  true
else
  AC_MSG_ERROR(required eigen library not found)
fi
dnl-------------------------------------------------------------------------
dnl #`--enable-debug`
dnl #>       Produce a `c++ -g` like code and turn on some runtime checks.
dnl #`--enable-dmalloc`
dnl #>       With debugging, also uses dynamic allocation runtime checking
dnl #>	     with `dmalloc` when available.
dnl-------------------------------------------------------------------------
AH_TEMPLATE([PARANO], Defines it if you are parano for debug)
AC_SUBST(INSTALL_PROGRAM_FLAGS)
AC_ARG_ENABLE(debug,
    [  --enable-debug          debug mode (default=no) ],
    [  case "${enableval}" in
          yes | no) enable_debug=${enableval};;
          *)        enable_debug=yes;;
       esac],
    [ enable_debug=no ]
)
AC_ARG_ENABLE(dmalloc,
    [  --enable-dmalloc        dmalloc debug library, when available; requiers debug mode (default=no) ],
    [  case "${enableval}" in
          yes | no) enable_dmalloc=${enableval};;
          *)        enable_dmalloc=yes;;
       esac],
    [ enable_dmalloc=no ]
)
if test x"${enable_debug}" = x"yes"; then
    CXXFLAGS="$CXXFLAGS -g"
    LDFLAGS="$LDFLAGS -g"
    AC_DEFINE(PARANO)
    INSTALL_PROGRAM_FLAGS=""
    if test x"${enable_dmalloc}" = x"yes"; then
        RHEO_CHECK_DMALLOC
    fi
else
    INSTALL_PROGRAM_FLAGS="-s"
fi
AM_CONDITIONAL(HAVE_DMALLOC, test x"${rheo_have_dmalloc}" = x"yes")

dnl-------------------------------------------------------------------------
dnl #`--enable-mpi`
dnl #>       Turns on/off the distributed computation features.
dnl #>       Default is on when distributed is on. This feature is currently in development.
dnl #>       When on, configure try to detect either the scotch or the parmetis libraries.
dnl-------------------------------------------------------------------------
rheo_incdir_mpi=""
rheo_libdir_mpi=""
rheo_libs_mpi=""
AC_ARG_ENABLE(mpi,
    [  --enable-mpi            MPI library, for distributed algebra (default=yes) ],
    [  case "${enableval}" in
          yes | no) enable_mpi="${enableval}";;
          *)        enable_mpi="yes";;
       esac],
    [ enable_mpi="yes" ]
)
AC_ARG_WITH(mpi-incdir,
    [  --with-mpi-incdir[[=DIR]]       the mpi includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_incdir_mpi="";;
          *)       rheo_incdir_mpi=${withval};;
       esac]
)
AC_ARG_WITH(mpi-libdir,
    [  --with-mpi-libdir[[=DIR]]       the mpi library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_mpi="";;
          *)       rheo_libdir_mpi=${withval};;
       esac]
)
AC_ARG_WITH(mpi-libs,
    [  --with-mpi-libs[[=LIBS]]        the mpi library linker flags (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libs_mpi="";;
          *)       rheo_libs_mpi=${withval};;
       esac]
)
if test x"$enable_mpi" = x"yes"; then
    RHEO_CHECK_MPI
fi
if test x"$rheo_have_mpi" = x"yes"; then
    true
else
    rheo_use_distributed=no
fi
dnl-------------------------------------------------------------------------
dnl #`--with-scotch-incdir`=incdir_scotch
dnl #>       Specifies the include directory
dnl #>       for the `scocth` distributed mesh partitioner.
dnl #>       Default is to auto-detect when mpi is available.
dnl #`--with-scotch-libdir`=libdir_scotch
dnl #>       Specifies the corresponding library directory.
dnl #>       Check in *libdir_scotch* for `libptscotchparmetis.so`, 
dnl #>       `libptscotch.so` and `libptscotcherrexit.so` or
dnl #>       corresponding `.a` libraries.
dnl #`--with-scotch-libs`=libs_scotch
dnl #>       Specifies some alternating library compile flag e.g.
dnl #>       `-lscotch`. 
dnl-------------------------------------------------------------------------
dnl #`--with-parmetis-incdir`=incdir_parmetis
dnl #>       Specifies the include directory
dnl #>       for the `parmetis` distributed mesh partitioner.
dnl #>       Default is to autodetect when mpi is available and scotch is unavailable.
dnl #`--with-parmetis-libdir`=libdir_parmetis
dnl #>       Specifies the corresponding library directory.
dnl #>       Check in *libdir_parmetis* for `libparmetis.so`,
dnl #>       `libparmetis.a` and also `libmetis.a`
dnl #>       `libmetis.so`.
dnl-------------------------------------------------------------------------
with_scotch=""
rheo_incdir_scotch=""
rheo_libdir_scotch=""
rheo_libs_scotch=""
#rheo_libs_scotch="-lptscotchparmetisv3 -lptscotch -lptscotcherrexit -lz"
#rheo_libs_scotch_old="-lptscotchparmetis -lptscotch -lptscotcherrexit -lz"
#rheo_libs_scotch_old_old="-lptscotchparmetis -lptscotch -lptscotcherrexit -lscotch -lscotcherrexit"
AC_ARG_WITH(scotch-incdir,
    [  --with-scotch-incdir[[=DIR]]    the scotch distributed mesh partitioner includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_scotch=${withval};;
          *)       rheo_incdir_scotch=${withval}
		   with_scotch=yes
               	   ;;
       esac]
)
AC_ARG_WITH(scotch-libdir,
    [  --with-scotch-libdir[[=DIR]]    the scotch distributed mesh partitioner library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_scotch=${withval};;
          *)       rheo_libdir_scotch=${withval}
		   with_scotch=yes
               	   ;;
       esac]
)
AC_ARG_WITH(scotch-libs,
    [  --with-scotch-libs[[=LIBS]]     the scotch distributed mesh partitioner library linker flags (default=-lptscotchparmetis -lptscotch -lptscotcherrexit -lz) ],
    [  case "${withval}" in
          yes|no)  with_scotch=${withval};;
          *)       rheo_libs_scotch=${withval}
		   with_scotch=yes
               	   ;;
       esac]
)
with_metis=""
rheo_incdir_metis=""
rheo_libdir_metis=""
with_parmetis=""
rheo_incdir_parmetis=""
rheo_libdir_parmetis=""
AC_ARG_WITH(metis-incdir,
    [  --with-metis-incdir[[=DIR]]     the metis distributed mesh partitioner includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_metis=${withval};;
          *)       rheo_incdir_metis=${withval}
		   with_metis=yes
               	   ;;
       esac]
)
AC_ARG_WITH(metis-libdir,
    [  --with-metis-libdir[[=DIR]]     the metis distributed mesh partitioner library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_metis=${withval};;
          *)       rheo_libdir_metis=${withval}
		   with_metis=yes
               	   ;;
       esac]
)
AC_ARG_WITH(parmetis-incdir,
    [  --with-parmetis-incdir[[=DIR]]  the parmetis distributed mesh partitioner includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_parmetis=${withval};;
          *)       rheo_incdir_parmetis=${withval}
		   with_parmetis=yes
               	   ;;
       esac]
)
AC_ARG_WITH(parmetis-libdir,
    [  --with-parmetis-libdir[[=DIR]]  the parmetis distributed mesh partitioner library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_parmetis=${withval};;
          *)       rheo_libdir_parmetis=${withval}
		   with_parmetis=yes
               	   ;;
       esac]
)
if test x"${rheo_use_distributed}" = x"yes"; then
  if test x"${with_scotch}" != x"no"; then
    RHEO_CHECK_SCOTCH
  fi
  if test x"${with_parmetis}" = x"yes"; then
    RHEO_CHECK_METIS
    if test x"${rheo_have_metis}" = x"yes"; then
      RHEO_CHECK_PARMETIS
    fi
  fi
  if test x"${rheo_have_scotch}" != x"yes" && test x"${rheo_have_parmetis}" != x"yes"; then
    AC_MSG_RESULT(** WARNING: the distributed feature is turned off because neither lib(pt)scotch nor lib(par)metis are available)
    rheo_use_distributed=no
fi
fi
dnl-------------------------------------------------------------------------
dnl #`--with-blas-libdidr`=rheo_libdir_blas
dnl #>       Specifies the include directory
dnl #>       for the `blas` linear algebra library.
dnl #>       Default is to auto-detect.
dnl #`--with-blas-libs`=rheo_libs_blas
dnl #>       Specifies the corresponding library directory.
dnl-------------------------------------------------------------------------
with_blas=""
#rheo_libs_blas="-llapack -lblas"; # mumps links to libblas automatically now
rheo_libs_blas=""
AC_ARG_WITH(blas-libdir,
    [  --with-blas-libdir[[=DIR]]      the basic linear algebra subroutines (BLAS) library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_blas=""
                   with_blas=${withval}
	       	   ;;
          *)       rheo_libdir_blas=${withval}
		   with_blas=yes
               	   ;;
       esac],
    [  rheo_libdir_blas="" ]
)
AC_ARG_WITH(blas-libs,
    [  --with-blas-libs[[=LIBS]]       the basic linear algebra subroutines (BLAS) libraries linker flags (default=-llapack -lblas) ],
    [  case "${withval}" in
          yes|no)  rheo_libs_blas=""
                   with_blas=${withval}
	       	   ;;
          *)       rheo_libs_blas=${withval}
		   with_blas=yes
               	   ;;
       esac],
    [  rheo_libs_blas="" ]
)
RHEO_CHECK_BLAS
dnl-------------------------------------------------------------------------
dnl #`--with-scalapack-libdir`=rheo_libdir_scalapack
dnl #>       Specifies the library directory
dnl #>       for the `scalapack` library.
dnl #>       Default is to auto-detect when `mpi` is available.
dnl #`--with-scalapack-libs`=rheo_libs_scalapack
dnl #>       Specifies some alternating library compile flag e.g.
dnl #>       `-lscalapack`. 
dnl-------------------------------------------------------------------------
with_scalapack=""
rheo_libs_scalapack="-lscalapack-openmpi -lblacs-openmpi"
AC_ARG_WITH(scalapack-libdir,
    [  --with-scalapack-libdir[[=DIR]] the scalable linear algebra subroutines (BLAS) library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_scalapack=""
                   with_scalapack=${withval}
	       	   ;;
          *)       rheo_libdir_scalapack=${withval}
		   with_scalapack=yes
               	   ;;
       esac],
    [  rheo_libdir_scalapack="" ]
)
AC_ARG_WITH(scalapack-libs,
    [  --with-scalapack-libs[[=LIBS]]  the scalable linear algebra subroutines (BLAS) libraries linker flags (default=-lscalapack-openmpi -lblacs-openmpi) ],
    [  case "${withval}" in
          yes|no)  rheo_libs_scalapack=""
                   with_scalapack=${withval}
	       	   ;;
          *)       rheo_libs_scalapack=${withval}
		   with_scalapack=yes
               	   ;;
       esac],
    [  rheo_libs_scalapack="" ]
)
RHEO_CHECK_SCALAPACK
dnl-------------------------------------------------------------------------
dnl #`--with-mumps-incdir`=incdir_mumps
dnl #>       Specifies the include directory
dnl #>       for the `mumps` linear algebra library.
dnl #>       Default is to auto-detect.
dnl #`--with-mumps-libdir`=libdir_mumps
dnl #>       Specifies the corresponding library directory.
dnl #`--with-mumps-libs`=libs_mumps
dnl #>       Specifies some alternating library compile flag e.g.
dnl #>       `-lmumps`. 
dnl-------------------------------------------------------------------------
if test x"${with_extended_arithmetic}" != x"yes"; then
  with_mumps="yes"
else
  with_mumps="no"
fi
rheo_incdir_mumps=""
rheo_libdir_mumps=""
rheo_libs_mumps=""
AC_ARG_WITH(mumps-incdir,
    [  --with-mumps-incdir[[=DIR]]     the mumps distributed direct solver includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_mumps=${withval};;
          *)       rheo_incdir_mumps=${withval}
		   with_mumps=yes
               	   ;;
       esac]
)
AC_ARG_WITH(mumps-libdir,
    [  --with-mumps-libdir[[=DIR]]     the mumps distributed direct solver library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_mumps=${withval};;
          *)       rheo_libdir_mumps=${withval}
		   with_mumps=yes
               	   ;;
       esac]
)
AC_ARG_WITH(mumps-libs,
    [  --with-mumps-libs[[=DIR]]       the mumps distributed direct solver library linker flags (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_mumps=${withval};;
          *)       rheo_libs_mumps=${withval}
		   with_mumps=yes
               	   ;;
       esac]
)
#echo "rheo_incdir_mumps=$rheo_incdir_mumps"
#echo "rheo_libdir_mumps=$rheo_libdir_mumps"
#echo "rheo_libs_mumps=$rheo_libs_mumps"
if test x"${with_mumps}" = x"yes"; then
  RHEO_CHECK_MUMPS
  if test x"${with_mumps}" = x"yes"; then
    RHEO_GET_MUMPS_VERSION
    RHEO_CHECK_MUMPS_WITH_SCOTCH
    RHEO_CHECK_MUMPS_WITH_PTSCOTCH
    RHEO_CHECK_MUMPS_WITH_METIS
    RHEO_CHECK_MUMPS_WITH_PARMETIS
  fi
fi
dnl-------------------------------------------------------------------------
dnl #`--with-trilinos`=libdir_trilinos
dnl #>       Specifies the library directory
dnl #>       for the `trilinos/ifpack` preconditioner library.
dnl #>       Check in *libdir_trilinos* for `libtrilinos_ifpack.so`, 
dnl #>       or the corresponding `.a` libraries.
dnl #>       The `trilinos` support is actually broken.
dnl-------------------------------------------------------------------------
if test x"${with_extended_arithmetic}" != x"yes"; then
  with_trilinos="yes"
else
  with_trilinos="no"
fi
rheo_incdir_trilinos=""
rheo_libdir_trilinos=""
#rheo_libs_trilinos="-ltrilinos_ifpack"
#rheo_libs_trilinos="-ltrilinos_ifpack -ltrilinos_amesos -ltrilinos_epetra -ltrilinos_teuchos -ltrilinos_galeri -ltrilinos_triutils"
rheo_libs_trilinos="-ltrilinos_ifpack -ltrilinos_amesos -ltrilinos_epetra -ltrilinos_teuchos"
AC_ARG_WITH(trilinos-incdir,
    [  --with-trilinos-incdir[[=DIR]]  the trilinos distributed preconditioner includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_trilinos=${withval};;
          *)       rheo_incdir_trilinos=${withval}
		   with_trilinos=yes
               	   ;;
       esac]
)
AC_ARG_WITH(trilinos-libdir,
    [  --with-trilinos-libdir[[=DIR]]  the trilinos distributed preconditioner library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  with_trilinos=${withval};;
          *)       rheo_libdir_trilinos=${withval}
		   with_trilinos=yes
               	   ;;
       esac]
)
AC_ARG_WITH(trilinos-libs,
    [  --with-trilinos-libs[[=LIBS]]   the trilinos distributed preconditioner library linker flags (default=-ltrilinos_ifpack) ],
    [  case "${withval}" in
          yes|no)  with_trilinos=${withval};;
          *)       rheo_libs_trilinos=${withval}
		   with_trilinos=yes
               	   ;;
       esac]
)
if test x"${with_trilinos}" = x"yes" && test x"${rheo_use_distributed}" = x"yes"; then
    # TRILIONOS requires mpi
    RHEO_CHECK_TRILINOS
fi
dnl-------------------------------------------------------------------------
dnl @--with-pastix=libdir_pastix
dnl @        Turns on/off the `pastix` distributed solver.
dnl @        Check in *libdir_pastix* for `libpastix.so`, 
dnl @        or the corresponding `.a` libraries.
dnl @        Default is to auto-detect when mpi is available.
dnl-------------------------------------------------------------------------
dnl pastix is now obsolete: no debian & bug on small matrix (size < np)
dnl => waiting for a debian package and bug fixes
dnl note: implementation could replace a missing trilinos or mumps
dnl
dnl with_pastix=""
dnl AC_ARG_WITH(pastix-incdir,
dnl     [  --with-pastix-incdir[[=DIR]]    the pastix distributed direct solver includes directory (default=autodetect) ],
dnl     [  case "${withval}" in
dnl           yes|no)  rheo_incdir_pastix=""
dnl                    with_pastix=${withval}
dnl 	       	   ;;
dnl           *)       rheo_incdir_pastix=${withval}
dnl 		   with_pastix=yes
dnl                	   ;;
dnl        esac],
dnl     [  rheo_incdir_pastix="" ]
dnl )
dnl AC_ARG_WITH(pastix-libdir,
dnl     [  --with-pastix-libdir[[=DIR]]    the pastix distributed direct solver library directory (default=autodetect) ],
dnl     [  case "${withval}" in
dnl           yes|no)  rheo_libdir_pastix=""
dnl                    with_pastix=${withval}
dnl 	       	   ;;
dnl           *)       rheo_libdir_pastix=${withval}
dnl 		   with_pastix=yes
dnl                	   ;;
dnl        esac],
dnl     [  rheo_libdir_pastix="" ]
dnl )
dnl if test x"${with_pastix}" != x"no" && test x"${use_distributed}" = x"yes" \
dnl && test x"${rheo_have_scotch}" = x"yes" && test x"${rheo_have_blas}" = x"yes" \
dnl && test x"${rheo_have_mumps}" != x"yes" -o x"${rheo_have_trilinos}" != x"yes"; then
dnl     RHEO_CHECK_PASTIX
dnl fi
dnl-------------------------------------------------------------------------
dnl #`--with-cholmod-incdir`=incdir_cholmod
dnl #>       Specifies the include directory
dnl #>       for the `cholmod` direct solver library
dnl #>       for sparse symmetric definite positive matrix.
dnl #>       Default is to auto-detect.
dnl #`--with-cholmod-libdir`=libdir_cholmod
dnl #>       Specifies the corresponding library directory.
dnl #>       Default *incdir_cholmod* is *libdir_cholmod*\ .
dnl #>       Check in *libdir_cholmod* for `libcholmod.so` or
dnl #>       `libcholmod.a` and for header
dnl #>       *incdir_cholmod*\ `/cholmod.h` or *incdir_cholmod*\ `/cholmod/cholmod.h`.
dnl #`--with-cholmod-libs`=libs_cholmod
dnl #>       Specifies some alternating library compile flag e.g.
dnl #>       `-lcholmod`. 
dnl-------------------------------------------------------------------------
rheo_incdir_cholmod=""
if test x"${with_extended_arithmetic}" != x"yes"; then
  with_cholmod=yes
else
  with_cholmod=no
fi
AC_ARG_WITH(cholmod-incdir,
    [  --with-cholmod-incdir[[=DIR]]   the cholmod includes directory],
    [  case "${withval}" in
          yes|no) with_cholmod=${withval};;
          *)      rheo_incdir_cholmod=${withval}
                  with_cholmod=yes;;
       esac]
)
rheo_libdir_cholmod=""
AC_ARG_WITH(cholmod-libdir,
    [  --with-cholmod-libdir[[=DIR]]   the cholmod library directory],
    [  case "${withval}" in
          yes|no) with_cholmod=${withval};;
          *)      rheo_libdir_cholmod=${withval}
                  with_cholmod=yes;;
       esac]
)
rheo_libs_cholmod="-lcholmod -lccolamd -lcolamd -lcamd -lamd -lsuitesparseconfig"
AC_ARG_WITH(cholmod-libs,
    [  --with-cholmod-libs[[=LIBS]]    the cholmod libraries linker flags (default=-lcholmod -lccolamd -lcolamd -lcamd -lamd -lsuitesparseconfig) ],
    [  case "${withval}" in
          yes|no)  with_cholmod=${withval};;
          *)       rheo_libs_cholmod=${withval}
		   with_cholmod=yes
       esac]
)
if test x"${with_cholmod}" = x"yes" && test x"${with_extended_arithmetic}" != x"yes"; then
    RHEO_CHECK_CHOLMOD
else
    rheo_have_cholmod="no"
fi
dnl-------------------------------------------------------------------------
dnl #`--with-umfpack-incdir`=incdir_umfpack
dnl #>       Specifies the include directory
dnl #>       for the `umfpack` direct solver library
dnl #>       for sparse unsymmetric matrix.
dnl #>       Default is to auto-detect.
dnl #`--with-umfpack-libdir`=libdir_umfpack
dnl #>       Specifies the corresponding library directory.
dnl #>       Default *incdir_umfpack* is *libdir_umfpack*\ .
dnl #>       Check in *libdir_umfpack* for `libumfpack.so` or
dnl #>       `libumfpack.a` and for header
dnl #>       *incdir_umfpack*\ `/umfpack.h`
dnl #>       or *incdir_umfpack*\ `/umfpack/umfpack.h`.
dnl #`--with-umfpack-libs`=libs_umfpack
dnl #>       Specifies some alternating library compile flag e.g.
dnl #>       `-lumfpack`. 
dnl-------------------------------------------------------------------------
# when mumps in not available, try to detect umfpack
if test x"${with_extended_arithmetic}" != x"yes"; then
  with_umfpack="yes"
else
  with_umfpack="no"
fi
rheo_incdir_umfpack=""
AC_ARG_WITH(umfpack-incdir,
    [  --with-umfpack-incdir[[=DIR]]   the umfpack includes directory],
    [  case "${withval}" in
          yes|no) with_umfpack=${withval};;
          *)      rheo_incdir_umfpack=${withval}
                  with_umfpack=yes;;
       esac]
)
rheo_libdir_umfpack=""
AC_ARG_WITH(umfpack-libdir,
    [  --with-umfpack-libdir[[=DIR]]   the umfpack library directory],
    [  case "${withval}" in
          yes|no) with_umfpack=${withval};;
          *)      rheo_libdir_umfpack=${withval}
                  with_umfpack=yes;;
       esac]
)
rheo_libs_umfpack="-lumfpack -lamd"
AC_ARG_WITH(umfpack-libs,
    [  --with-umfpack-libs[[=LIBS]]    the umfpack libraries linker flags (default=-lumfpack -lamd) ],
    [  case "${withval}" in
          yes|no)  with_umfpack=${withval};;
          *)       rheo_libs_umfpack=${withval}
		   with_umfpack=yes
       esac]
)
if test x"${with_umfpack}" = x"yes" && test x"${with_extended_arithmetic}" != x"yes"; then
    RHEO_CHECK_UMFPACK
else
    rheo_have_umfpack="no"
fi
dnl-------------------------------------------------------------------------
dnl @--with-taucs-ldadd=taucs_ldadd
dnl @--with-taucs-incdir=taucs_incdir
dnl @        Turns on/off the `taucs` out-of-core sparse direct solver.
dnl @	     When this library is not available, the configure script
dnl @        check for the spooles multifrontal (see below).
dnl @        The `taucs` support is actually broken.
dnl-------------------------------------------------------------------------
dnl try_taucs=no
dnl AC_ARG_WITH(taucs-incdir,
dnl     [  --with-taucs-incdir[[=DIR]]     the taucs out-of-core sparse direct solver includes directory (broken) ],
dnl     [  case "${withval}" in
dnl           yes | no) try_taucs=${withval};;
dnl           *)  rheo_incdir_taucs=${withval}
dnl               try_taucs=yes;;
dnl        esac]
dnl )
dnl AC_ARG_WITH(taucs-ldadd,
dnl     [  --with-taucs-libs[[=LIBS]]      the taucs out-of-core sparse direct solver linker flags (broken) ],
dnl     [  case "${withval}" in
dnl           yes | no) try_taucs=${withval};;
dnl           *)  rheo_ldadd_taucs=${withval}
dnl               try_taucs=yes;;
dnl        esac]
dnl )
dnl RHEO_CHECK_TAUCS
dnl-------------------------------------------------------------------------
dnl @--with-spooles-libdir=libdir_spooles
dnl @--with-spooles-incdir=incdir_spooles
dnl @        Turns on/off the `spooles` multifrontal direct solver.
dnl @        Default $incdir_spooles* is *libdir_spooles*\ .
dnl @        Check in *libdir_spooles* for `libspooles.so`,
dnl @        `libspooles.a` or `spooles.a` and for header
dnl @        *incdir_spooles*\ `/FrontMtx.h`.
dnl @	     When this library is not available, the direct solver
dnl @        bases upon a traditionnal skyline Choleski factorisation
dnl @        combined with a reverse Cuthill-Mc Kee reordering.
dnl-------------------------------------------------------------------------
dnl AC_ARG_WITH(spooles-incdir,
dnl     [  --with-spooles-incdir[[=DIR]]   the spooles distributed direct solver includes directory],
dnl     [  case "${withval}" in
dnl           no)  with_spooles="no";;
dnl           /*)  rheo_incdir_spooles=${with_spooles_incdir}
dnl                if test x"${with_spooles}" != x"yes"; then
dnl                    echo "    WARNING: turns on --with-spooles to use --with-spooles-incdir";
dnl 	       fi
dnl                ;;
dnl           *)   echo "    ERROR: bad value ${withval} for --with-spooles-incdir"; exit 1;;
dnl        esac],
dnl     [  rheo_incdir_spooles="" # will try to auto-detect from incdir
dnl     ]
dnl )
dnl AC_ARG_WITH(spooles,
dnl     [  --with-spooles-libdir[[=DIR]]   the spooles distributed direct solver library directory (default=no) ],
dnl     [  case "${withval}" in
dnl           no)  with_spooles="no";;
dnl           /*)  rheo_libdir_spooles=${with_spooles}
dnl 	       with_spooles="yes"
dnl                if test x"${rheo_have_taucs}" = x"yes"; then
dnl                    echo "    ERROR: incompatible options taucs and spooles"; exit 1
dnl 	       fi
dnl                if test x"${rheo_have_cln}" = x"yes"; then
dnl                    echo "    ERROR: incompatible options cln/bigfloat and spooles"; exit 1
dnl 	       fi
dnl                ;;
dnl           *)   echo "    ERROR: bad value ${withval} for --with-spooles"; exit 1;;
dnl        esac],
dnl     [ with_spooles="no";
dnl     ]
dnl )
dnl RHEO_CHECK_SPOOLES
dnl-------------------------------------------------------------------------
dnl for builtin LDLT sparses equential solver, when nothing else is available
dnl-------------------------------------------------------------------------
rheo_have_suitesparse_amd=no
AH_TEMPLATE([HAVE_SUITESPARSE_AMD], Defines if you have the amd suitesparse ordering library)
PREV_LIBS=${LIBS}
AC_SEARCH_LIBS([amd_order], [amd], rheo_have_suitesparse_amd=yes)
LIBS=${PREV_LIBS}
if test x"${rheo_have_suitesparse_amd}" = x"yes"; then
  AC_CHECK_HEADERS(suitesparse/amd.h, break, rheo_have_suitesparse_amd=no)
fi
AC_SUBST(INCLUDES_SUITESPARSE_AMD)
INCLUDES_SUITESPARSE_AMD=""
AC_SUBST(LDADD_SUITESPARSE_AMD)
if test x"$rheo_have_suitesparse_amd" = x"yes"; then
  AC_DEFINE(HAVE_SUITESPARSE_AMD)
  LDADD_SUITESPARSE_AMD="-lamd"
else
  LDADD_SUITESPARSE_AMD=""
fi
dnl-------------------------------------------------------------------------
dnl #`--with-cgal-incdir`=incdir_cgal
dnl #>       Specifies the include directory
dnl #>       for the `cgal` discrete geometry library.
dnl #>       Default is to auto-detect.
dnl #`--with-cgal-libdir`=libdir_cgal
dnl #>       Check in *libdir_cgal* for `libcgal.so`, 
dnl #>       or the corresponding `.a` libraries.
dnl #`--with-cgal-libs`=libs_cgal
dnl #>       Specifies some alternating library compile flag e.g.
dnl #        `-lCGAL`. 
dnl-------------------------------------------------------------------------
with_cgal="yes"
rheo_incdir_cgal=""
rheo_libdir_cgal=""
#rheo_libs_cgal="-lCGAL_Core -lCGAL -lboost_thread"
#rheo_libs_cgal="-lCGAL -lgmp"
#rheo_libs_cgal="-lgmp"
rheo_libs_cgal=""
AC_ARG_WITH(cgal-incdir,
    [  --with-cgal-incdir[[=DIR]]      the cgal computational geometry includes directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_incdir_cgal=""
                   with_cgal=${withval}
	       	   ;;
          *)       rheo_incdir_cgal=${withval}
		   with_cgal=yes
               	   ;;
       esac],
    [  rheo_incdir_cgal="" ]
)
AC_ARG_WITH(cgal-libdir,
    [  --with-cgal-libdir[[=DIR]]      the cgal computational geometry library directory (default=autodetect) ],
    [  case "${withval}" in
          yes|no)  rheo_libdir_cgal=""
                   with_cgal=${withval}
	       	   ;;
          *)       rheo_libdir_cgal=${withval}
		   with_cgal=yes
               	   ;;
       esac],
    [  rheo_libdir_cgal="" ]
)
AC_ARG_WITH(cgal-libs,
    [  --with-cgal-libs[[=LIBS]]       the cgal computational geometry library linker flags (default=-lCGAL) ],
    [  case "${withval}" in
          yes|no)  with_cgal=${withval};;
          *)       rheo_libs_cgal=${withval}
		   with_cgal=yes
               	   ;;
       esac]
)
if test x"$rheo_float_ext" != x""; then
  if test x"$with_cgal" = x"yes"; then
    echo "warning: unsupported cgal library with extended \"$rheo_float_ext\" feature" 1>&2
  fi
  with_cgal=no
fi
if test x"${with_cgal}" = x"yes"; then
  RHEO_CHECK_CGAL
else
  rheo_have_cgal=no
fi
AM_CONDITIONAL(HAVE_CGAL, test x"${rheo_have_cgal}" = x"yes")
dnl-------------------------------------------------------------------------
dnl determine here if we use the distributed environment:
dnl-------------------------------------------------------------------------
AH_TEMPLATE([HAVE_MPI], Defines if you have distributed environment)
AC_SUBST(USE_DISTRIBUTED)
if test x"${rheo_use_distributed}" = x"yes"; then
    AC_DEFINE(HAVE_MPI)
    USE_DISTRIBUTED=true
else
    USE_DISTRIBUTED=false
    # un-activate: MPI, BOOST_MPI, SCOTCH & PARMETIS
dnl AC_MSG_RESULT(** WARNING: the distributed feature is turned off)
    MPIRUN=""
    INCLUDES_MPI=""
    LDADD_MPI=""
    INCLUDES_BOOST_MPI=""
    LDADD_BOOST_MPI=""
    INCLUDES_SCOTCH="" 
    LDADD_SCOTCH=""
    INCLUDES_PARMETIS="" 
    LDADD_PARMETIS="" 
fi
dnl-------------------------------------------------------------------------
dnl Generic or hardware-dependant optimization
dnl use previous enable_optim and enable_debug
dnl => may be after debug and optim
dnl-------------------------------------------------------------------------
AC_ARG_ENABLE(generic,  [  --enable-generic        turn off hardware-dependant optimization options (default=yes)])
if test x"$rheo_have_float128" = x"yes"; then
  # float128 + i86 + SSE-optim => segfault
  AC_MSG_CHECKING(for float128 conflicts with hardware-specific optimization options)
  mach="`uname -m`"
  case $mach in
    i*86) enable_generic=yes;;
  esac
  AC_MSG_RESULT(${enable_generic})
fi
AC_ARG_ENABLE(optim,    [  --enable-optim          turn on compiler optimization (default=yes)])
AC_ARG_ENABLE(profiling,[  --enable-profiling      turn on profiling (default=no)])

m4_include(config/acmacros.m4)
m4_include(config/acoptim.m4)

# strip all possible -On flags and then force -O3
# note: use [...] to protect -O[0-9] regular expr
if test x"${debian_packaging}" = x"yes"; then
  # debian packaging: -g -O2 is required
  CXXFLAGS_OPT="-O2"
else
  # otherwise: push optim flag
  CXXFLAGS_OPT="-O3"
fi
[
  res=`echo ${CXXFLAGS} | grep -e '-O[0-9]' >/dev/null`
  status=$?
  if test ${status} = 0; then
    CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's/-O[0-9]//g'`
  fi
  CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_OPT}"
]
dnl-------------------------------------------------------------------------
dnl #`--enable-optim`
dnl #>       Turns compile-time optimization to maximum available.
dnl #>       Include architecture-dependent compilation (e.g. on intel, executable
dnl #>       are less portable across intel variants).
dnl #>       Default is on.
dnl-------------------------------------------------------------------------
dnl AC_ARG_ENABLE(optim,
dnl     [  --enable-optim          compile-time architecture-dependent optimization mode (default=yes) ],
dnl     [  case "${enableval}" in
dnl           yes | no) enable_optim=${enableval};;
dnl           *)        enable_optim=yes;;
dnl        esac],
dnl     [ enable_optim=yes ]
dnl )
dnl optimize or not ?
dnl if test x"${enable_optim}" = x"yes"; then
dnl     # architecture-dependent optim
dnl     RHEO_OPTIMIZE_CXX
dnl else
dnl     # architecture-independent optim, when no debug
dnl     if test x"${enable_debug}" != x"yes"; then
dnl       CXXFLAGS="-O3 ${CXXFLAGS}"
dnl     fi
dnl fi
dnl-------------------------------------------------------------------------
dnl   others variables
dnl-------------------------------------------------------------------------

dnl the date of the version:
DATE=`date +"%d/%m/%y %H:%M"`
dnl where executables and scripts can find auxilliary data:

dnl echo ${ac_n} "toto${ac_c}" = portable echo -n "toto" or echo "toto\c"
AC_SUBST(ac_n)
AC_SUBST(ac_c)
AC_SUBST(ac_t)
 
dnl-------------------------------------------------------------------------
dnl   ABS_TOP_SRCDIR
dnl-------------------------------------------------------------------------
dnl used by geo::zero_dimension for IR=space::real() during non-regre tests
rheo_top_srcdir="`dirname $0`"
here=`pwd`; cd $rheo_top_srcdir; rheo_abs_top_srcdir=`pwd`; cd $here
#echo "top ? myself=$0"
#echo "rheo_top_srcdir=$rheo_top_srcdir, rheo_abs_top_srcdir=$rheo_abs_top_srcdir"
AH_TEMPLATE([ABS_TOP_SRCDIR], Defines the absolute top source directory during compilation - used by non-regression tests)
AC_DEFINE_UNQUOTED(ABS_TOP_SRCDIR,"${rheo_abs_top_srcdir}")

dnl-------------------------------------------------------------------------
dnl   Used by src2man and doc/web
dnl-------------------------------------------------------------------------
REFMAN_SCAN_SUBDIRS="		\
        .	                \
        config                  \
        util/bamg               \
        util/lib                \
        linalg/lib              \
        linalg/bin              \
        fem/quadrature          \
        fem/geo_element         \
        fem/lib                 \
	main/lib                \
        main/bin                \
        main/sbin               \
        doc/examples            \
        doc/web			\
"
AC_SUBST(REFMAN_SCAN_SUBDIRS)

dnl-------------------------------------------------------------------------
dnl   Output
dnl-------------------------------------------------------------------------
AC_CONFIG_FILES([\
	Makefile			\
	ci_gitlab/Makefile		\
	ci_gitlab/dockerfiles/Makefile	\
	ci_gitlab/dockerfiles/debian_buster/Makefile	\
	ci_gitlab/dockerfiles/ubuntu20.04/Makefile	\
	config/Makefile			\
	config/config.mk		\
	util/Makefile			\
	util/dmallocxx/Makefile		\
	util/bigfloat/Makefile		\
	util/bamg/Makefile		\
	util/lib/Makefile		\
	util/tst/Makefile		\
	fem/Makefile			\
	fem/quadrature/Makefile		\
	fem/geo_element/Makefile	\
	fem/lib/Makefile		\
	fem/tst/Makefile		\
	fem/idoc/Makefile		\
	linalg/Makefile			\
	linalg/lib/Makefile		\
	linalg/bin/Makefile		\
	linalg/tst/Makefile		\
	main/Makefile			\
	main/data/Makefile		\
	main/lib/Makefile		\
	main/sbin/Makefile		\
	main/bin/Makefile		\
	main/vtk/Makefile		\
	main/tst/Makefile		\
	doc/Makefile			\
	doc/examples/Makefile		\
	doc/usrman/Makefile		\
	doc/web/Makefile		\
])
AC_OUTPUT
dnl-------------------------------------------------------------------------
dnl libtool, 2nd pass
dnl-------------------------------------------------------------------------
dnl this 2nd pass may be after the AC_OUTPUT command, that generates the "libtool" script
dnl since we use this script here. Also, the "config.status" output was generated before 
dnl "libtool" was created, and the two variables calculated here cannot be added to "config.status"
dnl So, create an additional "config2.status"...

AC_MSG_CHECKING(for shlibpath variable name)
RHEOLEF_SHLIBPATH_VAR=`./libtool --config | grep -i "^shlibpath_var=" | sed -e 's/.*=//'`
AC_MSG_RESULT(${RHEOLEF_SHLIBPATH_VAR})

# add optional -rpath flag to linker ?
AC_MSG_CHECKING(for hardcode libdir flag spec)
libtool_rpath_sh="/tmp/libtool-rpath-$$.sh"
./libtool --config > $libtool_rpath_sh
echo "eval \"echo \$hardcode_libdir_flag_spec\"" >> $libtool_rpath_sh
RHEOLEF_HARDCODE_LIBDIR_FLAG_SPEC=`SED=sed exec_prefix=${exec_prefix} libdir=${libdir} sh $libtool_rpath_sh`
rm -f $libtool_rpath_sh
AC_MSG_RESULT(${RHEOLEF_HARDCODE_LIBDIR_FLAG_SPEC})

# merge here the compiler flags:
AC_SUBST(INCLUDES_RHEOLEF)
AC_SUBST(LIBS_RHEOLEF)
INCLUDES_RHEOLEF="${CPPFLAGS} ${CXXFLAGS} ${INCLUDES_CGAL} ${INCLUDES_MUMPS} ${INCLUDES_SCALAPACK} ${INCLUDES_UMFPACK} ${INCLUDES_CHOLMOD} ${INCLUDES_SUITESPARSE_AMD} ${INCLUDES_TRILINOS} ${INCLUDES_SCOTCH} ${INCLUDES_PARMETIS} ${INCLUDES_EIGEN} ${INCLUDES_BLAS} ${INCLUDES_BOOST_MPI} ${INCLUDES_MPI} ${INCLUDES_FLOAT128} ${INCLUDES_DMALLOCXX} ${INCLUDES_DMALLOC} -I${includedir} -I${libdir}"
LIBS_RHEOLEF="-L${libdir} -lrheolef ${LDADD_CGAL} ${LDADD_MUMPS} ${LDADD_SCALAPACK} ${LDADD_UMFPACK} ${LDADD_CHOLMOD} ${LDADD_SUITESPARSE_AMD} ${LDADD_TRILINOS} ${LDADD_SCOTCH} ${LDADD_PARMETIS} ${LDADD_EIGEN} ${LDADD_BLAS} ${LDADD_BOOST_MPI} ${LDADD_MPI} ${LDADD_FLOAT128} ${LDADD_DMALLOCXX} ${LDADD_DMALLOC} ${LIBS} ${RHEOLEF_HARDCODE_FLAG}"

# then output results to "config2.status"
output2="config2.status"
rm -f $output2
echo "#!/bin/sh" >> $output2
echo "# File automatically generated by configure." >> $output2
echo "exec_prefix=\"${exec_prefix}\"" >> $output2
echo "RHEOLEF_SHLIBPATH_VAR=\"${RHEOLEF_SHLIBPATH_VAR}\"" >> $output2
echo "RHEOLEF_HARDCODE_LIBDIR_FLAG_SPEC=\"${RHEOLEF_HARDCODE_LIBDIR_FLAG_SPEC}\"" >> $output2
echo "configure: creating $output2"

dnl-------------------------------------------------------------------------
dnl add a _RHEOLEF_ prefix to #defined macros
dnl-------------------------------------------------------------------------
if test x"${rheo_use_distributed}" = x"yes"; then
  echo "localhost slots=25" > config/hostfile.txt
  echo "configure: creating config/hostfile.txt"
fi
sh $srcdir/config/rheolef_config_header.sh \
	< config/acconfig.h 			\
	> config/config.h.new

if test -f config/config.h.cache && diff config/config.h.cache config/config.h.new >/dev/null; then
    cp -a config/config.h.cache config/config.h
    echo "configure: config/config.h is unchanged"
else
    mv config/config.h.new config/config.h
    echo "configure: creating config/config.h"
fi
echo "configure: creating config/config.mk"

dnl-------------------------------------------------------------------------
dnl summary
dnl-------------------------------------------------------------------------
status=0
echo "------------------------------------------------"
echo "summary:"
echo "	prefix	         : ${prefix}"
echo "	documentation	 : ${show_documentation}"
echo "	c++ compiler	 : ${rheo_cxx}"
if test x"${enable_optim}" != x"no"; then
  echo "	optimization	 : yes, machine-dependent"
else
  echo "	optimization	 : yes, machine-independent"
fi
if test x"${rheo_have_ginac}" = x"yes"; then
  echo "	ginac	         : ${rheo_have_ginac}"
fi
if test x"${rheo_float_ext}" != x""; then
    echo "	arithmetic       : ${rheo_float_ext} (extended)"
fi
if test x"${rheo_have_cgal}" = x"yes"; then
    echo "	geometry         : cgal"
else
    if test x"${with_extended_arithmetic}" != x"yes"; then
      echo "	geometry         : *NONE*"
      status=1; # no geo locator and characteristic
    else
      echo "	geometry         :"
    fi
fi
solvers="eigen(superlu/ldlt) "
if test x"${rheo_have_mumps}" = x"yes"; then
    solvers="${solvers}mumps " 
    if test x"${rheo_have_mpi}" = x"yes"; then
      solvers="${solvers}(distributed) " 
    fi
fi
if test x"${rheo_have_pastix}" = x"yes"; then
    solvers="${solvers}pastix "
    if test x"${rheo_have_mpi}" = x"yes"; then
      solvers="${solvers}(distributed) " 
    fi
fi
if test x"${rheo_have_cholmod}" = x"yes"; then
    solvers="${solvers}cholmod "
fi
if test x"${rheo_have_umfpack}" = x"yes"; then
    solvers="${solvers}umfpack "
fi
if test x"${rheo_have_umfpack}" = x"yes" -o x"${rheo_have_cholmod}" = x"yes"; then
  if test x"${rheo_have_mpi}" = x"yes"; then
    solvers="${solvers}(sequential) " 
  fi
fi
echo "	direct solver    : $solvers"
if test x"${rheo_have_trilinos}" = x"yes"; then
    echo "	preconditioners  : ilut mic trilinos/ifpack"
elif test x"${rheo_have_pastix}" = x"yes"; then
    echo "	preconditioners  : pastix"
else
    echo "	preconditioners  : ilut mic"
fi
if test x"${rheo_use_distributed}" = x"yes"; then
  if test x"${rheo_have_scotch}" = x"yes"; then
    echo "	partitioner      : scotch"
  elif test x"${rheo_have_parmetis}" = x"yes"; then
    echo "	partitioner      : parmetis"
  else
    echo "	partitioner      : *NONE*"
    status=1
  fi
  if test x"${rheo_have_mpi}" = x"yes"; then
    if test x"${rheo_recognized_mpi}" != x"no"; then
      echo "	mpi	         : ${rheo_recognized_mpi}"
    else
      echo "	mpi	         : yes"
    fi
  else
    echo "	mpi	         : *NONE*"
    status=1
  fi
fi
echo "	distributed      : ${rheo_use_distributed}"
if test ${status} -ne 0; then
  echo "configure: ERROR: some required library are not found"
  exit 1
else
  if test x"${rheo_use_distributed}" = x"yes" -a x"${with_mumps}" = x"yes"; then
    if test x"${rheo_have_mumps_with_ptscotch}" != x"yes" -a x"${rheo_have_mumps_with_parmetis}" != x"yes" -a x"${rheo_have_mumps_with_scotch}" != x"yes" -a x"${rheo_have_mumps_with_metis}" != x"yes"; then
      echo "WARNING: mumps founded but compiled without (pt)scotch or (par)metis ordering support"
      echo "HINT:    for a better efficiency, mumps should be recompiled with one of these support"
    fi
  fi
fi
echo "------------------------------------------------"
dnl-------------------------------------------------------------------------
dnl   End of configure script: rest of the documenttion
dnl-------------------------------------------------------------------------
dnl AUTHOR:
dnl     @email{Pierre.Saramito@@imag.fr}
dnl DATE:
dnl     19 january 1999
dnl=========================================================================