-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
416 lines (344 loc) · 11.2 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
## Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program 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
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
##
## $Id: configure.ac 7840 2011-05-04 15:46:53Z xavier $
AC_PREREQ(2.59)
AC_INIT([Octopus],[4.0.1],[[email protected]],[octopus])
AC_CONFIG_SRCDIR([src/basic/global.F90])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
# Installation prefix by default
AC_PREFIX_DEFAULT([/opt/etsf])
# who am i
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_YACC
dnl check whether mpi is enabled
AC_ARG_ENABLE(mpi, AS_HELP_STRING([--enable-mpi(=PATH)], [Parallel version]))
case $enable_mpi in
yes) ;;
no | "") enable_mpi=no ;;
-* | */* | *.a | *.so | *.so.* | *.o)
LIBS_MPI="$enable_mpi"
enable_mpi=yes
;;
*)
LIBS_MPI="-l$enable_mpi"
enable_mpi=yes
;;
esac
if test x"$enable_mpi" == x"yes"; then
octopus_default_cc=mpicc
else
octopus_default_cc=gcc
fi
AC_PROG_CC($octopus_default_cc)
AM_PROG_AS
# optimizations extensions supported by the compiler
AC_C_INLINE
AC_C_RESTRICT
ACX_C_BUILTIN_PREFETCH
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([signal.h errno.h])
AC_FUNC_ALLOCA
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_SIZEOF(void*)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPES([uint32_t, uint64_t])
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gettimeofday \
strndup tcgetpgrp scandir alphasort \
sigaction readdir closedir strchr strtod \
perror strcasestr sbrk getopt_long])
ACX_PAPI
ACX_ARCH
dnl ============================================================================
dnl This part of the configuration file tries to sort out what needs to be built.
dnl In particular, the code can be compiled in single-precision, in debug mode,
dnl and with OpenMP threads.
dnl these are the --enable/--disable possible in octopus
AC_ARG_ENABLE(single, AS_HELP_STRING([--enable-single], [octopus in single-precision]))
AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug], [debug mode]), [DEBUG=${enableval}])
AC_ARG_ENABLE(openmp, AS_HELP_STRING([--enable-openmp], [Multi-threaded parallel version using OpenMP]))
AC_ARG_ENABLE(opencl, AS_HELP_STRING([--enable-opencl], [OpenCL support (experimental)]))
AC_ARG_ENABLE(blacs, AS_HELP_STRING([--with-blacs], [Blacs support (experimental)]))
AC_ARG_ENABLE(scalapack, AS_HELP_STRING([--with-scalapack], [ScaLAPACK support (experimental), add before --with-blacs]))
AC_ARG_ENABLE(libfm, AS_HELP_STRING([--with-libfm], [Libfm support (experimental)]))
AC_ARG_ENABLE(libfm, AS_HELP_STRING([--with-pfft], [PFFT support (experimental)]))
if test -n "${enable_single}" -a x"${enable_single}" != x"no"; then
SINGLE_PRECISION=1
fi
if test -n "${enable_openmp}" -a x"${enable_openmp}" != x"no"; then
HAVE_OPENMP=1
fi
if test x"${enable_opencl}" == x"yes" ; then
AC_MSG_WARN([
Experimental OpenCL support enabled.
])
AC_CHECK_HEADER(CL/cl.h, [], [AC_MSG_ERROR([Cannot find the OpenCL header.])], [])
AC_CHECK_FUNC(clGetPlatformIDs, [], [LIBS=$LIBS" -lOpenCL"])
AC_CHECK_FUNC(clFinish, [], [AC_MSG_ERROR([Cannot find the OpenCL library.])])
AC_DEFINE(HAVE_OPENCL, 1, [defined if opencl support is enabled])
fi
AM_CONDITIONAL(COMPILE_OPENCL, test x"${enable_opencl}" == x"yes")
dnl workaround for xlf compilers
ac_enable_f90_forall=yes
AC_ARG_ENABLE(f90-forall, AS_HELP_STRING([--disable-f90-forall], [Workaround for buggy xlf compilers]),
[ac_enable_f90_forall=${enableval}])
if test x"${ac_enable_f90_forall}" = x"no"; then
F90_FORALL=no
else
F90_FORALL=yes
fi
AC_SUBST(F90_FORALL)
dnl check for METIS
if test x"$enable_mpi" != x"no"; then
ACX_METIS
fi
AM_CONDITIONAL(COMPILE_METIS, test x${HAVE_METIS} = x1)
dnl check for NEWUOA
ACX_NEWUOA
AM_CONDITIONAL(COMPILE_NEWUOA, test x${HAVE_NEWUOA} = x1)
dnl check for external Zoltan
ACX_ZOLTAN
AM_CONDITIONAL(COMPILE_ZOLTAN, test x"$compile_zoltan" == x"yes")
dnl check for C MPI
if test x"$enable_mpi" == x"yes"; then
AC_CHECK_HEADER(mpi.h,,AC_MSG_ERROR([cannot find mpi.h]))
ACX_MPI([], AC_MSG_ERROR([cannot call MPI from C]))
fi
dnl build/install Perl bits unless --disable-perl is used
AC_ARG_ENABLE([perl],
AS_HELP_STRING([--disable-perl], [don't build/install Perl components]),
[ac_cv_build_perl=$enableval],
[ac_cv_build_perl=yes])
if test "x$ac_cv_build_perl" = "xyes"; then
AC_PATH_PROG([PERL], [perl], [], [])
if test -z "$PERL" ; then
AC_MSG_WARN([perl not found. Disabling Perl parts])
ac_cv_build_perl="no"
fi
fi
AM_CONDITIONAL([ENABLE_PERL], [test x"$ac_cv_build_perl" = x"yes"])
dnl try to find out what is the default FORTRAN 90 compiler
dnl note that this has to be done after the AC_ARG_ENABLE(mpi...)
acx_save_fcflags="${FCFLAGS}"
if test x"$enable_mpi" = x"yes"; then
AC_PROG_FC([mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r], [Fortran 90])
else
AC_PROG_FC([], Fortran 90)
fi
if test x"$FC" = x; then
AC_MSG_ERROR([could not find Fortran 90 compiler])
fi
AC_LANG_PUSH(Fortran)
AC_FC_SRCEXT(f90)
FCFLAGS="${acx_save_fcflags}"
ACX_FCFLAGS
dnl octopus needs the preprocessor. The result goes to FCCPP
dnl this is a hack, and should be changed in the future
AC_LANG_PREPROC
dnl how Fortran mangles function names
AC_FC_WRAPPERS
acx_save_libs="${LIBS}"
LIBS="${FCEXTRALIBS} $FCLIBS"
ACX_FC_INTEGER_SIZE
ACX_CC_FORTRAN_INT
dnl Sometimes Fortran may use the flush function, sometimes not.
ACX_FORTRAN_CHECK_FUNC(flush)
dnl Some compilers define the sizeof intrinsic
ACX_FC_SIZEOF
ACX_FORTRAN_LOC
dnl check whether we have or not a compiler that allows for very long lines...
ACX_LONG_FORTRAN_LINES
dnl check whether the Fortran 90 compiler accepts line markers cast by the preprocessor.
ACX_F90_ACCEPTS_LINE_NUMBERS
dnl check whether the Fortran compiler supports command-line arguments
ACX_FC_COMMAND_LINE_ARGUMENTS
dnl check whether the Fortran compiler supports Fortran 2003's c_ptr type
ACX_FC_F2003_C_PTR
dnl check flag to include module path
AX_F90_MODULE_FLAG
F90_MODULE_FLAG=$ax_cv_f90_modflag
AC_SUBST([F90_MODULE_FLAG])
if test "${HAVE_OPENMP}"; then
AC_DEFINE(HAVE_OPENMP, 1, [enable OpenMP support])
AX_OPENMP(,AC_MSG_ERROR([Fortran compiler does not support OpenMP]))
FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
fi
dnl ============================================================================
dnl find what is the extension of the programs supposed to be
MYEXT=""
dnl mpi
AS_IF([test x"$enable_mpi" != x"no"], [MYEXT="${MYEXT}_mpi"])
dnl debug mode
if test "${SINGLE_PRECISION}"; then
AC_DEFINE(SINGLE_PRECISION, 1, [octopus compiled in single precision])
MYEXT="${MYEXT}_single"
fi
dnl debug mode
if test x"${DEBUG}" = x"no" ; then
AC_DEFINE(NDEBUG, yes, [octopus compiled without debug mode])
fi
AC_SUBST(DEBUG)
dnl set the default extension for the programs
EXEEXT="${MYEXT}${EXEEXT}"
dnl we only generate the utilities if single precision and MPI are off
if test x"$enable_mpi" = x"no" -a -z "${SINGLE_PRECISION}"; then
UTILITY_PROGRAMS='$(EXTRA_PROGRAMS)'
msg="+ utilities"
else
UTILITY_PROGRAMS=''
msg=""
fi
AC_SUBST(UTILITY_PROGRAMS)
AC_ARG_WITH(max-dim, [ --with-max-dim=NDIM maximum number of dimensions Octopus can use;
the default is 3 (other values are experimental), must be >= 3],
[maxdim=$withval], [maxdim=3])
if test $maxdim -lt 3; then
AC_MSG_ERROR([max-dim must be at least 3])
fi
AC_DEFINE_UNQUOTED(MAX_DIM, $maxdim, [the maximum dimension of the space])
dnl tell the user what we will be compiling
echo "**********************************************"
echo "*** octopus${EXEEXT} $msg will be generated "
echo "**********************************************"
dnl ===================================================================
dnl now we search for libraries
ACX_LIBXC
dnl check for BLAS
ACX_BLAS([], AC_MSG_ERROR([could not find required BLAS library]))
dnl test zdotc in BLAS
ACX_ZDOTC
dnl check for LAPACK
ACX_LAPACK([], AC_MSG_ERROR([could not find required LAPACK library]))
dnl check for GSL
AC_LANG_PUSH(C)
LIBS="${acx_save_libs}"
AX_PATH_GSL([1.9],
[CFLAGS="$CFLAGS $GSL_CFLAGS"],
AC_MSG_ERROR([could not find required GSL library]))
dnl check for GD library
ACX_GDLIB
LIBS="${FCLIBS}"
AC_LANG_POP(C)
dnl check for FFT
ACX_FFT
dnl check for NETCDF
ACX_NETCDF
dnl check for ETSF_IO
ACX_ETSF_IO
dnl check for SPARSKIT
ACX_SPARSKIT
dnl check for Fortran MPI support
if test x"$enable_mpi" != x"no"; then
ACX_MPI([], AC_MSG_ERROR([could not compile an MPI test program]))
ACX_MPI_FC_MODULE
ACX_MPI2
fi
dnl check for SCALAPACK/BLACS
ACX_BLACS
ACX_SCALAPACK
dnl check for Libfm
ACX_LIBFM
dnl check for PFFT
ACX_PFFT
dnl now I run configure for the internal libraries
AC_CONFIG_SUBDIRS([external_libs/spglibs])
# This is certainly wrong, but I don't know
# how to do it right
LINK="$FC $FCFLAGS $LDFLAGS -o \$@"
AC_SUBST(LINK)
AC_SUBST(FCEXTRALIBS)
ACX_OCTOPUS_COMPILATION_INFO
AC_CONFIG_FILES([Makefile
external_libs/Makefile
external_libs/metis-4.0/Makefile
external_libs/qshep/Makefile
external_libs/spglib/Makefile
external_libs/spglib/src/Makefile
external_libs/newuoa/Makefile
external_libs/zoltan/Makefile
external_libs/slatec/Makefile
liboct_parser/Makefile
src/Makefile
src/include/Makefile
src/basic/Makefile
src/math/Makefile
src/species/Makefile
src/ions/Makefile
src/grid/Makefile
src/poisson/Makefile
src/states/Makefile
src/xc/Makefile
src/hamiltonian/Makefile
src/system/Makefile
src/scf/Makefile
src/td/Makefile
src/opt_control/Makefile
src/sternheimer/Makefile
src/main/Makefile
src/utils/Makefile
perl/Makefile
doc/Makefile
doc/pdf/Makefile
doc/html/Makefile
doc/html/icons/Makefile
doc/html/js/Makefile
doc/html/vars/Makefile
share/Makefile
share/PP/Makefile
share/PP/PSF/Makefile
share/PP/HGH/Makefile
share/PP/UPF/Makefile
share/recipes/Makefile
share/recipes/en/Makefile
share/recipes/es/Makefile
share/recipes/it/Makefile
share/util/Makefile
share/opencl/Makefile
build/Makefile
build/octopus.spec
testsuite/Makefile
testsuite/components/Makefile
testsuite/finite_systems_1d/Makefile
testsuite/finite_systems_2d/Makefile
testsuite/finite_systems_3d/Makefile
testsuite/functionals/Makefile
testsuite/real_time/Makefile
testsuite/linear_response/Makefile
testsuite/optimal_control/Makefile
testsuite/open_systems/Makefile
testsuite/periodic_systems/Makefile])
AC_CONFIG_FILES([testsuite/oct-run_testsuite], [chmod +x testsuite/oct-run_testsuite])
AC_OUTPUT