-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.m4
164 lines (140 loc) · 5.54 KB
/
config.m4
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
if test -z "$SED"; then
PHP_PDO_OCI_SED="sed";
else
PHP_PDO_OCI_SED="$SED";
fi
PHP_PDO_OCI_TAIL1=`echo a | tail -n1 2>/dev/null`
if test "$PHP_PDO_OCI_TAIL1" = "a"; then
PHP_PDO_OCI_TAIL1="tail -n1"
else
PHP_PDO_OCI_TAIL1="tail -1"
fi
AC_DEFUN([AC_PDO_OCI_VERSION],[
AC_MSG_CHECKING([Oracle version])
PDO_OCI_LCS_BASE=$PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME
dnl Oracle 10g, 11g, 12c etc
PDO_OCI_LCS=`ls $PDO_OCI_LCS_BASE.*.1 2> /dev/null | $PHP_PDO_OCI_TAIL1`
if test -f "$PDO_OCI_LCS"; then
dnl Oracle 10g, 11g 12c etc. The x.2 version libraries are named x.1 for
dnl drop in compatibility
PDO_OCI_VERSION=`echo $PDO_OCI_LCS | $PHP_PDO_OCI_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
else
AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found or its version is lower than 10g)
fi
AC_MSG_RESULT($PDO_OCI_VERSION)
])
AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
AC_CHECK_SIZEOF([long])
AC_MSG_CHECKING([if we're at 64-bit platform])
AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
AC_MSG_RESULT([no])
TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
],[
AC_MSG_RESULT([yes])
TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib"
])
AC_MSG_CHECKING([OCI8 libraries dir])
if test -d "$PDO_OCI_DIR/lib" && test ! -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib"
elif test ! -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
elif test -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR=$TMP_PDO_OCI_LIB_DIR
else
AC_MSG_ERROR([Oracle required OCI8 libraries not found])
fi
AC_MSG_RESULT($PDO_OCI_LIB_DIR)
])
PHP_ARG_WITH([pdo-oci],
[Oracle OCI support for PDO],
[AS_HELP_STRING([[--with-pdo-oci[=DIR]]],
[PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME. Use
--with-pdo-oci=instantclient,/path/to/instant/client/lib for an Oracle
Instant Client installation.])])
if test "$PHP_PDO_OCI" != "no"; then
if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
fi
AC_MSG_CHECKING([Oracle Install-Dir])
if test "$PHP_PDO_OCI" = "yes" || test -z "$PHP_PDO_OCI"; then
PDO_OCI_DIR=$ORACLE_HOME
else
PDO_OCI_DIR=$PHP_PDO_OCI
fi
AC_MSG_RESULT($PHP_PDO_OCI)
AC_MSG_CHECKING([if that is sane])
if test -z "$PDO_OCI_DIR"; then
AC_MSG_ERROR([You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.])
else
AC_MSG_RESULT([yes])
fi
if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then
AC_CHECK_SIZEOF([long])
AC_MSG_CHECKING([if we're at 64-bit platform])
AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
AC_MSG_RESULT([no])
PDO_OCI_CLIENT_DIR="client"
],[
AC_MSG_RESULT([yes])
PDO_OCI_CLIENT_DIR="client64"
])
PDO_OCI_LIB_DIR="`echo $PDO_OCI_DIR | cut -d, -f2`"
AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR)
AC_MSG_CHECKING([for oci.h])
dnl Header directory for Instant Client SDK RPM install
OCISDKRPMINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib/oracle/\(.*\)/\('${PDO_OCI_CLIENT_DIR}'\)/lib[/]*$!\1/include/oracle/\2/\3!'`
dnl Header directory for manual installation
OCISDKMANINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib[/]*$!\1/include!'`
dnl Header directory for Instant Client SDK zip file install
OCISDKZIPINC=$PDO_OCI_LIB_DIR/sdk/include
if test -f "$OCISDKRPMINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKRPMINC)
AC_MSG_RESULT($OCISDKRPMINC)
elif test -f "$OCISDKMANINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKMANINC)
AC_MSG_RESULT($OCISDKMANINC)
elif test -f "$OCISDKZIPINC/oci.h" ; then
PHP_ADD_INCLUDE($OCISDKZIPINC)
AC_MSG_RESULT($OCISDKZIPINC)
else
AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your Instant Client install])
fi
else
AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)
if test -d "$PDO_OCI_DIR/rdbms/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/public"
fi
if test -d "$PDO_OCI_DIR/rdbms/demo"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/demo)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/demo"
fi
if test -d "$PDO_OCI_DIR/network/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/network/public)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/network/public"
fi
if test -d "$PDO_OCI_DIR/plsql/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/plsql/public)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/plsql/public"
fi
if test -d "$PDO_OCI_DIR/include"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/include)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/include"
fi
if test -f "$PDO_OCI_LIB_DIR/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $PDO_OCI_LIB_DIR/sysliblist`, PDO_OCI_SYSLIB)
elif test -f "$PDO_OCI_DIR/rdbms/lib/sysliblist"; then
PHP_EVAL_LIBLINE(`cat $PDO_OCI_DIR/rdbms/lib/sysliblist`, PDO_OCI_SYSLIB)
fi
AC_PDO_OCI_VERSION($PDO_OCI_LIB_DIR)
fi
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
PHP_ADD_LIBPATH($PDO_OCI_LIB_DIR, PDO_OCI_SHARED_LIBADD)
PHP_CHECK_PDO_INCLUDES
PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_cv_inc_path)
PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD)
PHP_SUBST_OLD(PDO_OCI_DIR)
PHP_SUBST_OLD(PDO_OCI_VERSION)
PHP_ADD_EXTENSION_DEP(pdo_oci, pdo)
AC_DEFINE_UNQUOTED(PHP_PDO_OCI_CLIENT_VERSION, "$PDO_OCI_VERSION", [ ])
fi