This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
forked from bendudson/BOUT
-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.ac
1780 lines (1500 loc) · 50.4 KB
/
configure.ac
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
# Copyright 2010 B D Dudson, S Farley
#
# Contact Ben Dudson, [email protected]
#
# This file is part of BOUT++.
#
# BOUT++ is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BOUT++ is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with BOUT++. If not, see <http://www.gnu.org/licenses/>.
#
#####################################################################
#
# Process this file with autoconf to produce a configure script.
#
# Changelog:
#
# 2010-03-09 Ben Dudson <[email protected]>
# * Changing to always require FFTW (removing NR routines)
# 2015-08-08 David Schwörer <[email protected]>
# * Searching for libs in lib and lib64
#
BOUT_VERSION="2.0"
AC_PREREQ(2.59)
AC_INIT(BOUT++, BOUT_VERSION, [email protected])
AC_ARG_WITH(checks, [ --with-checks=no/1/2/3 Set run-time checking level])
AC_ARG_WITH(signal, [ --with-signal=no Disable SEGFAULT handling])
AC_ARG_WITH(track, [ --with-track Enable variable tracking])
AC_ARG_WITH(pdb, [ --with-pdb Enable support for PDB files])
AC_ARG_WITH(netcdf, [ --with-netcdf Enable support for netCDF files])
AC_ARG_WITH(hdf5, [ --with-hdf5 Enable support for HDF5 files])
AC_ARG_WITH(parallelhdf5,[ --with-parallelhdf5 Enable support for parallel HDF5 files])
AC_ARG_WITH(pnetcdf,[ --with-pnetcdf Set path to Parallel NetCDF library])
AC_ARG_WITH(debug, [ --with-debug Enable all debugging flags])
AC_ARG_WITH(ida, [ --with-ida=/path/to/ida Use the SUNDIALS IDA solver])
AC_ARG_WITH(cvode, [ --with-cvode Use the SUNDIALS CVODE solver])
AC_ARG_WITH(sundials, [ --with-sundals Use CVODE and IDA])
AC_ARG_WITH(facets, [ --with-facets Build the interface to FACETS])
AC_ARG_WITH(fftw, [ --with-fftw Set directory of FFTW3 library])
AC_ARG_WITH(lapack, [ --with-lapack Use the LAPACK library])
AC_ARG_WITH(petsc, [ --with-petsc Enable PETSc interface])
AC_ARG_WITH(slepc, [ --with-slepc Enable SLEPc interface])
AC_ARG_WITH(pvode, [ --with-pvode Build and enable PVODE 98 (DEFAULT)])
AC_ARG_WITH(hypre, [ --with-hypre Link to the Hypre library])
AC_ARG_WITH(mumps, [ --with-mumps Link with MUMPS library for direct matrix inversions])
AC_ARG_WITH(arkode, [ --with-arkode Use the SUNDIALS ARKODE solver])
AC_ARG_VAR(EXTRA_INCS,[Extra compile flags])
AC_ARG_VAR(EXTRA_LIBS,[Extra linking flags])
file_formats="" # Record which file formats are being supported
# Delete the build log from last time
rm config-build.log
AC_ARG_VAR(CXXFLAGS,[Extra compile flags])
AC_ARG_VAR(LDFLAGS,[Extra linking flags])
AC_SUBST(MKDIR)
AC_SUBST(EXTRA_INCS)
AC_SUBST(EXTRA_LIBS)
# Adding variables for additional sources
AC_SUBST(PRECON_SOURCE)
AC_SUBST(FACETS_SOURCE)
AC_DEFUN([CREATE_DIR],
[
if ! [[ -d $1 ]]
then
mkdir $1
fi
])
#############################################################
# General Options
#############################################################
if test "$with_debug" != ""
then
echo "Enabling all debug options"
with_checks="3"
CXXFLAGS="$CXXFLAGS -g -O0"
else
CXXFLAGS="$CXXFLAGS -O"
fi
CHECK_LEVEL="0"
if test "$with_checks" != "no"
then
echo "Run-time checking enabled"
if test "$with_checks" = "1"
then
echo " -> Level 1 (Basic checking)"
CXXFLAGS="$CXXFLAGS -DCHECK=1"
CHECK_LEVEL="1"
elif test "$with_checks" = "3"
then
CXXFLAGS="$CXXFLAGS -DCHECK=3"
echo " -> Level 3 (Full checking + stack tracing)"
CHECK_LEVEL="3"
else
echo " -> Level 2 (Basic checking + stack tracing)"
CXXFLAGS="$CXXFLAGS -DCHECK=2"
CHECK_LEVEL="2"
fi
else
echo "Run-time checking disabled"
fi
if test "$with_signal" != "no"
then
echo "Segmentation fault handling enabled"
CXXFLAGS="$CXXFLAGS -DSIGHANDLE"
else
echo "Segmentation fault handling disabled"
fi
if test "$with_track" != ""
then
CXXFLAGS="$CXXFLAGS -DTRACK"
fi
echo
#############################################################
# Git revision number
#############################################################
rev=`git rev-parse HEAD`
if test "$?" = "0"
then
# Attach revision info to flags
CXXFLAGS="$CXXFLAGS -DREVISION=$rev"
echo "Revision ID: $rev"
fi
GIT_REVISION=$rev
#############################################################
# FACETS
#############################################################
if test "$with_facets" != ""
then
FACETS="$with_facets"
AC_CHECK_FILE($FACETS/include/FacetsIfc.h, FIFCPATH=$FACETS,
AC_CHECK_FILE(/usr/include/FacetsIfc.h, FIFCPATH=/usr,
AC_CHECK_FILE(/usr/local/include/FacetsIfc.h, FIFCPATH=/usr/local,
AC_CHECK_FILE(/opt/local/include/FacetsIfc.h, FIFCPATH=/opt/local,
AC_CHECK_FILE($HOME/local/include/FacetsIfc.h, FIFCPATH=$HOME/local,
AC_CHECK_FILE($HOME/software/facetsifc/include/FacetsIfc.h, FIFCPATH=$HOME/software/facetsifc,
))))))
if test "$FIFCPATH" != ""
then
echo "Enabling FACETS interface"
EXTRA_INCS="$EXTRA_INCS -I$FIFCPATH/include"
FACETS_SOURCE="$FACETS_SOURCE bout_facets.cxx"
else
echo "--with-facets was specified but could not find the FACETS interface"
exit
fi
fi
#############################################################
# PETSc library
#############################################################
if test "$with_petsc" != "" && test "$with_petsc" != "no"
then
### This still needs to check for PETSC_ARCH
if test "$with_petsc" != "yes"
then
PETSC_DIR="$with_petsc"
else
AC_CHECK_FILE($PETSC_DIR/$PETSC_ARCH/conf, ,
echo "Error - can't find PETSc distribution"
exit)
fi
cat <<MFILE > petscmake$$
PETSC_ARCH = ${PETSC_ARCH}
PETSC_DIR = ${PETSC_DIR}
include ${PETSC_DIR}/conf/rules
include ${PETSC_DIR}/conf/variables
echo_cxx:
-@echo \${CXX}
echo_sundials:
-@echo \${SUNDIALS_LIB}
MFILE
CXX="`make -f petscmake$$ echo_cxx`"
HAS_SUNDIALS=`make -f petscmake$$ echo_sundials | grep -c sundials`
HAS_CXX=`echo $CXX | grep -ic mp`
if test "$HAS_SUNDIALS" == "0"
then
echo "Warning - PETSc has no SUNDIALS support"
PETSC_HAS_SUNDIALS="no"
else
PETSC_HAS_SUNDIALS="yes"
fi
if test "$HAS_CXX" == "0"
then
echo "Warning - PETSc must have C++ support"
#rm petscmake$$
#exit
fi
echo "PETSc used C++ compiler $CXX"
#MPICXX=$CXX
rm petscmake$$
PETSC_VERSION_MAJOR="0"
PETSC_VERSION_MAJOR=`grep 'define PETSC_VERSION_MAJOR' $PETSC_DIR/include/petscversion.h | awk '{print \$3;}'`
PETSC_VERSION_MINOR="0"
PETSC_VERSION_MINOR=`grep 'define PETSC_VERSION_MINOR' $PETSC_DIR/include/petscversion.h | awk '{print \$3;}'`
PETSC_VERSION_RELEASE="0"
PETSC_VERSION_RELEASE=`grep 'define PETSC_VERSION_RELEASE' $PETSC_DIR/include/petscversion.h | awk '{print \$3;}'`
if test $PETSC_VERSION_MAJOR != "3"
then
echo "PETSc must be at least version 3"
exit
fi
if test "$PETSC_VERSION_MINOR" = "1"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_3_1"
echo "Using PETSc 3.1 interface"
elif test "$PETSC_VERSION_MINOR" = "2"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_3_2"
echo "Using PETSc 3.2 interface"
elif test "$PETSC_VERSION_MINOR" = "3" && test "$PETSC_VERSION_RELEASE" = "1"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_3_3"
echo "Using PETSc 3.3 interface"
elif test "$PETSC_VERSION_MINOR" = "4" && test "$PETSC_VERSION_RELEASE" = "1"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_3_4"
echo "Using PETSc 3.4 interface"
elif test "$PETSC_VERSION_MINOR" = "5" && test "$PETSC_VERSION_RELEASE" = "1"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_3_5"
echo "Using PETSc 3.5 interface"
elif test "$PETSC_VERSION_MINOR" = "5" && test "$PETSC_VERSION_RELEASE" = "0"
then
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_DEV"
echo "Using PETSc-dev interface"
else
echo "***********************************"
echo "WARNING: Unrecognised PETSc version"
echo "MAJOR VERSION: $PETSC_VERSION_MAJOR"
echo "MINOR VERSION: $PETSC_VERSION_MINOR"
echo "RELEASE : $PETSC_VERSION_RELEASE"
echo ""
echo "Trying PETSc-dev interface"
echo "***********************************"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_PETSC -DBOUT_HAS_PETSC_DEV"
fi
PETSC="include \$(PETSC_DIR)/conf/variables"
else
PETSC=
fi
AC_SUBST(PETSC, $PETSC)
if test "$PETSC" != ""
then
echo "Using PETSC_DIR = $PETSC_DIR"
echo "Using PETSC_ARCH = $PETSC_ARCH"
PRECON_SOURCE="$PRECON_SOURCE jstruc.cxx"
EXTRA_INCS="$EXTRA_INCS \$(PETSC_CC_INCLUDES)"
EXTRA_LIBS="$EXTRA_LIBS \$(PETSC_LIB)"
if test "$PETSC_HAS_SUNDIALS" == "yes"
then
CXXFLAGS="$CXXFLAGS -DPETSC_HAS_SUNDIALS "
fi
fi
echo
#############################################################
# SLEPc library
#############################################################
HAS_SLEPC="no"
SLEPC_VARS=""
if test "$with_slepc" != "" && test "$with_slepc" != "no"
then
#PETSC_ARCH = ${PETSC_ARCH}
#SLEPC_DIR = ${SLEPC_DIR}
echo "Searching for SLEPc"
if test "$SLEPC_DIR" == ""
then
echo "Error - SLEPC_DIR not set"
exit
fi
# Check that the config directory exists
AC_CHECK_FILE($SLEPC_DIR/$PETSC_ARCH/conf, ,
echo "Error - can't find SLEPc distribution"
exit)
echo " -> using SLEPC_DIR=$SLEPC_DIR"
# Find version number
AC_CHECK_FILE(${SLEPC_DIR}/include/slepcversion.h, ,
echo "Error - can't read include/slepcversion.h"
exit)
SLEPC_VERSION_MAJOR="0"
SLEPC_VERSION_MAJOR=`grep 'define SLEPC_VERSION_MAJOR' $SLEPC_DIR/include/slepcversion.h | awk '{print \$3;}'`
SLEPC_VERSION_MINOR="0"
SLEPC_VERSION_MINOR=`grep 'define SLEPC_VERSION_MINOR' $SLEPC_DIR/include/slepcversion.h | awk '{print \$3;}'`
if test "$SLEPC_VERSION_MAJOR" = "3" && test "$SLEPC_VERSION_MINOR" = "4"
then
# Version 3.4
echo " -> Using interface for SLEPc 3.4"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_SLEPC -DBOUT_HAS_SLEPC_3_4"
HAS_SLEPC="yes"
EXTRA_INCS="$EXTRA_INCS \$(SLEPC_INCLUDE)"
EXTRA_LIBS="$EXTRA_LIBS \$(SLEPC_LIB)"
SLEPC_VARS="include \${SLEPC_DIR}/conf/slepc_variables"
else
echo "Error - Unknown SLEPc version"
echo " -> No SLEPc support"
HAS_SLEPC="no"
fi
fi
AC_SUBST(SLEPC_VARS, $SLEPC_VARS)
echo
#############################################################
# MUMPS library
#############################################################
if test "$with_mumps" != "" && test "$with_mumps" != "no"
then
MUMPS=""
echo "Searching for MUMPS"
if test "$with_mumps" != "yes"
then
# User specified a directory
MUMPS="$with_mumps"
# Check for libraries
MUMPS_INC=$MUMPS/include
MUMPS_LIB=$MUMPS/lib
fi
if test "$MUMPS" == ""
then
# Look in some standard locations
AC_CHECK_FILE(/usr/include/dmumps_c.h, MUMPS="/usr/".
AC_CHECK_FILE($HOME/local/include/dmumps_c.h, MUMPS="$HOME/local/",))
# Check for libraries
MUMPS_INC=$MUMPS/include
MUMPS_LIB=$MUMPS/lib
fi
if test "$MUMPS" == "" && test "$PETSC_DIR" != ""
then
# Try PETSc installation
mumps_dir=`ls $PETSC_DIR/externalpackages/ | grep MUMPS`
if test "$mumps_dir" != ""
then
# PETSc has a MUMPS installation
MUMPS_INC=$PETSC_DIR/externalpackages/$mumps_dir/include
MUMPS_LIB=$PETSC_DIR/$PETSC_ARCH/lib
MUMPS=$PETSC_DIR/externalpackages/$mumps_dir
fi
fi
if test "$MUMPS" != ""
then
# Check all files needed
AC_CHECK_FILES( $MUMPS_INC/dmumps_c.h $MUMPS_LIB/libdmumps.a $MUMPS_LIB/libmumps_common.a $MUMPS_LIB/libpord.a $MUMPS_LIB/libscalapack.a $MUMPS_LIB/libblacs.a $MUMPS_LIB/libparmetis.a $MUMPS_LIB/libmetis.a $MUMPS_LIB/libptscotch.a $MUMPS_LIB/libptesmumps.a, ,[ MUMPS="" ])
fi
if test "$MUMPS" == ""
then
echo " -> MUMPS not found"
else
echo " -> MUMPS support enabled"
echo " Includes : $MUMPS_INC"
echo " Libraries: $MUMPS_LIB"
EXTRA_INCS="$EXTRA_INCS -I$MUMPS_INC"
EXTRA_LIBS="$EXTRA_LIBS -L$MUMPS_LIB -ldmumps -lmumps_common -lpord -lscalapack -lblacs -lparmetis -lmetis -lptscotch -lptesmumps"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_MUMPS"
fi
echo
fi
#############################################################
# Solver choice: SUNDIALS' IDA, SUNDIALS' CVODE, PVODE
#############################################################
if ( ( test "$with_sundials" != "" ) && ( test "$with_sundials" != "no" ) )
then
# Set both IDA and CVODE if not set already
if test "$with_ida" = ""
then
with_ida=$with_sundials
fi
if test "$with_cvode" = ""
then
with_cvode=$with_sundials
fi
fi
if ( ( test "$with_ida" != "" ) && ( test "$with_ida" != "no" ) )
then
echo "Searching for SUNDIALS IDA library"
if test "$with_ida" = "yes"
then
# No path specified. Try using sundials-config
if type sundials-config > /dev/null 2>&1; then
IDAINCS=`sundials-config -m ida -t p -l c -s cppflags`
IDALIBS=`sundials-config -m ida -t p -l c -s libs`
scr=`which sundials-config`
echo "=> Using SUNDIALS IDA solver, configured with $scr"
else
IDAINCS=""
IDALIBS=""
fi
else
# Specified with path
echo "Checking given path to SUNDIALS' IDA solver"
IDALIBS=$with_ida
AC_CHECK_FILES( $with_ida/include/ida/ida.h $with_ida/include/ida/ida_spgmr.h $with_ida/include/ida/ida_bbdpre.h $with_ida/include/nvector/nvector_parallel.h $with_ida/include/sundials/sundials_types.h , , [
IDALIBS=""
] )
AC_CHECK_FILES( $with_ida/lib/libsundials_nvecparallel.a $with_ida/lib/libsundials_ida.a, IDALIBSLIB='lib',
AC_CHECK_FILES( $with_ida/lib64/libsundials_nvecparallel.a $with_ida/lib64/libsundials_ida.a, IDALIBSLIB='lib64',
IDALIBS=""
) )
if test "$IDALIBS" != ""
then
IDAINCS="-I$IDALIBS/include"
IDALIBS="-L$IDALIBS/$IDALIBSLIB -lsundials_ida -lsundials_nvecparallel"
echo "=> Using SUNDIALS IDA solver, path $with_ida"
else
echo " -> Given path not correct. Finding..."
fi
fi
if test "$IDALIBS" = ""
then
# Try some known paths
AC_CHECK_FILE($HOME/local/include/ida/ida.h, IDALIBS=$HOME/local,
AC_CHECK_FILE($HOME/include/ida/ida.h, IDALIBS=$HOME,
AC_CHECK_FILE(/usr/include/ida/ida.h, IDALIBS=/usr,
AC_CHECK_FILE(/usr/local/include/ida/ida.h, IDALIBS=/usr/local,
AC_CHECK_FILE(/opt/local/include/ida/ida.h, IDALIBS=/opt/local,
)))))
if test "$IDALIBS" != ""
then
# Check the rest of the files
AC_CHECK_FILES( $IDALIBS/include/ida/ida.h $IDALIBS/include/ida/ida_spgmr.h $IDALIBS/include/ida/ida_bbdpre.h $IDALIBS/include/nvector/nvector_parallel.h $IDALIBS/include/sundials/sundials_types.h , , [
IDALIBS=""
] )
AC_CHECK_FILES( $IDALIBS/lib/libsundials_nvecparallel.a $IDALIBS/lib/libsundials_ida.a, IDALIBSLIB='lib',
AC_CHECK_FILES( $IDALIBS/lib64/libsundials_nvecparallel.a $IDALIBS/lib64/libsundials_ida.a, IDALIBSLIB='lib64',
IDALIBS=""
) )
fi
if test "$IDALIBS" != ""
then
IDAINCS="-I$IDALIBS/include"
IDALIBS="-L$IDALIBS/$IDALIBSLIB -lsundials_ida -lsundials_nvecparallel"
fi
fi
if test "$IDALIBS" = ""
then
echo "=> IDA solver not available"
echo
else
# Compile in the IDA solver
echo "=> IDA solver enabled"
echo
EXTRA_LIBS="$EXTRA_LIBS $IDALIBS"
EXTRA_INCS="$EXTRA_INCS $IDAINCS"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_IDA"
fi
fi
if ( ( test "$with_cvode" != "" ) && ( test "$with_cvode" != "no" ) )
then
echo "Searching for SUNDIALS' CVODE library"
if test "$with_cvode" = "yes"
then
# No path specified. Try using sundials-config
if type sundials-config > /dev/null 2>&1; then
CVODEINCS=`sundials-config -m cvode -t p -l c -s cppflags`
CVODELIBS=`sundials-config -m cvode -t p -l c -s libs`
scr=`which sundials-config`
echo "=> Using SUNDIALS CVODE solver, configured with $scr"
else
CVODEINCS=""
CVODELIBS=""
fi
else
# Specified with path
echo "Checking given path to SUNDIALS' CVODE solver"
CVODELIBS=$with_cvode
AC_CHECK_FILES( $with_cvode/include/cvode/cvode.h $with_cvode/include/cvode/cvode_spgmr.h $with_cvode/include/cvode/cvode_bbdpre.h $with_cvode/include/nvector/nvector_parallel.h, , [
CVODELIBS=""
] )
AC_CHECK_FILES( $with_cvode/lib/libsundials_cvode.a $with_cvode/lib/libsundials_nvecparallel.a, CVODELIBSLIB='lib',
AC_CHECK_FILES( $with_cvode/lib64/libsundials_cvode.a $with_cvode/lib64/libsundials_nvecparallel.a, CVODELIBSLIB='lib64', [
CVODELIBS=""
]) )
if test "$CVODELIBS" != ""
then
CVODEINCS="-I$with_cvode/include"
CVODELIBS="-L$with_cvode/$CVODELIBSLIB -lsundials_cvode -lsundials_nvecparallel"
echo "=> Using SUNDIALS CVODE solver, path $with_cvode"
else
echo " -> Given path not correct. Finding..."
fi
fi
if test "$CVODELIBS" = ""
then
# Try some known paths
AC_CHECK_FILE($HOME/local/include/cvode/cvode_spgmr.h, CVODELIBS=$HOME/local,
AC_CHECK_FILE($HOME/include/cvode/cvode_spgmr.h, CVODELIBS=$HOME,
AC_CHECK_FILE(/usr/include/cvode/cvode_spgmr.h, CVODELIBS=/usr,
AC_CHECK_FILE(/usr/local/include/cvode/cvode_spgmr.h, CVODELIBS=/usr/local,
AC_CHECK_FILE(/opt/local/include/cvode/cvode_spgmr.h, CVODELIBS=/opt/local,
)))))
if test "$CVODELIBS" != ""
then
# Check the rest of the files
AC_CHECK_FILES( $CVODELIBS/include/cvode/cvode.h $CVODELIBS/include/cvode/cvode_bbdpre.h $CVODELIBS/include/nvector/nvector_parallel.h , , [
CVODELIBS=""
])
AC_CHECK_FILES( $CVODELIBS/lib/libsundials_cvode.a $CVODELIBS/lib/libsundials_nvecparallel.a, CVODELIBSLIB='lib',
AC_CHECK_FILES( $CVODELIBS/lib64/libsundials_cvode.a $CVODELIBS/lib64/libsundials_nvecparallel.a, CVODELIBSLIB='lib64', [
CVODELIBS=""
]) )
fi
if test "$CVODELIBS" != ""
then
CVODEINCS="-I$CVODELIBS/include"
CVODELIBS="-L$CVODELIBS/$CVODELIBSLIB -lsundials_cvode -lsundials_nvecparallel"
fi
fi
if test "$CVODELIBS" = ""
then
echo "=> CVODE solver not available"
echo
else
# Compile in the CVODE solver
echo "=> CVODE solver enabled"
echo
EXTRA_LIBS="$EXTRA_LIBS $CVODELIBS"
EXTRA_INCS="$EXTRA_INCS $CVODEINCS"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_CVODE"
fi
fi
############## ARKode ####################
if ( ( test "$with_arkode" != "" ) && ( test "$with_arkode" != "no" ) )
then
echo "Searching for SUNDIALS' ARKODE library"
if test "$with_arkode" = "yes"
then
# No path specified. Try using sundials-config (not currently available in SUNDIALS, but include here for the future)
if type sundials-config > /dev/null 2>&1; then
ARKODEINCS=`sundials-config -m arkode -t p -l c -s cppflags`
ARKODELIBS=`sundials-config -m arkode -t p -l c -s libs`
scr=`which sundials-config`
echo "=> Using SUNDIALS ARKODE solver, configured with $scr"
else
ARKODEINCS=""
ARKODELIBS=""
fi
else
# Specified with path
echo "Checking given path to SUNDIALS' ARKODE solver"
ARKODELIBS=$with_arkode
AC_CHECK_FILES( $with_arkode/include/arkode/arkode.h $with_arkode/include/arkode/arkode_spgmr.h $with_arkode/include/arkode/arkode_bbdpre.h $with_arkode/include/nvector/nvector_parallel.h , , [
ARKODELIBS=""
] )
AC_CHECK_FILES( $ARKODELIBS/lib/libsundials_arkode.a $ARKODELIBS/lib/libsundials_nvecparallel.a, ARKODELIBSLIB='lib',
AC_CHECK_FILES( $ARKODELIBS/lib64/libsundials_arkode.a $ARKODELIBS/lib64/libsundials_nvecparallel.a, ARKODELIBSLIB='lib64', [
ARKODELIBS=""
]) )
if test "$ARKODELIBS" != ""
then
ARKODEINCS="-I$with_arkode/include"
ARKODELIBS="-L$with_arkode/$ARKODELIBSLIB -lsundials_arkode -lsundials_nvecparallel"
echo "=> Using SUNDIALS ARKODE solver, path $with_arkode"
else
echo " -> Given path not correct. Finding..."
fi
fi
if test "$ARKODELIBS" = ""
then
# Try some known paths
AC_CHECK_FILE($HOME/local/include/arkode/arkode_spgmr.h, ARKODELIBS=$HOME/local,
AC_CHECK_FILE($HOME/include/arkode/arkode_spgmr.h, ARKODELIBS=$HOME,
AC_CHECK_FILE(/usr/include/arkode/arkode_spgmr.h, ARKODELIBS=/usr,
AC_CHECK_FILE(/usr/local/include/arkode/arkode_spgmr.h, ARKODELIBS=/usr/local,
AC_CHECK_FILE(/opt/local/include/arkode/arkode_spgmr.h, ARKODELIBS=/opt/local,
)))))
if test "$ARKODELIBS" != ""
then
# Check the rest of the files
AC_CHECK_FILES( $ARKODELIBS/include/arkode/arkode.h $ARKODELIBS/include/arkode/arkode_bbdpre.h $ARKODELIBS/include/nvector/nvector_parallel.h, , [
ARKODELIBS=""
])
AC_CHECK_FILES( $ARKODELIBS/lib/libsundials_arkode.a $ARKODELIBS/lib/libsundials_nvecparallel.a, ARKODELIBSLIB='lib',
AC_CHECK_FILES( $ARKODELIBS/lib64/libsundials_arkode.a $ARKODELIBS/lib64/libsundials_nvecparallel.a, ARKODELIBSLIB='lib64', [
ARKODELIBS=""
]) )
fi
if test "$ARKODELIBS" != ""
then
ARKODEINCS="-I$ARKODELIBS/include"
ARKODELIBS="-L$ARKODELIBS/$ARKODELIBSLIB -lsundials_arkode -lsundials_nvecparallel"
fi
fi
if test "$ARKODELIBS" = ""
then
echo "=> ARKODE solver not available"
echo
else
# Compile in the ARKODE solver
echo "=> ARKODE solver enabled"
echo
EXTRA_LIBS="$EXTRA_LIBS $ARKODELIBS"
EXTRA_INCS="$EXTRA_INCS $ARKODEINCS"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_ARKODE"
fi
fi
#############################################################
# FFT routines
#############################################################
echo "Searching for FFTW library"
# first only look for header files
if test "$with_fftw" = ""
then
# No path specified
FFTPATH=""
echo " -> Path not given. Searching for library..."
else
FFTPATH=$with_fftw
# look only for header file, later search for library ($FFTPATH/lib/libfftw3.a)
AC_CHECK_FILES( $FFTPATH/include/fftw3.h ,, [
echo " -> Given path not correct. Finding..."
FFTPATH=""
] )
fi
# Test if FFTW_ROOT is set
if test "$FFTPATH" = ""
then
if test "$FFTW_ROOT" != ""
then
AC_CHECK_FILES( $FFTW_ROOT/include/fftw3.h , FFTPATH=$FFTW_ROOT, )
fi
fi
# Find fftw-wisdom
if type fftw-wisdom > /dev/null 2>&1; then
echo " -> Found fftw-wisdom executable"
# Path to fftw-wisdom, then remove fft-wisdom and bin/
FFTWISDOM=`which fftw-wisdom | xargs -0 dirname | xargs -0 dirname`
# Check if the files are there
AC_CHECK_FILES( $FFTWISDOM/include/fftw3.h , FFTPATH=$FFTWISDOM, )
#AC_CHECK_FILES( $FFTWISDOM/lib/libfftw3.a , FFTPATH=$FFTWISDOM, )
fi
# Try some known paths
if test "$FFTPATH" = ""
then
AC_CHECK_FILE(/usr/include/fftw3.h, FFTPATH=/usr,
AC_CHECK_FILE(/usr/local/include/fftw3.h, FFTPATH=/usr/local,
AC_CHECK_FILE(/opt/local/include/fftw3.h, FFTPATH=/opt/local,
AC_CHECK_FILE($HOME/local/include/fftw3.h, FFTPATH=$HOME/local,
AC_CHECK_FILE($HOME/include/fftw3.h, FFTPATH=$HOME/,
)))))
fi
#Test for library
if test "$FFTPATH" != ""
then
AC_CHECK_FILES($FFTPATH/lib/libfftw3.a, FFTPATHLIB='lib',
AC_CHECK_FILES($FFTPATH/lib64/libfftw3.a, FFTPATHLIB='lib64', FFTPATH='' ) )
fi
if test "$FFTPATH" = ""
then
echo "ERROR: FFTW not found. Required by BOUT++"
exit
else
echo " -> path $FFTPATH"
EXTRA_INCS="$EXTRA_INCS -I$FFTPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$FFTPATH/$FFTPATHLIB -lfftw3"
fi
echo ""
#############################################################
# LAPACK routines (Used for tri- and band-diagonal solvers)
#############################################################
HAS_LAPACK="no"
if ( ( test "$with_lapack" != "" ) && ( test "$with_lapack" != "no" ) )
then
echo "Using LAPACK"
EXTRA_LIBS="$EXTRA_LIBS -llapack -lblas"
CXXFLAGS="$CXXFLAGS -DLAPACK"
HAS_LAPACK="yes"
fi
#############################################################
# HDF5 library
#############################################################
HDFPATH="" # Indicates not found
HAS_PHDF5="no"
if test "$with_parallelhdf5" != "no" && test "$with_parallelhdf5" != ""
then
with_hdf5="$with_parallelhdf5"
fi
if test "$with_hdf5" != "no"
then
##########################################
# Try to find a valid HDF5 configuration
if (test "$with_hdf5" = "yes") || (test "$with_hdf5" = "")
then
# No path specified
echo "Searching for HDF5 configuration"
# Try some common HDF5 utilities
for i in h5cc h5pcc h5diff h5ls
do
printf " -> Looking for $i..."
if type $i > /dev/null 2>&1; then
printf "yes\n"
# Remove 'h5cc' then bin
HDFPATH=`which $i | xargs -0 dirname | xargs -0 dirname`
break
fi
printf "no\n"
done
# Check for include and library files
AC_CHECK_FILES($HDFPATH/include/hdf5.h ,, [
echo " -> Can't find HDF5 files"
HDFPATH=""
] )
else
HDFPATH=$with_hdf5 # Configure given path
# Check for include and library files
AC_CHECK_FILES($HDFPATH/include/hdf5.h ,, [
echo " ERROR: Given HDF5 path not correct."
exit
] )
fi
# Try some known paths
if test "$HDFPATH" = ""
then
AC_CHECK_FILE(/usr/include/hdf5.h, HDFPATH=/usr,
AC_CHECK_FILE(/usr/local/include/hdf5.h, HDFPATH=/usr/local,
AC_CHECK_FILE(/opt/local/include/hdf5.h, HDFPATH=/opt/local,
AC_CHECK_FILE($HOME/local/include/hdf5.h, HDFPATH=$HOME/local,
AC_CHECK_FILE($HOME/include/hdf5.h, HDFPATH=$HOME,
)))))
fi
if test $HDFPATH
then
AC_CHECK_FILES($HDFPATH/lib/libhdf5.a , HDFLIBPATH='lib',
AC_CHECK_FILES($HDFPATH/lib64/libhdf5.a , HDFLIBPATH='lib64', HDFPATH=''))
test $HDFLIBPATH || echo " -> Can't find HDF5 files"
fi
# Check if found valid path
if test "$HDFPATH" != ""
then
echo "HDF5 path: $HDFPATH"
CXXFLAGS="$CXXFLAGS -DHDF5"
if test "$with_phdf5" != "no" && test "$with_parallelhdf5" != ""
then
CXXFLAGS="$CXXFLAGS -DPHDF5"
HAS_PHDF5="yes"
fi
EXTRA_INCS="$EXTRA_INCS -I$HDFPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$HDFPATH/$HDFLIBPATH -lhdf5 -lz"
file_formats="$file_formats HDF5"
else
printf "HDF5 library not found\n\n"
fi
else
printf "HDF5 support disabled\n"
fi
echo ""
#############################################################
# netCDF support
#############################################################
NCCONF="" # Configuration script
if test "$with_netcdf" != "no"
then
##########################################
# Try to find a valid NetCDF configuration
echo "Searching for NetCDF configuration"
OLDNCDF="0" # Indicates whether nc-config or ncxx4-config
if (test "$with_netcdf" = "yes") || (test "$with_netcdf" = "")
then
# No path specified. Try using nc-config
if type ncxx4-config > /dev/null 2>&1; then
NCCONF=`which ncxx4-config` # New interface
elif type nc-config > /dev/null 2>&1; then
# Older interface. May or may not have C++ support
echo " -> nc-config script found:" `which nc-config`
if test `nc-config --has-c++` = "yes"
then
echo " -> C++ support included"
NCCONF=`which nc-config`
OLDNCDF="1"
else
echo " -> NO C++ SUPPORT"
fi
else
echo " -> No configure script found. Specify using --with-netcdf option"
fi
else
# see if configure scripts are in path
if type $with_netcdf/ncxx4-config > /dev/null 2>&1; then
NCCONF="$with_netcdf/ncxx4-config"
elif type $with_netcdf/bin/ncxx4-config > /dev/null 2>&1; then
NCCONF="$with_netcdf/bin/ncxx4-config"
elif type $with_netcdf/nc-config > /dev/null 2>&1; then
NCCONF="$with_netcdf/nc-config"
OLDNCDF="1"
elif type $with_netcdf/bin/nc-config > /dev/null 2>&1; then
NCCONF="$with_netcdf/bin/nc-config"
OLDNCDF="1"
fi
fi
##########################################
# Get configuration
if test "$NCCONF" != ""; then
echo " -> NetCDF config script found: $NCCONF"
NCINC=`$NCCONF --cflags`
EXTRA_INCS="$EXTRA_INCS $NCINC"
if test "$OLDNCDF" == "1"; then
NCLIB=`$NCCONF --libs | sed s/-lnetcdf/-lnetcdf_c++\ -lnetcdf/` # Note netcdf_c++ needed
LDFLAGS="$LDFLAGS -Wl,-rpath,`nc-config --prefix`/lib"
CXXFLAGS="$CXXFLAGS -DNCDF"
echo " -> NetCDF support enabled"
else
NCLIB=`$NCCONF --libs`
CXXFLAGS="$CXXFLAGS -DNCDF4"
echo " -> NetCDF-4 support enabled"
fi
EXTRA_LIBS="$EXTRA_LIBS $NCLIB"
file_formats="$file_formats netCDF"
NCPATH="found"
else
# No configuration script. Check the NetCDF path manually
NCPATH=$with_netcdf
if test "$NCPATH" != ""
then
# Path set, so check if libraries present
AC_CHECK_FILES( $NCPATH/include/netcdfcpp.h $NCPATH/lib/libnetcdf_c++.a $NCPATH/lib/libnetcdf.a ,, [
echo " -> Given path not correct. Finding..."
NCPATH=""
] )
else
echo " -> Path not given. Searching for library..."
fi
# Try some known paths
if test "$NCPATH" = ""
then
AC_CHECK_FILE(/usr/include/netcdfcpp.h, NCPATH=/usr/,
AC_CHECK_FILE(/usr/local/include/netcdfcpp.h, NCPATH=/usr/local/,
AC_CHECK_FILE(/opt/local/include/netcdfcpp.h, NCPATH=/opt/local/,
AC_CHECK_FILE($HOME/local/include/netcdfcpp.h, NCPATH=$HOME/local,
AC_CHECK_FILE($HOME/include/netcdfcpp.h, NCPATH=$HOME,
)))))
if test "$NCPATH" != ""
then
# Check for the rest of the files
AC_CHECK_FILES( $NCPATH/lib/libnetcdf_c++.a $NCPATH/lib/libnetcdf.a, NCPATHLIB='lib',
AC_CHECK_FILES( $NCPATH/lib64/libnetcdf_c++.a $NCPATH/lib64/libnetcdf.a, NCPATHLIB='lib64', NCPATH=""))
fi
fi
# Try to find using locate
if test "$NCPATH" = ""
then
NCFILE=`locate netcdfcpp.h | head -n 1`
if test "$NCFILE" != ""
then
NCFILE=`dirname $NCFILE`
NCFILE=$NCFILE/..
AC_CHECK_FILES( $NCFILE/include/netcdfcpp.h , NCPATH=$NCFILE, with_netcdf="no")
AC_CHECK_FILES( $NCFILE/lib/libnetcdf_c++.a $NCFILE/lib/libnetcdf.a , NCPATHLIB='lib',
AC_CHECK_FILES( $NCFILE/lib64/libnetcdf_c++.a $NCFILE/lib64/libnetcdf.a , NCPATHLIB='lib64', with_netcdf="no"))
else
echo "checking locate... no"
with_netcdf="no"
fi
fi
# Finally, if found, add to BOUT++
if test "$with_netcdf" != "no"
then
# Set a compile-time flag
CXXFLAGS="$CXXFLAGS -DNCDF"
if test "$NCPATH" != ""; then