summaryrefslogtreecommitdiff
path: root/m4/ax_lib_oracle_oci.m4
diff options
context:
space:
mode:
authorMateusz Loskot <mateusz@loskot.net>2007-11-30 21:28:02 +0100
committerPeter Simons <simons@cryp.to>2007-11-30 21:28:02 +0100
commitdc736a23f5ac87df0c294b8cc11eadbcac1365bc (patch)
tree2c4cb6f75894dabda249795222f8ef360f7f789a /m4/ax_lib_oracle_oci.m4
parentc9229c361edbb41eaafeda441466a7751c522b54 (diff)
downloadautoconf-archive-dc736a23f5ac87df0c294b8cc11eadbcac1365bc.tar.gz
AX_LIB_ORACLE_OCI: various improvements
Users who update from an earlier version should be aware of the fact that the result variable has been renamed from HAVE_ORACLE to HAVE_ORACLE_OCI.
Diffstat (limited to 'm4/ax_lib_oracle_oci.m4')
-rw-r--r--m4/ax_lib_oracle_oci.m4172
1 files changed, 125 insertions, 47 deletions
diff --git a/m4/ax_lib_oracle_oci.m4 b/m4/ax_lib_oracle_oci.m4
index a3bf6e2..3d81876 100644
--- a/m4/ax_lib_oracle_oci.m4
+++ b/m4/ax_lib_oracle_oci.m4
@@ -8,16 +8,23 @@
#
# This macro provides tests of availability of Oracle OCI API of
# particular version or newer. This macros checks for Oracle OCI
-# headers and libraries and defines compilation flags
+# headers and libraries and defines compilation flags.
#
# Macro supports following options and their values:
#
-# 1) Single-option usage: --with-oracle - path to ORACLE_HOME
-# directory
+# 1) Single-option usage:
+#
+# --with-oci -- path to ORACLE_HOME directory
#
# 2) Two-options usage (both options are required):
-# --with-oracle-include - path to directory with OCI headers
-# --with-oracle-lib - path to directory with OCI libraries
+#
+# --with-oci-include -- path to directory with OCI headers
+# --with-oci-lib -- path to directory with OCI libraries
+#
+# NOTE: These options described above do not take yes|no values. If
+# 'yes' value is passed, then WARNING message will be displayed, 'no'
+# value, as well as the --without-oci-* variations will cause the
+# macro to not check enything.
#
# This macro calls:
#
@@ -27,15 +34,15 @@
#
# And sets:
#
-# HAVE_ORACLE
+# HAVE_ORACLE_OCI
#
# LAST MODIFICATION
#
-# 2006-07-17
+# 2007-11-30
#
# COPYLEFT
#
-# Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
+# Copyright (c) 2007 Mateusz Loskot <mateusz@loskot.net>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
@@ -43,23 +50,41 @@
AC_DEFUN([AX_LIB_ORACLE_OCI],
[
- AC_ARG_WITH([oracle],
- AC_HELP_STRING([--with-oracle=@<:@DIR@:>@],
- [use Oracle OCI API from given path to Oracle home directory]
+ AC_ARG_WITH([oci],
+ AC_HELP_STRING([--with-oci=@<:@ARG@:>@],
+ [use Oracle OCI API from given Oracle home (ARG=path); use existing ORACLE_HOME (ARG=yes); disable Oracle OCI support (ARG=no)]
),
- [oracle_home_dir="$withval"],
- [oracle_home_dir=""]
+ [
+ if test "$withval" = "yes"; then
+ if test -n "$ORACLE_HOME"; then
+ oracle_home_dir="$ORACLE_HOME"
+ else
+ oracle_home_dir=""
+ fi
+ elif test -d "$withval"; then
+ oracle_home_dir="$withval"
+ else
+ oracle_home_dir=""
+ fi
+ ],
+ [
+ if test -n "$ORACLE_HOME"; then
+ oracle_home_dir="$ORACLE_HOME"
+ else
+ oracle_home_dir=""
+ fi
+ ]
)
- AC_ARG_WITH([oracle-include],
- AC_HELP_STRING([--with-oracle-include=@<:@DIR@:>@],
+ AC_ARG_WITH([oci-include],
+ AC_HELP_STRING([--with-oci-include=@<:@DIR@:>@],
[use Oracle OCI API headers from given path]
),
[oracle_home_include_dir="$withval"],
[oracle_home_include_dir=""]
)
- AC_ARG_WITH([oracle-lib],
- AC_HELP_STRING([--with-oracle-lib=@<:@DIR@:>@],
+ AC_ARG_WITH([oci-lib],
+ AC_HELP_STRING([--with-oci-lib=@<:@DIR@:>@],
[use Oracle OCI API libraries from given path]
),
[oracle_home_lib_dir="$withval"],
@@ -79,7 +104,14 @@ AC_DEFUN([AX_LIB_ORACLE_OCI],
if test "$oracle_home_dir" != "no" -a "$oracle_home_dir" != "yes"; then
dnl ORACLE_HOME path provided
+
+ dnl Primary path to OCI headers, available in Oracle>=10
oracle_include_dir="$oracle_home_dir/rdbms/public"
+
+ dnl Secondary path to OCI headers used by older versions
+ oracle_include_dir2="$oracle_home_dir/rdbms/demo"
+
+ dnl Library path
oracle_lib_dir="$oracle_home_dir/lib"
elif test "$oracle_home_dir" = "yes"; then
want_oracle_but_no_path="yes"
@@ -102,8 +134,8 @@ AC_DEFUN([AX_LIB_ORACLE_OCI],
if test "$want_oracle_but_no_path" = "yes"; then
AC_MSG_WARN([Oracle support is requested but no Oracle paths have been provided. \
-Please, locate Oracle directories using --with-oracle or \
---with-oracle-include and --with-oracle-lib options.])
+Please, locate Oracle directories using --with-oci or \
+--with-oci-include and --with-oci-lib options.])
fi
dnl
@@ -114,8 +146,15 @@ Please, locate Oracle directories using --with-oracle or \
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$oracle_include_dir"
+ dnl Additional path for older Oracle installations
+ if test -n "$oracle_include_dir2"; then
+ CPPFLAGS="$CPPFLAGS -I$oracle_include_dir2"
+ fi
+
+ dnl Depending on later Oracle version detection,
+ dnl -lnnz10 flag might be removed for older Oracle < 10.x
saved_LDFLAGS="$LDFLAGS"
- oci_ldflags="-L$oracle_lib_dir -lclntsh -lnnz10"
+ oci_ldflags="-L$oracle_lib_dir -lclntsh"
LDFLAGS="$LDFLAGS $oci_ldflags"
dnl
@@ -127,8 +166,13 @@ Please, locate Oracle directories using --with-oracle or \
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[@%:@include <oci.h>]],
[[
-#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
-// Everything is okay
+#if defined(OCI_MAJOR_VERSION)
+#if OCI_MAJOR_VERSION == 10 && OCI_MINOR_VERSION == 2
+// Oracle 10.2 detected
+#endif
+#elif defined(OCI_V7_SYNTAX)
+// OK, older Oracle detected
+// TODO - mloskot: find better macro to check for older versions;
#else
# error Oracle oci.h header not found
#endif
@@ -136,6 +180,11 @@ Please, locate Oracle directories using --with-oracle or \
)],
[
ORACLE_OCI_CFLAGS="-I$oracle_include_dir"
+
+ if test -n "$oracle_include_dir2"; then
+ ORACLE_OCI_CFLAGS="$ORACLE_OCI_CFLAGS -I$oracle_include_dir2"
+ fi
+
oci_header_found="yes"
AC_MSG_RESULT([yes])
],
@@ -182,25 +231,11 @@ if (envh) OCIHandleFree(envh, OCI_HTYPE_ENV);
dnl
dnl Check required version of Oracle is available
dnl
-
oracle_version_req=ifelse([$1], [], [], [$1])
- if test "$oci_header_found" = "yes" -a \
- "$oci_lib_found" = "yes" -a \
- -n "$oracle_version_req"; then
-
- AC_MSG_CHECKING([if Oracle OCI version is >= $oracle_version_req])
-
- dnl Decompose required version string of Oracle
- dnl and calculate its number representation
- oracle_version_req_major=`expr $oracle_version_req : '\([[0-9]]*\)'`
- oracle_version_req_minor=`expr $oracle_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
-
- oracle_version_req_number=`expr $oracle_version_req_major \* 1000000 \
- \+ $oracle_version_req_minor \* 1000`
+ if test "$oci_header_found" = "yes" -a "$oci_lib_found" = "yes" -a \
+ -n "$oracle_version_req"; then
- dnl Decompose version string of installed Oracle
- dnl and calculate its number representation
oracle_version_major=`cat $oracle_include_dir/oci.h \
| grep '#define.*OCI_MAJOR_VERSION.*' \
| sed -e 's/#define OCI_MAJOR_VERSION *//' \
@@ -211,20 +246,63 @@ if (envh) OCIHandleFree(envh, OCI_HTYPE_ENV);
| sed -e 's/#define OCI_MINOR_VERSION *//' \
| sed -e 's/ *\/\*.*\*\///'`
- oracle_version_number=`expr $oracle_version_major \* 1000000 \
- \+ $oracle_version_minor \* 1000`
+ AC_MSG_CHECKING([if Oracle OCI version is >= $oracle_version_req])
- oracle_version_check=`expr $oracle_version_number \>\= $oracle_version_req_number`
- if test "$oracle_version_check" = "1"; then
- AC_MSG_RESULT([yes])
+ if test -n "$oracle_version_major" -a -n $"oracle_version_minor"; then
+
+ ORACLE_OCI_VERSION="$oracle_version_major.$oracle_version_minor"
+
+ dnl Decompose required version string of Oracle
+ dnl and calculate its number representation
+ oracle_version_req_major=`expr $oracle_version_req : '\([[0-9]]*\)'`
+ oracle_version_req_minor=`expr $oracle_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+
+ oracle_version_req_number=`expr $oracle_version_req_major \* 1000000 \
+ \+ $oracle_version_req_minor \* 1000`
+
+ dnl Calculate its number representation
+ oracle_version_number=`expr $oracle_version_major \* 1000000 \
+ \+ $oracle_version_minor \* 1000`
+
+ oracle_version_check=`expr $oracle_version_number \>\= $oracle_version_req_number`
+ if test "$oracle_version_check" = "1"; then
+
+ oracle_version_checked="yes"
+ AC_MSG_RESULT([yes])
+
+ dnl Add -lnnz10 flag to Oracle >= 10.x
+ AC_MSG_CHECKING([for Oracle version >= 10.x to use -lnnz10 flag])
+ oracle_nnz10_check=`expr $oracle_version_number \>\= 10 \* 1000000`
+ if test "$oracle_nnz10_check" = "1"; then
+ ORACLE_OCI_LDFLAGS="$ORACLE_OCI_LDFLAGS -lnnz10"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ else
+ oracle_version_checked="no"
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Oracle $ORACLE_OCI_VERSION found, but required version is $oracle_version_req])
+ fi
else
+ ORACLE_OCI_VERSION="UNKNOWN"
AC_MSG_RESULT([no])
+ AC_MSG_WARN([Oracle version unknown, probably OCI older than 10.2 is available])
fi
+ fi
+
+ AC_MSG_CHECKING([if Oracle support is enabled])
+
+ if test "$oci_header_found" = "yes" -a "$oci_lib_found" = "yes"; then
+
+ AC_SUBST([ORACLE_OCI_VERSION])
+ AC_SUBST([ORACLE_OCI_CFLAGS])
+ AC_SUBST([ORACLE_OCI_LDFLAGS])
- ORACLE_OCI_VERSION="$oracle_version_major.$oracle_version_minor"
+ HAVE_ORACLE_OCI="yes"
+ else
+ HAVE_ORACLE_OCI="no"
fi
- AC_SUBST([ORACLE_OCI_VERSION])
- AC_SUBST([ORACLE_OCI_CFLAGS])
- AC_SUBST([ORACLE_OCI_LDFLAGS])
+ AC_MSG_RESULT([$HAVE_ORACLE_OCI])
])