Skip to content

Commit 1b8e5e6

Browse files
author
Peter van Dijk
committed
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
1 parent 8ac0c06 commit 1b8e5e6

File tree

7 files changed

+88
-9
lines changed

7 files changed

+88
-9
lines changed

configure.ac

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ AM_CONDITIONAL(RECURSOR,test x"$enable_recursor" = "xyes")
328328
for a in $modules $dynmodules
329329
do
330330
case "$a" in
331+
oracle|goracle)
332+
needoracle=yes
333+
;;
331334
gmysql )
332335
needmysql=yes
333336
;;
@@ -382,6 +385,75 @@ do
382385
esac
383386
done
384387

388+
AM_CONDITIONAL(ORACLE,test x"$needoracle" = "xyes")
389+
390+
if test "$needoracle"
391+
then
392+
AC_ARG_WITH(oracle_includes, [--with-oracle-includes=<path> instantclient sdk include dir])
393+
AC_ARG_WITH(oracle_libs, [--with-oracle-libs=<path> instantclient oracle library dir])
394+
395+
if test x"$with_oracle_includes" = "x"
396+
then
397+
# check possible locations
398+
for p1 in /usr/include/oracle /usr/local/include/oracle
399+
do
400+
for p2 in $p1/*/client*
401+
do
402+
if test -d "$p2"
403+
then
404+
with_oracle_includes=$p2
405+
fi
406+
done
407+
done
408+
fi
409+
410+
if test x"$with_oracle_includes" = x && test "$ORACLE_HOME/rdbms/public" != "/rdbms/public"; then
411+
if test -d $ORACLE_HOME/rdbms/public; then
412+
with_oracle_includes=$ORACLE_HOME/rdbms/public
413+
fi
414+
fi
415+
416+
# test header
417+
old_CXXFLAGS="$CXXFLAGS"
418+
old_CFLAGS="$CFLAGS"
419+
CXXFLAGS="$CXXFLAGS -I$with_oracle_includes"
420+
CPPFLAGS="$CPPFLAGS -I$with_oracle_includes"
421+
AC_CHECK_HEADER([oci.h], ORACLE_CFLAGS="-I$with_oracle_includes", AC_MSG_ERROR([Could not find oci.h]))
422+
CXXFLAGS="$old_CXXFLAGS"
423+
CPPFLAGS="$old_CPPFLAGS"
424+
AC_SUBST([ORACLE_CFLAGS])
425+
AC_SUBST([ORACLE_LIBS])
426+
427+
if test x"$with_oracle_libs" = "x"
428+
then
429+
# check possible locationse
430+
for p1 in /usr/lib/oracle /usr/local/lib/oracle
431+
do
432+
for p2 in $p1/*/client*/lib
433+
do
434+
if test -d "$p2"
435+
then
436+
with_oracle_libs=$p2
437+
fi
438+
done
439+
done
440+
fi
441+
442+
if test x"$with_oracle_libs" = x && test "$ORACLE_HOME/lib" != "/lib"; then
443+
if test -d $ORACLE_HOME/lib; then
444+
with_oracle_libs=$ORACLE_HOME/lib
445+
fi
446+
fi
447+
448+
# we have to check for client9 as well...
449+
450+
# test -lclntsh
451+
old_LDFLAGS="$LDFLAGS"
452+
LDFLAGS="-L$with_oracle_libs -lnnz11 -locci"
453+
AC_CHECK_LIB([clntsh],[OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lnnz11 -lclntsh -locci",
454+
AC_CHECK_LIB([client9], [OCIEnvInit],ORACLE_LIBS="-L$with_oracle_libs -lclient9 -lclntsh9",AC_MSG_ERROR([Could not find client libraries])))
455+
LDFLAGS="$old_LDFLAGS"
456+
fi
385457

386458
if test "$needmysql"
387459
then

modules/goraclebackend/Makefile.am

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ lib_LTLIBRARIES = libgoraclebackend.la
66

77
EXTRA_DIST=OBJECTFILES OBJECTLIBS
88

9-
ORACLE_HOME ?= /opt/oracle
10-
11-
INCLUDES= -I$(ORACLE_HOME)/rdbms/demo \
12-
-I$(ORACLE_HOME)/rdbms/public
9+
INCLUDES= $(ORACLE_CFLAGS)
1310

1411
libgoraclebackend_la_SOURCES=goraclebackend.cc goraclebackend.hh \
1512
soracle.hh soracle.cc
1613

1714

18-
libgoraclebackend_la_LDFLAGS=-module -avoid-version -L$(ORACLE_HOME)/lib -lclient9 -lclntst9
15+
libgoraclebackend_la_LDFLAGS=-module -avoid-version $(ORACLE_LIBS)
1916
#soracle_LDFLAGS=-module -L$(ORACLE_HOME)/lib -lclient9 -lclntst9 -ldl -pthread
2017

2118
# -Wl,-Bstatic -lpq++ -lpq -Wl,-Bdynamic -lssl -lcrypt -lcrypto

modules/goraclebackend/OBJECTLIBS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
-L$(ORACLE_HOME)/lib -lclient9 -lclntst9

modules/goraclebackend/soracle.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include "pdns/utility.hh"
99
#include <oci.h>
1010

11+
#ifndef dsword
12+
typedef sb4 dsword;
13+
#endif
14+
1115
class SOracle : public SSql
1216
{
1317
public:

modules/oraclebackend/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ lib_LTLIBRARIES = liboraclebackend.la
44

55
EXTRA_DIST=OBJECTFILES OBJECTLIBS schema.sql dropschema.sql
66

7-
INCLUDES= -I$(ORACLE_HOME)/rdbms/public
7+
INCLUDES= $(ORACLE_CFLAGS)
88

99
liboraclebackend_la_SOURCES=oraclebackend.cc oraclebackend.hh
10-
liboraclebackend_la_LDFLAGS=-module -avoid-version -L$(ORACLE_HOME)/lib
10+
liboraclebackend_la_LDFLAGS=-module -avoid-version $(ORACLE_LIBS)
1111
liboraclebackend_la_LIBADD=-lclntsh

modules/oraclebackend/OBJECTLIBS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
-L$(ORACLE_HOME)/lib -lclntsh

pdns/Makefile.am

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ endif
9090
if SQLITE3
9191
pdns_server_SOURCES += ssqlite3.cc ssqlite3.hh
9292
endif
93+
94+
if ORACLE
95+
pdns_server_LDADD += $(ORACLE_LIBS)
96+
endif
9397

9498
pdnssec_SOURCES=pdnssec.cc dbdnsseckeeper.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnswriter.hh \
9599
misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
@@ -128,6 +132,10 @@ if SQLITE3
128132
pdnssec_SOURCES += ssqlite3.cc ssqlite3.hh
129133
endif
130134

135+
if ORACLE
136+
pdnssec_LDADD += $(ORACLE_LIBS)
137+
endif
138+
131139
sdig_SOURCES=sdig.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.cc dnswriter.cc dnslabeltext.cc dnswriter.hh \
132140
misc.cc misc.hh rcpgenerator.cc rcpgenerator.hh base64.cc base64.hh unix_utility.cc \
133141
logger.cc statbag.cc qtype.cc sillyrecords.cc nsecrecords.cc base32.cc

0 commit comments

Comments
 (0)