2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_oracle])
6 if test x$with_[]modname != xno; then
8 targetname=modname # we might change this later.
11 AC_SUBST(ORACLE_INCLUDE)
13 AC_MSG_CHECKING([for oci.h])
16 dnl # See if the user passed in the oracle_home_dir option and
17 dnl # use that first. If not, use $ORACLE_HOME. If that's
18 dnl # not defined, give up. There's no point in blindly
19 dnl # hunting around for Oracle - there's no standard place
20 dnl # for it. Any sane Oracle user/developer should have $ORACLE_HOME
21 dnl # defined anyways.
24 AC_TRY_COMPILE([#include <oci.h>],
31 if test "x$ORACLE_INCLUDE" = "x"; then
34 AC_LOCATE_DIR(oracle_home_dir,oci.h)
36 for try in $oracle_home_dir $oracle_include_dir; do
37 CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include"
38 AC_TRY_COMPILE([#include <oci.h>],
43 if test "x$OHOME" != "x"; then
48 if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then
49 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"
50 AC_TRY_COMPILE([#include <oci.h>],
59 if test "x$OHOME" != "x"; then
61 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"
63 fi ## this section sets $ORACLE_HOME, if found.
65 # not Oracle8i, try older.
66 if test "x$ORACLE_INCLUDE" = "x"; then
69 AC_LOCATE_DIR(oracle_include_dir,oci.h)
71 for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do
72 CFLAGS="$old_CFLAGS -I$try"
73 AC_TRY_COMPILE([#include <oci.h>],
75 ORACLE_INCLUDE="-I$try",
78 if test "x$ORACLE_INCLUDE" != "x"; then
85 if test "x$ORACLE_INCLUDE" = "x"; then
87 AC_MSG_WARN([oracle headers not found. Use --with-oracle-home-dir=<path>.])
88 targetname= # disabled module
90 sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}"
94 ## is this set, from above?
95 if test "x$ORACLE_HOME" != "x"; then
96 ## we must have an Oracle8i tree
98 # FIXME: we might do some checking, just to be nice
99 ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm"
102 AC_MSG_CHECKING([for oracle_init in -loracleclient])
105 dnl # Look for it in a number of directories.
109 AC_LOCATE_DIR(oracle_lib_dir,[oracleclient.so])
110 AC_LOCATE_DIR(oracle_lib_dir,[oracleclient.a])
112 for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do
113 LIBS="$old_LIBS -L$try -loracleclient"
114 AC_TRY_LINK([extern char oracle_init();],
116 ORACLE_LIBS="-L$try -loracleclient",
119 if test "x$ORACLE_LIBS" != "x"; then
126 dnl # If one or the other isn't found, disable
128 dnl # If both are found, enable them both.
130 if test "x$ORACLE_LIBS" = "x"; then
134 sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS"
140 if test "x$ORACLE_LIBS" != "x"; then
141 AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=<path>.])
142 targetname= # disabled module
146 if test "x$targetname" = "x"; then
147 AC_MSG_WARN([sql submodule 'oracle' disabled])
152 echo \*\*\* module modname is disabled.
155 AC_SUBST(sql_oracle_ldflags)
156 AC_SUBST(sql_oracle_cflags)