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.

47 lines
1.0 KiB

6 years ago
#!/bin/sh
6 years ago
echo "Checking to see if libmagic is available..."
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
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`
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)
${CC} ${CFLAGS} ${CPPFLAGS} ${LD_FLAGS} ${CXXFLAGS} ${DYLIB_LDFLAGS} ${SHLIB_LDFLAGS} -L/usr/local/lib -L/opt/local/lib -L/usr/lib -lmagic -o ${temp_exe} ${temp_src} > /dev/null 2>&1
6 years ago
ccerr=$?
rm ${temp_src} ${temp_exe}
if [ "$ccerr" = 1 ] ; then
6 years ago
echo
echo
echo "The libmagic library was not found."
echo
echo "Please install it before installing this package."
echo
echo
exit 1
fi
exit 0