-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfigure.ac
More file actions
302 lines (253 loc) · 8.35 KB
/
configure.ac
File metadata and controls
302 lines (253 loc) · 8.35 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
dnl Process this file with autoconf to produce a configure script.
dnl author: Mike Smith (grimbough@gmail.com)
AC_PREREQ([2.65])
AC_INIT([hdf5Filters], [0.99.3], [grimbough@gmail.com])
AC_CONFIG_SRCDIR([src])
m4_include([tools/ax_gcc_x86_cpu_supports.m4])
m4_include([tools/ax_check_compile_flag.m4])
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
AC_SUBST(CC, `"${R_HOME}/bin/R" CMD config CC`)
AC_SUBST(CFLAGS, `"${R_HOME}/bin/R" CMD config CFLAGS`)
AC_SUBST(CPICFLAGS, `"${R_HOME}/bin/R" CMD config CPICFLAGS`)
AC_SUBST(CXX, `"${R_HOME}/bin/R" CMD config CXX`)
AC_SUBST(CXXFLAGS, `"${R_HOME}/bin/R" CMD config CXXFLAGS`)
AC_SUBST(CXXPICFLAGS, `"${R_HOME}/bin/R" CMD config CXXPICFLAGS`)
AC_SUBST(CPPFLAGS, `"${R_HOME}/bin/R" CMD config CPPFLAGS`)
AC_SUBST(MAKE, `"${R_HOME}/bin/R" CMD config MAKE`)
AC_SUBST(RANLIB, `"${R_HOME}/bin/R" CMD config RANLIB`)
AC_SUBST(LDFLAGS, `"${R_HOME}/bin/R" CMD config LDFLAGS`)
AC_SUBST(C99FLAGS, `"${R_HOME}/bin/R" CMD config C99FLAGS`)
CC99=`"${R_HOME}/bin/R" CMD config CC99`
if test -z "$CC99"; then
CC99=`"${R_HOME}/bin/R" CMD config CC`
fi
AC_SUBST(CC99)
## seems unreliable as to whether this information is available
AR=`"${R_HOME}/bin/R" CMD config AR`
AS_IF([test "x$AR" = "xERROR: no information for variable 'AR'"], [AC_PATH_PROG([AR], [ar])], [])
AC_SUBST(AR)
AC_PROG_CC
## determine the location of the Rhdf5lib versions of the HDF5 library
RHDF5_INCLUDE=`"${R_HOME}/bin${R_ARCH_BIN}/Rscript" -e 'cat(system.file("include", package="Rhdf5lib"))' | \
tail -n1`
AC_SUBST(RHDF5_INCLUDE)
##############################
AC_ARG_WITH(bundled-libraries,,
[
bundled_libs="yes"
AC_MSG_NOTICE([Forcing the use of bundled compression libraries])
],
[
bundled_libs="no"
])
UNAME=`uname`
dnl we will use the bundled compression libraries if: requested OR this is a Mac OR this is the BBS
AS_IF([test "x$bundled_libs" = xyes],
[AC_MSG_NOTICE(requesting bundled libs)],
#[test "${UNAME}" = "Darwin"],
#[AC_MSG_NOTICE(running on Mac OSX)],
[test "${IS_BIOC_BUILD_MACHINE}" = "true"],
[AC_MSG_NOTICE(is Bioc build machine)],
[
AC_MSG_NOTICE(is NOT Bioc build machine)
HAVE_BZ2="yes"
HAVE_ZSTD="yes"
HAVE_BLOSC="yes"
])
##############################
AC_MSG_NOTICE(configuring the Zstd filter...)
if test "x$HAVE_ZSTD" = "xyes"; then
AC_CHECK_HEADERS([zstd.h], [HAVE_ZSTD_H="yes"], [unset HAVE_ZSTD])
if test "x$HAVE_ZSTD_H" = "xyes"; then
AC_CHECK_LIB([zstd], [ZSTD_decompress],, [unset HAVE_ZSTD])
fi
fi
if test -z "$HAVE_ZSTD"; then
AC_MSG_NOTICE(compiling bundled Zstd library)
AC_SUBST(BUILD_ZSTD, libzstd.a)
AC_SUBST(ZSTD_INCLUDE, "-I. -Icommon")
AC_SUBST(ZSTD_LIB, ../zstd/libzstd.a)
else
AC_MSG_NOTICE(Using system Zstd library)
AC_SUBST(BUILD_ZSTD, "")
AC_SUBST(ZSTD_INCLUDE, "")
AC_SUBST(ZSTD_LIB, -lzstd)
fi
AC_SUBST(BUILD_ZSTD)
AC_SUBST(ZSTD_INCLUDE)
AC_SUBST(ZSTD_LIB)
AC_CONFIG_FILES([src/zstd/Makefile])
##############################
AC_MSG_NOTICE(configuring the BLOSC filter...)
if test "x$HAVE_BLOSC" = "xyes"; then
AC_CHECK_HEADERS([blosc.h], [HAVE_BLOSC_H="yes"], [unset HAVE_BLOSC])
if test "x$HAVE_BLOSC_H" = "xyes"; then
AC_CHECK_LIB([blosc], [blosc_compress],, [unset HAVE_BLOSC])
fi
fi
dnl if there's not a system install of blosc build our own version
if test -z "$HAVE_BLOSC"; then
AC_MSG_NOTICE(compiling bundled BLOSC library)
## check if we have an x86 CPU
machine=`uname -m`
AS_CASE([$machine],
[*86*], [x86_CPU=true],
[x86_CPU=false]
)
## see if -msse2 is a supported flag
AX_CHECK_COMPILE_FLAG([-msse2], [MSSE2=true], [MSSE2=false])
IS_BIOC_BUILD_MACHINE=${IS_BIOC_BUILD_MACHINE:-false}
if [ "${IS_BIOC_BUILD_MACHINE}" = "true" ]; then
AC_MSG_NOTICE(Bioc build machine; disabling MAVX2)
MAVX2=false
else
## see if -mavx2 is a supported flag
AX_CHECK_COMPILE_FLAG([-mavx2], [MAVX2=true], [MAVX2=false])
fi
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>],
[__builtin_cpu_init ();])
],
[ax_cv_gcc_check_x86_cpu_init=true],
[ax_cv_gcc_check_x86_cpu_init=false])
## check CPU supports sse2 and avx2
if [ "$x86_CPU" = "true" ] && [ "$ax_cv_gcc_check_x86_cpu_init" = "true" ]; then
AX_GCC_X86_CPU_SUPPORTS(sse2, [SSE2_SUPPORTED=true], [SSE2_SUPPORTED=false])
if [ "$MAVX2" = true ]; then
AX_GCC_X86_CPU_SUPPORTS(avx2, [AVX2_SUPPORTED=true], [AVX2_SUPPORTED=false])
fi
else
SSE2_SUPPORTED=false
AVX2_SUPPORTED=false
fi
if [ "$MSSE2" = true ] && [ "$SSE2_SUPPORTED" = true ] ; then
SSE2="-DSHUFFLE_SSE2_ENABLED"
MSSE2="-msse2"
SSE2_BITSHUFFLE='bitshuffle-sse2.o: bitshuffle-sse2.c
$(CC) $(FLAGS) -c bitshuffle-sse2.c'
SSE2_BITSHUFFLE_OBJ='bitshuffle-sse2.o'
SSE2_SHUFFLE='shuffle-sse2.o: shuffle-sse2.c
$(CC) $(FLAGS) -c shuffle-sse2.c'
SSE2_SHUFFLE_OBJ='shuffle-sse2.o'
SSE2_OBJ_PATH='lib/blosc-1.20.1/'
else
SSE2=""
MSSE2=""
SSE2_BITSHUFFLE=""
SSE2_SHUFFLE=""
SSE2_BITSHUFFLE_OBJ=""
SSE2_SHUFFLE_OBJ=""
SSE2_OBJ_PATH=""
fi
AC_SUBST(SSE2)
AC_SUBST(MSSE2)
AC_SUBST(SSE2_BITSHUFFLE)
AC_SUBST(SSE2_SHUFFLE)
AC_SUBST(SSE2_BITSHUFFLE_OBJ)
AC_SUBST(SSE2_SHUFFLE_OBJ)
AC_SUBST(SSE2_OBJ_PATH)
if [ "$MAVX2" = true ] && [ "$AVX2_SUPPORTED" = true ] ; then
AVX2="-DSHUFFLE_AVX2_ENABLED"
MAVX2="-mavx2"
AVX2_BITSHUFFLE='bitshuffle-avx2.o: bitshuffle-avx2.c
$(CC) $(FLAGS) -c bitshuffle-avx2.c'
AVX2_BITSHUFFLE_OBJ='bitshuffle-avx2.o'
AVX2_SHUFFLE='shuffle-avx2.o: shuffle-avx2.c
$(CC) $(FLAGS) -c shuffle-avx2.c'
AVX2_SHUFFLE_OBJ='shuffle-avx2.o'
AVX2_OBJ_PATH='lib/blosc-1.20.1/'
else
AVX2=""
MAVX2=""
AVX2_BITSHUFFLE=""
AVX2_SHUFFLE=""
AVX2_BITSHUFFLE_OBJ=""
AVX2_SHUFFLE_OBJ=""
AVX2_OBJ_PATH=""
fi
AC_SUBST(AVX2)
AC_SUBST(MAVX2)
AC_SUBST(AVX2_BITSHUFFLE)
AC_SUBST(AVX2_SHUFFLE)
AC_SUBST(AVX2_BITSHUFFLE_OBJ)
AC_SUBST(AVX2_SHUFFLE_OBJ)
AC_SUBST(AVX2_OBJ_PATH)
AC_SUBST(BUILD_BLOSC, "libblosc.a")
AC_SUBST(BLOSC_INCLUDE, "-I./lib/blosc-1.20.1")
AC_SUBST(BLOSC_LIB, "./libblosc.a")
else
AC_MSG_NOTICE(Using system BLOSC library)
AC_SUBST(BUILD_BLOSC, "")
AC_SUBST(BLOSC_INCLUDE, "")
AC_SUBST(BLOSC_LIB, -lblosc)
fi
AC_CONFIG_FILES([src/blosc/lib/blosc-1.20.1/Makefile src/blosc/Makefile])
##############################
AC_MSG_NOTICE(configuring the VBZ filter)
## check if we have an x86 CPU
machine=`uname -m`
AS_CASE([$machine],
[*86*], [CPU_ARCH=x86],
[aarch64], [CPU_ARCH=arm64], ## Linux ARM64
[arm64], [CPU_ARCH=arm64], ## Mac M1
[CPU_ARCH=false]
)
IS_BIOC_BUILD_MACHINE=${IS_BIOC_BUILD_MACHINE:-false}
if [ "${IS_BIOC_BUILD_MACHINE}" = "true" ]; then
echo machine=${machine}
echo CPU_ARCH=${CPU_ARCH}
fi
if test "${CPU_ARCH}" = arm64; then
VBZ_FLAGS="-D__ARM_NEON__"
STREAMBYTE_FLAGS=""
elif test "${CPU_ARCH}" = x86; then
## see if -mavx is a supported flag
AX_CHECK_COMPILE_FLAG([-mavx], [MAVX=true], [MAVX=false])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>],
[__builtin_cpu_init ();])
],
[ax_cv_gcc_check_x86_cpu_init=true],
[ax_cv_gcc_check_x86_cpu_init=false])
if [ "${MAVX}" = "true" ] && [ "${ax_cv_gcc_check_x86_cpu_init}" = "true" ] ; then
AX_GCC_X86_CPU_SUPPORTS(avx, [AVX_SUPPORTED=true], [AVX_SUPPORTED=false])
fi
if test ${AVX_SUPPORTED} = "true"; then
VBZ_FLAGS="-mssse3"
STREAMBYTE_FLAGS="-mavx"
fi
else
echo "Unknown architecture"
fi
if [ "${IS_BIOC_BUILD_MACHINE}" = "true" ]; then
echo VBZ_FLAGS=${VBZ_FLAGS}
fi
dnl if VBZ_FLAG isn't set don't compile the VBZ filter
if test -z "${VBZ_FLAGS}"; then
AC_SUBST(USE_VBZ, "")
AC_SUBST(VBZ_F_LIB, "")
AC_SUBST(VBZ_FLAGS, "")
AC_SUBST(STREAMBYTE_FLAGS, "")
else
AC_SUBST(USE_VBZ, "libH5Zvbz.so")
AC_SUBST(VBZ_F_LIB, "vbz/libH5Zvbz.so")
AC_SUBST(VBZ_FLAGS, "${VBZ_FLAGS}")
AC_SUBST(STREAMBYTE_FLAGS, "${STREAMBYTE_FLAGS}")
fi
AC_CONFIG_FILES([src/vbz/Makefile src/vbz/vbz/Makefile src/vbz/third_party/streamvbyte/Makefile])
##############################
dnl update variables in Makevars
BZIP2_F_LIB="bzip2/libH5Zbz2.so"
BLOSC_F_LIB="blosc/libH5Zblosc.so"
LZF_F_LIB="lzf/libH5Zlzf.so"
ZSTD_F_LIB="zstd/libH5Zzstd.so"
AC_SUBST(BZIP2_F_LIB)
AC_SUBST(BLOSC_F_LIB)
AC_SUBST(LZF_F_LIB)
AC_SUBST(ZSTD_F_LIB)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT