2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_oracle])
6 if test x$with_[]modname != xno; then
11 targetname=modname # we might change this later.
14 AC_SUBST(ORACLE_INCLUDE)
16 AC_MSG_CHECKING([for oci.h])
19 dnl # See if the user passed in the oracle_home_dir option and
20 dnl # use that first. If not, use $ORACLE_HOME. If that's
21 dnl # not defined, give up. There's no point in blindly
22 dnl # hunting around for Oracle - there's no standard place
23 dnl # for it. Any sane Oracle user/developer should have $ORACLE_HOME
24 dnl # defined anyways.
27 AC_TRY_COMPILE([#include <oci.h>],
34 if test "x$ORACLE_INCLUDE" = "x"; then
37 FR_LOCATE_DIR(oracle_home_dir,oci.h)
39 for try in $oracle_home_dir $oracle_include_dir; do
40 CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include"
41 AC_TRY_COMPILE([#include <oci.h>],
46 if test "x$OHOME" != "x"; then
51 if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then
52 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"
53 AC_TRY_COMPILE([#include <oci.h>],
62 if test "x$OHOME" != "x"; then
64 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"
66 fi ## this section sets $ORACLE_HOME, if found.
68 # not Oracle8i, try older.
69 if test "x$ORACLE_INCLUDE" = "x"; then
72 FR_LOCATE_DIR(oracle_include_dir,oci.h)
74 for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do
75 CFLAGS="$old_CFLAGS -I$try"
76 AC_TRY_COMPILE([#include <oci.h>],
78 ORACLE_INCLUDE="-I$try",
81 if test "x$ORACLE_INCLUDE" != "x"; then
88 if test "x$ORACLE_INCLUDE" = "x"; then
90 AC_MSG_WARN([oracle headers not found. Use --with-oracle-home-dir=<path>.])
91 targetname= # disabled module
93 sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}"
97 ## is this set, from above?
98 if test "x$ORACLE_HOME" != "x"; then
99 ## we must have an Oracle8i tree
101 # FIXME: we might do some checking, just to be nice
102 ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm"
105 AC_MSG_CHECKING([for oracle_init in -loracleclient])
108 dnl # Look for it in a number of directories.
112 FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.so])
113 FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.a])
115 for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do
116 LIBS="$old_LIBS -L$try -loracleclient"
117 AC_TRY_LINK([extern char oracle_init();],
119 ORACLE_LIBS="-L$try -loracleclient",
122 if test "x$ORACLE_LIBS" != "x"; then
129 dnl # If one or the other isn't found, disable
131 dnl # If both are found, enable them both.
133 if test "x$ORACLE_LIBS" = "x"; then
139 if test "x$ORACLE_LIBS" = "x"; then
140 AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=<path>.])
141 targetname= # disabled module
143 sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS"
148 if test "x$targetname" = "x"; then
149 AC_MSG_WARN([sql submodule 'oracle' disabled])
154 echo \*\*\* module modname is disabled.
157 AC_SUBST(sql_oracle_ldflags)
158 AC_SUBST(sql_oracle_cflags)