-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
740 lines (638 loc) · 25 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([NCPA Propagation Modeling Suite], [2.2.0], [[email protected]], ncpaprop)
#AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/common/parameterset.h])
#AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C++])
# set default variables
default_petsc_build_dir="${abs_builddir}/extern/petsc"
default_petsc_branch="release"
default_petsc_version=""
petsc_url="https://gitlab.com/petsc/petsc.git"
default_slepc_build_dir="${abs_builddir}/extern/slepc"
default_slepc_version="3.21.1"
slepc_url_base="https://slepc.upv.es/download/distrib"
warning_compiler_flags="-Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas"
# Need OS name for automatic default architecture name
os_type=$(uname -s | awk '{print tolower($0)}')
default_petsc_arch_name_real="arch-${os_type}-c-real"
default_petsc_arch_name_complex="arch-${os_type}-c-complex"
# Set up options for automatic prerequisite building
AC_ARG_WITH([localpetsc],
AS_HELP_STRING([--with-localpetsc],[Attempt to build a PETSc instance local to the $PACKAGE_NAME installation])
)
AC_ARG_WITH([localslepc],
AS_HELP_STRING([--with-localslepc],[Attempt to build a SLEPc instance local to the $PACKAGE_NAME installation. Automatically set to 'yes' if --with-localpetsc is specified])
)
AS_IF([test "x$with_localpetsc" = "xyes"],
[with_localslepc="yes"] )
AC_ARG_WITH([localpetscdebug],
AS_HELP_STRING([--with-localpetscdebug],[Build the debug version of PETSc/SLEPc instead of the default optimized version]),
[],
[with_localpetscdebug=no]
)
AC_ARG_WITH([insecuressl],
AS_HELP_STRING([--with-insecuressl],[Ignore SSL certificate errors when downloading SLEPc]),
[],
[with_insecuressl=no]
)
AC_ARG_ENABLE([localpetscmpi],
AS_HELP_STRING([--enable-localpetscmpi],[Build PETSc/SLEPc without MPI support]),
[],
[enable_localpetscmpi=no]
)
AC_ARG_ENABLE([autodependencies],
AS_HELP_STRING([--enable-autodependencies],[Attempt to install dependencies using the default package manager (Linux only). Currently supported package managers: apt, yum])
)
AC_ARG_ENABLE([compilerwarnings],
AS_HELP_STRING([--enable-compilerwarnings],[Don't suppress additional compiler warnings (development only)])
)
# Environmental variables
AC_ARG_VAR(local_petsc_dir,[Override default local PETSc installation directory])
AC_ARG_VAR(local_slepc_dir,[Override default local SLEPc installation directory])
AC_ARG_VAR(local_petsc_arch_real,[Override automatic PETSc real architecture name])
AC_ARG_VAR(local_petsc_arch_complex,[Override automatic PETSc complex architecture name])
AC_ARG_VAR(local_petsc_version,Override automatic PETSc version number)
AC_ARG_VAR(local_slepc_version,Override automatic (or outdated) SLEPc version number)
AC_CANONICAL_HOST
AC_MSG_CHECKING([operating system])
AC_MSG_RESULT([$host_os])
# check host OS for support
case $host_os in
darwin* )
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AC_MSG_ERROR([Option --enable-autodependencies is not supported on MacOS.])
])
;;
linux* )
# For Linux, need to know if apt-get or yum is installed
AC_CHECK_PROGS([default_package_manager],[apt-get yum],[])
AC_MSG_NOTICE([Detected package manager = ${default_package_manager}])
AS_IF([test "x${default_package_manager}" = "x"],[
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AC_MSG_ERROR([No supported package manager detected. Option --enable-autodependencies supports apt-get and yum.])
])
])
AS_IF([test "x${enable_compilerwarnings}" != "xyes"],[
warning_compiler_flags="${warning_compiler_flags} -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-unused-result"
])
;;
*)
AC_MSG_ERROR([Your platform is not currently supported])
;;
esac
# Look for bash and perl. If not found, check with the user, cause
# that's unusual for a Linux-like system
AC_PATH_PROG([BASHPATH],[bash],)
AS_IF([test "x$BASHPATH" = "x"],[
AC_MSG_FAILURE(["No bash interpreter found on your path! Please check this."])
])
AC_PATH_PROG([PERLPATH],[perl],)
AS_IF([test "x$PERLPATH" = "x"],[
AC_MSG_FAILURE(["No perl interpreter found on your path! Please check this."])
])
AC_PROG_RANLIB
AC_PROG_CXX
AS_IF([test "x$CXX" = "x"],[
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AS_CASE([$host_os],
[darwin*],[
AC_MSG_ERROR([Auto dependencies not available for MacOS. Install g++ using your package manager of choice.])
],
[linux*],[
AS_CASE([$default_package_manager],
[*apt-get],[
sudo $default_package_manager -y install g++
],
[*yum],[
sudo $default_package_manager -y install gcc-c++
],[
AC_MSG_ERROR([No supported package manager found (apt and yum currently supported)])
]
)
])
unset ac_cv_prog_CXX
unset ac_cv_cxx_compiler_gnu
unset ac_cv_prog_cxx_g
AC_PROG_CXX
AS_IF([test "x${CXX}" = "x"],[
AC_MSG_ERROR("Unable to install C++ compiler. Please install manually and retry.")
])
],[
AC_MSG_ERROR([Failed to detect a C++ compiler. Please install the appropriate package or compile from source.])
])
])
AC_PROG_CC
AS_IF([test "x$CC" = "x"],[
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AS_CASE([$host_os],
[darwin*],[
AC_MSG_ERROR([Auto dependencies not available for MacOS. Install gcc using your package manager of choice.])
],
[linux*],[
AS_CASE([$default_package_manager],
[*apt-get],[
sudo $default_package_manager -y install gcc
],
[*yum],[
sudo $default_package_manager -y install gcc
],[
AC_MSG_ERROR([No supported package manager found (apt and yum currently supported)])
]
)
])
unset ac_cv_prog_CC
unset ac_cv_cc_compiler_gnu
unset ac_cv_prog_cc_g
AC_PROG_CC
AS_IF([test "x${CC}" = "x"],[
AC_MSG_ERROR("Unable to install C compiler. Please install manually and retry.")
])
],[
AC_MSG_ERROR([Failed to detect a C compiler. Please install the appropriate package or compile from source.])
])
])
AC_PROG_CPP
# Checks for libraries.
AC_CHECK_LIB([m],[cos],,[AC_MSG_ERROR([Missing M library])])
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d],,[
# Are we going to try to auto-correct?
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AS_CASE([$host_os],
[darwin*],[
AC_MSG_ERROR([Auto dependencies not available for MacOS. Install FFTW using your package manager of choice.])
],
[linux*],[
AS_CASE([$default_package_manager],
[*apt-get],[
sudo $default_package_manager -y install libfftw3-dev
],
[*yum],[
sudo $default_package_manager -y install fftw-devel
],[
AC_MSG_ERROR([No supported package manager found (apt and yum currently supported)])
]
)
])
unset ac_cv_lib_fftw3_fftw_plan_dft_1d
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d],,[AC_MSG_ERROR([Could not install FFTW using ${default_package_manager}, please install manually])])
],[
AC_MSG_ERROR([Failed to detect FFTW. Please install the appropriate fftw3 dev package or compile from source.])
])
])
AC_CHECK_LIB([gslcblas], [cblas_dgemm],,[
# Are we going to try to auto-correct?
AS_IF([test "x$enable_autodependencies" = "xyes"],[
AS_CASE([$host_os],
[darwin*],[
AC_MSG_ERROR([Auto dependencies not available for MacOS. Install GSL using your package manager of choice.])
],
[linux*],[
AS_CASE([$default_package_manager],
[*apt-get],[
sudo $default_package_manager -y install libgsl-dev
],
[*yum],[
sudo $default_package_manager -y install gsl-devel
],[
AC_MSG_ERROR([No supported package manager found (apt and yum currently supported)])
]
)
])
unset ac_cv_lib_gslcblas_cblas_dgemm
AC_CHECK_LIB([gslcblas], [cblas_dgemm],,[AC_MSG_ERROR([Could not install GSL using ${default_package_manager}, please install manually])])
],[
AC_MSG_ERROR([Failed to detect GSL. Please install the appropriate gsl dev package or compile from source.])
])
])
AC_CHECK_LIB([gsl], [gsl_blas_dgemm],,[
# Are we going to try to auto-correct?
AS_IF([test "x$enable_auto_dependencies" = "xyes"],[
AS_CASE([$host_os],
[darwin*],[
AC_MSG_ERROR([Auto dependencies not available for MacOS. Install GSL using your package manager of choice.])
],
[linux*],[
AS_CASE([$default_package_manager],
[*apt-get],[
sudo $default_package_manager -y install libgsl-dev
],
[*yum],[
sudo $default_package_manager install gsl-devel
],[
AC_MSG_ERROR([No supported package manager found (apt and yum currently supported)])
]
)
])
unset ac_cv_lib_gsl_gsl_blas_dgemm
AC_CHECK_LIB([gsl], [gsl_blas_dgemm],,[AC_MSG_ERROR([Could not install GSL using ${default_package_manager}, please install manually])])
],[
AC_MSG_ERROR([Failed to detect GSL. Please install the appropriate gsl dev package or compile from source.])
])
])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([floor memset mkdir modf pow sqrt strpbrk])
# Try to install PETSc and/or SLEPc if requested
AC_MSG_CHECKING([automatic local PETSc installation])
AS_IF(
[test "x${with_localpetsc}" = "xyes"],
[
AC_MSG_RESULT([yes])
AC_LANG_PUSH([C])
# See if default PETSc directory is overridden
AS_IF([test "x${local_petsc_dir}" != "x"],
[petsc_build_dir=${local_petsc_dir}],
[petsc_build_dir="$(pwd)/extern/petsc"])
# See if default PETSc version is overridden
AS_IF([test "x$local_petsc_version" = "x"],
[
AC_MSG_NOTICE([Using default PETSc])
petsc_version=""
],[
AC_MSG_NOTICE([Using PETSc version ${local_petsc_version}])
petsc_version="v${local_petsc_version}"
]
)
AC_MSG_NOTICE([petsc_build_dir = ${petsc_build_dir}])
# check for extra configuration options.
petsc_extra_config="--with-fc=0"
# See if default PETSc real arch name is overridden
AS_IF([test "x${local_petsc_arch_real}" = "x"],
[
AS_IF([test "x${with_localpetscdebug}" = "xyes"],
[
petsc_local_arch_name_real="${default_petsc_arch_name_real}-debug"
],
[
petsc_local_arch_name_real="${default_petsc_arch_name_real}"
]
)
],[petsc_local_arch_name_real=$local_petsc_arch_real])
AC_MSG_NOTICE([petsc_local_arch_name_real = ${petsc_local_arch_name_real}])
# See if default PETSc complex arch name is overridden
AS_IF([test "x${local_petsc_arch_complex}" = "x"],
[
AS_IF([test "x${with_localpetscdebug}" = "xyes"],
[
petsc_local_arch_name_complex="${default_petsc_arch_name_complex}-debug"
],
[
petsc_local_arch_name_complex="${default_petsc_arch_name_complex}"
]
)
],[petsc_local_arch_name_complex=$local_petsc_arch_complex])
AC_MSG_NOTICE([petsc_local_arch_name_complex = ${petsc_local_arch_name_complex}])
# debug version?
AS_IF([test "x${with_localpetscdebug}" = "xyes"],
[petsc_extra_config="${petsc_extra_config} --with-debugging=1"],
[petsc_extra_config="${petsc_extra_config} --with-debugging=0"]
)
# Use MPI?
AS_IF([test "x${enable_localpetscmpi}" = "xyes"],[
AC_CHECK_PROGS(MPI_FOUND, [mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++])
AS_IF([test "x$MPI_FOUND" = "x"],[
petsc_extra_config="${petsc_extra_config} --download-openmpi"
])
],[
petsc_extra_config="${petsc_extra_config} --with-mpi=0"
])
# Go get F2CBLAS-LAPACK?
AX_BLAS([
AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.])
],[
petsc_extra_config="${petsc_extra_config} --download-f2cblaslapack=1"
])
dnl AS_IF([test "x${with_localpetscfblas}" = "xyes"],
dnl [
dnl petsc_extra_config="${petsc_extra_config} --download-f2cblaslapack=1"
dnl ],[
dnl petsc_extra_config="${petsc_extra_config} --with-fc=0"
dnl ])
AC_MSG_NOTICE([petsc_extra_config = ${petsc_extra_config}])
# make the install dir
AC_MSG_CHECKING([PETSc build directory])
AS_IF([test -d "$petsc_build_dir"],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no, creating])
mkdir -p ${petsc_build_dir}
AS_IF([test -d "$petsc_build_dir"],,AC_MSG_ERROR(["Error creating PETSc build directory ${petsc_build_dir}"]))
])
# see if it's already been downloaded and/or built
basedir=$(pwd)
cd ${petsc_build_dir}
AC_MSG_CHECKING([PETSc download])
AS_IF([test -f "configure"],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, cloning])
git clone -b ${default_petsc_branch} ${petsc_url} .
]
)
# Version
AS_IF([test "x${petsc_version}" != "x"],
[
AC_MSG_NOTICE([Checking out branch ${petsc_version}])
git checkout ${petsc_version}
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error switching to PETSc version ${petsc_version}])]
)
]
)
AC_MSG_CHECKING([for existing ${petsc_local_arch_name_real} architecture])
AC_CHECK_FILE( ${petsc_build_dir}/${petsc_local_arch_name_real}/lib/petsc/conf/petscvariables,
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, building])
# build the real version with indicated options
./configure PETSC_ARCH=${petsc_local_arch_name_real} PETSC_DIR=${petsc_build_dir} ${petsc_extra_config}
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running PETSc configure command: ./configure PETSC_ARCH=${petsc_local_arch_name_real} PETSC_DIR=${petsc_build_dir} ${petsc_extra_config}])]
)
make PETSC_ARCH=${petsc_local_arch_name_real} PETSC_DIR=${petsc_build_dir} all
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running make command for real PETSc: make PETSC_ARCH=${petsc_local_arch_name_real} PETSC_DIR=${petsc_build_dir} all])]
)
# see if it made the include file
AC_MSG_CHECKING([successful ${petsc_local_arch_name_real} PETSc build])
# clear the cached variable
unset `$as_echo "ac_cv_file_${petsc_build_dir}/${petsc_local_arch_name_real}/lib/petsc/conf/petscvariables" | $as_tr_sh`
AC_CHECK_FILE( ${petsc_build_dir}/${petsc_local_arch_name_real}/lib/petsc/conf/petscvariables,,
[
AC_MSG_ERROR([Error building real PETSc, ${petsc_build_dir}/${petsc_local_arch_name_real}/lib/petsc/conf/petscvariables not found])
]
)
]
)
AC_MSG_CHECKING([for existing ${petsc_local_arch_name_complex} architecture])
AC_CHECK_FILE( ${petsc_build_dir}/${petsc_local_arch_name_complex}/lib/petsc/conf/petscvariables,
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, building])
# build the real version with indicated options
./configure PETSC_ARCH=${petsc_local_arch_name_complex} PETSC_DIR=${petsc_build_dir} ${petsc_extra_config} --with-scalar-type=complex
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running PETSc configure command: ./configure PETSC_ARCH=${petsc_local_arch_name_complex} PETSC_DIR=${petsc_build_dir} ${petsc_extra_config} --with-scalar-type=complex])]
)
make PETSC_ARCH=${petsc_local_arch_name_complex} PETSC_DIR=${petsc_build_dir} all
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running make command for complex PETSc: make PETSC_ARCH=${petsc_local_arch_name_complex} PETSC_DIR=${petsc_build_dir} all])]
)
# see if it made the include file
AC_MSG_CHECKING([successful ${petsc_local_arch_name_complex} PETSc build])
# clear the cached variable
unset `$as_echo "ac_cv_file_${petsc_build_dir}/${petsc_local_arch_name_complex}/lib/petsc/conf/petscvariables" | $as_tr_sh`
AC_CHECK_FILE( ${petsc_build_dir}/${petsc_local_arch_name_complex}/lib/petsc/conf/petscvariables,,
[
AC_MSG_ERROR([Error building complex PETSc, ${petsc_build_dir}/${petsc_local_arch_name_complex}/lib/petsc/conf/petscvariables not found])
]
)
]
)
AC_LANG_POP
export PETSC_DIR=${petsc_build_dir}
export PETSC_ARCH_REAL=${petsc_local_arch_name_real}
export PETSC_ARCH_COMPLEX=${petsc_local_arch_name_complex}
cd $basedir
],[AC_MSG_RESULT([no])
])
# check validity of PETSc installation
# first, environmental variables
AS_IF([test "x$PETSC_DIR" = "x"],[
AC_MSG_FAILURE([No value provided for PETSC_DIR!])
])
AS_IF([test "x$PETSC_ARCH_REAL" = "x"],[
AC_MSG_FAILURE([No value provided for PETSC_ARCH_REAL!])
])
AS_IF([test "x$PETSC_ARCH_COMPLEX" = "x"],[
AC_MSG_FAILURE([No value provided for PETSC_ARCH_COMPLEX!])
])
# check directories
AC_CHECK_FILE( $PETSC_DIR,[
AC_MSG_NOTICE([PETSc directory $PETSC_DIR OK.])
],[
AC_MSG_ERROR([PETSc directory $PETSC_DIR not found. Check your PETSC_DIR variable.])
])
AS_IF([test -d $PETSC_DIR],,[
AC_MSG_ERROR([Specified PETSc directory ${PETSC_DIR} is not a directory!])
])
# Now see if the various include files are present
PETSC_INCLUDE_FILE_GENERIC="${PETSC_DIR}/lib/petsc/conf/variables"
AC_CHECK_FILE( $PETSC_INCLUDE_FILE_GENERIC,,[
AC_MSG_ERROR([PETSc generic include file $PETSC_INCLUDE_FILE_GENERIC not found. Your PETSc build may be incomplete."])
])
AC_CHECK_FILE( ${PETSC_DIR}/${PETSC_ARCH_REAL}/lib/petsc/conf/petscvariables,,[
AC_MSG_ERROR([PETSc real architecture-specific include file ${PETSC_DIR}/${PETSC_ARCH_REAL}/lib/petsc/conf/petscvariables not found. Check your PETSC_ARCH_REAL variable and your PETSc installation.])
])
AC_CHECK_FILE( ${PETSC_DIR}/${PETSC_ARCH_COMPLEX}/lib/petsc/conf/petscvariables,,
[
AC_MSG_ERROR([PETSc complex architecture-specific include file ${PETSC_DIR}/${PETSC_ARCH_COMPLEX}/lib/petsc/conf/petscvariables not found. Check your PETSC_ARCH_COMPLEX variable and your PETSc installation.])
])
AC_MSG_CHECKING([automatic local SLEPc installation])
AS_IF([test "x${with_localslepc}" = "xyes"],[
AC_MSG_RESULT([yes])
basedir=$(pwd)
downloader=""
AC_CHECK_PROGS(downloader,[wget curl])
AC_MSG_CHECKING([command-line downloader])
AS_IF([test "x${downloader}" = "x"],[
AC_MSG_RESULT([no])
AC_MSG_ERROR("Neither wget nor curl detected")
],[
AC_MSG_RESULT([$downloader])
])
# See if default SLEPc directory is overridden
AS_IF([test "x${local_slepc_dir}" != "x"],
[slepc_build_dir=${local_slepc_dir}],
[slepc_build_dir="$(pwd)/extern/slepc"]
)
# See if default SLEPc version is overridden
AS_IF([test "x$local_slepc_version" = "x"],
[slepc_version=$default_slepc_version],
[slepc_version=$local_slepc_version]
)
slepc_tarfile="slepc-${slepc_version}.tar.gz"
AC_MSG_NOTICE([slepc_build_dir = ${slepc_build_dir}])
AC_MSG_NOTICE([slepc_version = ${slepc_version}])
AC_MSG_NOTICE([slepc_tarfile = ${slepc_tarfile}])
# check for extra configuration options.
slepc_extra_config=""
# make the install dir
AC_MSG_CHECKING([SLEPc build directory])
AS_IF([test -d "$slepc_build_dir"],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no, creating])
mkdir -p "${slepc_build_dir}"
AS_IF([test -d "$slepc_build_dir"],,[
AC_MSG_ERROR(["Error creating SLEPc build directory ${slepc_build_dir}"])
])
])
# see if it's already been downloaded and/or built
cd ${slepc_build_dir}
slepc_build_dir="${slepc_build_dir}/slepc-${slepc_version}"
AC_MSG_CHECKING([SLEPc download])
AS_IF([test -f "${slepc_build_dir}/configure"],
[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no, installing])
AC_CHECK_FILE([$slepc_tarfile],,[
slepc_url="${slepc_url_base}/${slepc_tarfile}"
downloader_flags=""
AS_IF([test "x$downloader" = "xcurl"],[
downloader_flags="--output ${slepc_tarfile}"
])
AS_IF([test "x$with_insecuressl" = "xyes"],[
AS_IF([test "x$downloader" = "xwget"],[
downloader_flags="${downloader_flags} --no-check-certificate"
],[
downloader_flags="${downloader_flags} --insecure"
])
])
echo "Downloading using command: ${downloader} ${slepc_url} ${downloader_flags}"
$downloader ${slepc_url} ${downloader_flags}
AS_IF([test $? != 0],[
AC_MSG_ERROR([Error downloading ${slepc_url}, check internet connection and version number])
])
])
tar xvzf ${slepc_tarfile}
AS_IF([test $? != 0],[
AC_MSG_ERROR([Error decompressing slepc-${slepc_version}.tar.gz, check download])
])
]
)
export SLEPC_DIR=${slepc_build_dir}
cd $SLEPC_DIR
AC_CHECK_FILE( ${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables,,[
AC_MSG_RESULT([no, building])
# build the real version with indicated options
export PETSC_ARCH=${PETSC_ARCH_REAL}
./configure
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running SLEPc configure command: ./configure])]
)
make PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} PETSC_ARCH=${PETSC_ARCH}
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running make command for real SLEPc: make PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} PETSC_ARCH=${PETSC_ARCH}])]
)
# see if it made the include file
AC_MSG_CHECKING([successful ${PETSC_ARCH} SLEPc build])
# clear the cached variable
unset `$as_echo "ac_cv_file_${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables" | $as_tr_sh`
AC_CHECK_FILE( ${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables,,[
AC_MSG_ERROR([Error building real SLEPc, ${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables not found])
])
])
AC_MSG_CHECKING([for existing ${PETSC_ARCH_COMPLEX} SLEPc architecture])
AC_CHECK_FILE( ${slepc_build_dir}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables,,[
AC_MSG_RESULT([no, building])
# build the complex version with indicated options
export PETSC_ARCH=${PETSC_ARCH_COMPLEX}
./configure
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running SLEPc configure command: ./configure])]
)
make PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR}
AS_IF([test $? != 0],
[AC_MSG_ERROR([Error running make command for complex SLEPc: make PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR}])]
)
# see if it made the include file
AC_MSG_CHECKING([successful ${PETSC_ARCH} SLEPc build])
# clear the cached variable
unset `$as_echo "ac_cv_file_${slepc_build_dir}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables" | $as_tr_sh`
AC_CHECK_FILE( ${slepc_build_dir}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables,,[
AC_MSG_ERROR([Error building complex SLEPc, ${slepc_build_dir}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables not found])
])
])
cd $basedir
],[
AC_MSG_RESULT([no])
])
# Checks for environmental variables
AS_IF([test "x$SLEPC_DIR" = "x"],[
AC_MSG_ERROR([No value provided for SLEPC_DIR!])
])
# Check the SLEPc installation
# First, check that the directories exist
AC_CHECK_FILE( $SLEPC_DIR,[
AC_MSG_NOTICE([SLEPc directory $SLEPC_DIR OK])
],[
AC_MSG_ERROR([SLEPc directory $SLEPC_DIR not found. Check your SLEPC_DIR variable.])
])
AS_IF([test ! -d $SLEPC_DIR],[
AC_MSG_ERROR([Specified PETSc directory ${PETSC_DIR} is not a directory!])
])
# Now see if the generic include files are present
SLEPC_INCLUDE_FILE_GENERIC="${SLEPC_DIR}/lib/slepc/conf/slepc_common"
AC_CHECK_FILE( $SLEPC_INCLUDE_FILE_GENERIC,[
AC_MSG_NOTICE([SLEPc generic include file OK])
],[
AC_MSG_ERROR([SLEPc generic include file $SLEPC_INCLUDE_FILE_GENERIC not found. Your SLEPc build may be incomplete.])
])
# Finally check the architecture-specific files
AC_CHECK_FILE( ${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables,[
AC_MSG_NOTICE([SLEPc real architecture-specific include file OK])
],[
AC_MSG_ERROR([SLEPc real architecture-specific include file ${SLEPC_DIR}/${PETSC_ARCH_REAL}/lib/slepc/conf/slepcvariables not found. Check your PETSC_ARCH_REAL variable and your SLEPc installation.])
])
AC_CHECK_FILE( ${SLEPC_DIR}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables,[
AC_MSG_NOTICE([SLEPc complex architecture-specific include file OK])
],[
AC_MSG_ERROR([SLEPc complex architecture-specific include file ${SLEPC_DIR}/${PETSC_ARCH_COMPLEX}/lib/slepc/conf/slepcvariables not found. Check your PETSC_ARCH_COMPLEX variable and your SLEPc installation.])
])
# Set output variables to propagate into Makefiles
AC_SUBST([INCLUDEFLAGS],"-I. -I../common -I../atmosphere -I../libmodes -I../libpe -I../libbroadband -I/usr/local/include -I/usr/include")
AC_SUBST([LIBS],"-lgsl -lgslcblas -lm -lfftw3")
AC_SUBST([WARNINGFLAGS],${warning_compiler_flags})
AC_SUBST([CXXFLAGS], "-fpic -c -Wall $CXXFLAGS")
LDFLAGS="${LDFLAGS} -L/usr/lib"
AC_SUBST([STATICLIBS],"../../lib/libatmosphere.a ../../lib/libcommon.a")
AC_SUBST([MODELIBS],"../../lib/libmodes.a")
AC_SUBST([PELIBS],"../../lib/libpe.a")
AC_SUBST([BROADBANDLIBS],"../../lib/libbroadband.a")
AC_SUBST([LDFLAGS],$LDFLAGS)
AC_SUBST([PETSC_DIR],$PETSC_DIR)
AC_SUBST([SLEPC_DIR],$SLEPC_DIR)
AC_SUBST([PETSC_INCLUDE_FILE_GENERIC],$PETSC_INCLUDE_FILE_GENERIC)
AC_SUBST([SLEPC_INCLUDE_FILE_GENERIC],$SLEPC_INCLUDE_FILE_GENERIC)
AC_SUBST([PETSC_ARCH_REAL],$PETSC_ARCH_REAL)
AC_SUBST([PETSC_ARCH_COMPLEX],$PETSC_ARCH_COMPLEX)
AC_CONFIG_FILES([
Makefile
src/common/Makefile
src/atmosphere/Makefile
src/libmodes/Makefile
src/libpe/Makefile
src/libbroadband/Makefile
src/modess/Makefile
src/modbb/Makefile
src/epade_pe/Makefile
src/wmod/Makefile
src/gfpe/Makefile
])
AC_OUTPUT
AC_MSG_NOTICE([
Configuration complete. Run 'make' to finish building $PACKAGE_TARNAME.
])
AC_MSG_NOTICE
cat <<EOF
Configuration complete. Run 'make' to finish building $PACKAGE_TARNAME.
Add the following lines to your .bashrc, .bash_profile, or .profile login file:
export PETSC_DIR=${PETSC_DIR}
export SLEPC_DIR=${SLEPC_DIR}
export PETSC_ARCH_REAL=${PETSC_ARCH_REAL}
export PETSC_ARCH_COMPLEX=${PETSC_ARCH_COMPLEX}
EOF