From: <mrj...@us...> - 2008-05-02 14:22:45
|
Revision: 2739 http://tora.svn.sourceforge.net/tora/?rev=2739&view=rev Author: mrjohnson0 Date: 2008-05-02 07:22:28 -0700 (Fri, 02 May 2008) Log Message: ----------- revert to previous Modified Paths: -------------- trunk/tora/config/m4/oracle.m4 Modified: trunk/tora/config/m4/oracle.m4 =================================================================== --- trunk/tora/config/m4/oracle.m4 2008-04-29 14:56:07 UTC (rev 2738) +++ trunk/tora/config/m4/oracle.m4 2008-05-02 14:22:28 UTC (rev 2739) @@ -46,9 +46,8 @@ oracle_user_instant= AC_ARG_WITH(instant-client, - [[ --with-instant-client=DIR - Path to your instant client. If you've unpacked all the zip files to this folder, - this is all you need to use an instant client. + [[ --with-instant-client + define if compiling against Oracle Instant Client. Disables testing for ORACLE_HOME and tnsnames.]], [ have_oracle=yes @@ -72,36 +71,26 @@ dnl user says we're running on the instant client libraries. AC_DEFINE(TO_INSTANT_CLIENT, 1, [Define if compiled against Oracle Instant Client]) - instant_ora_libs="$oracle_user_instant" - instant_ora_inc="$oracle_user_instant/sdk/include" + if test "x$oracle_user_lib" = "x" && test "x$oracle_user_inc" = "x"; then + dnl try to find oracle includes for instant client + dnl these are from the rpm install. they're all i know of so far. - dnl try to find oracle includes for instant client - if test "x$oracle_user_lib" = "x"; then - if test "`ls $instant_ora_libs/libclntsh*so 2>/dev/null || echo x`" != "x"; then - ora_ldflags=-L$instant_ora_libs - else - AC_MSG_ERROR([ -The path "$instant_ora_libs"/libclntsh*so does not exist. -Because of the way Oracle versions its libraries, you need to create a -symlink to the library. Try something like this: + for dir in `ls /usr/lib/oracle/`; do + echo "trying $dir" >&5 + if expr $dir \> 10 >/dev/null; then + oracle_user_otl_ver=10G + fi + ora_ldflags="-L/usr/lib/oracle/$dir/client/lib" -cd $instant_ora_libs -ln -s libclntsh.so.11.1 libclntsh.so -]) - fi + incdir=/usr/include/oracle/$dir/client + if ! test -d $incdir; then + AC_MSG_ERROR([$incdir doesn't exist. Please install the sdk package or use --oracle-includes.]) + fi + ora_cflags="-I$incdir" + break + done else ora_ldflags="-L$oracle_user_lib" - fi - - if test "x$oracle_user_inc" = "x"; then - if test -d $instant_ora_inc; then - ora_cflags="-I$instant_ora_inc" - else - AC_MSG_ERROR([ -$instant_ora_inc doesn't exist. -Please install the instant client sdk package or use --with-oracle-includes=DIR.]) - fi - else ora_cflags="-I$oracle_user_inc" fi elif test "x$ORACLE_HOME" != "x"; then @@ -149,12 +138,11 @@ if test "x$ORACLE_HOME" != "x"; then dnl check real quick that ORACLE_HOME doesn't end with a slash - dnl for some stupid reason, the instant client bombs. + dnl for some stupid reason, the 10g instant client bombs. ora_home_oops=`echo $ORACLE_HOME | $AWK '/\/@S|@/ {print "oops"}'` if test "$ora_home_oops" = "oops"; then - AC_MSG_WARN([ -Your ORACLE_HOME environment variable ends with a -slash (i.e. /). Oracle Instant Client is known to have a problem + AC_MSG_WARN([Your ORACLE_HOME environment variable ends with a +slash (i.e. /). Oracle 10g Instant Client is known to have a problem with this. If you get the message "otl_initialize failed!" at the console when running TOra, this is probably why.]) fi @@ -166,71 +154,55 @@ LDFLAGS="$LDFLAGS $ora_ldflags" LIBS="$ora_lib" + # i pulled this from one of the examples in the demo dir. AC_RUN_IFELSE([[ -#include <oci.h> -#include <iostream> -#include <fstream> -using namespace std; - -Lda_Def lda; -ub4 hda [HDA_SIZE/(sizeof(ub4))]; + #include <oci.h> + Lda_Def lda; + ub4 hda [HDA_SIZE/(sizeof(ub4))]; -int main(int c, char **v) { - ofstream version; - version.open("ociversion", ios::out); - if(!version.is_open()) { - cerr << "Cannot open ociversion output file"; - exit(1); - } - - sword major, minor, update, patch, port; - OCIClientVersion(&major, &minor, &update, &patch, &port); - - switch(major) { - default: - exit(1); /* unknown */ - - case 11: - version << "11G"; - break; - - case 10: - if(minor >= 2) - version << "10G_R2"; - else - version << "10G"; - break; - - case 9: - version << "9I"; - break; - - case 8: - if(minor >= 1) - version << "8I"; - else - version << "8"; - } - - version.close(); - return 0; -} + int main(int c, char **v) { + return 0; + } ]], [found_oracle=yes], [found_oracle=no], ) if test $found_oracle = no; then - AC_MSG_ERROR([ -Couldn't compile and run a simpile OCI app. -Try setting ORACLE_HOME or check config.log. -Otherwise, make sure ORACLE_HOME/lib is in /etc/ld.so.conf or LD_LIBRARY_PATH]) + AC_MSG_ERROR([Couldn't compile and run a simpile OCI app. + Try setting ORACLE_HOME or check config.log. + Otherwise, make sure ORACLE_HOME/lib is in /etc/ld.so.conf or LD_LIBRARY_PATH]) + fi + + sqlplus= + if test -x "$ORACLE_HOME/bin/sqlplus"; then + sqlplus="$ORACLE_HOME/bin/sqlplus" + fi + if test "x${sqlplus}" = "x"; then + if test -x "$ORACLE_HOME/bin/sqlplusO"; then + sqlplus="$ORACLE_HOME/bin/sqlplusO" + fi + fi + + if test "x$oracle_user_otl_ver" != "x"; then + otl_ver=$oracle_user_otl_ver + elif test "x${sqlplus}" = "x"; then + AC_MSG_ERROR([Couldn't find sqlplus. Set the Oracle version manually.]) else - if test -r "ociversion"; then - otl_ver="`cat ociversion`" - rm -f ociversion + # get oracle oci version. know a better way? + sqlplus_ver=`$sqlplus -? | $AWK '/Release/ {print @S|@3}'` + echo "sqlplus_ver: $sqlplus_ver" >&5 + + if expr $sqlplus_ver \> 11 >/dev/null; then + otl_ver=11G + elif expr $sqlplus_ver \> 10.2 >/dev/null; then + otl_ver=10G_R2 + elif expr $sqlplus_ver \> 10 >/dev/null; then + otl_ver=10G + elif expr $sqlplus_ver \> 9 >/dev/null; then + otl_ver=9I + elif expr $sqlplus_ver \< 8.1 >/dev/null; then + otl_ver=8 else - AC_MSG_ERROR([ -Couldn't find ociversion output file. Please mail the tora-dev email list -and let us know about this problem.]) + otl_ver=8I fi fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |