forked from m-a-d-n-e-s-s/madness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
405 lines (349 loc) · 13 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
AC_PREREQ(2.59)
# was 2.61 but jaguar is not up to date so backported which
# involved replacing AC_PROG_SED and UINT*_T type checks.
AC_INIT([MADNESS], [0.9], [http://code.google.com/p/m-a-d-n-e-s-s])
AC_CONFIG_SRCDIR([configure.ac])
# This is where autoconf automatically generated files go
AC_CONFIG_AUX_DIR([config])
# This is where local macros will be stored (by us)
AC_CONFIG_MACRO_DIR([config])
# Default options for automake ??
AM_INIT_AUTOMAKE([-Wall -Werror nostdinc foreign])
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
# We want #defines output into a header file
AC_CONFIG_HEADERS([src/madness/config.h])
# Detect specific systems so can provide their whacky defaults
ACX_CRAYXT
ACX_CRAYXE
ACX_MAC
ACX_IBMBGP
ACX_IBMBGQ
#AC_AIX
ACX_WITH_STUBMPI
# Set default thread processor-affinity
BIND=${BIND-"-1 -1 -1"}
AC_DEFINE_UNQUOTED([MAD_BIND_DEFAULT], ["$BIND"], [The default binding for threads])
# This sets host, host_cpu, host_vendor, host_os
AC_CANONICAL_HOST
AC_MSG_NOTICE([HOST INFORMATION: $host $host_cpu $host_vendor $host_os])
AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [Defines the host cpu (x86, x86_64, ...).])
AC_DEFINE_UNQUOTED([HOST_SYSTEM], ["$host_os"], [Defines the host os (linux-gnu, ...).])
# Pick out CPUs for which we have special source files (assembler)
use_x86_64_asm=no
use_x86_32_asm=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if !(defined(__x86_64__) || defined(_M_X64))
#error Not x86_64
#endif
]])], [use_x86_64_asm=yes])
if test $use_x86_64_asm = no; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if !(defined(__i386) || defined(_M_IX86))
#error Not x86
#endif
]])], [use_x86_32_asm=yes])
fi
# Define AM conditional for use of aforementioned assembler
AM_CONDITIONAL([USE_X86_64_ASM], [test $use_x86_64_asm = yes])
AM_CONDITIONAL([USE_X86_32_ASM], [test $use_x86_32_asm = yes])
# All source will be built with the MPI C++ and C compilers
ACX_MPI
initial_CFLAGS="$CFLAGS"
initial_CXXFLAGS="$CXXFLAGS"
AC_PROG_CC([$MPICC])
AC_PROG_CXX([$MPICXX])
AC_PROG_F77([$MPIF77]) # f90 is a superset of f77
AC_LANG_CPLUSPLUS
AC_MSG_NOTICE([Compiler choices after 'AC LANG' ... $CXX and $CC])
CFLAGS="$initial_CFLAGS"
CXXFLAGS="$initial_CXXFLAGS"
# Check that the MPICC Compiler can link correctly.
AC_LANG_PUSH([C])
AC_MSG_CHECKING([that the $MPICC linker works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR(["Unable to link with $MPICC])])
AC_LANG_POP
# Check that the MPICXX Compiler can link correctly.
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([that the $MPICXX linker works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR(["Unable to link with $MPICXX])])
AC_LANG_POP
ACX_DETECT_CXX
# Set debugging
ACX_ENABLE_DEBUGGING
# Set optimization
ACX_ENABLE_OPTIMIZATION
# Set warning flags by compiler vendor
ACX_ENABLE_WARN
# Look for user choice of language standard
ACX_ENABLE_CPP0XTR1
# Selelect best compilation flags
ACX_ENABLE_OPTIMAL
# Check for boost
ACX_WITH_BOOST
ACX_CHECK_TR1
# Get optional external libraries inplace so that building will partially check them
ACX_WITH_LIBUNWIND
ACX_WITH_GOOGLE_PERF
ACX_WITH_GOOGLE_TEST
ACX_WITH_LIBXC
ACX_WITH_MADXC
ACX_WITH_TBB
ACX_ENABLE_GENTENSOR
# Set task profiler option
ACX_ENABLE_TASK_PROFILER
# Check for basic build functionality
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_AS
#AC_PROG_SED
AC_CHECK_PROG([HAVE_SED],[sed],[YES],[NO])
if test $HAVE_SED = YES; then
AC_PATH_PROG(SED,sed)
fi
# We need these to build the documentation
AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[YES],[NO])
if test $HAVE_DOXYGEN = YES; then
AC_PATH_PROG(DOXYGEN,doxygen)
fi
AC_CHECK_PROG([HAVE_DOT],[dot],[YES],[NO])
if test $HAVE_DOT = YES; then
AC_PATH_PROG(DOT,dot)
fi
AC_CHECK_PROG([HAVE_PDFLATEX],[pdflatex],[YES],[NO])
if test $HAVE_PDFLATEX = YES; then
AC_PATH_PROG(PDFLATEX,pdflatex)
fi
AC_CHECK_PROG([HAVE_LATEX],[latex],[YES],[NO])
if test $HAVE_LATEX = YES; then
AC_PATH_PROG(LATEX,latex)
fi
AM_CONDITIONAL([CAN_BUILD_DOC], [test $HAVE_DOXYGEN = YES])
AC_HEADER_TIME
AC_HEADER_STDC
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/time.h unistd.h])
AC_CHECK_HEADERS([bits/atomicity.h ext/atomicity.h])
AC_HEADER_STDBOOL
# No longer used
#ACX_GNU_HASHMAP
# Types
AC_TYPE_PID_T
AC_C_RESTRICT
ACX_CHECK_TLS
AC_TYPE_SIZE_T
AC_HEADER_TIME
#AC_TYPE_UINT64_T
#AC_TYPE_INT64_T
AC_CHECK_TYPES([uint64_t, int64_t, uint32_t, int32_t, uint16_t, uint8_t, long long])
AC_C_VOLATILE
AC_C_CONST
AC_C_INLINE
AC_CHECK_TYPES([ptrdiff_t])
# Library functions
AC_CHECK_FUNCS([sleep random execv perror gettimeofday memmove memset pow sqrt strchr strdup getenv])
AC_FUNC_FORK
# EFV: when using Intel compiler on OS X malloc is found to be non-GNU-compatible, which breaks gcc's cstdlib
#AC_FUNC_MALLOC
AC_FUNC_ERROR_AT_LINE
ACX_POSIX_MEMALIGN
# Check for EIGEN3
ACX_WITH_EIGEN3
# Check for Elemental
ACX_WITH_ELEMENTAL
# Set the default fortran integer type
AC_ARG_WITH([fortran-int32],
[AC_HELP_STRING([--with-fortran-int32], [Set FORTRAN integer size to 32 bit. By default, assume 32-bit integers.])],
[
case $withval in
yes)
acx_fortran_int_size=4
;;
no)
acx_fortran_int_size=8
;;
*)
AC_MSG_ERROR([Unknown value provided for --with-fortran-int32])
esac
],
[acx_fortran_int_size=4])
case $acx_fortran_int_size in
4)
AC_DEFINE([MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE],[4],[Default Fortran integer size.])
AC_SUBST([MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE],[4])
AC_MSG_NOTICE([Default Fortran integer: integer*4])
;;
8)
if test x$ac_cv_type_int64_t = xno; then
AC_MSG_ERROR([The compiler does not support int64_t, which is required to link with fortran libraries that use 8 byte integers. Rerun configure with '--with-fortran-int32' option.])
fi
AC_DEFINE([MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE],[8],[Default Fortran integer size.])
AC_SUBST([MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE],[8])
AC_MSG_NOTICE([Default Fortran integer: integer*8])
esac
ACX_WITH_MKL
# Checks for Fortran linking conventions and BLAS+LAPACK at the same time
ACX_FORTRAN_SYMBOLS
# Compiler quirks
ACX_UNQUALIFIED_STATIC_DECL
ACX_STD_ABS
# Check for xterm
AC_CHECK_PROG(XTERM,xterm,xterm,no)
if test $XTERM = 'xterm'; then
AC_DEFINE(HAVE_XTERM,[1],[If set indicates xterm is in path])
fi
# Check for gdb
AC_CHECK_PROG(GDB,gdb,gdb,no)
if test $GDB = 'gdb'; then
AC_DEFINE(HAVE_GDB,[1],[If set indicates gdb is in path])
fi
# How to handle MADNESS exceptions.
AC_ARG_ENABLE(madex,
[AC_HELP_STRING([--enable-madex=arg],
[Specifies behavior of MADNESS assertions: throw (default), abort, assert, disable])],
[madex=$enableval],
[madex=throw])
case $madex in
abort)
AC_MSG_NOTICE([MADNESS assertions will abort])
AC_DEFINE([MADNESS_ASSERTIONS_ABORT], [1], [Set if MADNESS assertions abort])
;;
assert)
AC_MSG_NOTICE([MADNESS assertions will assert])
AC_DEFINE([MADNESS_ASSERTIONS_ASSERT], [1], [Set if MADNESS assertions assert])
;;
disable)
AC_MSG_NOTICE([MADNESS assertions are disabled])
AC_DEFINE([MADNESS_ASSERTIONS_DISABLE], [1], [Set if MADNESS assertions disabled])
;;
*)
AC_MSG_NOTICE([MADNESS assertions will throw])
AC_DEFINE([MADNESS_ASSERTIONS_THROW], [1], [Set if MADNESS assertions throw])
;;
esac
# Determine if we should use the instrumented new/delete
AC_ARG_ENABLE([memstats],
[AC_HELP_STRING([--enable-memstats], [If yes, gather memory statistics (expensive)])],
[memstats=$enableval],
[memstats=no])
if test "$memstats" = "yes"; then
AC_MSG_NOTICE([MADNESS will gather memory statistics (expensive)])
AC_DEFINE([WORLD_GATHER_MEM_STATS], [1], [Set if MADNESS gathers memory statistics])
fi
AC_ARG_ENABLE([profile],
[AC_HELP_STRING([--enable-profile], [Enables profiling])],
[AC_MSG_NOTICE([Enabling profiling]); AC_DEFINE(WORLD_PROFILE_ENABLE, [1], [Define if should enable profiling])],
[])
AC_ARG_ENABLE([tensor-bounds-checking],
[AC_HELP_STRING([--enable-tensor-bounds-checking],
[Enable checking of bounds in tensors ... slow but useful for debugging])],
[AC_MSG_NOTICE([Enabling tensor bounds checking]); AC_DEFINE(TENSOR_BOUNDS_CHECKING, [1], [Define if should enable bounds checking in tensors])],
[])
AC_ARG_ENABLE([tensor-instance-count],
[AC_HELP_STRING([--enable-tensor-instance-count],
[Enable counting of allocated tensors for memory leak detection])],
[AC_MSG_NOTICE([Enabling tensor instance counting]); AC_DEFINE(TENSOR_INSTANCE_COUNT, [1], [Define if should enable instance counting in tensors])],
[])
AC_ARG_ENABLE([spinlocks],
[AC_HELP_STRING([--enable-spinlocks],
[Enables use of spinlocks instead of mutexs (faster unless over subscribing processors)])],
[AC_MSG_NOTICE([Enabling use of spinlocks]); AC_DEFINE(USE_SPINLOCKS, [1], [Define if should use spinlocks])],
[])
AC_ARG_ENABLE([never-spin],
[AC_HELP_STRING([--enable-never-spin],
[Disables use of spinlocks (notably for use inside virtual machines)])],
[AC_MSG_NOTICE([Disabling use of spinlocks]); AC_DEFINE(NEVER_SPIN, [1], [Define if should use never use spinlocks])],
[])
AC_ARG_WITH([papi],
[AC_HELP_STRING([--with-papi], [Enables use of PAPI])],
[AC_MSG_NOTICE([Enabling use of PAPI]); AC_DEFINE(HAVE_PAPI,[1], [Define if have PAPI])],
[])
# Capture configuration info for user by compiled code
AC_DEFINE_UNQUOTED([MADNESS_CONFIGURATION_USER],["$USER"],[User that configured the code])
AC_DEFINE_UNQUOTED([MADNESS_CONFIGURATION_DATE],["`date`"],[Date of configuration])
AC_DEFINE_UNQUOTED([MADNESS_CONFIGURATION_CXX], ["$CXX"],[Configured C++ compiler])
AC_DEFINE_UNQUOTED([MADNESS_CONFIGURATION_CXXFLAGS], ["$CXXFLAGS"],[Configured C++ compiler flags])
AC_DEFINE_UNQUOTED([MADNESS_CONFIGURATION_HOST], ["$HOSTNAME"],[Configured on this machine])
# Not yet enabled the user to configure this stuff but probably should
AC_ARG_ENABLE([bsend-ack],
[AC_HELP_STRING([--disable-bsend-ack], [Use MPI Send instead of MPI Bsend for huge message acknowledgements.])],
[
if test "x$enableval" != xno; then
AC_DEFINE([MADNESS_USE_BSEND_ACKS],[1],[Define when MADNESS should use Bsend for huge message acknowledgements.])
fi
],
[
AC_DEFINE([MADNESS_USE_BSEND_ACKS],[1],[Define when MADNESS should use Bsend for huge message acknowledgements.])
])
# Set the MPI thread level used by MADNESS
MADNESS_MPI_THREAD_LEVEL=MPI_THREAD_SERIALIZED
if test X$MADNESS_HAS_ELEMENTAL = X1; then
MADNESS_MPI_THREAD_LEVEL=MPI_THREAD_MULTIPLE
fi
AC_ARG_WITH([mpi-thread],
[AC_HELP_STRING([--with-mpi-thread], [Thread level for MPI (multiple,serialized)])],
[
case $withval in
multiple)
MADNESS_MPI_THREAD_LEVEL=MPI_THREAD_MULTIPLE
;;
serialized)
MADNESS_MPI_THREAD_LEVEL=MPI_THREAD_SERIALIZED
;;
*)
AC_MSG_ERROR([Invalid value for --with-mpi-thread ($withval)])
;;
esac
])
AC_DEFINE_UNQUOTED([MADNESS_MPI_THREAD_LEVEL], [$MADNESS_MPI_THREAD_LEVEL], [Thread-safety level requested from MPI by MADNESS])
AC_MSG_NOTICE([MPI thread-safety requested: $MADNESS_MPI_THREAD_LEVEL])
# Stuff that either does not work or is ill-advised
######AC_DEFINE([WORLD_TAU_TRACE],[1],[Enable tracing using tau])
#####AC_DEFINE([WORLD_SCHED_BACKOFF],[1],[Yield during busy spin])
# Display options
AC_MSG_NOTICE([CPPFLAGS = $CPPFLAGS])
AC_MSG_NOTICE([CFLAGS = $CFLAGS])
AC_MSG_NOTICE([CXXFLAGS = $CXXFLAGS])
AC_MSG_NOTICE([LDFLAGS = $LDFLAGS])
AC_MSG_NOTICE([LIBS = $LIBS])
# These are the files that must be generated/preprocessed ... as you add files
# please maintain the directory tree file order and indenting.
AC_CONFIG_FILES([
Makefile
config/Makefile
config/Makefile.sample
config/MADNESS.pc
src/Makefile
src/gtest/Makefile
src/madness/Makefile
src/madness/world/Makefile
src/madness/muParser/Makefile
src/madness/misc/Makefile
src/madness/tinyxml/Makefile
src/madness/tensor/Makefile
src/madness/mra/Makefile
src/apps/Makefile
src/apps/chem/Makefile
src/apps/tdse/Makefile
src/apps/hf/Makefile
src/apps/exciting/Makefile
src/apps/moldft/Makefile
src/apps/nick/Makefile
src/apps/tkato/Makefile
src/apps/jacob/Makefile
src/apps/interior_bc/Makefile
src/apps/interior_bc/nanophoto/Makefile
src/examples/Makefile
doc/Makefile
doc/doxygen.cfg
])
AC_OUTPUT