@@ -13,9 +13,6 @@ PKG_CSW_NAME="libxml2_dev"
1313PKG_TEST_HEADER=" <libxml/tree.h>"
1414PKG_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
2017if [ " $INCLUDE_DIR " ] || [ " $LIB_DIR " ]; then
2118 echo " Found INCLUDE_DIR and/or LIB_DIR!"
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"
6756echo " 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
8576fi
8677
8778# Write to Makevars
0 commit comments