You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 lines
1.6 KiB

#!/bin/sh
echo "Checking to see if libmagic is available..."
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo
echo "could not determine R_HOME"
echo
exit 1
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
DYLIB_LDFLAGS=`"${R_HOME}/bin/R" CMD config DYLIB_LDFLAGS`
SHLIB_LDFLAGS=`"${R_HOME}/bin/R" CMD config SHLIB_LDFLAGS`
LIBDIRS="/usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu /usr/lib64 /usr/lib32 /usr/local/lib /opt/local/lib /usr/lib /lib"
PKG_LD_FLAGS=""
for DIR in ${LIBDIRS} ; do
if test -d ${DIR} ; then PKG_LD_FLAGS="${PKG_LD_FLAGS} -L$DIR" ; fi
done
INCDIRS="/usr/include/x86_64-linux-gnu /usr/include/i386-linux-gnu /usr/include /usr/local/include /opt/local/include"
PKG_CPP_FLAGS=""
for DIR in ${INCDIRS} ; do
if test -d ${DIR} ; then PKG_CPP_FLAGS="${PKG_CPP_FLAGS} -L$DIR" ; fi
done
temp_src=$(mktemp)
cat > ${temp_src} <<EOF
#include "src/magic.h"
int main() {
magic_t t = magic_open(MAGIC_NONE);
return(0)
}
EOF
temp_exe=$(mktemp)
${CPP} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} ${PKG_CPP_FLAGS} ${PKG_LD_FLAGS} -o ${temp_exe} -lmagic ${temp_src} > /dev/null 2>&1
ccerr=$?
rm ${temp_src} ${temp_exe}
if [ "$ccerr" = 1 ] ; then
echo
echo
echo "The libmagic library was not found."
echo
echo "Please install it before installing this package."
echo
echo
exit 1
fi
sed -e "s|@cflags@|$PKG_CPP_FLAGS|" -e "s|@libs@|$PKG_LD_FLAGS|" src/Makevars.in > src/Makevars
exit 0