-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure
executable file
·122 lines (104 loc) · 3.25 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
## 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"
SYMPHONY_CPPFLAGS=`pkg-config --cflags SYMPHONY >/dev/null 2>&1`
SYMPHONY_LIBS=`pkg-config --libs SYMPHONY >/dev/null 2>&1`
test -z "${SYMPHONY_LIBS}" && SYMPHONY_LIBS="-lSym -lCgl -lOsiClp -lClp -lOsi -lCoinUtils"
## Test whether we can compile and link a minimal program.
rm -f conftest.*
cat << EOF > conftest.cc
#include <coin/symphony.h>
extern "C"
int
main ()
{
sym_environment *env = sym_open_environment();
sym_close_environment(env);
return 0;
}
EOF
_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_=false
${R} CMD SHLIB conftest.cc ${SYMPHONY_CPPFLAGS} ${SYMPHONY_LIBS} >/dev/null 2>&1
status=${?}
rm -f conftest.*
if test ${status} -eq 0; then
SYMPHONY_INCLUDE_PATH=
SYMPHONY_LIB_PATH=
SYMPHONY_TS=
else
# if Mac OS X need to specify C compiler
if [[ "$OSTYPE" == "darwin"* ]]; then
cat << EOF > test.c
#include <omp.h>
#include <stdio.h>
int main() {
printf("Hey");
return 0;
}
EOF
# first test the default gcc used by R
`R CMD config CC` -lgomp test.c -o test >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo -e "* Using the default compiler"
CC="`R CMD config CC`"
CXX="`R CMD config CXX`"
OMP_FLAG="--enable-openmp"
# if there is no brew gcc installed try to compile with clang
else
echo -e "* Defaulting to clang/clang++"
CC="`${R} CMD config CC`"
CXX="`${R} CMD config CXX`"
if [ -z "$OMP_FLAG" ]; then
OMP_FLAG="--disable-openmp"
fi
fi
rm -f test.*
(cd src/SYMPHONY && \
./configure \
CC="$CC" CXX="$CXX" \
CFLAGS="-w -g -O2" \
CXXFLAGS="-w -g -O2" \
--enable-static --disable-shared --with-pic \
--with-application=no --disable-dependency-tracking \
--disable-zlib --disable-bzlib "${OMP_FLAG}" \
--disable-cplex-libcheck --disable-glpk-libcheck \
--disable-osl-libcheck --disable-soplex-libcheck \
--disable-xpress-libcheck)
SYMPHONY_LIBS="-lSym -lCgl -lOsiClp -lClp -lOsi -lCoinUtils"
SYMPHONY_INCLUDE_PATH="-ISYMPHONY/include"
SYMPHONY_LIB_PATH="-LSYMPHONY/lib"
SYMPHONY_TS="SYMPHONY.ts"
# for other (Unix) systems use
else
(cd src/SYMPHONY && \
./configure \
--enable-static --disable-shared --with-pic \
--with-application=no --disable-dependency-tracking \
--disable-zlib --disable-bzlib \
--disable-cplex-libcheck --disable-glpk-libcheck \
--disable-osl-libcheck --disable-soplex-libcheck \
--disable-xpress-libcheck \
CFLAGS="-w -g -O2" \
CXXFLAGS="-w -g -O2" \
CC="`${R} CMD config CC`" \
#CPP="`${R} CMD config CPP`" \
CXX="`${R} CMD config CXX`" \
#CXXCPP="`${R} CMD config CXXCPP`" \
F77="`${R} CMD config FC`" \
FLIBS="`${R} CMD config FLIBS`")
SYMPHONY_LIBS="-lSym -lCgl -lOsiClp -lClp -lOsi -lCoinUtils"
SYMPHONY_INCLUDE_PATH="-ISYMPHONY/include"
SYMPHONY_LIB_PATH="-LSYMPHONY/lib"
SYMPHONY_TS="SYMPHONY.ts"
fi
fi
sed -e "s|@SYMPHONY_LIBS@|${SYMPHONY_LIBS}|" \
-e "s|@SYMPHONY_INCLUDE_PATH@|${SYMPHONY_INCLUDE_PATH}|" \
-e "s|@SYMPHONY_LIB_PATH@|${SYMPHONY_LIB_PATH}|" \
-e "s|@SYMPHONY_TS@|${SYMPHONY_TS}|" \
src/Makevars.in > src/Makevars