-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·769 lines (696 loc) · 20.2 KB
/
configure
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
#!/bin/bash
###############################################################################
#
# Copyright 2008, 2015, Mississippi State University
#
# This file is part of the Loci Framework.
#
# The Loci Framework is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Loci Framework 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
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with the Loci Framework. If not, see <http://www.gnu.org/licenses>
#
###############################################################################
LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH:/:/usr:/usr/local:/opt:/opt/local
PETSC_BASE=$PETSC_DIR
if [ -e ParMetis-4.0/metis.h ] ; then
INSTALL_METIS=1
USE_METIS=1
METIS_BASE="\$(LOCI_BASE)/ParMetis-4.0"
METIS_LIBS="-lparmetis -lmetis -lgk"
METIS_INCLUDE="-I\$(METIS_BASE) -DLOCI_USE_METIS"
else
INSTALL_METIS=0
USE_METIS=0
METIS_BASE=
METIS_LIBS=
METIS_INCLUDE=
fi
set +e
set -u
set -f
if [ "$PETSC_BASE" == "" ]; then
PETSC_BASE=/notinstalled/petsc
fi
H5PATH=/notinstalled/hdf5
CGNSPATH=none
TEC360PATH=none
find_exec() {
RETURN_VALUE=0
for i in ${PATH//:/ }; do
if [ -e $i/$1 ]; then
RETURN_VALUE=$i
break ;
fi
done
}
find_lib() {
RETURN_VALUE=0
for i in ${LD_LIBRARY_PATH//:/ }; do
if [ -e $i/lib$1.a ]; then
RETURN_VALUE=$i
break;
fi
if [ -e $i/lib$1.so ]; then
RETURN_VALUE=$i
break ;
fi
if [ -e $i/lib$1.dylib ]; then
RETURN_VALUE=$i
break ;
fi
done
}
OBJDIR=OBJ
ARCH=`uname -s`
COMPILER=gcc
case "$ARCH" in
IRIX64)
COMPILER=CC_sgi
;;
*)
;;
esac
NO_MPI=0
NO_MPI_DRIVER=0
PREFIX=/usr/local
if [ $# -eq 0 ]; then
echo "*******************************************************************************"
echo "** NOTICE!!!!"
echo "** Usually the option --prefix will be used to specify an installation"
echo "** directory. The default setting for the prefix is \"${PREFIX}\". If you"
echo "** want to install into a different directory, use the --prefix option of "
echo "** configure. Execute \"./configure --help\" to see more configure options."
echo "** NOTICE!!!!"
echo "*******************************************************************************"
fi
MPI_BASE=/notselected
while [ $# -ne 0 ]; do
case "$1" in
--prefix)
shift
PREFIX=$1
;;
--prefix\=*)
tmp=$1
PREFIX=${tmp#--prefix\=}
;;
--petsc-dir)
shift
PETSC_BASE=$1
;;
--petsc-dir\=*)
tmp=$1
PETSC_BASE=${tmp#--petsc-dir\=}
;;
--with-petsc)
shift
PETSC_BASE=$1
;;
--with-petsc\=*)
tmp=$1
PETSC_BASE=${tmp#--with-petsc\=}
;;
--no-metis)
METIS_BASE=""
METIS_LIBS=""
METIS_INCLUDE=""
INSTALL_METIS=0
USE_METIS=0
;;
--nometis)
METIS_BASE=""
METIS_LIBS=""
METIS_INCLUDE=""
INSTALL_METIS=0
USE_METIS=0
;;
--with-metis)
shift
METIS_BASE=$1
INSTALL_METIS=0
;;
--with-metis\=*)
tmp=$1
METIS_BASE=${tmp#--with-metis\=}
INSTALL_METIS=0
;;
--hdf5-dir)
shift
H5PATH=$1
;;
--hdf5-dir\=*)
tmp=$1
H5PATH=${tmp#--hdf5-dir\=}
;;
--with-hdf5)
shift
H5PATH=$1
;;
--with-hdf5\=*)
tmp=$1
H5PATH=${tmp#--with-hdf5\=}
;;
--cgns-dir)
shift
CGNSPATH=$1
;;
--cgns-dir\=*)
tmp=$1
CGNSPATH=${tmp#--cgns-dir\=}
;;
--with-cgns)
shift
CGNSPATH=$1
;;
--with-cgns\=*)
tmp=$1
CGNSPATH=${tmp#--with-cgns\=}
;;
--tec360-dir)
shift
TEC360PATH=$1
;;
--tec360-dir\=*)
tmp=$1
TEC360PATH=${tmp#--tec360-dir\=}
;;
--with-tec360)
shift
TEC360PATH=$1
;;
--with-tec360\=*)
tmp=$1
TEC360PATH=${tmp#--with-tec360\=}
;;
--mpi-dir)
shift
MPI_BASE=$1
;;
--mpi-dir\=*)
tmp=$1
MPI_BASE=${tmp#--mpi-dir\=}
;;
--with-mpi)
shift
MPI_BASE=$1
;;
--with-mpi\=*)
tmp=$1
MPI_BASE=${tmp#--with-mpi\=}
;;
--no-mpi-driver)
NO_MPI_DRIVER=1
;;
--compiler)
shift
COMPILER=$1
;;
--compiler\=*)
tmp=$1
COMPILER=${tmp#--compiler\=}
;;
--obj-dir)
shift
OBJDIR=$1
;;
--obj-dir\=*)
tmp=$1
OBJDIR=${tmp#--obj-dir\=}
;;
--nompi)
NO_MPI=1
;;
--help)
echo "configure usage:"
echo "./configure <options>"
echo "where <options> may include"
echo " --prefix <install directory> : tell configure where to install Loci."
echo " --with-hdf5 <HDF5 directory> : tell configure where to find HDF5 package."
echo " --with-cgns <CGNS directory> : tell configure where to find CGNS package."
echo " --with-tec360 <tec360 directory> : tell configure where to find TECIO package."
echo " --with-mpi <MPI directory> : tell configure where to find MPI package."
echo " --nompi : tell configure to build without using MPI"
echo " --with-petsc <PETSc directory> : tell configure where to find PETSc package."
echo " --with-metis <parMETIS dir> : tell configure where to find alternative Parallel METIS package."
echo " --no-metis : tell configure not to install or use metis"
echo " --compiler <compiler name> : tell configure what compiler to use"
echo " --obj-dir <OBJDIR name> : tell configure where to put object files"
echo " --help : output this help information"
exit -1
;;
*)
echo configure option \'$1\' not understood!
echo use ./configure --help to see correct usage!
exit -1
break
;;
esac
shift
done
if [ ${INSTALL_METIS} == 0 ] ; then
GKLIB=""
if [ -f ${METIS_BASE}/lib/libgk.so ] ; then
GKLIB="-lgk"
fi
if [ -f ${METIS_BASE}/lib/libgk.a ] ; then
GKLIB="-lgk"
fi
if [ -f ${METIS_BASE}/lib/libgk.dylib ] ; then
GKLIB="-lgk"
fi
if [ ${USE_METIS} == 0 ] ; then
METIS_LIBS=""
METIS_INCLUDE=""
else
METIS_LIBS="-L\$(METIS_BASE)/lib -lparmetis -lmetis $GKLIB"
METIS_INCLUDE="-I\$(METIS_BASE)/include -DLOCI_USE_METIS"
fi
fi
echo Setup for compiler \"$COMPILER\".
#setup install directory
echo INSTALL_DIR=$PREFIX > sys.conf
echo >> sys.conf
#setup MPI
HAS_MPI=1
MPIEXEC=mpirun
if [ $MPI_BASE == "/notselected" ]; then
find_exec mpirun
if [ $RETURN_VALUE == 0 ]; then
find_exec mpiexec
MPIEXEC=mpiexec
fi
MPI_PATH=$RETURN_VALUE
if [ $MPI_PATH == 0 ]; then
HAS_MPI=0
MPI_PATH="/usr"
fi
MPI_C_COMPILER=none
MPI_CPP_COMPILER=none
MPI_F90_COMPILER=none
if [ $NO_MPI_DRIVER == 0 ]; then
if [ -e $MPI_PATH/mpicc ]; then
MPI_C_COMPILER=mpicc
fi
if [ -e $MPI_PATH/mpif90 ]; then
MPI_F90_COMPILER=mpif90
fi
if [ -e $MPI_PATH/mpic++ ]; then
MPI_CPP_COMPILER=mpic++
else
if [ -e $MPI_PATH/mpicxx ]; then
MPI_CPP_COMPILER=mpicxx
else
if [ -e $MPI_PATH/mpiCC ]; then
MPI_CPP_COMPILER=mpiCC
fi
fi
fi
fi
MPI_BASE=`echo $MPI_PATH | sed "s/\/.[a-zA-Z0-9]*$//"`
else
MPI_PATH=$MPI_BASE/bin
MPI_C_COMPILER=none
MPI_CPP_COMPILER=none
MPI_F90_COMPILER=none
if [ -e $MPI_PATH/mpicc ]; then
MPI_C_COMPILER=mpicc
fi
if [ -e $MPI_PATH/mpif90 ]; then
MPI_F90_COMPILER=mpif90
fi
if [ -e $MPI_PATH/mpic++ ]; then
MPI_CPP_COMPILER=mpic++
else
if [ -e $MPI_PATH/mpicxx ]; then
MPI_CPP_COMPILER=mpicxx
else
if [ -e $MPI_PATH/mpiCC ]; then
MPI_CPP_COMPILER=mpiCC
fi
fi
fi
fi
MPI_LIBRARY=""
if [ -e $MPI_BASE/lib/libmpi.a ]; then
MPI_LIBRARY="-lmpi"
fi
if [ -e $MPI_BASE/lib/libmpi.so ]; then
MPI_LIBRARY="-lmpi"
fi
if [ -e $MPI_BASE/lib/libmpi.dylib ]; then
MPI_LIBRARY="-lmpi"
fi
if [ $MPI_LIBRARY=="" ]; then
if [ -e $MPI_BASE/lib/libmpich.a ]; then
MPI_LIBRARY="-lmpich"
fi
if [ -e $MPI_BASE/lib/libmpich.so ]; then
MPI_LIBRARY="-lmpich"
fi
if [ -e $MPI_BASE/lib/libmpich.dylib ]; then
MPI_LIBRARY="-lmpich"
fi
fi
echo \# MPI Libraries Setup >> sys.conf
if [ $NO_MPI == 1 ] ; then
echo "*********************************************************************"
echo "** Configuring Loci to not use MPI! This install will not support"
echo "** parallel processing."
echo "*********************************************************************"
echo MPI_BASE = >> sys.conf
echo MPI_LIBS = >> sys.conf
echo MPI_INCLUDE = -DMPI_STUBB -I\$\(LOCI_BASE\)/include/MPI_stubb >> sys.conf
echo MPI_RUN = none >> sys.conf
echo MPI_C_COMPILER = none >> sys.conf
echo MPI_CPP_COMPILER = none >> sys.conf
echo MPI_F90_COMPILER = none >> sys.conf
else
if [ "$MPI_C_COMPILER" == "none" ]; then
if [ "$ARCH" == "IRIX64" ]; then
echo MPI_BASE = /usr/ >> sys.conf
echo MPI_LIBS = -L/usr/lib64 \$\(RPATH\)/usr/lib64 $MPI_LIBRARY >> sys.conf
echo MPI_INCLUDE = -DMPI_NO_CPPBIND >> sys.conf
echo MPI_RUN = $MPIEXEC >> sys.conf
else
echo MPI_BASE = $MPI_BASE >> sys.conf
echo MPI_LIBS = -L$MPI_BASE/lib $MPI_LIBRARY >> sys.conf
echo MPI_INCLUDE = -DMPI_NO_CPPBIND -I$MPI_BASE/include >> sys.conf
echo MPI_RUN=$MPI_PATH/$MPIEXEC >> sys.conf
fi
else
echo MPI_BASE = $MPI_BASE >> sys.conf
echo MPI_LIBS = >> sys.conf
echo MPI_INCLUDE = -DMPI_NO_CPPBIND -DMPICH_IGNORE_CXX_SEEK >> sys.conf
echo MPI_RUN=$MPI_PATH/$MPIEXEC >> sys.conf
fi
echo MPI_C_COMPILER = $MPI_C_COMPILER >> sys.conf
echo MPI_CPP_COMPILER = $MPI_CPP_COMPILER >> sys.conf
echo MPI_F90_COMPILER = $MPI_F90_COMPILER >> sys.conf
fi
echo >> sys.conf
#setup hdf5
# find hdf5
if [ ! -d "$H5PATH" ]; then
find_exec h5dump
if [ $RETURN_VALUE != 0 ]; then
H5PATH=${RETURN_VALUE%/bin*}
fi
fi
if [ ! -d "$H5PATH" ]; then
find_lib hdf5
if [ $RETURN_VALUE != 0 ]; then
H5PATH=${RETURN_VALUE%/lib*}
fi
fi
if [ ! -d $H5PATH ]; then
echo Unable to find hdf5 libararies!
echo Make sure hdf5 executables are in your PATH and that the library
echo directories are in your LD_LIBRARY_PATH environment variables
echo exiting configure in failure!
exit -1
fi
H5SUPPORTLIBS=-lz
H5SUPPORTLIBSPATHS=
if [ -e $H5PATH/lib/libhdf5.settings ]; then
H5SUPPORTLIBS=`grep "Extra libraries" $H5PATH/lib/libhdf5.settings | sed "s/.*://"`
H5SUPPORTLIBSPATHS=`grep "AM_LDFLAGS" $H5PATH/lib/libhdf5.settings | sed "s/.*://"`
fi
echo \# HDF5 File I/O Libraries Setup >> sys.conf
echo HDF5_BASE = $H5PATH >> sys.conf
echo Using HDF5 libraries in directory \"$H5PATH\".
if [ -e $H5PATH/lib64/libhdf5.so ]; then
echo HDF5_LIBS = -L\$\(HDF5_BASE\)/lib64 \$\(RPATH\)\$\(HDF5_BASE\)/lib64 -L\$\(HDF5_BASE\)/lib \$\(RPATH\)\$\(HDF5_BASE\)/lib -lhdf5 -lz >> sys.conf
elif [ -e $H5PATH/lib/x86_64-linux-gnu/libhdf5_serial.so ]; then
echo HDF5_LIBS = -L\$\(HDF5_BASE\)/lib/x86_64-linux-gnu/ \$\(RPATH\)\$\(HDF5_BASE\)/lib/x86_64-linux-gnu -lhdf5_serial -lz >> sys.conf
else
echo HDF5_LIBS = -L\$\(HDF5_BASE\)/lib -lhdf5 \$\(RPATH\)\$\(HDF5_BASE\)/lib $H5SUPPORTLIBSPATHS $H5SUPPORTLIBS >> sys.conf
fi
if [ -e $H5PATH/lib/x86_64-linux-gnu/libhdf5_serial.so ]; then
echo HDF5_INCLUDE = -I\$\(HDF5_BASE\)/include/hdf5/serial >> sys.conf
else
echo HDF5_INCLUDE = -I\$\(HDF5_BASE\)/include/ >> sys.conf
fi
echo >> sys.conf
echo "# libxml2 library setup" >> sys.conf
XMLPATH=/usr
if [ ! -d $XMLPATH/include/libxml2 ]; then
find_lib xml2
if [ $RETURN_VALUE != 0 ]; then
XMLPATH=${RETURN_VALUE%/lib*}
fi
fi
if [ -d $XMLPATH/include/libxml2 ]; then
echo LIBXML2_DEFINE = -DUSE_LIBXML2 >> sys.conf
if [ -e $XMLPATH/lib64/libxml2.so -o -e $XMLPATH/lib64/libxml2.a ] ; then
echo LIBXML2_LIBS = -L$XMLPATH/lib64 -L$XMLPATH/lib \$\(RPATH\)$XMLPATH/lib64 \$\(RPATH\)$XMLPATH/lib -lxml2 >> sys.conf
else
echo LIBXML2_LIBS = -L$XMLPATH/lib -lxml2 >> sys.conf
fi
echo LIBXML2_INCLUDE = -I$XMLPATH/include/libxml2 >> sys.conf
echo Using libxml2 found in \"$XMLPATH/include/libxml2\".
else
echo libxml2 not found, disabling XML features!
echo LIBXML2_DEFINE = >> sys.conf
echo LIBXML2_LIBS = >> sys.conf
echo LIBXML2_INCLUDE = >> sys.conf
fi
echo >> sys.conf
echo \# METIS Library Setup >> sys.conf
echo INSTALL_METIS=$INSTALL_METIS >> sys.conf
echo METIS_BASE= $METIS_BASE >> sys.conf
echo METIS_LIBS= $METIS_LIBS >> sys.conf
echo METIS_INCLUDE= $METIS_INCLUDE >> sys.conf
echo >> sys.conf
if [ ! -d $CGNSPATH/include ]; then
find_lib cgns
if [ $RETURN_VALUE != 0 ]; then
CGNSPATH=${RETURN_VALUE%/lib*}
fi
fi
if [ ! -f $TEC360PATH/lib/libtecio.a ]; then
find_lib tecio
if [ $RETURN_VALUE != 0 ]; then
TEC360PATH=${RETURN_VALUE%/lib*}
echo Found tecplot360 IO libraries in $TEC360PATH
fi
fi
if [ -d $CGNSPATH/include ]; then
echo Using CGNS library found in $CGNSPATH
echo # CGNS Library Setup >> sys.conf
echo CGNS_BASE = $CGNSPATH >> sys.conf
echo CGNS_INCLUDE = -I\$\(CGNS_BASE\)/include/ -DUSE_CGNS >> sys.conf
echo CGNS_LIBS = -L\$\(CGNS_BASE\)/lib \$\(RPATH\)\$\(CGNS_BASE\)/lib -lcgns >> sys.conf
echo >>sys.conf
else
echo libcgns not found, disabling CGNS features!
echo CGNS_BASE = >> sys.conf
echo CGNS_INCLUDE = >> sys.conf
echo CGNS_LIBS = >> sys.conf
echo >> sys.conf
fi
if [ -f $TEC360PATH/lib/libtecio.a ]; then
echo Using TECPLOT native IO library found in $TEC360PATH
echo TEC360INCLUDE = -I$TEC360PATH/include -DUSE_NATIVE_TECPLOT >> sys.conf
echo TEC360LIB = $TEC360PATH/lib/libtecio.a >> sys.conf
else
echo Note: TECPLOT native IO library not found, older ascii format will be used instead.
echo If you expected to include TECPLOT support, use --with-tec360 to specify where
echo tecplot360 is installed.
echo
echo TEC360INCLUDE = >> sys.conf
echo TEC360LIB = >> sys.conf
fi
echo >> sys.conf
echo \# PETSc Library Setup >> sys.conf
if [ ! -d $PETSC_BASE ]; then
find_lib petsc
if [ $RETURN_VALUE != 0 ]; then
PETSC_BASE=${RETURN_VALUE%/lib*}
fi
fi
if [ -d $PETSC_BASE ]; then
if [ -e $PETSC_BASE/bmake/petscconf ]; then
# This is the OLD v2 petsc setup
PETSC_ARCH=`grep PETSC_ARCH $PETSC_BASE/bmake/petscconf | sed s/PETSC_ARCH=//`
if [ ! -d $PETSC_BASE/bmake/$PETSC_ARCH ]; then
echo Problem with PETSc library setup, check PETSC_DIR
echo PETSC_BASE = $PETSC_BASE
echo PETSC_ARCH = $PETSC_ARCH
rm sys.conf
exit -1
fi
if [ -e $PETSC_BASE/bmake/$PETSC_ARCH/petscconf ]; then
BLASLAPACK_LIB=`egrep ^BLASLAPACK_LIB $PETSC_BASE/bmake/$PETSC_ARCH/petscconf`
else
echo WARNING: Unable to find file $PETSC_BASE/bmake/$PETSC_ARCH/petscconf!
BLASLAPACK_LIB=
fi
if [ "$BLASLAPACK_LIB" == "" ] ; then
echo WARNING: BLAS library paths not extracted from PETSC config files!
echo WARNING: Is PETSC installed properly?
fi
echo Using PETSc libraries found in \"$PETSC_BASE\".
echo PETSC_BASE = $PETSC_BASE >> sys.conf
echo $BLASLAPACK_LIB >> sys.conf
echo PETSC_ARCH = $PETSC_ARCH >> sys.conf
echo PETSC_LIBS = -L\$\(PETSC_BASE\)/lib/\$\(PETSC_ARCH\) \$\(RPATH\)\$\(PETSC_BASE\)/lib/\$\(PETSC_ARCH\) -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc -L\$\(PETSC_BASE\)/externalpackages/fblaslapack/\$\(PETSC_ARCH\) \$\(RPATH\)\$\(PETSC_BASE\)/externalpackages/fblaslapack/\$\(PETSC_ARCH\) \$\(BLASLAPACK_LIB\) >> sys.conf
echo PETSC_INCLUDE = -I\$\(PETSC_BASE\)/include -I\$\(PETSC_BASE\)/bmake/\$\(PETSC_ARCH\) >> sys.conf
echo PETSC_DEFINE = -DUSE_PETSC -DPETSC_USE_EXTERN_CXX >> sys.conf
else
BLASLAPACK_LIB=
if [ -e $PETSC_BASE/conf/petscvariables ]; then
BLASLAPACK_LIB=`egrep ^BLASLAPACK_LIB $PETSC_BASE/conf/petscvariables`
else
if [ -e $PETSC_BASE/lib/petsc/conf/petscvariables ]; then
BLASLAPACK_LIB=`egrep ^BLASLAPACK_LIB $PETSC_BASE/lib/petsc/conf/petscvariables`
fi
fi
if [ "$BLASLAPACK_LIB" == "" ] ; then
set +f
if [ -e $PETSC_BASE/arch-*/conf/petscvariables ]; then
BLASLAPACK_LIB=`egrep ^BLASLAPACK_LIB $PETSC_BASE/arch-*/conf/petscvariables`
else
echo WARNING: Unable to find file $PETSC_BASE/arch-*/conf/petscvariables!
fi
set -f
fi
if [ "$BLASLAPACK_LIB" == "" ] ; then
echo WARNING: BLAS library paths not extracted from PETSC config files!
echo WARNING: Is PETSC installed properly?
fi
echo Using PETSc libraries found in \"$PETSC_BASE\".
echo PETSC_BASE = $PETSC_BASE >> sys.conf
echo $BLASLAPACK_LIB >> sys.conf
echo PETSC_LIBS = -L\$\(PETSC_BASE\)/lib/ \$\(RPATH\)\$\(PETSC_BASE\)/lib/ -lpetsc \$\(BLASLAPACK_LIB\) >> sys.conf
echo PETSC_INCLUDE = -I\$\(PETSC_BASE\)/include >> sys.conf
echo PETSC_DEFINE = -DUSE_PETSC -DPETSC_USE_EXTERN_CXX >> sys.conf
fi
else
echo "# PETSc not found, Loci compiled without PETSc enabled" >> sys.conf
echo "Warning: PETSc not installed... "
echo " Set PETSC_DIR if you want to compile Loci with"
echo " the PETSc libraries enabled."
fi
echo >> sys.conf
# check for fortran includes
FORTRAN_LIBS=
if [ "$MPI_C_COMPILER" == "none" ]; then
echo Selecting compiler = $COMPILER
else
COMP_TEST=`$MPI_PATH/$MPI_C_COMPILER -show | sed "s/ .*//"`
if [ -e src/conf/$COMP_TEST.conf ]; then
COMPILER=$COMP_TEST
echo Selecting compiler = $COMPILER
fi
fi
case "$COMPILER" in
gcc)
find_exec gfortran
if [ $RETURN_VALUE != 0 ]; then
FORTRAN_LIBS=-lgfortran
else
find_exec g77
if [ $RETURN_VALUE != 0 ]; then
FORTRAN_LIBS=-lg2c
fi
fi
;;
*)
# Currently only gcc compiler supported in fortran library search
;;
esac
case "$ARCH" in
SunOS)
# SunOS architecture
# find sunmath.h
find_exec cc
CCPATH=$RETURN_VALUE/cc
CCBASE=${CCPATH%/bin/cc}
CCINC=$CCBASE/prod/include/cc
if [ -e $CCINC/sunmath.h ]; then
echo MISC=-I$CCINC >> sys.conf
echo MISC_LIBS=-L$CCBASE/lib -lsunmath -lmalloc -lm $FORTRAN_LIBS >> sys.conf
else
echo MISC=-DNOSUNMATH >> sys.conf
echo MISC_LIBS=-lmalloc -lm $FORTRAN_LIBS >> sys.conf
fi
;;
*)
#everything else
echo MISC= >> sys.conf
echo MISC_LIBS=$FORTRAN_LIBS >> sys.conf
;;
esac
echo >> sys.conf
echo \# Dynamic Library Defines >> sys.conf
case "$ARCH" in
Linux)
echo DYNAMIC_LOADING_DEFINES = >> sys.conf
echo DYNAMIC_LOADING_LINK = -ldl >> sys.conf
;;
Darwin)
echo DYNAMIC_LOADING_DEFINES = >> sys.conf
echo DYNAMIC_LOADING_LINK = -ldl >> sys.conf
;;
IRIX64)
echo DYNAMIC_LOADING_DEFINES = >> sys.conf
echo DYNAMIC_LOADING_LINK = -lc >> sys.conf
;;
*)
echo DYNAMIC_LOADING_DEFINES = >> sys.conf
echo DYNAMIC_LOADING_LINK = >> sys.conf
;;
esac
echo >> sys.conf
case "$ARCH" in
Linux)
USEMAKE=make
;;
Darwin)
USEMAKE=make
;;
CYGWIN*)
USEMAKE=make
;;
*)
USEMAKE=gmake
;;
esac
echo MAKE =$USEMAKE >> sys.conf
echo >> sys.conf
echo "##############################################" >> sys.conf
echo "# No need to change things below this line" >> sys.conf
echo >> sys.conf
echo "MACHINE_SPECIFIC = \$(PETSC_DEFINE) \$(PETSC_INCLUDE) \$(HDF5_INCLUDE)\\">> sys.conf
echo " \$(MPI_INCLUDE) \$(METIS_INCLUDE) \$(CGNS_INCLUDE) \$(MISC)\\" >> sys.conf
echo " \$(DYNAMIC_LOADING_DEFINES) " >> sys.conf
echo >> sys.conf
echo "BASE_LIBS = \$(HDF5_LIBS) \$(PETSC_LIBS) \$(METIS_LIBS) \\" >> sys.conf
echo " \$(MISC_LIBS) \$(CGNS_LIBS) \$(DYNAMIC_LOADING_LINK) \$(MPI_LIBS)" >> sys.conf
echo Making compile subdirectory ${OBJDIR}...
INSTALL_METIS=$INSTALL_METIS ./tmpcopy --target $OBJDIR --compiler $COMPILER > copy.out
mv sys.conf ${OBJDIR}/sys.conf
# Make makefile
echo "default:" > Makefile
echo " cd ${OBJDIR}; $USEMAKE" >> Makefile
echo "install:" >> Makefile
echo " cd ${OBJDIR}; $USEMAKE install" >> Makefile
echo "clean:" >> Makefile
echo " cd ${OBJDIR}; $USEMAKE clean" >> Makefile
echo "distclean:" >> Makefile
echo " rm -fr ${OBJDIR} copy.out Makefile" >> Makefile
echo
echo
echo "To compile Loci, enter:"
echo " make"
echo "To install Loci in the directory $PREFIX, enter:"
echo " make install"