forked from bendudson/BOUT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
1382 lines (1179 loc) · 39 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, bd512@york.ac.uk
#
# 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 <bd512@york.ac.uk>
# * Changing to always require FFTW (removing NR routines)
#
AC_PREREQ(2.59)
AC_INIT(BOUT++, 1.0, bd512@york.ac.uk)
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(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(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_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"
else
CXXFLAGS="$CXXFLAGS -O"
fi
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"
elif test "$with_checks" = "3"
then
CXXFLAGS="$CXXFLAGS -DCHECK=3"
echo " -> Level 3 (Full checking + stack tracing)"
else
echo " -> Level 2 (Basic checking + stack tracing)"
CXXFLAGS="$CXXFLAGS -DCHECK=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
#############################################################
# 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" = "3" && 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
#############################################################
# 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 $with_ida/lib/libsundials_ida.a $with_ida/lib/libsundials_nvecparallel.a, , [
IDALIBS=""
] )
if test "$IDALIBS" != ""
then
IDAINCS="-I$IDALIBS/include"
IDALIBS="-L$IDALIBS/lib -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/lib/libsundials_ida.a $IDALIBS/lib/libsundials_nvecparallel.a, , [
IDALIBS=""
] )
fi
if test "$IDALIBS" != ""
then
IDAINCS="-I$IDALIBS/include"
IDALIBS="-L$IDALIBS/lib -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 $with_cvode/lib/libsundials_cvode.a $with_cvode/lib/libsundials_nvecparallel.a, , [
CVODELIBS=""
] )
if test "$CVODELIBS" != ""
then
CVODEINCS="-I$with_cvode/include"
CVODELIBS="-L$with_cvode/lib -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/lib/libsundials_cvode.a $CVODELIBS/lib/libsundials_nvecparallel.a, , [
CVODELIBS=""
])
fi
if test "$CVODELIBS" != ""
then
CVODEINCS="-I$CVODELIBS/include"
CVODELIBS="-L$CVODELIBS/lib -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
#############################################################
# FFT routines
#############################################################
echo "Searching for FFTW library"
if test "$with_fftw" = ""
then
# No path specified
FFTPATH=""
echo " -> Path not given. Searching for library..."
else
FFTPATH=$with_fftw
AC_CHECK_FILES( $FFTPATH/include/fftw3.h $FFTPATH/lib/libfftw3.a ,, [
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 $FFTW_ROOT/lib/libfftw3.a , 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 $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,
))))
if test "$FFTPATH" != ""
then
# Check for the rest of the files
# NOTE: AC_CHECK_FILES works here, but AC_CHECK_FILE doesn't (?!)
AC_CHECK_FILES( $FFTPATH/lib/libfftw3.a , , FFTPATH="" )
fi
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/lib -lfftw3"
fi
echo ""
#############################################################
# LAPACK routines (Used for tri- and band-diagonal solvers)
#############################################################
if ( ( test "$with_lapack" != "" ) && ( test "$with_lapack" != "no" ) )
then
echo "Using LAPACK"
EXTRA_LIBS="$EXTRA_LIBS -llapack -lblas"
CXXFLAGS="$CXXFLAGS -DLAPACK"
fi
#############################################################
# 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($HOME/local/include/netcdfcpp.h, NCPATH=$HOME/local,
)))
if test "$NCPATH" != ""
then
# Check for the rest of the files
AC_CHECK_FILES( $NCPATH/lib/libnetcdf_c++.a $NCPATH/lib/libnetcdf.a, , 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 $NCFILE/lib/libnetcdf_c++.a $NCFILE/lib/libnetcdf.a , NCPATH=$NCFILE, 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
echo " -> path $NCPATH"
EXTRA_INCS="$EXTRA_INCS -I$NCPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$NCPATH/lib"
LDFLAGS="$LDFLAGS -Wl,-rpath,$NCPATH/lib"
fi
EXTRA_LIBS="$EXTRA_LIBS -lnetcdf_c++ -lnetcdf"
file_formats="$file_formats netCDF"
echo " -> NetCDF support enabled"
else
echo "NetCDF support disabled"
fi
fi
fi
echo ""
#############################################################
# Parallel NetCDF support
#############################################################
PNCPATH=""
if test "$with_pnetcdf" != "no"
then
echo "Searching for Parallel-NetCDF library"
if test "$with_pnetcdf" != ""
then
# Given a path to the library
AC_CHECK_FILES($with_pnetcdf/include/pnetcdf.h $with_pnetcdf/lib/libpnetcdf.a, PNCPATH=$with_pnetcdf,)
if test "$PNCPATH" == ""
then
echo "parallel-netcdf not found in given directory"
fi
fi
# Find the utilities included with pnetcdf
if test "$PNCPATH" == ""
then
path=`which ncmpidump`
if test "$path" != ""
then
path=`dirname $path`
path=$path/..
AC_CHECK_FILES($path/include/pnetcdf.h $path/lib/libpnetcdf.a, PNCPATH=$path,)
fi
fi
# Try locate
if test "$PNCPATH" == ""
then
path=`locate pnetcdf.h | head -n 1`
if test "$path" != ""
then
path=$path/..
AC_CHECK_FILES($path/include/pnetcdf.h $path/lib/libpnetcdf.a, PNCPATH=$path,)
fi
fi
fi
if test "$PNCPATH" == ""
then
echo "Parallel-NetCDF support disabled"
else
# Set a compile-time flag
CXXFLAGS="$CXXFLAGS -DPNCDF"
EXTRA_INCS="$EXTRA_INCS -I$PNCPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$PNCPATH/lib -lpnetcdf"
file_formats="$file_formats Parallel-NetCDF"
echo "Parallel-NetCDF support enabled"
fi
echo ""
#############################################################
# PACT library
#############################################################
AC_ARG_VAR(PACT,[Path to the Portable Application Toolkit library])
if test "$with_pdb" = "no"
then
echo "=> PDB support disabled"
else
echo "Searching for PDB library"
if test "$PACT" != ""
then
# Path set, check it's correct
AC_CHECK_FILES( $PACT/include/pdb.h $PACT/lib/libpdb.a $PACT/lib/libpml.a $PACT/lib/libscore.a ,, [
echo "PACT library location not correct. Finding..."
PACT=""
] )
else
echo "PACT variable not set. Searching for library..."
fi
if ( test "$with_pdb" != "" ) && ( test "$with_pdb" != "yes" ) && ( test "$with_pdb" != "no" )
then
# could be a path
PACT=$with_pdb
AC_CHECK_FILES( $PACT/include/pdb.h $PACT/lib/libpdb.a $PACT/lib/libpml.a $PACT/lib/libscore.a ,, [
echo "with-pdb library location not correct. Finding..."
PACT=""
] )
fi
## Try some known paths
if test "$PACT" = ""
then
AC_CHECK_FILE(/usr/include/pdb.h, PACT=/usr/,
AC_CHECK_FILE(/usr/local/include/pdb.h, PACT=/usr/local/,
AC_CHECK_FILE($HOME/local/include/pdb.h, PACT=$HOME/local/,
AC_CHECK_FILE($HOME/local/include/pdb.h, PACT=$HOME/local/,
))))
if test "$PACT" != ""
then
# Check the rest of the PACT libraries exist
AC_CHECK_FILES( $PACT/lib/libpdb.a $PACT/lib/libpml.a $PACT/lib/libscore.a, , PACT="")
fi
fi
## Try to find using locate
if test "$PACT" = ""
then
PACTFILE=`locate pdb.h | head -n 1`
if test "$PACTFILE" != ""
then
PACTFILE=`dirname $PACTFILE`
PACTFILE=$PACTFILE/..
AC_CHECK_FILES( $PACTFILE/include/pdb.h $PACTFILE/lib/libpdb.a $PACTFILE/lib/libpml.a $PACTFILE/lib/libscore.a,
PACT=$PACTFILE,
PACT="")
else
echo "checking locate... no"
fi
fi
# Test if PACT is set
if test "$PACT" != ""
then
with_pdb="yes"
# Set include and library paths
EXTRA_INCS="$EXTRA_INCS -I$PACT/include"
EXTRA_LIBS="$EXTRA_LIBS -L$PACT/lib"
fi
## Add PDB support if available
if test "$with_pdb" = "yes"
then
EXTRA_LIBS="$EXTRA_LIBS -lpdb -lpml -lscore \$(shell $PACT/bin/pact -link)"
# Set a compile-time flag. PDBF because PDB already used in score.h
CXXFLAGS="$CXXFLAGS -DPDBF"
file_formats="$file_formats PDB"
echo "=> PDB support enabled"
else
echo "=> PDB support not available"
fi
fi
echo
#############################################################
# Check file formats
#############################################################
if test "$file_formats" = ""
then
echo "ERROR: At least one file format must be supported"
exit
else
echo "Supported file formats:$file_formats"
fi
echo
#############################################################
# Hypre
#############################################################
if test "$with_hypre" != "no"
then
# Try to find a valid Hypre installation
HYPREPATH=""
if test "$with_hypre" != "yes"
then
# Path specified. Check that needed files exist
HYPREPATH=$with_hypre
echo "Looking for HYPRE in $HYPREPATH"
AC_CHECK_FILES( $HYPREPATH/include/HYPRE.h $HYPREPATH/lib/libHYPRE.a ,, [
echo " -> Given path not correct. Finding..."
HYPREPATH=""
] )
fi
if test "$HYPREPATH" = ""
then
# try some known paths
AC_CHECK_FILE(/usr/include/HYPRE.h, HYPREPATH=/usr/,
AC_CHECK_FILE(/usr/local/include/HYPRE.h, HYPREPATH=/usr/local/,
AC_CHECK_FILE(/opt/local/include/HYPRE.h, HYPREPATH=/opt/local/,
AC_CHECK_FILE($HOME/local/include/HYPRE.h, HYPREPATH=$HOME/local,
))))
if test "$HYPREPATH" = ""
then
# Check for the other files
AC_CHECK_FILES( $HYPREPATH/lib/libHYPRE.a ,, [
HYPREPATH=""
] )
fi
fi
if test "$HYPREPATH" != ""
then
echo "Support for Hypre enabled"
EXTRA_INCS="$EXTRA_INCS -I$HYPREPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$HYPREPATH/lib -lHYPRE"
CFLAGS="$CFLAGS -DBOUT_HAS_HYPRE"
else
echo "Support for Hypre disabled"
fi
echo ""
fi
#############################################################
# Hypre
#############################################################
if test "$with_hypre" != "no"
then
# Try to find a valid Hypre installation
HYPREPATH=""
if test "$with_hypre" != "yes"
then
# Path specified. Check that needed files exist
HYPREPATH=$with_hypre
echo "Looking for HYPRE in $HYPREPATH"
AC_CHECK_FILES( $HYPREPATH/include/HYPRE.h $HYPREPATH/lib/libHYPRE.a ,, [
echo " -> Given path not correct. Finding..."
HYPREPATH=""
] )
fi
if test "$HYPREPATH" = ""
then
# try some known paths
AC_CHECK_FILE(/usr/include/HYPRE.h, HYPREPATH=/usr/,
AC_CHECK_FILE(/usr/local/include/HYPRE.h, HYPREPATH=/usr/local/,
AC_CHECK_FILE(/opt/local/include/HYPRE.h, HYPREPATH=/opt/local/,
AC_CHECK_FILE($HOME/local/include/HYPRE.h, HYPREPATH=$HOME/local,
))))
if test "$HYPREPATH" = ""
then
# Check for the other files
AC_CHECK_FILES( $HYPREPATH/lib/libHYPRE.a ,, [
HYPREPATH=""
] )
fi
fi
if test "$HYPREPATH" != ""
then
echo "Support for Hypre enabled"
EXTRA_INCS="$EXTRA_INCS -I$HYPREPATH/include"
EXTRA_LIBS="$EXTRA_LIBS -L$HYPREPATH/lib -lHYPRE"
CXXFLAGS="$CXXFLAGS -DBOUT_HAS_HYPRE"
else
echo "Support for Hypre disabled"
fi
echo ""
fi
#############################################################
# Checks for programs
#############################################################