-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·43 lines (34 loc) · 1.48 KB
/
configure
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
#!/bin/bash
# Example
# R CMD INSTALL ./ --configure-vars='ARROW_INCLUDE_DIR=/usr/local/include ARROW_LIB_DIR=/usr/local/lib/ PYTHON_INCLUDE_DIR=/usr/include/python2.7 PYTHON_LIB_DIR=/usr/lib'
PKG_TEST_HEADER="<arrow/api.h>"
PKG_LIBS="-larrow -larrow_python -lpython2.7"
if [ "$ARROW_INCLUDE_DIR" ] || [ "$ARROW_LIB_DIR" ] || [ "$PYTHON_INCLUDE_DIR" ] || [ "$PYTHON_LIB_DIR" ]; then
echo "Found INCLUDE_DIR and/or LIB_DIR!"
PKG_CFLAGS="-I$ARROW_INCLUDE_DIR -I$PYTHON_INCLUDE_DIR $PKG_CFLAGS"
PKG_LIBS="-L$ARROW_LIB_DIR -L$PYTHON_LIB_DIR $PKG_LIBS"
elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then
echo "Found pkg-config cflags and libs!"
PKG_CFLAGS=${PKGCONFIG_CFLAGS}
PKG_LIBS=${PKGCONFIG_LIBS}
fi
# For debugging
echo "PKG_CFLAGS=$PKG_CFLAGS"
echo "PKG_LIBS=$PKG_LIBS"
# Find compiler
CXXCPP=$("${R_HOME}"/bin/R CMD config CXXCPP)
CXX11FLAGS=$("${R_HOME}"/bin/R CMD config CXX11FLAGS)
CXX11STD=$("${R_HOME}"/bin/R CMD config CXX11STD)
CPPFLAGS=$("${R_HOME}"/bin/R CMD config CPPFLAGS)
# Test if we can load arrow
echo "#include $PKG_TEST_HEADER" | ${CXXCPP} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX11FLAGS} ${CXX11STD} -xc++ - >/dev/null 2>&1
# If we can't load PKG_TEST_HEADER, then fail
if [ $? -ne 0 ]; then
echo "------------------------- ANTICONF ERROR ---------------------------"
echo "Configuration failed"
exit 1;
fi
# Write to Makevars
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" -e "s|@visibility@|$C_VISIBILITY|" src/Makevars.in > src/Makevars
# Success
exit 0