Skip to content

Commit

Permalink
add test compile
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Oct 10, 2024
1 parent 2ac354c commit 2c49d34
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PKG_CONFIG_NAME="openssl"
PKG_DEB_NAME="libssl-dev"
PKG_RPM_NAME="openssl-devel"
PKG_BREW_NAME="openssl"
PKG_TEST_FILE="tools/test_openssl.c"
PKG_LIBS="-lssl -lcrypto"
PKG_CFLAGS=""

Expand Down Expand Up @@ -41,10 +40,10 @@ CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS`
CPPFLAGS=`${R_HOME}/bin/R CMD config CPPFLAGS`

# For debugging
echo "Testing compiler using PKG_CFLAGS=$PKG_CFLAGS"
echo "Testing compiler OpenSSL configuration using PKG_CFLAGS=$PKG_CFLAGS"

# Test configuration
${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E ${PKG_TEST_FILE} >/dev/null 2>configure.log
${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E tools/test_openssl.c >/dev/null 2>configure.log

# Customize the error
if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -105,6 +104,22 @@ else
PKG_LIBS="${PKGCONFIG_LIBS} ${PKG_LIBS}"
fi

# Check compile of test file
CXX17="`${R_HOME}/bin/R CMD config CXX17`"
CXX17FLAGS=`"${R_HOME}"/bin/R CMD config CXX17FLAGS`
CXX17STD=`"${R_HOME}"/bin/R CMD config CXX17STD`

echo "Testing Abseil configuration using PKG_CFLAGS=${PKG_CFLAGS}"

${CXX17} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX17FLAGS} ${CXX17STD} -E tools/test_absl.cc >/dev/null 2>>configure.log
if [ $? -ne 0 ]; then
echo "Test compile failed!"
echo "------- Error ---------"
cat configure.log
echo "-----------------------"
exit 1
fi

# From apache/arrow/r/configure:
# If on Raspberry Pi, need to manually link against latomic
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 for similar example
Expand Down

0 comments on commit 2c49d34

Please sign in to comment.