-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
279 lines (225 loc) · 7.99 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([tps], [1.1], [https://github.com/pecos/tps])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([tps_config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([subdir-objects])
AM_EXTRA_RECURSIVE_TARGETS([style enforcestyle])
AX_SUMMARIZE_ENV
# MPI
AX_PROG_CC_MPI
AX_PROG_CXX_MPI
# libtool/dynamic library support
AC_PROG_LIBTOOL([disable-static])
# python binary
AM_PATH_PYTHON([3.6.8])
# python interface
AC_ARG_ENABLE([pybind11],
[AS_HELP_STRING([--enable-pybind11],[enable python interface [default=no]])],
[],[enable_pybind11=no])
if test ${enable_pybind11} == "yes" ; then
AX_PYTHON_DEVEL
CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([pybind11/pybind11.h],[],[found_pybind11_header=no])
if test "x${found_pybind11_header}" = "xno" ; then
AC_MSG_ERROR([pybind11 header not found. Please verify pybind11 is installed locally.])
fi
AC_LANG_POP([C++])
# check for mpi4py
AX_PATH_MPI4PY([3.1], [no])
if test x$HAVE_MPI4PY = x1 ; then
ENABLE_MPI4PY=yes
fi
fi
AM_CONDITIONAL(PYTHON_ENABLED,test x$enable_pybind11 = xyes)
AM_CONDITIONAL(ENABLED_MPI4PY,test x$ENABLE_MPI4PY = xyes)
# enable c++11 standard
CXXFLAGS="-std=c++11 $CXXFLAGS"
# check for mpi-ext.h
AC_LANG_PUSH([C++])
AH_TEMPLATE([HAVE_MPI_EXT],[Enable MPI extensions declared in mpi-ext.h])
AC_CHECK_HEADER([mpi-ext.h],[found_mpi_ext=yes],[found_mpi_ext=no],[#include <mpi.h>])
if test "x${found_mpi_ext}" = "xyes" ; then
AC_DEFINE([HAVE_MPI_EXT])
fi
AC_LANG_POP([C++])
#--------------------
# 3rd party libraries
#--------------------
AX_PATH_GRVY([0.36], [yes])
AX_PATH_HDF5([1.8.0],[yes])
AX_PATH_OPENBLAS([no])
ENABLE_MASA=no
AX_PATH_MASA([0.50], [no])
if test x$HAVE_MASA = x1 ; then
ENABLE_MASA=yes
fi
dnl AC_PROG_RANLIB
# Valgrind?
AX_VALGRIND_CHECK()
AM_CONDITIONAL(VALGRIND_ENABLED,test x$enable_valgrind = xyes)
#----------------------------------------------
# Optionally enable code coverage tool
#----------------------------------------------
AX_CODE_COVERAGE
#-- Slurm job restart support
ENABLE_SLURM=no
AH_TEMPLATE([HAVE_SLURM],[Enable SLURM resource manager support])
AC_ARG_ENABLE(slurm, [AS_HELP_STRING([--enable-slurm Whether to enable optional SLURM support or not (default=check)])],
[],[enable_slurm=check])
if test "x$enable_slurm" != "xno" ; then
AC_CHECK_HEADER([slurm/slurm.h],[found_slurm_header=yes],[found_slurm_header=no])
if test "x${found_slurm_header}" = "xyes" ; then
AC_CHECK_LIB([slurm],slurm_get_rem_time,[found_slurm_library=yes],[found_slurm_library=no])
if test "x${found_slurm_library}" = "xyes" ; then
AC_DEFINE([HAVE_SLURM])
ENABLE_SLURM=yes
else
ENABLE_SLURM=no
fi
fi
if test "x${enable_slurm}" = "xyes" ; then
if test "x$ENABLE_SLURM" = "xno" ; then
AC_MSG_ERROR([slurm requested, but not found locally])
fi
fi
fi
AM_CONDITIONAL(SLURM_ENABLED,test x$ENABLE_SLURM = xyes)
AH_TEMPLATE([_GPU_], [Build in GPU support])
AH_TEMPLATE([_CUDA_],[CUDA backend])
AH_TEMPLATE([_HIP_], [HIP backend])
dnl ------------------------------
dnl -- GPU/Cuda build setup
AC_MSG_CHECKING([if requesting gpu-cuda build])
AC_ARG_ENABLE([gpu-cuda],
[AS_HELP_STRING([--enable-gpu-cuda],[Enable GPU build, requires associated MFEM with CUDA support.])],
[],[enable_gpu_cuda=no])
AC_ARG_VAR(CUDA_ARCH,"Specifies target architecture for CUDA build")
if test x$enable_gpu_cuda = xyes ;then
AC_MSG_RESULT([yes])
AC_DEFINE([_GPU_])
# make sure we were given a desired cuda arch
AC_MSG_CHECKING([if gpu arch was provided])
if test x$CUDA_ARCH = x; then
AC_MSG_RESULT([no])
echo " "
echo "A desired CUDA_ARCH is required. Example settings include:"
echo "CUDA_ARCH=sm_70 # LLNL Lassen"
echo "CUDA_ARCH=sm_75 # Marvin"
echo " "
AC_MSG_ERROR([Please rerun configure with a valid CUDA_ARCH setting.])
else
AC_MSG_RESULT([yes])
fi
AC_LANG_PUSH([C])
AX_CHECK_CUDA
AC_LANG_POP([C])
AC_ARG_VAR(USER_CUDA_CXXFLAGS,"Additional C++ compiler flags")
CXX=$NVCC_PATH/nvcc
CUDA_CXXFLAGS="-Xcompiler=-fPIC -x=cu --expt-extended-lambda -arch=$CUDA_ARCH $USER_CUDA_CXXFLAGS -ccbin mpicxx $CUDA_CXXFLAGS"
CUDA_LDFLAGS="--expt-extended-lambda -arch=$CUDA_ARCH -ccbin mpicxx $CUDA_LDFLAGS -lcuda -lcudart"
dnl CUDA does not support -fPIC, disable in libtool in favor of -Xcompiler option above
_LT_TAGVAR(lt_prog_compiler_pic,)=''
_LT_TAGVAR(lt_prog_compiler_pic,CXX)=''
dnl CUDA aldo does not support -Wl linker option, replace with -Xlinker
_LT_TAGVAR(lt_prog_compiler_wl,CXX)='-Xlinker '
ENABLE_GPU=yes
ENABLE_CUDA=yes
AC_DEFINE([_CUDA_])
else
AC_MSG_RESULT([no])
ENABLE_GPU=no
ENABLE_CUDA=no
fi
AM_CONDITIONAL(CUDA_ENABLED,test x$ENABLE_CUDA = xyes)
AM_CONDITIONAL(GPU_ENABLED,test x$ENABLE_CUDA = xyes)
dnl ------------------------------
dnl Check for GPU/HIP build setup
ENABLE_HIP=no
if test x$ENABLE_GPU != xyes; then
AX_HIP_CHECK()
AM_CONDITIONAL(GPU_ENABLED,test x$ENABLE_HIP = xyes)
if test x$ENABLE_HIP = xyes; then
dnl Absolutely insist that libtool has CC=hipcc for tag=CXX
_LT_TAGVAR(compiler,CXX)='hipcc'
fi
fi
AM_CONDITIONAL(HIP_ENABLED,test x$ENABLE_HIP = xyes)
dnl ------------------------------
dnl Check for GPU build without hip or cuda
AC_ARG_ENABLE([gpu-cpu],
[AS_HELP_STRING([--enable-gpu-cpu],[Enable GPU code path on CPU (WARNING: Experimental option).])],
[],[enable_gpu_cpu=no])
if test x$enable_gpu_cpu = xyes; then
AC_MSG_NOTICE([Configuring for GPU code path build on CPU system])
AC_MSG_NOTICE([WARNING: This is an experimental feature.])
AC_DEFINE([_GPU_])
AM_CONDITIONAL(GPU_ENABLED,test x$enable_gpu_cpu = xyes)
fi
AX_PATH_MFEM([4.4], [yes])
#-- GSLIB support in MFEM?
AC_MSG_CHECKING([if GSLIB is available in mfem])
ENABLE_GSLIB=no
AC_LANG_PUSH([C++])
cxxflags_save=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $MFEM_CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <mfem/config/config.hpp>
#ifndef MFEM_USE_GSLIB
# error macro not defined
#endif
]])], [found_gslib_support="yes"], [found_gslib_support="no"])
CXXFLAGS=$cxxflags_save
AC_LANG_POP([C++])
AH_TEMPLATE([HAVE_GSLIB],[Enable GSLIB support])
if test "x$found_gslib_support" = "xyes" ; then
AC_DEFINE([HAVE_GSLIB])
ENABLE_GSLIB=yes
fi
if test "x$ENABLE_GSLIB" = "xno" ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AM_CONDITIONAL(GSLIB_ENABLED,test x$ENABLE_GSLIB = xyes)
# -------------------------------------------------------------
# Doxygen - look for doxygen (a documentation tool)
# -------------------------------------------------------------
AC_CONFIG_FILES(doc/Doxyfile)
AC_PATH_PROG(DOXYGEN, doxygen)
AC_SUBST(DOXYGEN)
# -------------------------------------------------------------
# -------------------------------------------------------------
# GSL - look for Gnu Scientific Library
# -------------------------------------------------------------
AH_TEMPLATE([HAVE_GSL],[Enable Gnu Scientific Library support])
ENABLE_GSL=no
AX_PATH_GSL(2.5, [ENABLE_GSL=yes], )
if test x$ENABLE_GSL = xyes; then
AC_DEFINE([HAVE_GSL])
fi
AM_CONDITIONAL(GSL_ENABLED,test x$ENABLE_GSL = xyes)
# -------------------------------------------------------------
# build deprecated capabilities if requested
# -------------------------------------------------------------
AH_TEMPLATE([_BUILD_DEPRECATED_], [Build deprecated functionality])
AC_ARG_ENABLE([build-deprecated],
[AS_HELP_STRING([--enable-build-deprecated],[Enable support for deprecated functionality.])],
[AC_DEFINE([_BUILD_DEPRECATED_])],[])
dnl --
AC_OUTPUT([Makefile src/Makefile test/Makefile utils/Makefile])
dnl create soft link to local bats binary in tests/
AC_MSG_NOTICE([Bootstrapping local bats test configuration])
if test -d test ; then
if test ! -e test/bats ; then
if test ! -L test/bats; then
ln -s $srcdir/../utils/bats/bin/bats test/bats
fi
fi
fi
dnl Final summary
AX_SUMMARIZE_CONFIG