-
Notifications
You must be signed in to change notification settings - Fork 10
/
configure.ac
389 lines (317 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT(Z-CHECKER, 0.9, [email protected])
AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])
AC_CONFIG_SRCDIR([zc/src/zc.c])
AC_CONFIG_HEADERS([config.h])
AC_LANG(C++)
AC_PROG_CXX
AC_PROG_CC
# Checks for programs.
#: ${CFLAGS=-O3 -std=c99 -Wall}
#: ${CFLAGS=-O3 -std=gnu99 -Wall}
: ${CXXFLAGS=-O3 -Wall}
: ${CFLAGS=-O3 -std=gnu99 -Wall}
##
## MPI
##
#CC=g++
AC_ARG_ENABLE(mpi, [ --enable-mpi use MPI], ok=$enableval, ok=no)
AM_CONDITIONAL([MPI], [test "x$enable_mpi" = "xyes"])
if test "$ok" = "yes"; then
AC_CHECK_PROG(MPICC,mpicc,yes,no)
if test "$MPICC" = no; then
AC_MSG_ERROR([Cound not find mpicc. Please install mpi library first.])
else
CC=mpicc
CXX=mpicxx
MPI_FLAGS="-DHAVE_MPI"
fi
fi
##
## HDF5
##
AC_ARG_ENABLE(hdf5, [ --enable-hdf5 use HDF5], hdf5_ok=$enableval, hdf5_ok=no)
AM_CONDITIONAL([HDF5], [test "x$enable_hdf5" = "xyes"])
if test "$hdf5_ok" = "yes"; then
AC_CHECK_PROG(H5CC,h5cc,yes,no)
if test "$H5CC" = no; then
AC_MSG_ERROR([Cound not find h5cc. Please install hdf5 first.])
else
CC=h5cc
HDF5_FLAGS="-DHAVE_HDF5"
fi
fi
# Check NETCDF library
AC_ARG_ENABLE(netcdf, [ --enable-netcdf use NETCDF], netcdf_ok=$enableval, netcdf_ok=no)
AM_CONDITIONAL([NETCDF], [test "x$enable_netcdf" = "xyes"])
if test "$netcdf_ok" = "yes"; then
# NETCDF_CFLAGS="-DHAVE_NETCDF"
AC_ARG_WITH([netcdf-prefix], [AS_HELP_STRING([--with-netcdf-prefix=DIR],
[installation prefix for netcdf])],
[with_netcdf_include_path=$with_netcdf_prefix/include;
with_netcdf_lib_path=$with_netcdf_prefix/lib])
AC_ARG_WITH([netcdf-include-path], [AS_HELP_STRING([--with-netcdf-include-path=DIR],
[path to the netcdf directory, defaults to /usr/include])], [])
if test "x$with_netcdf_include_path" = x ; then
with_netcdf_include_path="/usr/include"
fi
AC_CHECK_FILE([${with_netcdf_include_path}/netcdf.h], [],
AC_MSG_ERROR([Invalid path to netcdf.h]))
NETCDF_HDR="-I$with_netcdf_include_path"
AC_ARG_WITH([netcdf-lib-path], [AS_HELP_STRING([--with-netcdf-lib-path],
[path to the netcdf libraries, defaults to /usr/lib])], [])
if test "x$with_netcdf_lib_path" = x ; then
with_netcdf_lib_path="/usr/lib"
fi
NETCDF_LIB="-L$with_netcdf_lib_path"
LIBS="$NETCDF_LIB"
if test "x$BUILD_STATIC" = xyes ; then
NETCDF_STATIC="${with_netcdf_lib_path}/libnetcdf.a"
NETCDF_LIB=
else
NETCDF_STATIC="-lnetcdf"
fi
# AC_SUBST(NETCDF_CFLAGS)
AC_SUBST(NETCDF_HDR)
AC_SUBST(NETCDF_LIB)
AC_SUBST(NETCDF_STATIC)
else
AC_MSG_WARN([NETCDF disabled])
fi
# Check LIBPRESSIOOPT library
AC_ARG_ENABLE(libpressioopt, [ --enable-libpressioopt use LIBPRESSIOOPT], libpressioopt_ok=$enableval, libpressioopt_ok=no)
AM_CONDITIONAL([LIBPRESSIOOPT], [test "x$enable_libpressioopt" = "xyes"])
if test "$libpressioopt_ok" = "yes"; then
# LIBPRESSIOOPT_CFLAGS="-DHAVE_LIBPRESSIOOPT"
AC_ARG_WITH([libpressioopt-prefix], [AS_HELP_STRING([--with-libpressioopt-prefix=DIR],
[installation prefix for libpressioopt])],
[with_libpressioopt_include_path=$with_libpressioopt_prefix/include;
with_libpressioopt_lib_path=$with_libpressioopt_prefix/lib64])
AC_ARG_WITH([libpressioopt-include-path], [AS_HELP_STRING([--with-libpressioopt-include-path=DIR],
[path to the libpressioopt directory, defaults to /usr/include])], [])
if test "x$with_libpressioopt_include_path" = x ; then
with_libpressioopt_include_path="/usr/include"
fi
AC_CHECK_FILE([${with_libpressioopt_include_path}/libpressio_opt/pressio_search.h], [],
AC_MSG_ERROR([Invalid path to pressio_search.h]))
LIBPRESSIOOPT_HDR="-I$with_libpressioopt_include_path -I$with_libpressioopt_include_path/sz -I$with_libpressioopt_include_path/zfp -I$with_libpressioopt_include_path/libpressio -I$with_libpressioopt_include_path/libpressio_opt -I$with_libpressioopt_include_path/std_compat -I$with_libpressioopt_include_path/boost -I$with_libpressioopt_include_path/libdistributed"
AC_ARG_WITH([libpressioopt-lib-path], [AS_HELP_STRING([--with-libpressioopt-lib-path],
[path to the libpressioopt libraries, defaults to /usr/lib])], [])
if test "x$with_libpressioopt_lib_path" = x ; then
with_libpressioopt_lib_path="/usr/lib"
fi
LIBPRESSIOOPT_LIB="-L$with_libpressioopt_lib_path"
LIBS="$LIBPRESSIOOPT_LIB"
if test "x$BUILD_STATIC" = xyes ; then
LIBPRESSIOOPTSTATIC="${with_libpressioopt_lib_path}/liblibpressio_opt.a"
LIBPRESSIOOPT_LIB=
else
LIBPRESSIOOPT_STATIC="-llibpressio_opt -lSZ -lzfp -ldlib -llibpressio -lstd_compat -llibdistributed"
fi
# AC_SUBST(LIBPRESSIOOPT_CFLAGS)
AC_SUBST(LIBPRESSIOOPT_HDR)
AC_SUBST(LIBPRESSIOOPT_LIB)
AC_SUBST(LIBPRESSIOOPT_STATIC)
else
AC_MSG_WARN([LIBPRESSIOOPT disabled])
fi
# Check FFTW3 library
AC_ARG_ENABLE(fftw3, [ --enable-fftw3 use FFTW3], fftw_ok=$enableval, fftw_ok=no)
AM_CONDITIONAL([FFTW3], [test "x$enable_fftw3" = "xyes"])
if test "$fftw_ok" = "yes"; then
# FFTW3_CFLAGS="-DHAVE_FFTW3"
AC_ARG_WITH([fftw3-prefix], [AS_HELP_STRING([--with-fftw3-prefix=DIR],
[installation prefix for fftw3])],
[with_fftw3_include_path=$with_fftw3_prefix/include;
with_fftw3_lib_path=$with_fftw3_prefix/lib])
AC_ARG_WITH([fftw3-include-path], [AS_HELP_STRING([--with-fftw3-include-path=DIR],
[path to the fftw3 directory, defaults to /usr/include])], [])
if test "x$with_fftw3_include_path" = x ; then
with_fftw3_include_path="/usr/include"
fi
AC_CHECK_FILE([${with_fftw3_include_path}/fftw3.h], [],
AC_MSG_ERROR([Invalid path to fftw3.h]))
FFTW3_HDR="-I$with_fftw3_include_path"
AC_ARG_WITH([fftw3-lib-path], [AS_HELP_STRING([--with-fftw3-lib-path],
[path to the fftw3 libraries, defaults to /usr/lib])], [])
if test "x$with_fftw3_lib_path" = x ; then
with_fftw3_lib_path="/usr/lib"
fi
FFTW3_LIB="-L$with_fftw3_lib_path"
LIBS="$FFTW3_LIB"
if test "x$BUILD_STATIC" = xyes ; then
FFTW3_STATIC="${with_fftw3_lib_path}/libfftw3.a"
FFTW3_LIB=
else
FFTW3_STATIC="-lfftw3"
fi
# AC_SUBST(FFTW3_CFLAGS)
AC_SUBST(FFTW3_HDR)
AC_SUBST(FFTW3_LIB)
AC_SUBST(FFTW3_STATIC)
else
AC_MSG_WARN([FFTW3 disabled])
fi
# Check R library
AC_ARG_ENABLE(r, [ --enable-r use R], r_ok=$enableval, r_ok=no)
AM_CONDITIONAL([R], [test "x$enable_r" = "xyes"])
if test "$r_ok" = "yes"; then
# R_CFLAGS="-DHAVE_R"
AC_ARG_WITH([r-prefix], [AS_HELP_STRING([--with-r-prefix=DIR],
[installation prefix for r])],
[with_r_include_path=$with_r_prefix/include;
with_r_lib_path=$with_r_prefix/lib])
AC_ARG_WITH([r-include-path], [AS_HELP_STRING([--with-r-include-path=DIR],
[path to the r directory, defaults to /usr/include])], [])
if test "x$with_r_include_path" = x ; then
with_r_include_path="/usr/include"
fi
AC_CHECK_FILE([${with_r_include_path}/R.h], [],
AC_MSG_ERROR([Invalid path to R.h]))
R_HDR="-I$with_r_include_path"
AC_ARG_WITH([r-lib-path], [AS_HELP_STRING([--with-r-lib-path],
[path to the r libraries, defaults to /usr/lib])], [])
if test "x$with_r_lib_path" = x ; then
with_r_lib_path="/usr/lib"
fi
R_LIB="-L$with_r_lib_path"
LIBS="$R_LIB"
if test "x$BUILD_STATIC" = xyes ; then
R_STATIC="${with_r_lib_path}/libr.a"
R_LIB=
else
R_STATIC="-lR"
fi
# AC_SUBST(R_CFLAGS)
AC_SUBST(R_HDR)
AC_SUBST(R_LIB)
AC_SUBST(R_STATIC)
else
AC_MSG_WARN([R disabled])
fi
#enable online visualization (zserver)
AC_ARG_ENABLE(zserver, [ --enable-zserver use ZSERVER], zserver_ok=$enableval, zserver_ok=no)
AM_CONDITIONAL([ZSERVER], [test "x$enable_zserver" = "xyes"])
if test "$zserver_ok" = "yes"; then
AC_ARG_WITH([zserver-prefix], [AS_HELP_STRING([--with-zserver-prefix=DIR],
[installation prefix for zserver])],
[with_zserver_include_path=$with_zserver_prefix/include;
with_zserver_lib_path=$with_zserver_prefix/lib])
AC_ARG_WITH([zserver-include-path], [AS_HELP_STRING([--with-zserver-include-path=DIR],
[path to the zserver directory, defaults to /usr/include])], [])
if test "x$with_zserver_include_path" = x ; then
with_zserver_include_path="/usr/include"
fi
AC_CHECK_FILE([${with_zserver_include_path}/zserver.h], [],
AC_MSG_ERROR([Invalid path to zserver.h]))
ZSERVER_HDR="-I$with_zserver_include_path"
AC_ARG_WITH([zserver-lib-path], [AS_HELP_STRING([--with-zserver-lib-path],
[path to the zserver libraries, defaults to /usr/lib])], [])
if test "x$with_zserver_lib_path" = x ; then
with_zserver_lib_path="/usr/lib"
fi
ZSERVER_LIB="-L$with_zserver_lib_path"
LIBS="$ZSERVER_LIB"
if test "x$BUILD_STATIC" = xyes ; then
ZSERVER_STATIC="${with_zserver_lib_path}/libzserver.a"
ZSERVER_LIB=
else
ZSERVER_STATIC="-lzserver"
fi
AC_SUBST(ZSERVER_HDR)
AC_SUBST(ZSERVER_LIB)
AC_SUBST(ZSERVER_STATIC)
else
AC_MSG_WARN([ZSERVER disabled])
fi
#check for R, netcdf and fftw3
if test "$zserver_ok" = "yes"; then
if test "$netcdf_ok" = "yes"; then
if test "$fftw_ok" = "yes"; then
if test "$r_ok" = "yes"; then
LIBS="$NETCDF_LIB $FFTW3_LIB $R_LIB $ZSERVER_LIB"
else
LIBS="$NETCDF_LIB $FFTW3_LIB $ZSERVER_LIB"
fi
else
if test "$r_ok" = "yes"; then
LIBS="$NETCDF_LIB $R_LIB $ZSERVER_LIB"
else
LIBS="$NETCDF_LIB $ZSERVER_LIB"
fi
fi
else
if test "$fftw_ok" = "yes"; then
if test "$r_ok" = "yes"; then
LIBS="$FFTW3_LIB $R_LIB $ZSERVER_LIB"
else
LIBS="$FFTW3_LIB $ZSERVER_LIB"
fi
else
if test "$r_ok" = "yes"; then
LIBS="$R_LIB $ZSERVER_LIB"
fi
fi
fi
else
if test "$netcdf_ok" = "yes"; then
if test "$fftw_ok" = "yes"; then
if test "$r_ok" = "yes"; then
LIBS="$NETCDF_LIB $FFTW3_LIB $R_LIB"
else
LIBS="$NETCDF_LIB $FFTW3_LIB"
fi
else
if test "$r_ok" = "yes"; then
LIBS="$NETCDF_LIB $R_LIB"
else
LIBS="$NETCDF_LIB"
fi
fi
else
if test "$fftw_ok" = "yes"; then
if test "$r_ok" = "yes"; then
LIBS="$FFTW3_LIB $R_LIB"
else
LIBS="$FFTW3_LIB"
fi
else
if test "$r_ok" = "yes"; then
LIBS="$R_LIB"
fi
fi
fi
fi
#mpi
AC_SUBST(MPI_FLAGS)
AC_PROG_RANLIB
AM_PROG_AR
AC_PROG_LIBTOOL
#m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_MAINTAINER_MODE([disable])
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memchr memset strchr strtol])
AC_CONFIG_FILES([Makefile])
if test "$netcdf_ok" = "yes"; then
AC_CONFIG_FILES([NetCDFReader/Makefile])
fi
if test "$hdf5_ok" = "yes"; then
AC_CONFIG_FILES([HDF5Reader/Makefile])
fi
if test "$r_ok" = "yes"; then
AC_CONFIG_FILES([R/Makefile])
fi
AC_CONFIG_FILES([zc/Makefile
examples/Makefile])
AC_OUTPUT
#set package dir in sz.config