Permalink
Browse files

autoconf support for oracle, thanks Aki Tuomi. Closes #726

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3139 d19b8d6e-7fed-0310-83ef-9ca221ded41b
  • Loading branch information...
1 parent 8ac0c06 commit 1b8e5e6fe35589834e3f837711893b890a1ba5c1 @Habbie Habbie committed Mar 28, 2013
View
@@ -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
@@ -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
@@ -1 +0,0 @@
--L$(ORACLE_HOME)/lib -lclient9 -lclntst9
@@ -8,6 +8,10 @@
#include "pdns/utility.hh"
#include <oci.h>
+#ifndef dsword
+typedef sb4 dsword;
+#endif
+
class SOracle : public SSql
{
public:
@@ -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
@@ -1 +0,0 @@
--L$(ORACLE_HOME)/lib -lclntsh
View
@@ -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

0 comments on commit 1b8e5e6

Please sign in to comment.