-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconfigure.ac
More file actions
executable file
·212 lines (192 loc) · 7.57 KB
/
configure.ac
File metadata and controls
executable file
·212 lines (192 loc) · 7.57 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
AC_INIT([ROracle], 1.5-0)
dnl find standard Instant Client installation
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
libnn=`"${R_HOME}/bin/R" CMD config LIBnn`
if test "$libnn" = "lib64" ; then
oci_client_lib="/usr/lib/oracle/11.2/client64/lib"
oci_client_inc="/usr/include/oracle/11.2/client64"
else
oci_client_lib="/usr/lib/oracle/11.2/client/lib"
oci_client_inc="/usr/include/oracle/11.2/client"
fi
dnl select library path from a configure option or from an environment
dnl variable or from a standard location.
AC_ARG_WITH([oci-lib],
AS_HELP_STRING([--with-oci-lib=OCI_LIBRARY_PATH],[the location of OCI libraries]),
[oci_library=$withval])
if test [ -n "$oci_library" ] ; then
ROCI_LIBS=${oci_library}
else
if test [ -n "${OCI_LIB}" ] ; then
ROCI_LIBS=${OCI_LIB}
else
if test [ -n "${ORACLE_HOME}" ] ; then
ROCI_LIBS="${ORACLE_HOME}/lib"
else
if test [ -d "$oci_client_lib" ] ; then
ROCI_LIBS=${oci_client_lib}
fi
fi
fi
fi
dnl If no libraries found locally, attempt download
AC_PATH_PROG([CURL], [curl])
if test [ ! -d "${ROCI_LIBS}" ] ; then
if test -n "$CURL"; then
AC_DEFINE(HAVE_CURL, 1, [Define if curl is present])
else
AC_DEFINE(HAVE_CURL, 0, [Define if curl is NOT present])
fi
AC_SUBST(CURL)
AC_DEFINE(CURL_LOCATION, "$CURL", [Path to wget if available])
if test "$CURL" != ""; then
dnl Normalize OS type
os=$(uname)
case "$os" in
aix*|AIX*) os="aix" ;;
Darwin*|darwin*|*BSD*|*bsd*) os="darwin" ;;
hpux*|HP-UX*) os="hpux" ;;
linux*|Linux*|mklinux*) os="linux" ;;
solaris*|SunOS*) os="solaris" ;;
esac
arch=`uname -m`
case "$os" in
aix)
bit_arch=$(getconf KERNEL_BITMODE)
case "$bit_arch" in
32)
downloaded_file_url="https://download.oracle.com/otn_software/aix/instantclient/instantclient-sdk-aix-ppc32.zip";
downloaded_file_name="instantclient-sdk-aix-ppc32.zip";;
*)
downloaded_file_url="https://download.oracle.com/otn_software/aix/instantclient/instantclient-sdk-aix.zip";
downloaded_file_name="instantclient-sdk-aix.zip";;
esac
;;
darwin)
case "$arch" in
arm64*)
downloaded_file_url="https://download.oracle.com/otn_software/mac/instantclient/instantclient-sdk-macos-arm64.dmg";
downloaded_file_name="instantclient-sdk-macos-arm64.dmg";;
*)
downloaded_file_url="https://download.oracle.com/otn_software/mac/instantclient/instantclient-sdk-macos.zip";
downloaded_file_name="instantclient-sdk-macos.zip";;
esac;;
hpux)
downloaded_file_url="https://download.oracle.com/otn_software/hp/instantclient/instantclient-sdk-hpia64.zip";
downloaded_file_name="instantclient-sdk-hpia64.zip";;
linux)
case "$arch" in
x86_64)
downloaded_file_url="https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip";
downloaded_file_name="instantclient-sdk-linuxx64.zip";;
*86*)
downloaded_file_url="https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linux.zip";
downloaded_file_name="instantclient-sdk-linux.zip";;
aarch64*)
downloaded_file_url="https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linux-arm64.zip";
downloaded_file_name="instantclient-sdk-linux-arm64.zip";;
ppc64le*)
downloaded_file_url="https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxleppc.zip";
downloaded_file_name="instantclient-sdk-linuxleppc.zip";;
s390*)
downloaded_file_url="https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxz64.zip";
downloaded_file_name="instantclient-sdk-linuxz64.zip";;
esac;;
solaris)
case "$arch" in
sun*)
downloaded_file_url="https://download.oracle.com/otn_software/solaris/instantclient/instantclient-sdk-solaris64.zip";
downloaded_file_name="instantclient-sdk-solaris64.zip";;
*86*)
downloaded_file_url="https://download.oracle.com/otn_software/solaris/instantclient/instantclient-sdk-solarisx64.zip";
downloaded_file_name="instantclient-sdk-solarisx64.zip";;
esac;;
*)
downloaded_file_url="https://download.oracle.com/otn_software/$(uname)/instantclient/instantclient-sdk-$(uname).zip";
downloaded_file_name="instantclient-sdk-$(uname).zip";;
esac
AC_MSG_CHECKING([downloading $downloaded_file_name])
if $CURL -O $downloaded_file_url; then
AC_MSG_RESULT([downloaded $downloaded_file_name])
else
AC_MSG_ERROR([Failed to download $downloaded_file_name])
fi
AC_MSG_CHECKING([extracting $downloaded_file_name])
case "$downloaded_file_name" in
*.zip)
AC_PATH_PROG([UNZIP], [unzip])
if $UNZIP -u "$downloaded_file_name"; then
AC_MSG_RESULT([unzipped $downloaded_file_name])
else
AC_MSG_ERROR([Failed to extract $downloaded_file_name. OCI headers required for compilation are missing.])
fi
directory=`$UNZIP -l "$downloaded_file_name" | grep -m1 'instantclient_' | awk '{print $4}' | awk -F/ '{print $1}'`
ROCI_LIBS="./$directory"
ROCI_LIBS=$(cd "$ROCI_LIBS"; pwd)
;;
*.dmg)
AC_PATH_PROG([HDIUTIL], [hdiutil])
RAND_ID=$RANDOM$$
MOUNT_POINT="/Volumes/InstantClientMount_$RAND_ID"
if $HDIUTIL attach "$downloaded_file_name" -mountpoint "$MOUNT_POINT" -nobrowse -quiet; then
AC_MSG_RESULT([mounted $downloaded_file_name at $MOUNT_POINT])
else
AC_MSG_ERROR([Failed to mount $downloaded_file_name. OCI headers required for compilation are missing.])
fi
directory=`ls "$MOUNT_POINT" | grep -m1 'instantclient_'`
ROCI_LIBS="$MOUNT_POINT/$directory"
cp -R "$ROCI_LIBS" ./ && $HDIUTIL detach "$MOUNT_POINT" -quiet
ROCI_LIBS="./$directory"
ROCI_LIBS=$(cd "$ROCI_LIBS"; pwd)
AC_MSG_RESULT([mounted and found $ROCI_LIBS]);;
esac
fi
fi
dnl select include path from a configure option or from an environment
dnl variable or from a standard location.
AC_ARG_WITH([oci-inc],
AS_HELP_STRING([--with-oci-inc=OCI_INCLUDE_PATH],[the location of OCI header files]),
[oci_include=$withval])
if test [ -n "$oci_include" ] ; then
ROCI_CPPFLAGS=${oci_include}
else
if test [ -n "${OCI_INC}" ] ; then
ROCI_CPPFLAGS=${OCI_INC}
else
if test [ -n "${ORACLE_HOME}" ] ; then
ROCI_CPPFLAGS="${ORACLE_HOME}/rdbms/public"
else
if test [ -d "$oci_client_inc" ] ; then
ROCI_CPPFLAGS=${oci_client_inc}
else
if test [ -d "${ROCI_LIBS}/sdk/include" ] ; then
ROCI_CPPFLAGS="${ROCI_LIBS}/sdk/include"
else
AC_MSG_ERROR([OCI headers not found])
fi
fi
fi
fi
fi
if test [ ! -d "${ROCI_CPPFLAGS}" ] ; then
AC_MSG_ERROR(["${ROCI_CPPFLAGS}" directory does not exist])
fi
os=$(uname)
dnl set complier flags
case "$os" in
AIX)
ROCI_LIBS="-L${ROCI_LIBS} -Wl,-blibpath:${ROCI_LIBS}";;
*)
ROCI_LIBS="-L${ROCI_LIBS} -Wl,-rpath,${ROCI_LIBS}";;
esac
ROCI_CPPFLAGS="-I${ROCI_CPPFLAGS}"
dnl substitute complier flags
AC_SUBST(ROCI_CPPFLAGS)
AC_SUBST(ROCI_LIBS)
dnl and do subsitution in the src/Makevars.in
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT