1 AC_INIT(rlm_sql_oracle.c)
2 AC_REVISION($Revision: 1.10 $)
3 AC_DEFUN(modname,[rlm_sql_oracle])
8 if test x$with_[]modname != xno; then
10 dnl ############################################################
11 dnl # Check for command line options
12 dnl ############################################################
14 dnl extra argument: --with-oracle-include-dir=DIR
16 AC_ARG_WITH(oracle-include-dir,
17 [AS_HELP_STRING([--with-oracle-include-dir=DIR],
18 [Directory where the oracle includes may be found])],
21 AC_MSG_ERROR(Need oracle-include-dir)
26 oracle_include_dir="$withval"
30 dnl extra argument: --with-oracle-lib-dir=DIR
32 AC_ARG_WITH(oracle-lib-dir,
33 [AS_HELP_STRING([--with-oracle-lib-dir=DIR],
34 [Directory where the oracle libraries may be found])],
37 AC_MSG_ERROR(Need oracle-lib-dir)
42 oracle_lib_dir="$withval"
46 dnl extra argument: --with-oracle-dir=DIR
47 AC_ARG_WITH(oracle-dir,
48 [AS_HELP_STRING([--with-oracle-dir=DIR],
49 [Base directory where oracle is installed])],
52 AC_MSG_ERROR(Need oracle-dir)
57 oracle_lib_dir="$withval/lib"
58 oracle_include_dir="$withval/include"
62 dnl ############################################################
63 dnl # Check for header files
64 dnl ############################################################
66 smart_try_dir="$oracle_include_dir /usr/local/instaclient/include"
68 if test "x$ORACLE_HOME" != "x"; then
69 smart_try_dir+="${ORACLE_HOME}/include"
72 FR_SMART_CHECK_INCLUDE(oci.h)
73 if test "x$ac_cv_header_oci_h" != "xyes"; then
74 AC_MSG_WARN([oracle headers not found. Use --with-oracle-include-dir=<path> or set ORACLE_HOME.])
78 dnl ############################################################
79 dnl # Check for libraries
80 dnl ############################################################
84 if test "x$oracle_lib_dir" != "x" ; then
85 lib_path="${oracle_lib_dir} "
86 elif test "x$ORACLE_HOME" != "x" ; then
87 lib_path="${ORACLE_HOME}/lib "
90 for path in $lib_path "/usr/local/instaclient/lib" "" "/opt/lib"; do
91 for oracle_version in 11 10 9 ""; do
92 if test "$path" != ""; then
93 AC_MSG_CHECKING([for OCIInitialize in nnz${oracle_version} in $path])
95 AC_MSG_CHECKING([for OCIInitialize in nnz${oracle_version}])
98 LIBS="$old_LIBS -L$path -lclntsh -lnnz${oracle_version}"
99 AC_TRY_LINK([#include <oci.h>
101 static OCIEnv *p_env;
102 static OCIError *p_err;
103 static OCISvcCtx *p_svc;
104 static OCIStmt *p_sql;
105 static OCIDefine *p_dfn = (OCIDefine *) 0;
106 static OCIBind *p_bnd = (OCIBind *) 0;
115 rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */
116 (dvoid * (*)(dvoid *, size_t)) 0,
117 (dvoid * (*)(dvoid *, dvoid *, size_t))0,
118 (void (*)(dvoid *, dvoid *)) 0 );
121 [mod_ldflags="$LIBS"],
123 if test "x$mod_ldflags" != "x"; then
130 if test "x$mod_ldflags" != "x"; then
137 if test "x$mod_ldflags" = "x"; then
138 AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=<path> or set ORACLE_HOME.])
139 fail=["$fail libclntsh libnnz[9-11]"]
145 echo \*\*\* module modname is disabled.
148 dnl Don't change this section.
149 if test "x$fail" != x; then
150 if test "x${enable_strict_dependencies}" = xyes; then
151 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
153 AC_MSG_WARN([silently not building ]modname[.])
154 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
159 mod_cflags="$SMART_CPPFLAGS"
160 AC_SUBST(mod_ldflags)