forked from grimbough/Rarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
127 lines (111 loc) · 3.57 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
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(R_CPPFLAGS, `"${R_HOME}/bin/R" CMD config --cppflags`)
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)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
## 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])
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_CONFIG_FILES([src/compression_tools/blosc/lib/blosc-1.20.1/Makefile src/compression_tools/blosc/Makefile])
AC_OUTPUT