forked from ester-project/ester
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.ac
More file actions
281 lines (236 loc) · 9.02 KB
/
configure.ac
File metadata and controls
281 lines (236 loc) · 9.02 KB
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
m4_include([version.m4])
AC_INIT([ESTER],
[ESTER_VERSION],
[http://ester-project.github.io/ester/],
[ester])
AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 tar-ustar -Wall subdir-objects foreign])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([config.h.in])
AC_PREFIX_DEFAULT(${HOME}/local)
# Checks for programs.
AC_PROG_LIBTOOL
AC_PROG_CPP
AC_PROG_CXX([icpc g++ clang++])
AC_PROG_CC([icc gcc clang])
AC_PROG_FC([ifort gfortran44 gfortran])
AC_PROG_F77([$FC])
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROG([ADDR2LINE], [addr2line], [yes], [no])
CXXFLAGS="$CXXFLAGS -std=c++11"
AS_IF([test "x$ADDR2LINE" == "xyes"],
[AC_DEFINE([HAVE_ADDR2LINE], [1], [addr2line is installed])])
AM_PATH_PYTHON(2.3)
AX_PKG_SWIG([1.3.17], [have_swig="yes"], [have_swig="no"])
AM_CONDITIONAL(HAVE_SWIG, [test "x$have_swig" == "xyes"])
AC_ARG_ENABLE([plt],
AS_HELP_STRING([--disable-plt],
[Enable/disable matplotlib support]))
AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
AC_PATH_PROGS([PYTHON_CONFIG],
[python$PYTHON_VERSION-config python-config],
[no],
[`dirname $PYTHON`])
AS_IF([test "x$PYTHON" != "x:"],
[PYTHONINC=`$PYTHON -c "from distutils import sysconfig; \
print(sysconfig.get_python_inc())"`
NUMPYINC=`$PYTHON -c "from numpy import get_include; print(get_include())"`
CPPFLAGS="$CPPFLAGS -I$PYTHONINC -I$NUMPYINC"
PYTHONLIBS=`$PYTHON_CONFIG --ldflags`
LIBS+=" $PYTHONLIBS"])
AS_IF([test "x$enable_plt" != "xno"],
[enable_plt="yes"
AC_MSG_CHECKING([for numpy API version])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
void main(void) {
int i = NPY_ARRAY_FARRAY_RO;
}
])],
[numpy_api=1.7],
[numpy_api=deprecated])
AC_MSG_RESULT($numpy_api)]
AC_DEFINE([ENABLE_PLT], [1], [Enable matplotlib grahpical output]),
[enable_plt="no"])
AS_IF([test "x$numpy_api" == "xdeprecated"],
[AC_DEFINE([USE_DEPRECATED_NUMPY], [1],
[Use deprecated (<1.7) numpy A API])])
# Checks for libraries.
# Checks for header files.
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/time.h])
AC_CHECK_HEADERS([cblas.h lapack.h])
AC_CHECK_HEADERS([Python.h],
[pymodule=yes],
[pymodule=no])
AM_CONDITIONAL(BUILD_ESTER_PY, [test "x$pymodule" == "xyes"])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
# AC_CHECK_HEADER_STDBOOL
# Checks for library functions.
AC_CHECK_LIB([m], [sqrt])
AC_CHECK_FUNC(cblas_dgemm, [have_cblas=yes], [have_cblas=no])
AC_CHECK_FUNC(dgemm_ , [have_blas=yes], [have_blas=no])
AC_CHECK_FUNC(dgetrf_ , [have_lapack=yes], [have_lapack=no])
# Search for mkl
AC_MSG_CHECKING([for mkl lib])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <mkl_cblas.h>
void main(void) {}
])],
[have_mkl=yes],
[have_mkl=no])
AC_MSG_RESULT($have_mkl)
AS_IF([test "x$have_mkl" == "xyes" -a "x$have_cblas" == "xno" -a "x$have_blas" == "xno" -a "x$have_lapack" == "xno"],
[AC_SEARCH_LIBS([dgetrf_], [mkl_rt],
[have_mkl=yes
AC_DEFINE([USE_MKL], [1],
[Use MKL lib])
LIBS="$LIBS -lmkl_rt"],
[have_mkl=no])])
AS_IF([test "x$have_mkl" == "xno"],
[AS_IF([test "x$ac_cv_header_cblas_h" == "xno"],
[AC_ERROR(could not find cblas.h)])
AS_IF([test "x$have_cblas" == "xno"],
[AC_SEARCH_LIBS([cblas_sgemm], [cblas blas],
[],
[AC_ERROR(cblas library not found)])])
AS_IF([test "x$have_blas" == "xno"],
[AC_CHECK_LIB([blas], [dgemm_], [],
[AC_ERROR(blas library not found)])])
AS_IF([test "x$have_lapack" == "xno"],
[AC_CHECK_LIB([lapack], [dgetrf_], [],
[AC_ERROR(blas library not found)])])])
AC_ARG_ENABLE([hdf5],
AS_HELP_STRING([--enable-hdf5],
[Enable HDF5 support]))
AS_IF([test "x$enable_hdf5" != "xno"],
[AX_LIB_HDF5([serial])
extension="out"
AS_IF([test "x$with_hdf5" == "xyes"],
[extension="h5"
CPPFLAGS="$CPPFLAGS $HDF5_CPPFLAGS"
LDFLAGS="$LDFLAGS $HDF5_LDFLAGS"
LIBS="$LIBS -lhdf5_cpp $HDF5_LIBS"
AC_DEFINE([USE_HDF5], [1], [Enable hdf5 support])],
[extension="out"])],
[with_hdf5="no"])
AM_CONDITIONAL(USE_HDF5, [test "x$with_hdf5" == "xyes"])
AC_SUBST(extension)
AC_LANG_POP([C++])
AC_FUNC_ERROR_AT_LINE
AC_CHECK_FUNCS([floor gettimeofday pow sqrt strtoul])
AC_CONFIG_FILES([Makefile
tables/Makefile
tables/cesam/Makefile
tables/freeeos/Makefile
tables/houdek/v9/Makefile
tables/houdek/v9/lib/Makefile
tables/opal/Makefile
src/Makefile
utils/Makefile
src/physics/Makefile
lib-example/Makefile
test/models/Makefile
python/Makefile])
AC_LANG_PUSH([Fortran 77])
AC_MSG_CHECKING([whether $FC supports -fno-align-commons])
save_fflags=$FFLAGS
FFLAGS="-fno-align-commons"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[fc_support_no_align_commons=yes],
[AC_MSG_RESULT([no])]
[fc_support_no_align_commons=no])
FFLAGS=$save_fflags
AC_LANG_POP([Fortran 77])
AS_IF([test "x$ac_cv_fc_compiler_gnu" == "xyes"], [
AS_IF([test "x$fc_support_no_align_commons" == "xyes"],
[FFLAGS="$FFLAGS -fno-align-commons"
FFLAGS="$FFLAGS -fdefault-real-8"
FFLAGS="$FFLAGS -fdefault-double-8"
FFLAGS="$FFLAGS -ffixed-line-length-none"
FFLAGS="$FFLAGS -O -w"
FFLAGS="$FFLAGS -fd-lines-as-comments"],
[AC_ERROR($FC does not support -fno-align-commons)])],
[FFLAGS="$FFLAGS -r8 -nowarn -fpp -extend-source"])
AC_ARG_ENABLE([perf-log],
AS_HELP_STRING([--enable-perf-log],
[Enable performance monitoring]), [
perf_log=$enableval], [
perf_log="no"])
AS_IF([test "x$enable_perf_log" == "xyes"], [
AC_DEFINE([PERF_LOG], [1], [Should perf-log be enabled])
perf_log="yes"])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[Enable debug mode]), [
AC_DEFINE([DEBUG], [1], [Eanble debug mode])
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"])
AC_DEFINE([ESTER_DATADIR], ["@datadir@"], [Path to ester data directory])
AC_MSG_CHECKING([whether we can run compiled binaries])
AC_LINK_IFELSE([AC_LANG_SOURCE([
void main(void) {
double a = 1.0, b = 1.0, c = 1.0;
int one = 1;
dgemm_("n", "n", &one, &one, &one, &a, &a, &one, &b, &one,
&a, &c, &one);
if (c == 2.0)
exit(0);
else
exit(1);
}
])],
[],
[AC_MSG_RESULT(no)
AC_ERROR(Could not link)])
AC_RUN_IFELSE([AC_LANG_SOURCE([
void main(void) {
double a = 1.0, b = 1.0, c = 1.0;
int one = 1;
dgemm_("n", "n", &one, &one, &one, &a, &a, &one, &b, &one,
&a, &c, &one);
if (c == 2.0)
exit(0);
else
exit(1);
}
])],
[can_run="yes"],
[can_run="no"])
AC_MSG_RESULT($can_run)
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version.m4'])
AC_OUTPUT
AS_IF([test "x$can_run" == "xno"],
[AC_WARN(Could not run compiled binary: check your LD_LIBRARY_PATH)])
cat<< EOF
-------------------------------------------------------------------------------
ester-$VERSION build configuration:
prefix: $prefix
FC: $FC
CPPFLAGS: $CPPFLAGS
LDFLAGS: $LDFLAGS
CXX: $CXX
CXXFLAGS: $CXXFLAGS
LIBS: $LIBS
HDF5: $with_hdf5
swig: $have_swig
python: $PYTHON_VERSION
py module: $pymodule
matplotlib: $enable_plt
-------------------------------------------------------------------------------
EOF