From 9055d46dca6999d3084334b06c7a0dc5831b9909 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Thu, 29 Jul 2010 14:03:31 +0200 Subject: [PATCH] Update Oracle Autoconf scripts. Closes bug #57 --- .../rlm_sql/drivers/rlm_sql_oracle/configure | 460 +++++---------------- .../rlm_sql/drivers/rlm_sql_oracle/configure.in | 205 ++++----- 2 files changed, 200 insertions(+), 465 deletions(-) diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure index 38b4b94..3839a9c 100755 --- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure +++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision. +# From configure.in Revision: 1.10 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # @@ -1201,6 +1201,23 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-oracle-include-dir=DIR + 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 + --with-oracle-lib-dir=DIR + 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 + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1644,6 +1661,47 @@ if test x$with_rlm_sql_oracle != xno; then echo $ECHO_N "checking for oci.h... $ECHO_C" >&6; } + + oracle_include_dir= + +# Check whether --with-oracle-include-dir was given. +if test "${with_oracle_include_dir+set}" = set; then + withval=$with_oracle_include_dir; case "$withval" in + no) + { { echo "$as_me:$LINENO: error: Need oracle-include-dir" >&5 +echo "$as_me: error: Need oracle-include-dir" >&2;} + { (exit 1); exit 1; }; } + ;; + yes) + ;; + *) + oracle_include_dir="$withval" + ;; + esac +fi + + + oracle_lib_dir= + +# Check whether --with-oracle-lib-dir was given. +if test "${with_oracle_lib_dir+set}" = set; then + withval=$with_oracle_lib_dir; case "$withval" in + no) + { { echo "$as_me:$LINENO: error: Need oracle-lib-dir" >&5 +echo "$as_me: error: Need oracle-lib-dir" >&2;} + { (exit 1); exit 1; }; } + ;; + yes) + ;; + *) + oracle_lib_dir="$withval" + ;; + esac +fi + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2607,41 +2665,11 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # Look for Oracle10g "Instant Client" installed from RPM - if test "x$ORACLE_INCLUDE" = "x"; then - old_CFLAGS="$CFLAGS" - - - -if test "x$LOCATE" != "x"; then - DIRS= - file=oci.h - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$oracle_include_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done -fi - -eval "oracle_include_dir=\"\$oracle_include_dir $DIRS\"" - - - for try in /usr/include/oracle/10.1.0.3/client $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I$try" - cat >conftest.$ac_ext <<_ACEOF + RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST= + if test "x$ORACLE_INCLUDE" = "x" ; then + old_CFLAGS="$CFLAGS" + CFLAGS="$old_CFLAGS -I$oracle_include_dir" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2673,7 +2701,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ORACLE_INCLUDE="-I$try" + ORACLE_INCLUDE="-I$oracle_include_dir" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2683,207 +2711,65 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$ORACLE_INCLUDE" != "x"; then - ORACLE_LIBS="-L$/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lm" - break; - fi - done - CFLAGS="$old_CFLAGS" - fi - # Finish Looking for Oracle10g includes installed from RPM - - # Look for Oracle8i. - if test "x$ORACLE_INCLUDE" = "x"; then - old_CFLAGS="$CFLAGS" - - -if test "x$LOCATE" != "x"; then - DIRS= - file=oci.h - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$oracle_home_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done -fi - -eval "oracle_home_dir=\"\$oracle_home_dir $DIRS\"" + RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST="$CFLAGS" + CFLAGS="$old_CFLAGS" + fi + # Proceed to linking makes only sense if include dir is OK. + if test "x$ORACLE_INCLUDE" != "x" ; then + old_LIBS="$LIBS" + old_CFLAGS="$CFLAGS" + CFLAGS="$RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST" - for try in $oracle_home_dir $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include" - cat >conftest.$ac_ext <<_ACEOF + ORACLE_LIBDIR_SWITCH= + if test "x$oracle_lib_dir" != "x" ; then + ORACLE_LIBDIR_SWITCH="-L${oracle_lib_dir} " + fi + LIBS="$old_LIBS $ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include -int -main () -{ - int a = 1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - OHOME=$try -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - OHOME= -fi + static OCIEnv *p_env; + static OCIError *p_err; + static OCISvcCtx *p_svc; + static OCIStmt *p_sql; + static OCIDefine *p_dfn = (OCIDefine *) 0; + static OCIBind *p_bnd = (OCIBind *) 0; -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$OHOME" != "x"; then - break; - fi - done - - if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then - 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" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include int main () { - int a = 1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - OHOME=$ORACLE_HOME -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - OHOME= - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - CFLAGS="$old_CFLAGS" - - if test "x$OHOME" != "x"; then - ORACLE_HOME=$OHOME - 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" - fi - fi ## this section sets $ORACLE_HOME, if found. - - # not Oracle8i, try older. - if test "x$ORACLE_INCLUDE" = "x"; then - old_CFLAGS="$CFLAGS" - - -if test "x$LOCATE" != "x"; then - DIRS= - file=oci.h + int p_bvi; + char p_sli[20]; + int rc; + char errbuf[100]; + int errcode; - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$oracle_include_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done -fi + rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */ + (dvoid * (*)(dvoid *, size_t)) 0, + (dvoid * (*)(dvoid *, dvoid *, size_t))0, + (void (*)(dvoid *, dvoid *)) 0 ); -eval "oracle_include_dir=\"\$oracle_include_dir $DIRS\"" - - for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I$try" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - int a = 1; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -2892,29 +2778,30 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ORACLE_INCLUDE="-I$try" + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ORACLE_LIBS="$ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ORACLE_INCLUDE= + ORACLE_LIBS= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "x$ORACLE_INCLUDE" != "x"; then - break; - fi - done +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + LIBS="$old_LIBS" CFLAGS="$old_CFLAGS" fi + if test "x$ORACLE_INCLUDE" = "x"; then { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } - { echo "$as_me:$LINENO: WARNING: oracle headers not found. Use --with-oracle-home-dir=." >&5 -echo "$as_me: WARNING: oracle headers not found. Use --with-oracle-home-dir=." >&2;} + { echo "$as_me:$LINENO: WARNING: oracle headers not found. Use --with-oracle-include-dir=." >&5 +echo "$as_me: WARNING: oracle headers not found. Use --with-oracle-include-dir=." >&2;} fail="$fail oci.h" else sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}" @@ -2922,139 +2809,12 @@ echo "$as_me: WARNING: oracle headers not found. Use --with-oracle-home-dir=&6; } - ## is this set, from above? - if test "x$ORACLE_HOME" != "x"; then - ## we must have an Oracle8i tree - - # FIXME: we might do some checking, just to be nice - ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm" - - else - { echo "$as_me:$LINENO: checking for oracle_init in -loracleclient" >&5 -echo $ECHO_N "checking for oracle_init in -loracleclient... $ECHO_C" >&6; } - - old_LIBS="$LIBS" - - - -if test "x$LOCATE" != "x"; then - DIRS= - file=oracleclient.so - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$oracle_lib_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done -fi - -eval "oracle_lib_dir=\"\$oracle_lib_dir $DIRS\"" - - - -if test "x$LOCATE" != "x"; then - DIRS= - file=oracleclient.a - - for x in `${LOCATE} $file 2>/dev/null`; do - base=`echo $x | sed "s%/${file}%%"` - if test "x$x" = "x$base"; then - continue; - fi - - dir=`${DIRNAME} $x 2>/dev/null` - exclude=`echo ${dir} | ${GREP} /home` - if test "x$exclude" != "x"; then - continue - fi - - already=`echo \$oracle_lib_dir ${DIRS} | ${GREP} ${dir}` - if test "x$already" = "x"; then - DIRS="$DIRS $dir" - fi - done -fi - -eval "oracle_lib_dir=\"\$oracle_lib_dir $DIRS\"" - - - for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do - LIBS="$old_LIBS -L$try -loracleclient" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -extern char oracle_init(); -int -main () -{ - oracle_init() - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ORACLE_LIBS="-L$try -loracleclient" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ORACLE_LIBS= - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - if test "x$ORACLE_LIBS" != "x"; then - break; - fi - done - LIBS="$old_LIBS" - - if test "x$ORACLE_LIBS" = "x"; then - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - ORACLE_INCLUDE= - fi - fi - if test "x$ORACLE_LIBS" = "x"; then { echo "$as_me:$LINENO: WARNING: oracle libraries not found. Use --with-oracle-lib-dir=." >&5 echo "$as_me: WARNING: oracle libraries not found. Use --with-oracle-lib-dir=." >&2;} - fail="$fail liboracleclient" + fail="$fail libclntsh libnnz10" else - sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS" + sql_oracle_ldflags="${sql_oracle_ldflags} $ORACLE_LIBS" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } fi diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in index 8a15c77..efb339f 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in +++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.in @@ -1,5 +1,5 @@ AC_INIT(sql_oracle.c) -AC_REVISION($Revision$) +AC_REVISION($Revision: 1.10 $) AC_DEFUN(modname,[rlm_sql_oracle]) fail= @@ -18,145 +18,120 @@ if test x$with_[]modname != xno; then dnl # defined anyways. dnl # + dnl ############################################################ + dnl # Check for command line options + dnl ############################################################ + + dnl extra argument: --with-oracle-include-dir=DIR + oracle_include_dir= + AC_ARG_WITH(oracle-include-dir, + [AS_HELP_STRING([--with-oracle-include-dir=DIR], + [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])], + [case "$withval" in + no) + AC_MSG_ERROR(Need oracle-include-dir) + ;; + yes) + ;; + *) + oracle_include_dir="$withval" + ;; + esac]) + + dnl extra argument: --with-oracle-lib-dir=DIR + oracle_lib_dir= + AC_ARG_WITH(oracle-lib-dir, + [AS_HELP_STRING([--with-oracle-lib-dir=DIR], + [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])], + [case "$withval" in + no) + AC_MSG_ERROR(Need oracle-lib-dir) + ;; + yes) + ;; + *) + oracle_lib_dir="$withval" + ;; + esac]) + + + AC_TRY_COMPILE([#include ], [ int a = 1;], ORACLE_INCLUDE=" ", ORACLE_INCLUDE= ) - # Look for Oracle10g "Instant Client" installed from RPM - if test "x$ORACLE_INCLUDE" = "x"; then - old_CFLAGS="$CFLAGS" - - FR_LOCATE_DIR(oracle_include_dir,oci.h) - - for try in /usr/include/oracle/10.1.0.3/client $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I$try" - AC_TRY_COMPILE([#include ], - [ int a = 1; ], - ORACLE_INCLUDE="-I$try", - ORACLE_INCLUDE= - ) - if test "x$ORACLE_INCLUDE" != "x"; then - ORACLE_LIBS="-L$/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lm" - break; - fi - done - CFLAGS="$old_CFLAGS" - fi - # Finish Looking for Oracle10g includes installed from RPM - - # Look for Oracle8i. - if test "x$ORACLE_INCLUDE" = "x"; then + RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST= + if test "x$ORACLE_INCLUDE" = "x" ; then old_CFLAGS="$CFLAGS" - - FR_LOCATE_DIR(oracle_home_dir,oci.h) - - for try in $oracle_home_dir $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include" - AC_TRY_COMPILE([#include ], - [ int a = 1; ], - OHOME=$try, - OHOME= - ) - if test "x$OHOME" != "x"; then - break; - fi - done - - if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then - 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" - AC_TRY_COMPILE([#include ], - [ int a = 1; ], - OHOME=$ORACLE_HOME, - OHOME= - ) - fi - + CFLAGS="$old_CFLAGS -I$oracle_include_dir" + AC_TRY_COMPILE([#include ], + [ int a = 1;], + ORACLE_INCLUDE="-I$oracle_include_dir", + ORACLE_INCLUDE= + ) + + RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST="$CFLAGS" CFLAGS="$old_CFLAGS" + fi - if test "x$OHOME" != "x"; then - ORACLE_HOME=$OHOME - 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" - fi - fi ## this section sets $ORACLE_HOME, if found. - - # not Oracle8i, try older. - if test "x$ORACLE_INCLUDE" = "x"; then + # Proceed to linking makes only sense if include dir is OK. + if test "x$ORACLE_INCLUDE" != "x" ; then + old_LIBS="$LIBS" old_CFLAGS="$CFLAGS" + CFLAGS="$RLM_SQL_ORA_WORKING_CFLAGS_FOR_LINKING_TEST" - FR_LOCATE_DIR(oracle_include_dir,oci.h) - - for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do - CFLAGS="$old_CFLAGS -I$try" - AC_TRY_COMPILE([#include ], - [ int a = 1; ], - ORACLE_INCLUDE="-I$try", - ORACLE_INCLUDE= - ) - if test "x$ORACLE_INCLUDE" != "x"; then - break; - fi - done + ORACLE_LIBDIR_SWITCH= + if test "x$oracle_lib_dir" != "x" ; then + ORACLE_LIBDIR_SWITCH="-L${oracle_lib_dir} " + fi + LIBS="$old_LIBS $ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10" + AC_TRY_LINK([#include + + static OCIEnv *p_env; + static OCIError *p_err; + static OCISvcCtx *p_svc; + static OCIStmt *p_sql; + static OCIDefine *p_dfn = (OCIDefine *) 0; + static OCIBind *p_bnd = (OCIBind *) 0; + ], + [ + int p_bvi; + char p_sli[20]; + int rc; + char errbuf[100]; + int errcode; + + rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, /* Initialize OCI */ + (dvoid * (*)(dvoid *, size_t)) 0, + (dvoid * (*)(dvoid *, dvoid *, size_t))0, + (void (*)(dvoid *, dvoid *)) 0 ); + + ], + ORACLE_LIBS="$ORACLE_LIBDIR_SWITCH -lclntsh -lnnz10", + ORACLE_LIBS= + ) + + LIBS="$old_LIBS" CFLAGS="$old_CFLAGS" fi + if test "x$ORACLE_INCLUDE" = "x"; then AC_MSG_RESULT(no) - AC_MSG_WARN([oracle headers not found. Use --with-oracle-home-dir=.]) + AC_MSG_WARN([oracle headers not found. Use --with-oracle-include-dir=.]) fail="$fail oci.h" else sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}" AC_MSG_RESULT(yes) - ## is this set, from above? - if test "x$ORACLE_HOME" != "x"; then - ## we must have an Oracle8i tree - - # FIXME: we might do some checking, just to be nice - ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm" - - else - AC_MSG_CHECKING([for oracle_init in -loracleclient]) - - dnl # - dnl # Look for it in a number of directories. - dnl # - old_LIBS="$LIBS" - - FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.so]) - FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.a]) - - for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do - LIBS="$old_LIBS -L$try -loracleclient" - AC_TRY_LINK([extern char oracle_init();], - [ oracle_init()], - ORACLE_LIBS="-L$try -loracleclient", - ORACLE_LIBS= - ) - if test "x$ORACLE_LIBS" != "x"; then - break; - fi - done - LIBS="$old_LIBS" - - dnl # - dnl # If one or the other isn't found, disable - dnl # them both.. - dnl # If both are found, enable them both. - dnl # - if test "x$ORACLE_LIBS" = "x"; then - AC_MSG_RESULT(no) - ORACLE_INCLUDE= - fi - fi - if test "x$ORACLE_LIBS" = "x"; then AC_MSG_WARN([oracle libraries not found. Use --with-oracle-lib-dir=.]) - fail="$fail liboracleclient" + fail="$fail libclntsh libnnz10" else - sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS" + sql_oracle_ldflags="${sql_oracle_ldflags} $ORACLE_LIBS" AC_MSG_RESULT(yes) fi fi -- 2.1.4