Repository navigation
Expand file tree
/
Copy pathconfigure.in
More file actions
464 lines (383 loc) · 14.3 KB
/
Copy pathconfigure.in
File metadata and controls
464 lines (383 loc) · 14.3 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
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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Phred, 0.2.0)
AC_PREREQ(2.57)
AC_CANONICAL_SYSTEM
dnl Every other copy of the package version number gets its value from here
AM_INIT_AUTOMAKE(Phred, 0.2.0)
AM_MAINTAINER_MODE
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
AM_CONFIG_HEADER(src/config.h)
AC_SUBST(VERSION)
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
dnl Optional programs
AC_ARG_WITH(netcdf, AC_HELP_STRING([--without-netcdf], [Don't use NetCDF library]))
AC_ARG_WITH(hdf5, AC_HELP_STRING([--without-hdf5], [Don't use the HDF5 library]))
AC_ARG_WITH(hdf, AC_HELP_STRING([--with-hdf], [Use the HDF4 library]))
WANT_DOUBLE=0
AC_ARG_ENABLE(double, AC_HELP_STRING([--enable-double], [Uses doubles (64-bits) instead of floats (32 bits) for field quantities. Double precision won't work with the AltiVec engine.]), [WANT_DOUBLE=1])
dnl Data type variables
FIELD_TYPE="float"
MPIFIELD_TYPE="MPI_FLOAT"
dnl options
WANT_DEBUG=
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging messages, turn on assertions and array bounds checking]), WANT_DEBUG=1)
dnl WANT_RUSAGE=
dnl AC_ARG_ENABLE(rusage, AC_HELP_STRING([--enable-rusage], [Print resouce usage information when finished]), WANT_RUSAGE=1)
AC_ARG_WITH(efence, AC_HELP_STRING([--with-efence], [Enable memory debugging using Electric Fence (default: no)]))
AC_ARG_WITH(cxx, AC_HELP_STRING([--with-cxx=CXX], [C++ compiler to use]),
[CXX="$withval"])
WANT_PROFILE=
AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [Compile with -pg flag for gprof support.]), [WANT_PROFILE=1])
WANT_ALTIVEC=0
AC_ARG_ENABLE(altivec, AC_HELP_STRING([--enable-altivec], [Use AltiVec instructions on G4 and G5 processors]), [WANT_ALTIVEC=1], [WANT_ALTIVEC=0])
WANT_TESTS=0
AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [Build various little test programs]), [WANT_TESTS=1], [WANT_TESTS=0])
AM_CONDITIONAL(WANT_TESTS, test "x$WANT_TESTS" = "x1")
AC_ARG_WITH(readline, AC_HELP_STRING([--without-readline], [Don't use readline for Python interactive mode. Interactive mode will be restricted to single node execution.]))
WANT_64BIT=0
AC_ARG_ENABLE(64bit, AC_HELP_STRING([--enable-64bit], [Compile 64 bit binaries (IBM RS/6000 SP and SGI machines only at the moment... all libraries must also be compiled to 64 bit.)]), [WANT_64BIT=1], [WANT_64BIT=0])
# Stolen in part from the LAM MPI configure.in file
if test "$with_cxx" = yes; then
AC_MSG_ERROR(--with-cxx requires the C++ compiler name)
fi
dnl Set up compiler flags, so that libraries will be tested with these
dnl (so that 64 bit tests will fail to work against 32 bit libs for
dnl instance).
if test "x$build_vendor" = "xibm"; then
if test "$CXX" = "mpCC" || test "$CXX" = "mpCC_r" || test "$CXX" = "xlC" || test "$CXX" = "xlC_r"; then
dnl Turn on inlining, template registry, RTTI, 2 GB memory access
CXXFLAGS="$CXXFLAGS -qtemplateregistry -qrtti=all"
if test "x$WANT_64BIT" = "x1"; then
CXXFLAGS="-q64 -qwarn64 $CXXFLAGS"
CFLAGS="-q64 -qwarn64 $CFLAGS"
else
CXXFLAGS="-bmaxdata:0x80000000 $CXXFLAGS"
CFLAGS="-bmaxdata:0x80000000 $CFLAGS"
fi
fi
if test "$CXX" = "g++"; then
CXXFLAGS="$CXXFLAGS -mpe"
if test "x$WANT_64BIT" = "x1"; then
CXXFLAGS="$CXXFLAGS -maix64"
fi
fi
fi
dnl SGI IRIX and MIPSPro C++ stuff
if test "x$build_vendor" = "xsgi"; then
CXXFLAGS="$CXXFLAGS -LANG:std -ptused -prelink"
if test "x$USE_OPENMP" = "x1"; then
LIBS="$LIBS -lm -lmp -lmpi++ -lmpi";
else
LIBS="$LIBS -lm -lmpi++ -lmpi";
fi
if test "x$WANT_64BIT" = "x1"; then
CXXFLAGS="$CXXFLAGS -64"
CFLAGS="$CFLAGS -64"
else
CXXFLAGS="$CXXFLAGS -n32"
CFLAGS="$CFLAGS -n32"
fi
fi
dnl HP SC45 stuff
if test "x$build_vendor" = "xdec"; then
CXXFLAGS="$CXXFLAGS -D__USE_STD_IOSTREAM -tused"
LIBS="$LIBS -lm -lmpi";
fi
CFLAGS_SAVE="$CFLAGS"
CXXFLAGS_SAVE="$CXXFLAGS"
CPPFLAGS_SAVE="$CPPFLAGS"
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CXX(mpic++ mpiCC, mpCC_r, mpCC, g++, CC, xlC_r)
AC_PROG_CXXCPP
dnl AC_PROG_YACC
dnl AM_PROG_LEX
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
CFLAGS="$CFLAGS_SAVE"
CXXFLAGS="$CXXFLAGS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
dnl Check for compiler things
AC_C_INLINE
AC_C_BIGENDIAN
AC_C_RESTRICT
AC_CXX_HAVE_COMPLEX
dnl Doxygen for generating documentation
DX_INIT_DOXYGEN([Phred], [doc/Doxyfile], [doc/generated_docs])
AC_LANG(C++)
dnl OpenMP support? These should really depend on the
dnl compiler, not the vendor...
INTEL_OMP="-openmp"
SGI_OMP="-mp" # -MP:open_mp=ON"
AIX_OMP="-qSMP=omp:noauto"
DEC_OMP="-omp"
OMP_FLAGS=""
if [[ "x$target_vendor" = "xpc" ]]; then
OMP_FLAGS=$INTEL_OMP
fi
if [[ "x$target_vendor" = "xsgi" ]]; then
OMP_FLAGS=$SGI_OMP
fi
if [[ "x$target_vendor" = "xibm" ]]; then
OMP_FLAGS=$AIX_OMP
fi
if [[ "x$target_vendor" = "xdec" ]]; then
OMP_FLAGS=$DEC_OMP
fi
AC_CXX_OPENMP([$OMP_FLAGS])
dnl Debug?
if test "x$WANT_DEBUG" = "x1"; then
AC_DEFINE([DEBUG], [1], [Turn on debugging messages])
dnl AC_LANG_WERROR
CXXFLAGS="$CXXFLAGS -g"
CFLAGS="$CFLAGS -g"
else
AC_DEFINE([NDEBUG], [1], [Turn off assertions])
CXXFLAGS="$CXXFLAGS -O3"
CFLAGS="$CFLAGS -O3"
if test "$CXX" = "mpCC" || test "$CXX" = "mpCC_r" || test "$CXX" = "xlC" || test "$CXX" = "xlC_r"; then
CXXFLAGS="$CXXFLAGS -qstrict -Q -qansialias -qhot -qfuncsect"
fi
fi
dnl Profile?
if [[ "x$WANT_PROFILE" = "x1" ]]; then
AC_DEFINE([PROFILE], [1], [Using profiling (-pg)])
CXXFLAGS="$CXXFLAGS -pg"
CFLAGS="$CFLAGS -pg"
fi
if [[ "x$with_efence" = "xyes" ]]; then
AC_CHECK_LIB(efence, malloc, [], [])
fi
dnl Checks for header files.
AC_HEADER_STDC
dnl AC_CHECK_HEADERS(unistd.h sys/param.h sys/time.h time.h sys/mkdev.h sys/sysmacros.h string.h memory.h fcntl.h dirent.h sys/ndir.h ndir.h alloca.h locale.h )
AC_CHECK_HEADERS(string map vector ctime ostream iostream cmath cstring fstream cassert utility time)
if [[ "$with_boost" != "no" ]]; then
CPPFLAGS="-I$with_boost/include $CPPFLAGS"
fi
AC_CHECK_HEADER([boost/shared_ptr.hpp], [], [AC_MSG_ERROR([*** Can't find boost/shared_ptr.hpp!])])
AC_HEADER_MAJOR
AC_FUNC_ALLOCA
AC_STRUCT_TM
AC_STRUCT_ST_BLOCKS
AC_FUNC_CLOSEDIR_VOID
dnl MPI header files? The mpi compiler script should take care of this
AC_CHECK_HEADER(mpi.h, [], [
AC_MSG_ERROR([*** Can't find any MPI header files. ])])
dnl if [[ ! "$with_popt" = "no" ]]; then
dnl AC_DEFINE([USE_POPT], [1], [Use the popt library])
dnl AC_CHECK_LIB(popt, poptGetContext, [], [])
dnl AC_CHECK_HEADER([popt.h], [], [])
dnl fi
AC_CHECK_FUNC(getopt,[AC_DEFINE(HAVE_GETOPT, 1, [getopt option parser])])
if [[ ! "$with_netcdf" = "no" ]]; then
AC_CHECK_LIB(netcdf, ncopen, [
LIBS="-lnetcdf $LIBS";
AC_CHECK_HEADER([netcdf.h], [
USE_NETCDF="1"
AC_DEFINE([USE_NETCDF], [1], [Use netCDF as a DataWriter])], [],
[$with_netcdf_includes])], [], [$with_netcdf_libs])
fi
if [[ "$with_hdf" = "yes" ]]; then
AC_CHECK_LIB(mfhdf, hdf_close, [
LIBS="-lmfhdf -ldf -ljpeg -lz $LIBS"
AC_CHECK_HEADER([hdf.h], [
USE_HDF4="1"
AC_DEFINE([USE_HDF4], [1], [Use HDF4 as a DataWriter])], [],
[$with_hdf4_includes])], [], [-ldf -ljpeg -lz])
if [[ ! "$with_netcdf" = "no" ]]; then
AC_MSG_WARN([Using HDF and NetCDF together may not work; they have clashing symbols.])
fi
fi
if [[ ! "$with_hdf5" = "no" ]]; then
AC_CHECK_LIB(hdf5, H5open, [
LIBS="-lhdf5 $LIBS";
AC_CHECK_HEADER([hdf5.h], [
USE_HDF5="1"
AC_DEFINE([USE_HDF5], [1], [Use HDF5 as a DataWriter])], [],
[$with_hdf5_includes])], [], [$with_hdf5_libs])
fi
dnl isinf, isnan, finite checking code taken from Sablotron 1.0,
dnl dually licensed licensed under MPL 1.1 and GPL
dnl available from http://www.gingerall.cz/charlie/ga/xml/p_sab.xml
dnl check for isnan etc...in the std. way and try link if not found
dnl this is due HPUX, where isnan & Co. are defined as macros
AC_CHECK_FUNC(isnan, [has_isnan=1; AC_DEFINE(HAVE_ISNAN, 1, isnan)], has_isnan=0)
AC_CHECK_FUNC(isinf, [has_isinf=1; AC_DEFINE(HAVE_ISINF, 1, isinf)], has_isinf=0)
AC_CHECK_FUNC(finite,[has_finite=1;AC_DEFINE(HAVE_FINITE, 1, finite)], has_finite=0)
dnl check for macro isnan in math
if test $has_isnan = 0; then
AC_MSG_CHECKING(for macro isnan)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[{ int foo; foo = isnan(0); }]])],[has_isnan=1],[has_isnan=0 ])
if test $has_isnan = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ISNAN, 1, isnan)
else
AC_MSG_RESULT(no)
fi
fi
dnl check for macro isinf in math
if test $has_isinf = 0; then
AC_MSG_CHECKING(for macro isinf)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[{ int foo; foo = isinf(0); }]])],[has_isinf=1],[has_isinf=0 ])
if test $has_isinf = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ISINF, 1, isinf)
else
AC_MSG_RESULT(no)
fi
fi
dnl check for macro finite in math
if test $has_finite = 0; then
AC_MSG_CHECKING(for macro finite)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cmath>]], [[{ int foo; foo = finite(0); }]])],[has_finite=1],[has_finite=0 ])
if test $has_finite = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FINITE, 1, finite)
else
AC_MSG_RESULT(no)
fi
fi
dnl Use double precision?
if test "x$WANT_DOUBLE" = "x1"; then
if test "x$WANT_ALTIVEC" = "x1"; then
AC_MSG_ERROR([Cannot use double precision and Altivec together.])
fi
FIELD_TYPE="double"
MPIFIELD_TYPE="MPI_DOUBLE"
fi
AC_ARG_VAR([FIELD_TYPE], [Data type to use for field quantities.])
AC_ARG_VAR([MPIFIELD_TYPE], [MPI data type to use for field quantities.])
dnl Use AlitVec instructions on G4 and G5 processors? Compiler support?
dnl Libraries?
if test "x$WANT_ALTIVEC" = "x1"; then
if test "$target_cpu" = "powerpc"; then
AC_MSG_WARN([AltiVec support is not implemented yet.])
AC_MSG_CHECKING([for AltiVec support])
AC_COMPILE_IFELSE([
void test()
{}
], [
AC_MSG_RESULT([yes])
USE_ALTIVEC="1"
CFLAGS="$CFLAGS -faltivec"
AC_DEFINE([USE_ALTIVEC], [1], [Using AltiVec])
], [AC_MSG_RESULT[no]])
else
AC_MSG_WARN([AltiVec support is only available on G4 and G5 powerpc processors!])
fi
fi
dnl Blitz++, required for optimization
AC_CXX_LIB_BLITZ
dnl Python, for scripting
AC_CXX_PYTHON
dnl Setup scripting
USE_PY_BINDINGS=0
if [[ "$ac_cxx_python" = "yes" ]]; then
AC_CXX_LIB_BOOST_PYTHON("required")
USE_PY_BINDINGS=1
AC_DEFINE([USE_PY_BINDINGS], [1], [Use Python bindings])
dnl Use readline?
if test ! "$with_readline" = "no"; then
AC_CHECK_LIB(readline, readline, [
LIBS="$LIBS -lreadline"
AC_CHECK_HEADER([readline/readline.h], [
HAVE_READLINE="1"
AC_DEFINE([HAVE_READLINE], [1],
[Use readline for interactive python])],
[], [])], [], [])
fi
dnl Is Numeric or numarray available?
HAVE_NUMERIC=0
AC_CHECK_HEADER([Numeric/arrayobject.h], [HAVE_NUMERIC=1], [], [
#if HAVE_PYTHON
#include <Python.h>
#endif
])
if [[ x$HAVE_NUMERIC = "x1" ]]; then
AC_DEFINE([HAVE_NUMERIC], [1], [Use Numeric for arrays in Python])
fi
HAVE_NUMARRAY=0
AC_CHECK_HEADER([libnumarray.h], [HAVE_NUMARRAY=1], [], [
#if HAVE_PYTHON
#include <Python.h>
#endif
])
if [[ x$HAVE_NUMARRY = "x1" ]]; then
AC_DEFINE([HAVE_NUMARRAY], [1], [Use numarray for arrays in Python])
fi
fi
AM_CONDITIONAL(PY_BINDINGS, test "x$USE_PY_BINDINGS" = "x1")
AC_SUBST(LIBS, $LIBS)
AC_SUBST(PYTHON_LDFLAGS, $PYTHON_LDFLAGS)
DATE=`date`
AC_SUBST(DATE, $DATE)
AC_SUBST(HAVE_ISNAN, $HAVE_ISNAN)
AC_SUBST(HAVE_ISINF, $HAVE_ISINF)
AC_OUTPUT([Makefile
src/Makefile
src/PythonBindings/Makefile
doc/Makefile
tests/Makefile
tests/high_speed_c/Makefile
tests/boost.python/Makefile
tests/boost.spirit/Makefile
tests/benchmarks/Makefile
src/Types.hh
doc/Doxyfile
doc/phred.lsm
phred.spec
src/Results/Makefile
src/Excitations/Makefile
src/DataWriters/Makefile
src/Boundaries/Makefile
src/Signals/Makefile
src/CSG/Makefile])
dnl Display a summary of results
echo "Configured $PACKAGE_NAME $PACKAGE_VERSION"
echo
echo "C++ compiler: $CXX"
echo "C compiler: $CC"
echo "C++ compiler flags: $CXXFLAGS"
echo "C compiler flags: $CFLAGS"
echo "Preprocessor flags: $CPPFLAGS"
echo "Linker flags: $LDFLAGS"
echo "Library flags: $LIBS"
echo
dnl echo $ECHO_N "Using popt to parse command line arguments? $ECHO_C"
dnl if test "x$HAVE_LIBPOPT" = "x1"; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
dnl echo
echo "DataWriters: "
echo $ECHO_N " - NetCDF? $ECHO_C"
if test "x$USE_NETCDF" = "x1"; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo $ECHO_N " - HDF 4? $ECHO_C"
if [[ "x$USE_HDF4" = "x1" ]]; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo $ECHO_N " - HDF 5? $ECHO_C"
if [[ "x$USE_HDF5" = "x1" ]]; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo
echo $ECHO_N "Building AltiVec support? $ECHO_C"
if [[ "x$USE_ALTIVEC" = "x1" ]]; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo $ECHO_N "Using OpenMP parallization? $ECHO_C"
if [[ "x$USE_OPENMP" = "x1" ]]; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo
echo $ECHO_N "Building Python bindings? $ECHO_C"
if [[ "x$USE_PY_BINDINGS" = "x1" ]]; then
echo "${ECHO_T}yes";
echo $ECHO_N "Using readline for interactive Python? $ECHO_C"
if [[ ! "$with_readline" = "no" ]]; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
else
echo "${ECHO_T}no";
fi
dnl echo $ECHO_N "Building a parser for Jan's input files? "
dnl if test ! -z "$LEX" && test ! -z "$YACC"; then echo "yes"; else echo "no"; fi
echo
echo "Field components will use $FIELD_TYPE."
echo
echo $ECHO_N "Build type: $ECHO_C"
if test "x$WANT_DEBUG" = "x1"; then echo "${ECHO_T}debugging"; else echo "${ECHO_T}optimized"; fi
echo $ECHO_N "Profiling? $ECHO_C"
if test "x$WANT_PROFILE" = "x1"; then echo "${ECHO_T}yes"; else echo "${ECHO_T}no"; fi
echo
echo "$PACKAGE_NAME is ready to be built. Type 'make'."