-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
290 lines (226 loc) · 8.79 KB
/
configure.in
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
AC_INIT([QDng], [1.0.0])
AC_CONFIG_SRCDIR([configure.in])
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE
AC_LANG([C++])
AC_PROG_CXX
AC_PROG_F77
AC_PROG_LEX
if test "x$LEX" == x; then
AC_MSG_ERROR(lex is missing)
fi
AC_PROG_YACC
if test "x$YACC" == x; then
AC_MSG_ERROR(Yacc or bison is missing)
fi
AM_PROG_LIBTOOL
LT_INIT
dnl Check for standard functions
AC_CHECK_HEADERS([fcntl.h],,AC_MSG_ERROR(fcntl.h not found))
AC_CHECK_HEADERS([limits.h],,AC_MSG_ERROR(limits.h not found))
AC_CHECK_HEADERS([sys/sysinfo.h],,AC_MSG_ERROR(sys/sysinfo.h not found))
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_FUNCS([pow],,AC_MSG_ERROR(power function not found))
AC_CHECK_FUNCS([sqrt],,AC_MSG_ERROR(sqrt function not found))
AC_CHECK_FUNCS([mkdir],,AC_MSG_ERROR(mkdir function not found))
AC_CHECK_FUNCS([ftruncate],,AC_MSG_ERROR(ftruncate function not found))
AC_CHECK_FUNCS([munmap],,AC_MSG_ERROR(munmap function not found))
AC_CHECK_FUNCS([mmap],,AC_MSG_ERROR(mmap function not found))
AC_CHECK_FUNCS([malloc],,AC_MSG_ERROR(malloc function not found))
AC_CHECK_FUNCS([memset],,AC_MSG_ERROR(memset function not found))
AC_CHECK_FUNCS([strdup],,AC_MSG_ERROR(strdup function not found))
AC_CHECK_FUNCS([strstr],,AC_MSG_ERROR(strstr function not found))
AC_CHECK_FUNCS([uname])
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_C_INLINE
AC_HEADER_STDBOOL
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
dnl
dnl Compiler flags for development
dnl
AC_ARG_ENABLE([devel],
[AS_HELP_STRING([--enable-devel],[Enable gcc pedantic code checking])],
[enable_devel=yes; DEVEL_FLAGS="-Werror -pedantic -pedantic-errors -Wall -Wdiv-by-zero -ansi -Wall -Wno-error=unused-function -Wno-long-long"],
[enable_devel=no; DEVEL_FLAGS=""])
AC_SUBST(DEVEL_FLAGS)
AM_CXXFLAGS="-Wno-long-long -DQD_SYS_MOD_PATH='\"\$(libdir)/qdng/\"'"
AC_SUBST(AM_CXXFLAGS)
dnl
dnl Optimization Flags
dnl
AC_ARG_ENABLE([gccopt],
[AS_HELP_STRING([--enable-gccopt],[Enable gcc specific optimizations (default: enabled)])],
[if test "x$enableval" = "xyes"; then
enable_opt=yes;
OPT_FLAGS="-O3 -funroll-loops -ffast-math";
else
enable_opt=no;
OPT_FLAGS=""
fi],
[enable_opt=yes; OPT_FLAGS="-O3 -funroll-loops -ffast-math"])
AC_SUBST(OPT_FLAGS)
dnl
dnl PerfCounters for Performance Checking
dnl
AC_ARG_ENABLE([perfcounters],
[AS_HELP_STRING([--enable-perfcounters],[Enable PerfCounters for timing analysis])],
[enable_perfcounters=yes; AC_DEFINE([HAVE_PERFCOUNTERS],[1],[enable PerfCounters for timings])],
[enable_perfcounters=no;])
dnl
dnl Google Protobuf library
dnl
AC_ARG_WITH([protobuf],[AS_HELP_STRING([--with-protobuf=PATH],[Path prefix to google protobuf installation])])
if test "x$with_protbuf" != "xno"; then
LDFLAGS="$LDFLAGS -L$with_protobuf/lib";
CXXFLAGS="$CXXFLAGS -I$with_protobuf/include"
fi
AC_CHECK_HEADER("google/protobuf/stubs/common.h",[],AC_MSG_ERROR(protobuf headers are missing))
save_LIBS=$LIBS
LIBS="$LIBS -lprotobuf"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <google/protobuf/io/zero_copy_stream_impl.h>],
[google::protobuf::io::FileInputStream dummy(0)])],
[HAVE_PROTOBUF=1],
[AC_MSG_ERROR([libprotobuf is not installed.])])
LIBS=$save_LIBS
dnl
dnl Google Protobuf compiler
dnl
AC_ARG_WITH([protoc],
[AS_HELP_STRING([--with-protoc=PATH],
[location of the protoc protocol buffer compiler binary, defaults to protoc])],
[PROTOC="$withval"],
[PROTOC='protoc'])
AC_SUBST([PROTOC])
dnl
dnl OpenMP
dnl
sinclude([m4/ax_openmp.m4])
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--enable-openmp],[Enable OpenMP parallelization])],
[AX_OPENMP(enable_openmp=yes,AC_MSG_ERROR(Compiler doesn't provide OpenMP))],
[enable_openmp=no])
AM_CONDITIONAL([HAVEOPENMP],[test "x$enable_openmp"="xyes"] )
AC_ARG_WITH([staticfftw],[AS_HELP_STRING([--with-staticfftw=PATH],[Path to fftw installation])])
dnl
dnl Setup FFTW compile time parameters
dnl
if test "x$with_staticfftw" = "x"; then
sinclude([m4/acx_fftw3.m4])
ACX_FFTW3
else
AC_MSG_CHECKING([for static version of fftw3])
echo ""
save_LIBS="$LIBS"; LIBS="$LIBS $with_staticfftw/lib/libfftw3_omp.a $with_staticfftw/lib/libfftw3.a"
save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -I$with_staticfftw/include"
AC_CHECK_HEADER(fftw3.h,[FFTW_CFLAGS="-I$with_staticfftw/include"],AC_MSG_ERROR(fftw3 headers are missing))
AC_TRY_LINK_FUNC([fftw_plan_dft],
[FFTW_LIBS="$with_staticfftw/lib/libfftw3.a"],
[AC_MSG_ERROR(libfftw3.a lib is missing)])
if test "x$enable_openmp" = "xyes"; then
AC_TRY_LINK_FUNC([fftw_init_threads],
[FFTW_LIBS="$with_staticfftw/lib/libfftw3_omp.a $with_staticfftw/lib/libfftw3.a"],
[AC_MSG_ERROR(libfftw3_omp.a is missing)])
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_SUBST(FFTW_LIBS)
AC_SUBST(FFTW_CFLAGS)
fi
AC_ARG_ENABLE([sse2],
[AS_HELP_STRING([--enable-sse2],[Explictly enable SSE2 optimizations])],
[enable_sse2 = yes; AC_DEFINE([HAVE_SSE2], [1], [Explictly enable SSE2 optimizations])])
AC_ARG_ENABLE([sse3],
[AS_HELP_STRING([--enable-sse3],[Explictly enable SSE3 optimizations])],
[enable_sse3=yes; enable_sse2=yes; OPT_FLAGS="$OPT_FLAGS -msse3" ;
AC_DEFINE([HAVE_SSE2], [1], [Explictly enable SSE2 optimizations])
AC_DEFINE([HAVE_SSE3], [1], [Explictly enable SSE3 optimizations])])
AC_ARG_ENABLE([avx],
[AS_HELP_STRING([--enable-avx],[Explictly enable AVX optimizations])],
[enable_avx = "yes" ; OPT_FLAGS="$OPT_FLAGS -mavx" ;
AC_DEFINE([HAVE_AVX], [1], [Explictly enable AVX optimizations])])
dnl zlib
sinclude([m4/ax_check_zlib.m4])
AX_CHECK_ZLIB()
dnl bzip2
sinclude([m4/ax_libbz2.m4])
AX_CHECK_LIBBZ2()
dnl libxml2
sinclude([m4/acx_libxml2.m4])
ACX_CHECK_LIBXML2
dnl blas/lapack
sinclude([m4/acx_blas.m4])
sinclude([m4/acx_lapack.m4])
ACX_BLAS(,AC_MSG_ERROR(BLAS libs are missing/not working))
ACX_LAPACK(,AC_MSG_ERROR(LAPACK is missing/not working))
dnl Configure C/F77 mixed mode (RT libs)
AC_F77_LIBRARY_LDFLAGS
AC_F77_WRAPPERS
dnl
dnl dynamic modules
dnl
AC_ARG_ENABLE([mods],
[AS_HELP_STRING([--enable-mods],[Enable dynamic loadable modules])],
[
if test "x$enableval" = "xyes"; then
AC_DEFINE([USE_DYNMODS], [1], [Enable dynamic loadable modules])
DL_LIBS="-ldl";
enable_mods=yes;
else
DL_LIBS="";
enable_mods=no;
fi
],
[DL_LIBS="";])
AC_SUBST(DL_LIBS)
AM_CONDITIONAL([DYNMODS], [test "x$enable_mods" = "xyes"])
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--enable-mpi],[Build with support for mpi parallization])],
[enable_mpi=yes; AC_DEFINE([HAVE_MPI], [1], [Compile with MPI support]) ], enable_mpi=no)
dnl AC_ARG_WITH([mpi-libs],
dnl [AS_HELP_STRING([--with-mpi-libs=PATH],[Compiler/linker flags for mpi libs])],
dnl
dnl AC_ARG_WITH([mpi-prefix],
dnl [AS_HELP_STRING([--with-mpi-prefix=PATH],[Prefix of the mpi installation])],
dnl [],with_mpi-prefix=no)
dnl
dnl CPP Unit tests
dnl
AC_ARG_WITH([cppunit],
[AS_HELP_STRING([--with-cppunit], [Enable CppUnit tests])],
[with_cppunit=yes],
[with_cppunit=no])
AM_CONDITIONAL([CPPUNIT], [test "x$with_cppunit" != "xno"])
AC_ARG_ENABLE([handbook],
[AS_HELP_STRING([--enable-handbook], [Build the PDF Handbook])],
[enable_handbook=yes], [enable_handbook=no])
AM_CONDITIONAL([ENABLE_HANDBOOK], [test "x$enable_handbook" == "xyes"])
dnl Check for presence of pdfLaTeX
AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex)
if test -z "$PDFLATEX"; then
AC_MSG_WARN([Unable to create PDF version of the user manual.])
fi
AM_CONDITIONAL([HAVE_PDFLATEX], [test -n "$PDFLATEX" -a "$enable_handbook" == "xyes"])
AC_CONFIG_FILES(
[Makefile doc/Makefile scripts/Makefile src/Makefile src/qdlib/Makefile src/tools/Makefile
src/fft/Makefile src/math/Makefile src/modules/Makefile
src/tests/Makefile src/slatec/Makefile src/linalg/Makefile
src/lib/Makefile tests/Makefile src/simpleXml/Makefile
src/matlab/Makefile
tests/TGE-GSPO.qdi tests/TGE-Arnoldi.qdi tests/TGE-Cheby.qdi tests/TGE-SIL.qdi
tests/TGP-Expec.qdi tests/TGP-Expec-SP.qdi tests/TGP-Expec-HOFD.qdi tests/TGP-NIP-Cheby.qdi
tests/TGP-Kick.qdi tests/TGP-Gmat.qdi
tests/TGPMS-Cheby.qdi tests/TGPMS-GSPO.qdi
tests/TGPLMS-Cheby.qdi tests/TGPLMS-SIL.qdi
tests/TGPL-IR-Pulse-Cheby.qdi tests/TGPL-IR-Pulse-GSPO.qdi
tests/TLP-H-GSPO.qdi tests/TLP-H-Cheby.qdi
tests/TLP-C-GSPO.qdi tests/TLP-C-Cheby.qdi
tests/TLPL-GSPO.qdi tests/TLPL-Cheby.qdi
tests/TGO-IR-Freq.qdi tests/TGO-IR-Krotov.qdi tests/TGO-IR-Rabitz.qdi
tests/TGO-IR-Krotov-Projection.qdi tests/TGO-UV-Krotov.qdi tests/TLO-Cheby.qdi ])
AC_OUTPUT