forked from yambo-code/yambo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
307 lines (307 loc) · 8.84 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
#
# License-Identifier: GPL
#
# Copyright (C) 2016 The Yambo Team
#
# Authors (see AUTHORS file for details): AM DS
#
m4_include([include/version/version.m4])
#
CURRENT_DIR=`echo "$PWD" | sed -e "s/ /X/g"`
if ! test -d $CURRENT_DIR ; then
AC_MSG_ERROR(Make cannot work using paths which include spaces)
fi
#
compdir=`echo "$PWD"`
#
AC_PREFIX_DEFAULT($PWD)
if test "$prefix" = "NONE" ; then prefix="$PWD" ; fi
if test "$exec_prefix" = "NONE" ; then exec_prefix="$prefix" ; fi
#
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR([driver/yambo.F])
#
# YAMBO SPECIFIC
#
m4_include([config/m4/yambo_remote_compilation_setup.m4])
m4_include([config/m4/yambo_specific.m4])
m4_include([config/m4/yambo_driver.m4])
#
# General
#
m4_include([config/m4/acx_echo.m4])
m4_include([config/m4/acx_misc.m4])
m4_include([config/m4/acx_gmake.m4])
m4_include([config/m4/acx_cpp.m4])
m4_include([config/m4/acx_fpp.m4])
m4_include([config/m4/ax_f90_module_flag.m4])
m4_include([config/m4/acx_get_fc_kind.m4])
m4_include([config/m4/acx_get_mpi_kind.m4])
m4_include([config/m4/acx_fortran_flags.m4])
m4_include([config/m4/acx_mpi.m4])
m4_include([config/m4/cuda.m4])
m4_include([config/m4/acx_version.m4])
m4_include([config/m4/acx_branch.m4])
m4_include([config/m4/acx_IO_wrap_up.m4])
#
# Report
#
m4_include([config/m4/acx_stripe_subpath.m4])
m4_include([config/m4/acx_report.m4])
# ============================================================================
# version.m4 -> version.h
ACX_VERSION
#
# ============================================================================
# Current branch
ACX_BRANCH
#
# Checks for library functions.
# ============================================================================
AC_CHECK_HEADERS([malloc.h stdlib.h unistd.h string.h sys/time.h])
AC_FUNC_ALLOCA
AC_C_CONST
AC_C_INLINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_PROG_MAKE_SET
# ============================================================================
# check size of pointers to int - needed to decide the size of integer
# arrays in fortran holding C pointers for FFTW
ACX_POINTER_SIZE
SIZEOF_INT_P=$ac_pointersize
AC_SUBST(SIZEOF_INT_P)
#
# ============================================================================
# Checks for programs.
AC_PROG_CC
#
AC_CANONICAL_HOST
hostname=`uname -n`
AC_SUBST(hostname)
# ============================================================================
# GNU Make
MAKE="make"
CHECK_GNU_MAKE()
if test "$_cv_gnu_make_command" = ""; then
ACX_CHECK_MAKE
if ! test "$make_works" = "yes"; then
AC_MSG_ERROR(Make does not accept function statments (use gmake if possible))
fi
else
MAKE=$_cv_gnu_make_command
fi
AC_SUBST(MAKE)
# ============================================================================
#AR
AC_CHECK_TOOL(AR, ar, false)
test -z "$AR" && AR=ar
test -z "$AR_FLAGS" && AR_FLAGS="-r"
AC_SUBST(AR_FLAGS)
#
# ============================================================================
#
# C options specific for driver.c
#
AC_ARG_ENABLE(options_check, AS_HELP_STRING([--enable-options-check],[Enable the command line options check in driver.c. Default is yes.]))
if test x"$enable_options_check" = "x"; then enable_options_check="yes"; fi
if test x"$enable_options_check" = "xno"; then
SAVE=$CFLAGS
CFLAGS="${SAVE} -D_NO_OPTIONS_CHECK"
fi
#
# ============================================================================
#
# Fortran 90
#
acx_save_fcflags="$FCFLAGS"
AC_PROG_FC([],[90])
if test "$FC" = "" ; then
AC_MSG_ERROR([could not find Fortran 90 compiler])
fi
# WIDESETUP affects the FCFLAGS/CFLAGS only if the variable is empty
ACX_WIDESETUP
AC_LANG_PUSH(Fortran)
#
# F90 extension
#
AC_ARG_WITH(f90ext, AS_HELP_STRING([--with-f90ext=<flags>],[Use .<flags> Fortran 90 extension],[32]))
if ! test -z "$with_f90ext"; then F90SUFFIX=".$with_f90ext"; fi
case $F90SUFFIX in
.f90)
AC_FC_SRCEXT(f90,[F90SUFFIX=".f90"; F90EXTFLAGS="$FCFLAGS_f90"],[])
;;
.f)
AC_FC_SRCEXT(f,[F90SUFFIX=".f"; F90EXTFLAGS="$FCFLAGS_f"],[])
;;
esac
AC_SUBST(F90SUFFIX)
FCFLAGS="${acx_save_fcflags}"
acx_save_fcflags="$FCFLAGS"
ACX_GET_FC_KIND()
#
# Fortran FLAGS
#
ACX_FCSETUP()
#
acx_save_fcflags="$FCFLAGS"
FCFLAGS="$acx_save_fcflags $F90EXTFLAGS"
#
# ============================================================================
#
# OpenMP
#
AC_ARG_ENABLE(open-mp, AS_HELP_STRING([--enable-open-mp],[Enable OpenMP support]))
if test x"$enable_open_mp" = "x"; then enable_open_mp="no"; fi
OPENMPLIBS=" "
def_openmp=" "
if test x"$enable_open_mp" = "xyes"; then
OPENMPLIBS="$OMPFLAGS";
def_openmp="-D_OPENMP"
fi
AC_SUBST(def_openmp)
AC_SUBST(OPENMPLIBS)
#
# ============================================================================
#
# Underscore options in subroutine naming
#
ACX_EXTUS
#
# Commented by AM on August 28 because it was imposing an F77 different from the FC
# leading to linking conflicts
#
#AC_F77_WRAPPERS
#
# Free Form sepcific options
#
AC_FC_FREEFORM
#
AC_LANG_POP(Fortran)
#
#=============================================================================
# FLAGS TO INCLUDE MODULE
AX_F90_MODULE_FLAG
IFLAG="$ax_cv_f90_modflag"
if test -z "$IFLAG" ; then IFLAG="-I" ; fi
AC_SUBST(IFLAG)
#
# ============================================================================
# CPP check & flags
ACX_CPP
#
# ============================================================================
# FPP check
ACX_FPP
#
# ============================================================================
# Fortran 77: test if the FC works as F77 as well
#
AC_LANG_PUSH(Fortran 77)
if test -z "$F77"; then F77=$FC; fi
if test -z "$FFLAGS"; then FFLAGS="$acx_save_fcflags"; fi
AC_PROG_F77
AC_MSG_CHECKING([if Fortran 77 compiler $F77 works])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[ integer ierr]),
[acx_f77_ok="yes"; AC_MSG_RESULT(yes)],
[acx_f77_ok="no"; AC_MSG_RESULT(no);
AC_MSG_ERROR(Fortran 77 compiler does not work. Impossible to continue.)])
AC_LANG_POP(Fortran 77)
#
# ============================================================================
# Scripts
#
m4_include([config/m4/scripts.m4])
#
# ============================================================================
# MPI
m4_include([config/m4/mpi.m4])
m4_include([config/urls/repos.list])
#
# ============================================================================
# Libs
#
m4_include([config/m4/blas.m4])
m4_include([config/m4/lapack.m4])
m4_include([config/m4/netcdf_f90.m4])
m4_include([config/m4/hdf5_f90.m4])
m4_include([config/m4/libxc.m4])
m4_include([config/m4/fft.m4])
m4_include([config/m4/futile.m4])
m4_include([config/m4/iotk.m4])
m4_include([config/m4/etsf_io.m4])
m4_include([config/m4/scalapack.m4])
m4_include([config/m4/petsc_slepc.m4])
#
AC_LANG_PUSH(Fortran)
# ============================================================================
# Yambo Libs
AC_YDRIVER
# ============================================================================
# YDB/YAMBOpy
ACX_SCRIPTS
# ============================================================================
# BLAS/Lapack
ACX_BLAS
ACX_LAPACK
# ============================================================================
# FFT
AC_HAVE_FFT
# ============================================================================
# PETSC/SLEPC
AC_PETSC_SLEPC_SETUP
# ============================================================================
# SCALAPACK/BLACS
AC_SLK_SETUP
# ============================================================================
# HDF5
AC_HAVE_HDF5_F90
# ============================================================================
# NETCDF
AC_HAVE_NETCDF_F90
# ============================================================================
# I/O wrap-up
ACX_IO_WRAP_UP
# ============================================================================
# FUTILE library
AC_HAVE_FUTILE
# ============================================================================
# IOTK library
AC_HAVE_IOTK
# ============================================================================
# ETSF_IO
AC_HAVE_ETSF_IO
# ============================================================================
# LIBXC
ACX_LIBXC
# ============================================================================
# CUDA
AC_HAVE_CUDA
# ============================================================================
# Prepare the REPORT file variables
ACX_REPORT()
# ============================================================================
# Compilation dir
AC_SUBST(compdir)
# ============================================================================
AC_CONFIG_HEADERS([include/headers/common/have_malloc.h:include/headers/common/have_malloc.h.in])
AC_CONFIG_FILES([
config/setup config/mk/global/defs.mk config/report config/msg_ydb
src/wf_and_fft/sgfft.F src/tools/.objects
config/mk/local/defs.mk config/mk/defs.mk sbin/compilation/helper.inc.sh
include/branch.inc include/driver/editor.h lib/archive/git.list ])
#
AC_OUTPUT
#
# Folders
#
m4_include([config/m4/yambo_folders.m4])
#
cat config/report
#
# Messages
#
if test "x$enable_ydb" = "xyes"; then
cat config/msg_ydb
fi