]> granicus.if.org Git - pdns/commitdiff
autoconf support for oracle, thanks Aki Tuomi. Closes #726
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 28 Mar 2013 13:49:53 +0000 (13:49 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 28 Mar 2013 13:49:53 +0000 (13:49 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3139 d19b8d6e-7fed-0310-83ef-9ca221ded41b

configure.ac
modules/goraclebackend/Makefile.am
modules/goraclebackend/OBJECTLIBS
modules/goraclebackend/soracle.hh
modules/oraclebackend/Makefile.am
modules/oraclebackend/OBJECTLIBS
pdns/Makefile.am

index 8770754ff2e4a9e50b7a5ab009c393cbc06bfe38..97283bc94ea0918225a74e2e61b363441f74274b 100644 (file)
@@ -328,6 +328,9 @@ AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
 for a in $modules $dynmodules
 do
        case "$a" in
+                oracle|goracle)
+                        needoracle=yes
+               ;;
                gmysql )
                        needmysql=yes
                ;;
@@ -382,6 +385,75 @@ do
        esac
 done
 
+AM_CONDITIONAL(ORACLE,test x"$needoracle" = "xyes")
+
+if test "$needoracle"
+then
+       AC_ARG_WITH(oracle_includes, [--with-oracle-includes=<path>    instantclient sdk include dir])
+        AC_ARG_WITH(oracle_libs, [--with-oracle-libs=<path>        instantclient oracle library dir])
+
+        if test x"$with_oracle_includes" = "x"
+        then
+           # check possible locations
+           for p1 in /usr/include/oracle /usr/local/include/oracle 
+           do
+             for p2 in $p1/*/client*
+             do
+if test -d "$p2"
+then 
+with_oracle_includes=$p2
+fi
+             done
+           done
+        fi
+
+        if test x"$with_oracle_includes" = x && test "$ORACLE_HOME/rdbms/public" != "/rdbms/public"; then 
+if test -d $ORACLE_HOME/rdbms/public; then
+  with_oracle_includes=$ORACLE_HOME/rdbms/public
+fi
+        fi
+
+        # test header
+        old_CXXFLAGS="$CXXFLAGS"
+        old_CFLAGS="$CFLAGS"
+        CXXFLAGS="$CXXFLAGS -I$with_oracle_includes"
+       CPPFLAGS="$CPPFLAGS -I$with_oracle_includes"
+        AC_CHECK_HEADER([oci.h], ORACLE_CFLAGS="-I$with_oracle_includes", AC_MSG_ERROR([Could not find oci.h]))
+       CXXFLAGS="$old_CXXFLAGS"
+       CPPFLAGS="$old_CPPFLAGS"
+        AC_SUBST([ORACLE_CFLAGS])
+        AC_SUBST([ORACLE_LIBS])
+
+       if test x"$with_oracle_libs" = "x"
+        then
+           # check possible locationse
+           for p1 in /usr/lib/oracle /usr/local/lib/oracle
+           do
+             for p2 in $p1/*/client*/lib
+             do
+if test -d "$p2"
+then
+with_oracle_libs=$p2
+fi
+             done
+           done
+        fi
+
+        if test x"$with_oracle_libs" = x && test "$ORACLE_HOME/lib" != "/lib"; then 
+if test -d $ORACLE_HOME/lib; then
+  with_oracle_libs=$ORACLE_HOME/lib
+fi
+        fi
+
+        # we have to check for client9 as well...
+
+       # test -lclntsh
+       old_LDFLAGS="$LDFLAGS"
+       LDFLAGS="-L$with_oracle_libs -lnnz11 -locci"
+       AC_CHECK_LIB([clntsh],[OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lnnz11 -lclntsh -locci",
+           AC_CHECK_LIB([client9], [OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lclient9 -lclntsh9",AC_MSG_ERROR([Could not find client libraries])))
+        LDFLAGS="$old_LDFLAGS"
+fi
 
 if test "$needmysql"
 then
index 61b11fbf06fad19824f2bb03b6513b9f08b606b9..990b7cf124226958dc3943acd90b35f887cb23f3 100644 (file)
@@ -6,16 +6,13 @@ lib_LTLIBRARIES = libgoraclebackend.la
 
 EXTRA_DIST=OBJECTFILES OBJECTLIBS
 
-ORACLE_HOME    ?= /opt/oracle
-
-INCLUDES= -I$(ORACLE_HOME)/rdbms/demo \
-                 -I$(ORACLE_HOME)/rdbms/public 
+INCLUDES= $(ORACLE_CFLAGS) 
 
 libgoraclebackend_la_SOURCES=goraclebackend.cc goraclebackend.hh \
                soracle.hh soracle.cc
 
 
-libgoraclebackend_la_LDFLAGS=-module -avoid-version -L$(ORACLE_HOME)/lib -lclient9  -lclntst9
+libgoraclebackend_la_LDFLAGS=-module -avoid-version $(ORACLE_LIBS)
 #soracle_LDFLAGS=-module  -L$(ORACLE_HOME)/lib -lclient9  -lclntst9 -ldl -pthread
 
 #      -Wl,-Bstatic -lpq++ -lpq -Wl,-Bdynamic -lssl -lcrypt -lcrypto
index afc4f008a7817358c30c95ad81e8f19c416b35c1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
--L$(ORACLE_HOME)/lib -lclient9  -lclntst9
\ No newline at end of file
index b85655f4d709a4b64e2e2c698b1f32c3f0438914..b0e3b3a0d26b120b2f2bd75d4ce3ad2abd0472f2 100644 (file)
@@ -8,6 +8,10 @@
 #include "pdns/utility.hh" 
 #include <oci.h>
 
+#ifndef dsword
+typedef sb4 dsword;
+#endif
+
 class SOracle : public SSql
 {
 public:
index c35ee9d54b5f88b9968b314f41b650c04f3e1c5f..e6f50022b7bd09c54acac57bb5e41787c79c12cd 100644 (file)
@@ -4,8 +4,8 @@ lib_LTLIBRARIES = liboraclebackend.la
 
 EXTRA_DIST=OBJECTFILES OBJECTLIBS schema.sql dropschema.sql
 
-INCLUDES= -I$(ORACLE_HOME)/rdbms/public
+INCLUDES= $(ORACLE_CFLAGS)
 
 liboraclebackend_la_SOURCES=oraclebackend.cc oraclebackend.hh
-liboraclebackend_la_LDFLAGS=-module -avoid-version -L$(ORACLE_HOME)/lib
+liboraclebackend_la_LDFLAGS=-module -avoid-version $(ORACLE_LIBS)
 liboraclebackend_la_LIBADD=-lclntsh
index f4de89683a6d8e546642293a407ca07715ac6298..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
--L$(ORACLE_HOME)/lib -lclntsh
index e429303932fd9100a986625a8994cf25eca32e41..b121e117895f4ba13fcb9a4e12c9caf4dace742d 100644 (file)
@@ -90,6 +90,10 @@ endif
 if SQLITE3
 pdns_server_SOURCES += ssqlite3.cc ssqlite3.hh
 endif
+
+if ORACLE
+pdns_server_LDADD += $(ORACLE_LIBS)
+endif
   
 pdnssec_SOURCES=pdnssec.cc dbdnsseckeeper.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnswriter.hh \
         misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
@@ -128,6 +132,10 @@ if SQLITE3
 pdnssec_SOURCES += ssqlite3.cc ssqlite3.hh
 endif
 
+if ORACLE
+pdnssec_LDADD += $(ORACLE_LIBS)
+endif
+
 sdig_SOURCES=sdig.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnslabeltext.cc dnswriter.hh \
        misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
        logger.cc statbag.cc qtype.cc sillyrecords.cc nsecrecords.cc base32.cc