2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_oracle])
8 if test x$with_[]modname != xno; then
10 AC_MSG_CHECKING([for oci.h])
13 dnl # See if the user passed in the oracle_home_dir option and
14 dnl # use that first. If not, use $ORACLE_HOME. If that's
15 dnl # not defined, give up. There's no point in blindly
16 dnl # hunting around for Oracle - there's no standard place
17 dnl # for it. Any sane Oracle user/developer should have $ORACLE_HOME
18 dnl # defined anyways.
21 AC_TRY_COMPILE([#include <oci.h>],
27 # Look for Oracle10g "Instant Client" installed from RPM
28 if test "x$ORACLE_INCLUDE" = "x"; then
31 FR_LOCATE_DIR(oracle_include_dir,oci.h)
33 for try in /usr/include/oracle/10.1.0.3/client $oracle_include_dir; do
34 CFLAGS="$old_CFLAGS -I$try"
35 AC_TRY_COMPILE([#include <oci.h>],
37 ORACLE_INCLUDE="-I$try",
40 if test "x$ORACLE_INCLUDE" != "x"; then
41 ORACLE_LIBS="-L$/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lm"
47 # Finish Looking for Oracle10g includes installed from RPM
50 if test "x$ORACLE_INCLUDE" = "x"; then
53 FR_LOCATE_DIR(oracle_home_dir,oci.h)
55 for try in $oracle_home_dir $oracle_include_dir; do
56 CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include"
57 AC_TRY_COMPILE([#include <oci.h>],
62 if test "x$OHOME" != "x"; then
67 if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then
68 CFLAGS="$old_CFLAGS -I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${ORACLE_HOME}/network/public -I${ORACLE_HOME}/oci/include"
69 AC_TRY_COMPILE([#include <oci.h>],
78 if test "x$OHOME" != "x"; then
80 ORACLE_INCLUDE="-I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${ORACLE_HOME}/network/public -I${ORACLE_HOME}/oci/include"
82 fi ## this section sets $ORACLE_HOME, if found.
84 # not Oracle8i, try older.
85 if test "x$ORACLE_INCLUDE" = "x"; then
88 FR_LOCATE_DIR(oracle_include_dir,oci.h)
90 for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do
91 CFLAGS="$old_CFLAGS -I$try"
92 AC_TRY_COMPILE([#include <oci.h>],
94 ORACLE_INCLUDE="-I$try",
97 if test "x$ORACLE_INCLUDE" != "x"; then
104 if test "x$ORACLE_INCLUDE" = "x"; then
106 AC_MSG_WARN([oracle headers not found. Use --with-oracle-home-dir=<path>.])
109 sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}"
113 ## is this set, from above?
114 if test "x$ORACLE_HOME" != "x"; then
115 ## we must have an Oracle8i tree
117 # FIXME: we might do some checking, just to be nice
118 ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm"
121 AC_MSG_CHECKING([for oracle_init in -loracleclient])
124 dnl # Look for it in a number of directories.
128 FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.so])
129 FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.a])
131 for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do
132 LIBS="$old_LIBS -L$try -loracleclient"
133 AC_TRY_LINK([extern char oracle_init();],
135 ORACLE_LIBS="-L$try -loracleclient",
138 if test "x$ORACLE_LIBS" != "x"; then
145 dnl # If one or the other isn't found, disable
147 dnl # If both are found, enable them both.
149 if test "x$ORACLE_LIBS" = "x"; then
155 if test "x$ORACLE_LIBS" = "x"; then
156 AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=<path>.])
157 fail="$fail liboracleclient"
159 sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS"
167 echo \*\*\* module modname is disabled.
170 dnl Don't change this section.
171 if test "x$fail" != x; then
172 if test "x${enable_strict_dependencies}" = xyes; then
173 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
175 AC_MSG_WARN([silently not building ]modname[.])
176 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
181 AC_SUBST(sql_oracle_ldflags)
182 AC_SUBST(sql_oracle_cflags)