forked from amusecode/amuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
274 lines (220 loc) · 6.78 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
AC_INIT([amuse], m4_esyscmd_s([python support/version.py]))
AC_CONFIG_SRCDIR([src/amuse/__init__.py])
AC_CONFIG_FILES([config.mk])
AC_CONFIG_FILES([build.py:bin/amusifier.in],[chmod +x build.py])
AC_CONFIG_FILES([bin/amusifier:build.py],[chmod +x bin/amusifier])
#CODE_GENERATOR="\${AMUSE_DIR}/build.py"
CODE_GENERATOR=amusifier
AC_SUBST(CODE_GENERATOR)
AC_PROG_CC()
AC_PROG_CXX()
AC_PROG_FC([],95)
AS_IF([test "x$FC" = "x"], [AC_MSG_ERROR([No fortran compiler found, please set the FC flag])])
AX_FC_WORKS()
AX_FC_ISO_C_BINDING()
AC_ARG_VAR([PYTHON], [Python interpreter])
AC_SUBST(FC_ISO_C_BINDINGS)
AS_IF([test "x$PYTHON" = "x"], [PYTHON=python])
AC_PATH_PROG([PYTHON], [$PYTHON], [])
AC_ARG_VAR([NVCC], [CUDA compiler command])
AC_ARG_VAR([NVCC_FLAGS], [Extra flags for the CUDA nvcc compiler])
AC_CHECK_PYTHON_DEV()
AC_ARG_VAR([JAVA_HOME], [Java sdk directory])
R_JAVA()
AC_SUBST(JAVA)
AC_SUBST(JAVA_LIBS)
AC_ARG_VAR([MPIEXEC], [mpiexec or mpirun location])
AC_PATH_PROGS(MPIEXEC, $MPIEXEC mpiexec mpirun)
AC_SUBST(MPIEXEC)
AC_ARG_ENABLE(mpi,
[AS_HELP_STRING([--enable-mpi],[Enable MPI support for communicating with codes, by default enabled])],
[WITH_MPI=no
AS_IF([test "x$enable_mpi" != "xno"], [
WITH_MPI=yes
])
],
[WITH_MPI=yes]
)
AC_SUBST(WITH_MPI)
AS_IF([test x"$WITH_MPI" != xno],[
AC_LANG(C++)
AX_MPI()
AC_LANG(C)
AX_MPI()
AC_LANG(Fortran)
AX_MPI()
], [
MPICC="$CC"
MPICXX="$CXX"
MPIFC="$FC"
CFLAGS="$CFLAGS -DNOMPI"
CXXFLAGS="$CXXFLAGS -DNOMPI"
FCFLAGS="$FCFLAGS -DNOMPI"
AC_SUBST(MPICC)
AC_SUBST(MPICXX)
AC_SUBST(MPIFC)
]
)
AC_LANG(C)
AC_ARG_ENABLE(openmp,
[AS_HELP_STRING([--enable-openmp], [Turn off OpenMP support, even if it is available in the compilers])],
[
HAVE_OPENMP="no"
OPENMP_CFLAGS=""
OPENMP_FCFLAGS=""
AS_IF([test "x$enable_openmp" != "xno"], [
AX_OPENMP(
[HAVE_OPENMP="yes"]
,[HAVE_OPENMP="no"]
)
AC_LANG(Fortran)
AX_OPENMP()
AC_LANG(C)
])
],
[
AX_OPENMP(
[HAVE_OPENMP="yes"]
,[HAVE_OPENMP="no"]
)
AC_LANG(Fortran)
AX_OPENMP()
AC_LANG(C)
]
)
AC_LANG(Fortran)
AX_GFORTRAN_VERSION()
AX_IFORT_VERSION()
AC_SUBST(GFORTRAN_VERSION)
AC_SUBST(IFORT_VERSION)
AC_SUBST(HAVE_OPENMP)
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP_FCFLAGS)
AC_LANG(C)
AX_CUDA()
AC_PROG_SED()
AX_CHECK_CL()
#
# Sapporo
#
AC_ARG_WITH([sapporo],
[AS_HELP_STRING([--with-sapporo],[Use sapporo library in given directory])],
[WITH_SAPPORO=yes],
[WITH_SAPPORO=no]
)
AC_ARG_ENABLE(sapporo2,
[AS_HELP_STRING([--enable-sapporo2],[Use the provided sapporo library version 2, instead of sapporo_light])],
[SAPPORO_VERSION="light"
SAPPORO_LIBS="-L\${AMUSE_DIR}/lib/sapporo_$SAPPORO_VERSION -lsapporo"
AS_IF([test "x$enable_sapporo2" != "xno"], [
SAPPORO_VERSION="2"
AS_IF([test x$WITH_CUDA =="xno"], [
SAPPORO_LIBS="${CL_LIBS} ${OPENMP_CFLAGS} -L\${AMUSE_DIR}/lib/sapporo_$SAPPORO_VERSION -lsapporo"
], [
SAPPORO_LIBS="${OPENMP_CFLAGS} -L\${AMUSE_DIR}/lib/sapporo_$SAPPORO_VERSION -lsapporo"
])
])
],
[SAPPORO_VERSION="light"
SAPPORO_LIBS="-L\${AMUSE_DIR}/lib/sapporo_$SAPPORO_VERSION -lsapporo]"
)
AC_SUBST(WITH_SAPPORO)
AC_SUBST(SAPPORO_VERSION)
AC_SUBST(SAPPORO_LIBS)
#Fortran-Sockets (FS) Libs
AS_IF([test x"$FC_ISO_C_BINDINGS" != xno],[
FS_FLAGS="-I\$(AMUSE_DIR)/lib/forsockets"
FS_LIBS="-L\$(AMUSE_DIR)/lib/forsockets -lforsockets"
], [
FS_FLAGS=""
FS_LIBS=""
]
)
AC_SUBST(FS_FLAGS)
AC_SUBST(FS_LIBS)
#Stopcond
SC_FLAGS="-I\$(AMUSE_DIR)/lib/stopcond"
SC_CLIBS="-L\$(AMUSE_DIR)/lib/stopcond -lstopcond"
SC_FCLIBS="-L\$(AMUSE_DIR)/lib/stopcond -lstopcond"
SC_MPI_CLIBS="-L\$(AMUSE_DIR)/lib/stopcond -lstopcondmpi"
SC_MPI_FCLIBS="-L\$(AMUSE_DIR)/lib/stopcond -lstopcondmpi"
AC_SUBST(SC_FLAGS)
AC_SUBST(SC_CLIBS)
AC_SUBST(SC_FCLIBS)
AC_SUBST(SC_MPI_CLIBS)
AC_SUBST(SC_MPI_FCLIBS)
AX_FFTW()
AX_GMP()
AX_MPFR()
AC_LANG(C++)
save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
CFLAGS="$MPFR_FLAGS $save_CFLAGS"
CPPFLAGS="$MPFR_FLAGS $save_CPPFLAGS"
cache_var=AS_TR_SH([ac_cv_header_mpfr.h])
#AC_CHECK_HEADER(
# [mpreal.h],
# [],
# [AC_MSG_WARN([Cannot find header (mpreal.h) of the library MPFR with MPFR_FLAGS $MPFR_FLAGS.])]
#)
$as_unset $cache_var
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
AC_LANG(C)
AX_LIB_HDF5()
AX_LIB_NETCDF4()
DETECT_PIC_FLAGS()
CFLAGS="$CFLAGS $PIC_FLAGS"
CXXFLAGS="$CXXFLAGS $PIC_FLAGS"
FCFLAGS="$FCFLAGS $PIC_FLAGS"
AX_PATH_GSL(1.0, [FOUND_GSL=yes], [
FOUND_GSL=no
AC_MSG_WARN([gsl not found, please specify --with-gsl])
])
AC_SUBST(FOUND_GSL)
AC_CHECK_PYTHON_MODULE(numpy, __version__)
AS_IF([test x"$PYTHON_numpy" != x1],
[AC_MSG_ERROR([numpy not found, please install numpy first])]
)
AS_VERSION_COMPARE([$PYTHON_numpy_VERSION], [1.2.1],
[AC_MSG_ERROR([numpy version $PYTHON_numpy_VERSION found, but at least 1.3.0 needed])]
)
AS_IF([test x"$WITH_MPI" != xno],[
AC_CHECK_PYTHON_MODULE(mpi4py, __version__)
AS_IF([test x"$PYTHON_mpi4py" != x1],
[AC_MSG_ERROR([mpi4py not found, please install mpi4py first])]
)
AS_VERSION_COMPARE([$PYTHON_mpi4py_VERSION], [1.1],
[AC_MSG_ERROR([numpy version $PYTHON_mpi4py_VERSION found, but at least 1.1.0 needed])]
)
])
AC_CHECK_PYTHON_MODULE(h5py, version.version)
AS_VERSION_COMPARE([$PYTHON_h5py_VERSION], [1.1.0],
[AC_MSG_WARN([h5py version $PYTHON_h5py_VERSION found, but at least 1.1.0 needed])]
)
AC_CHECK_PYTHON_MODULE(nose, __version__)
AS_VERSION_COMPARE([$PYTHON_nose_VERSION], [0.10],
[AC_MSG_ERROR([nose version $PYTHON_nose_VERSION found, but at least 0.11 needed])]
)
AC_CHECK_PYTHON_MODULE(docutils, __version__)
AS_VERSION_COMPARE([$PYTHON_docutils_VERSION], [0.5],
[AC_MSG_ERROR([docutils version $PYTHON_docutils_VERSION found, but at least 0.6 needed])]
)
AC_CHECK_PYTHON_MODULE(zlib, __version__)
AS_IF([test x"$PYTHON_zlib" != x1],
[AC_MSG_ERROR([zlib not found, please recompile python check that development libraries for zlib ar installed first])]
)
$PYTHON -c "import zlib; exit(zlib.crc32('amuse')&0xffffffff == 0xc0cc9367)" 2>/dev/null
AS_IF([test x"$?" != x1],
[AC_MSG_ERROR([crc32 function of zlib not found, please recompile python])]
)
AS_VERSION_COMPARE([$PYTHON_zlib_VERSION], [1.0],
[AC_MSG_ERROR([numpy version $PYTHON_zlib_VERSION found, but at least 1.0 needed])]
)
AC_CHECK_PYTHON_MODULE(matplotlib)
#AC_CHECK_PYTHON_MODULE(Cython, __version__)
#AS_VERSION_COMPARE([$PYTHON_Cython_VERSION], [0.13],
# [AC_MSG_WARN([Cython version $PYTHON_Cython_VERSION found, but at least 0.13 needed])]
#)
AC_OUTPUT()
AC_MSG_NOTICE( Configuration done. Configuration written to config.mk )