forked from bernhard-da/sdcTable
-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure
executable file
·47 lines (39 loc) · 1.04 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh
## For the time being, this is a simple shell script ...
## Test whether a complete GLPK library environment is available,
## e.g. ftp://ftp.gnu.org/gnu/glpk/
## Find the R home directory.
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "Could not determine R_HOME."
exit 1
fi
R="${R_HOME}/bin/R"
GLPK_LIBS="-lglpk"
## Test whether we can compile and link a minimal program.
rm -f conftest.*
cat > conftest.cc <<EOF
#include <glpk.h>
int main ()
{
glp_prob *lp;
lp = glp_create_prob();
glp_delete_prob(lp);
return 0;
}
EOF
_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_=false \
"${R}" CMD SHLIB conftest.cc ${GLPK_LIBS} >/dev/null 2>&1 \
&& "$R" --slave --vanilla -e 'dyn.load("conftest.so")'
status=${?}
if test ${status} -eq 0; then
rm -f conftest.*o
GLPK_LIBS="-lglpk -lgmp -lm"
_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_=false \
"${R}" CMD SHLIB conftest.cc ${GLPK_LIBS} >/dev/null 2>&1 \
&& "$R" --slave --vanilla -e 'dyn.load("conftest.so")'
else
echo "GLPK is not available"
exit 1
fi
rm -f conftest.*