-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.ac
216 lines (181 loc) · 6.03 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
dnl Process this file with autoconf to produce a configure script.
dnl author: Mike Smith ([email protected])
AC_PREREQ([2.65])
AC_INIT([Rarr], [0.0.0.9000], [[email protected]])
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(CXX, `"${R_HOME}/bin/R" CMD config CXX`)
AC_SUBST(CFLAGS, `"${R_HOME}/bin/R" CMD config CFLAGS`)
AC_SUBST(CXXFLAGS, `"${R_HOME}/bin/R" CMD config CXXFLAGS`)
AC_SUBST(CPICFLAGS, `"${R_HOME}/bin/R" CMD config CPICFLAGS`)
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`)
dnl 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)
R_CPPFLAGS=`"${R_HOME}/bin/R" CMD config --cppflags`
if [[ -z "$R_CPPFLAGS" ]]; then
R_CPPFLAGS=""
NO_RLIB="-DNO_RLIB"
else
NO_RLIB=""
fi
echo "NO_RLIB=${NO_RLIB}"
echo "R_CPPFLAGS=${R_CPPFLAGS}"
AC_SUBST(R_CPPFLAGS)
AC_SUBST(NO_RLIB)
AC_CONFIG_FILES([src/Makevars])
##############################
AC_ARG_WITH(bundled-libraries,,
[
bundled_libs="yes"
AC_MSG_NOTICE([Forcing the use of bundled compression libraries])
],
[
bundled_libs="no"
])
dnl we will use the bundled compression libraries if: requested OR this is the BBS
AS_IF([test "x$bundled_libs" = xyes],
[AC_MSG_NOTICE(requesting bundled libs)],
[test "${IS_BIOC_BUILD_MACHINE}" = "true"],
[AC_MSG_NOTICE(is Bioc build machine)],
[
AC_MSG_NOTICE(is NOT Bioc build machine)
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_LIB, ./compression_tools/zstd/libzstd.a)
else
AC_MSG_NOTICE(Using system Zstd library)
AC_SUBST(BUILD_ZSTD, "")
AC_SUBST(ZSTD_LIB, -lzstd)
fi
AC_SUBST(BUILD_ZSTD)
AC_SUBST(ZSTD_LIB)
##############################
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, "./compression_tools/blosc/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/compression_tools/blosc/lib/blosc-1.20.1/Makefile src/compression_tools/blosc/Makefile src/compression_tools/blosc/lib/snappy-1.1.1/Makefile])
AC_OUTPUT