2 AC_REVISION($Revision: 1.10 $)
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 dnl ############################################################
22 dnl # Check for command line options
23 dnl ############################################################
25 dnl extra argument: --with-oracle-include-dir=DIR
27 AC_ARG_WITH(oracle-include-dir,
28 [AS_HELP_STRING([--with-oracle-include-dir=DIR],
29 [Directory where the Oracle includes may be found. It should be located under ORACLE_HOME if you have client SDK installed. Use --with-oracle-include-dir=yes if you are sure that your compiler include path includes Oracle include dir. Hint: you might try to do: locate oci.h])],
32 AC_MSG_ERROR(Need oracle-include-dir)
37 oracle_include_dir="$withval"
41 dnl extra argument: --with-oracle-lib-dir=DIR
43 AC_ARG_WITH(oracle-lib-dir,
44 [AS_HELP_STRING([--with-oracle-lib-dir=DIR],
45 [Directory where the oracle libraries may be found. It should be located under ORACLE_HOME. iUse --with-oracle-lib-dir=yes if you are sure that your linker will find the necessary Oracle client libs. Hint: you might try to do: locate libclntsh.so])],
48 AC_MSG_ERROR(Need oracle-lib-dir)
53 oracle_lib_dir="$withval"
59 AC_TRY_COMPILE([#include <oci.h>],
65 RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST=
66 if test "x$ORACLE_INCLUDE" = "x" ; then
68 CFLAGS="$old_CFLAGS -I$oracle_include_dir"
69 AC_TRY_COMPILE([#include <oci.h>],
71 ORACLE_INCLUDE="-I$oracle_include_dir",
75 RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST="$CFLAGS"
79 # Proceed to linking makes only sense if include dir is OK.
80 if test "x$ORACLE_INCLUDE" != "x" ; then
83 CFLAGS="$RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST"
86 if test "x$oracle_lib_dir" != "x" ; then
87 ORACLE_LIBDIR_SWITCH="-L${oracle_lib_dir} "
89 for oracle_version in 10 11 9 ""; do
90 LIBS="$old_LIBS $ORACLE_LIBDIR_SWITCH -lclntsh -lnnz${oracle_version}"
91 AC_TRY_LINK([#include <oci.h>
94 static OCIError *p_err;
95 static OCISvcCtx *p_svc;
96 static OCIStmt *p_sql;
97 static OCIDefine *p_dfn = (OCIDefine *) 0;
98 static OCIBind *p_bnd = (OCIBind *) 0;
107 rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */
108 (dvoid * (*)(dvoid *, size_t)) 0,
109 (dvoid * (*)(dvoid *, dvoid *, size_t))0,
110 (void (*)(dvoid *, dvoid *)) 0 );
113 ORACLE_LIBS="$ORACLE_LIBDIR_SWITCH -lclntsh -lnnz${oracle_version}",
116 if test "x$ORACLE_LIBS" != "x"; then
126 if test "x$ORACLE_INCLUDE" = "x"; then
128 AC_MSG_WARN([oracle headers not found. Use --with-oracle-include-dir=<path>.])
131 sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}"
135 if test "x$ORACLE_LIBS" = "x"; then
136 AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=<path>.])
137 fail="$fail libclntsh libnnz${oracle_version}"
139 sql_oracle_ldflags="${sql_oracle_ldflags} $ORACLE_LIBS"
147 echo \*\*\* module modname is disabled.
150 dnl Don't change this section.
151 if test "x$fail" != x; then
152 if test "x${enable_strict_dependencies}" = xyes; then
153 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
155 AC_MSG_WARN([silently not building ]modname[.])
156 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
161 AC_SUBST(sql_oracle_ldflags)
162 AC_SUBST(sql_oracle_cflags)