-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
executable file
·102 lines (75 loc) · 2.56 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
#! /usr/bin/env sh
# Check that this is not just ./configure. We need to run this
# from R CMD INSTALL, to have the R env vars set.
if [ -z "$R_HOME" ]; then
echo >&2 R_HOME is not set, are you running R CMD INSTALL?
exit 1
fi
# Find the R binary we need to use. This is a bit trickier on
# Windows, because it has two architectures. On windows R_ARCH_BIN
# is set, so this should work everywhere.
RBIN="${R_HOME}/bin${R_ARCH_BIN}/R"
# ------------------------------------------------------------------------
# Detect system
# ------------------------------------------------------------------------
unset POSIX
if [ "$R_OSTYPE" = "unix" ]; then
UNAME=`uname`
else
UNAME=Windows
fi
if [ -n "$EMSCRIPTEN" ] && [ -n "$CROSS_COMPILE" ]; then
UNAME=Emscripten
fi
unset WINDOWS
if [ "$R_OSTYPE" = "windows" ]; then WINDOWS=true; fi
unset LINUX
if [ "$UNAME" = "Linux" ]; then LINUX=true; POSIX=true; fi
unset MACOS
if [ "$UNAME" = "Darwin" ]; then MACOS=true; POSIX=true; fi
unset FREEBSD
if [ "$UNAME" = "FreeBSD" ]; then FREEBSD=true; POSIX=true; fi
unset OPENBSD
if [ "$UNAME" = "OpenBSD" ]; then OPENBSD=true; POSIX=true; fi
unset NETBSD
## if [ "$UNAME" = "NetBSD" ]; then NETBSD=true; POSIX=true; fi
unset DRAGONFLY
if [ "$UNAME" = "DragonFly" ]; then DRAGONFLY=true; POSIX=true; fi
unset BSD
if [ -n "$FREEBSD" ] || [ -n "$OPENBSD" ] || [ -n "$NETBSD" ] || [ -n "$DRAGONFLY" ]; then
BSD=true
fi
unset SUNOS
## if [ "UNAME" = "SunOS" ]; then SUNOS=true; POSIX=true; fi
unset AIX
## if [ "UNAME" = "AIX" ]; then AIX=true; POSIX=true; fi
# ------------------------------------------------------------------------
# Set source files, macros, libs, compile flags
# ------------------------------------------------------------------------
CPPFLAGS=
if [ -n "$WINDOWS" ]; then
LIBRARIES=
elif [ -n "$FREEBSD" ]; then
LIBRARIES=
elif [ -n "$DRAGONFLY" ]; then
LIBRARIES=
elif [ -n "$OPENBSD" ]; then
LIBRARIES=bind
LIBDIRS=-L/usr/local/lib/libbind
CPPFLAGS=-I/usr/local/include/bind
else
LIBRARIES=resolv
fi
# ------------------------------------------------------------------------
# Create Makevars file
# ------------------------------------------------------------------------
# OBJECTS (= source files)
# LIBRARIES -> PKG_LIBS
LIBS=`for l in $LIBRARIES; do echo "-l${l}"; done | tr "\n", " "`
LIBS="$LIBDIRS ${LIBS} $FRAMEWORKS"
cat src/Makevars.in | \
sed "s|@OBJECTS@|${OBJECTS}|" | \
sed "s|@LIBS@|${LIBS}|" | \
sed "s|@TARGETS@|${TARGETS}|" | \
sed "s|@CPPFLAGS@|${CPPFLAGS}|" | \
sed "s|@EXTRA@|${EXTRA}|" > src/Makevars