Skip to content

Commit 04dacdd

Browse files
committed
Cleanup configure a bit
1 parent 9c3fc65 commit 04dacdd

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ windows
2424
\.so$
2525
^CRAN-SUBMISSION$
2626
^README\.Rmd$
27+
^configure.log$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ TODO.md
1212
windows
1313
docs/
1414
Makefile
15+
configure.log

cleanup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
rm -f src/Makevars
2+
rm -f src/Makevars configure.log

configure

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ PKG_CSW_NAME="libxml2_dev"
1313
PKG_TEST_HEADER="<libxml/tree.h>"
1414
PKG_LIBS="-lxml2"
1515

16-
OS_TYPE=`uname -s`
17-
OS_VERSION=`uname -r | cut -d '.' -f 1`
18-
1916
# Note that cflags may be empty in case of success
2017
if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then
2118
echo "Found INCLUDE_DIR and/or LIB_DIR!"
@@ -28,17 +25,9 @@ else
2825
PKGCONFIG_CFLAGS=`xml2-config --cflags`
2926
PKGCONFIG_LIBS=`xml2-config --libs`
3027

31-
# MacOS versions El Capitan and later ship a xml2-config which appends `xcrun
32-
# --show-sdk-path` to the xml2-config. So we remove it if it is present.
33-
# (https://stat.ethz.ch/pipermail/r-sig-mac/2016-September/012046.html)
34-
if [ "$OS_TYPE" = "Darwin" ] && [ "$OS_VERSION" -gt "13" ] && [ "$OS_VERSION" -lt "17" ]; then
35-
PKGCONFIG_CFLAGS=`echo $PKGCONFIG_CFLAGS | perl -pe "s{\Q\`xcrun -show-sdk-path\`\E}{}"`
36-
PKGCONFIG_LIBS=`echo $PKGCONFIG_LIBS | perl -pe "s{\Q\`xcrun -show-sdk-path\`\E}{}"`
37-
fi
38-
3928
# Fix a missing libxml2 directory on the requested include directory
4029
# https://github.com/r-lib/xml2/issues/296
41-
if [ "${OS_TYPE}" = "Darwin" ] && echo "${PKGCONFIG_CFLAGS}" | grep -sq "/usr/include$"; then
30+
if [ `uname` = "Darwin" ] && echo "${PKGCONFIG_CFLAGS}" | grep -sq "/usr/include$"; then
4231
PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS/libxml2"
4332
fi
4433

@@ -67,10 +56,10 @@ echo "Using PKG_CFLAGS=$PKG_CFLAGS"
6756
echo "Using PKG_LIBS=$PKG_LIBS"
6857

6958
# Test configuration
70-
echo "#include $PKG_TEST_HEADER" | ${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E -xc - >/dev/null 2>&1 || R_CONFIG_ERROR=1;
59+
echo "#include $PKG_TEST_HEADER" | ${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E -xc - >/dev/null 2>configure.log
7160

7261
# Customize the error
73-
if [ $R_CONFIG_ERROR ]; then
62+
if [ $? -ne 0 ]; then
7463
echo "------------------------- ANTICONF ERROR ---------------------------"
7564
echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:"
7665
echo " * deb: $PKG_DEB_NAME (Debian, Ubuntu, etc)"
@@ -80,8 +69,10 @@ if [ $R_CONFIG_ERROR ]; then
8069
echo "PATH and PKG_CONFIG_PATH contains a $PKG_CONFIG_NAME.pc file. If pkg-config"
8170
echo "is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:"
8271
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'"
72+
echo "-------------------------- [ERROR MESSAGE] ---------------------------"
73+
cat configure.log
8374
echo "--------------------------------------------------------------------"
84-
exit 1;
75+
exit 1
8576
fi
8677

8778
# Write to Makevars

0 commit comments

Comments
 (0)