]> granicus.if.org Git - pdns/commitdiff
hmm
authorBert Hubert <bert.hubert@netherlabs.nl>
Wed, 27 Nov 2002 15:54:00 +0000 (15:54 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Wed, 27 Nov 2002 15:54:00 +0000 (15:54 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@12 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/pdnsbackend/configure.in [new file with mode: 0644]
modules/pipebackend/backend.pl [new file with mode: 0755]

diff --git a/modules/pdnsbackend/configure.in b/modules/pdnsbackend/configure.in
new file mode 100644 (file)
index 0000000..faa2f14
--- /dev/null
@@ -0,0 +1,235 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(pdnsbackend.cc)
+AM_INIT_AUTOMAKE(ahudns-pdnsbackend, 2.0rc2)
+AC_CANONICAL_SYSTEM
+AC_PREFIX_DEFAULT(/opt/pdns)
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_DISABLE_STATIC
+AM_PROG_LIBTOOL
+AC_LANG_CPLUSPLUS
+
+#
+# Location of MySQL installation
+#
+AC_ARG_WITH(mysql,
+    [  --with-mysql=<path>     root directory path of MySQL installation],
+    [MYSQL_lib_check="$withval/lib/mysql $with_mysql/lib"
+MYSQL_inc_check="$withval/include/mysql"],
+    [MYSQL_lib_check="/usr/local/mysql/lib/mysql /usr/local/lib/mysql /opt/mysql/lib/mysql /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib /opt/mysql/lib /usr/lib"
+MYSQL_inc_check="/usr/local/mysql/include/mysql /usr/local/include/mysql /opt/mysql/include/mysql /opt/mysql/include /usr/include/mysql"])
+
+AC_ARG_WITH(mysql-lib,
+    [  --with-mysql-lib=<path> directory path of MySQL library installation],
+    [MYSQL_lib_check="$withval/lib/mysql $withval/mysql $withval"])
+
+AC_ARG_WITH(mysql-includes,
+    [  --with-mysql-includes=<path>
+                          directory path of MySQL header installation],
+    [MYSQL_inc_check="$withval/include/mysql $withval/mysql $withval"])
+
+AC_MSG_CHECKING([for MySQL library directory])
+MYSQL_libdir=
+for m in $MYSQL_lib_check; do
+        if test -d "$m" && \
+          (test -f "$m/libmysqlclient.so" || test -f "$m/libmysqlclient.a")
+        then
+                MYSQL_libdir=$m
+                break
+        fi
+done
+
+if test -z "$MYSQL_libdir"; then
+        AC_MSG_ERROR([Didn't find the mysql library dir in '$MYSQL_lib_check'])
+fi
+
+case "$MYSQL_libdir" in
+  /* ) ;;
+  * )  AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
+esac
+
+AC_MSG_RESULT([$MYSQL_libdir])
+
+case "$MYSQL_libdir" in
+  /usr/lib) ;;
+  *) LDFLAGS="$LDFLAGS -L${MYSQL_libdir}" ;;
+esac
+
+AC_MSG_CHECKING([for MySQL include directory])
+MYSQL_incdir=
+for m in $MYSQL_inc_check; do
+        if test -d "$m" && test -f "$m/mysql.h"
+        then
+                MYSQL_incdir=$m
+                break
+        fi
+done
+
+if test -z "$MYSQL_incdir"; then
+        AC_MSG_ERROR([Didn't find the mysql include dir in '$MYSQL_inc_check'])
+fi
+
+case "$MYSQL_incdir" in
+  /* ) ;;
+  * )  AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
+esac
+
+AC_MSG_RESULT([$MYSQL_incdir])
+
+CPPFLAGS="$CPPFLAGS -I${MYSQL_incdir}"
+
+dnl Checks for programs.
+
+dnl Checks for libraries.
+dnl Replace `main' with a function in -ldl:
+AC_CHECK_LIB(dl, main)
+AC_CHECK_LIB(z, main)
+AC_CHECK_LIB(mysqlclient, mysql_store_result)
+dnl Replace `main' with a function in -lpthread:
+AC_CHECK_LIB(pthread, main)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+dnl Checks for ahudns functions
+dnl Check for ahudns
+
+search_ahudns=1
+
+AC_ARG_WITH(ahudns-includes, [  --with-ahudns-includes=PATH Specify location of ahudns headers],
+[ if test x"$withval" = x"no"; then
+    search_ahudns=0
+  else
+    #if test x"$withval" != x"yes"; then
+    if test -d "$withval"; then
+      AHUDNS_INCLUDES="-I$withval"
+      search_ahudns=0
+      has_ahudns=1
+    fi
+  fi
+])
+
+
+AC_DEFUN(AC_CHECK_AHUDNS,
+[ if test x"$search_ahudns" != x"0"; then
+    if test -f "$1/$2"; then
+      AC_MSG_RESULT($5)
+      AHUDNS_LIBS="$3"
+      AHUDNS_INCLUDES="$4"
+      search_ahudns=0
+      has_ahudns=1
+    fi
+  fi
+])
+
+AC_DEFUN(AC_SEARCH_AHUDNS,
+[ AC_MSG_CHECKING("location of ahudns logger.hh include")
+  AC_CHECK_AHUDNS($HOME/programming/ahudns, logger.hh,,-I$HOME/programming/ahudns, "found in $HOME/programming/ahudns")
+  AC_CHECK_AHUDNS(../ahudns, logger.hh,,-I../ahudns, "found in ../ahudns")
+  AC_CHECK_AHUDNS(../ahudns-1.2, logger.hh,,-I../ahudns-1.2, "found in ../ahudns-1.2")
+])
+
+if test x"$search_ahudns" != x"0"; then
+  AC_SEARCH_AHUDNS()
+fi
+
+if test x"$has_ahudns" = x"1"; then
+       echo Found ahudns include file, assuming working and compliant ahudns
+else
+       echo
+       echo Did not find ahudns include file
+       echo
+       exit 1 
+fi
+
+CPPFLAGS="$CPPFLAGS $AHUDNS_INCLUDES"
+
+
+dnl Checks for library functions.
+
+dnl Check for STL
+AC_CHECK_HEADER(sstream,dontneedstl=1)
+
+if test "$dontneedstl" != "1" 
+then
+search_stl=1
+
+AC_ARG_WITH(stl-includes, [  --with-stl-includes=PATH Specify location of STL headers],
+[ if test x"$withval" = x"no"; then
+    search_stl=0
+  else
+    #if test x"$withval" != x"yes"; then
+    if test -d "$withval"; then
+      STL_INCLUDES="-I$withval"
+      search_stl=0
+      has_stl=1
+    fi
+  fi
+])
+
+
+
+AC_ARG_WITH(stl-libs, [  --with-stl-libs=PATH    Specify location of STL libs],
+[ if test x"$withval" = x"no"; then
+    search_stl=0
+  else
+    #if test x"$withval" != x"yes"; then
+    if test -d "$withval"; then
+      STL_LIBS="$LIBS -L$withval -lstlport_gcc"
+      search_stl=0
+      has_stl=1
+    fi
+  fi
+])
+
+AC_DEFUN(AC_CHECK_STL,
+[ if test x"$search_stl" != x"0"; then
+    if test -f "$1/$2"; then
+      AC_MSG_RESULT($5)
+      STL_LIBS="$3"
+      STL_INCLUDES="$4"
+      search_stl=0
+      has_stl=1
+    fi
+  fi
+])
+
+AC_DEFUN(AC_SEARCH_STL,
+[ AC_MSG_CHECKING("location of sstream")
+  AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
+  AC_CHECK_STL(/usr/include/stlport, sstream, -lstlport_gcc, -I/usr/include/stlport, "found in /usr/include/stlport")
+  AC_CHECK_STL(/usr/include, sstream, -lstlport_gcc,, "found in /usr/include")
+  AC_CHECK_STL(/usr/local/include, sstream, -L/usr/local/lib -lstlport_gcc, -I/usr/local/include, "found in /usr/local")
+  AC_CHECK_STL(/usr/local/include/stl, sstream, -L/usr/local/lib -L/usr/local/lib/stl -lstlport_gcc, -I/usr/local/include/stl, "found in /usr/local/include/stl")
+  AC_CHECK_STL(/home/ahu/download/STLport-4.0/stlport, sstream,-L/home/ahu/download/STLport-4.0/lib/ -lstlport_gcc, -I/home/ahu/download/STLport-4.0/stlport/, "found in /home/ahu/download/STLport-4.0/stlport")
+  AC_CHECK_STL($HOME/STLport-4.0/stlport, sstream,-L$HOME/STLport-4.0/lib/ -lstlport_gcc, -I$HOME/STLport-4.0/stlport/, "found in $HOME/STLport-4.0/stlport")
+])
+
+if test x"$search_stl" != x"0"; then
+  AC_SEARCH_STL()
+fi
+
+if test x"$has_stl" = x"1"; then
+       echo Found sstream include file, assuming working and compliant STL
+else
+       echo
+       echo Did not find sstream include file, this probably means that your STL is not
+       echo compliant - the default gcc libstdc++ isn\'t. Download STLport-4.0 from
+       echo http://www.stlport.org, or use --with-stl-includes and --with-stl-libs
+       echo to specify the location of your STL.
+       echo
+       exit 1 
+fi
+
+CPPFLAGS="$CPPFLAGS $STL_INCLUDES $MYSQLPP_INCLUDES"
+LIBS="$LIBS $STL_LIBS"
+fi
+
+AM_CONFIG_HEADER(config.h)
+AC_OUTPUT(Makefile)
+
diff --git a/modules/pipebackend/backend.pl b/modules/pipebackend/backend.pl
new file mode 100755 (executable)
index 0000000..2a25435
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+# sample PowerDNS Coprocess backend
+#
+
+use strict;
+
+
+$|=1;                                  # no buffering
+
+my $line=<>;
+chomp($line);
+
+unless($line eq "HELO\t1") {
+       print "FAIL\n";
+       print STDERR "Recevied '$line'\n";
+       <>;
+       exit;
+}
+print "OK      Sample backend firing up\n";    # print our banner
+
+while(<>)
+{
+       print STDERR "$$ Received: $_";
+       chomp();
+       my @arr=split(/\t/);
+       if(@arr<6) {
+               print "LOG      PowerDNS sent unparseable line\n";
+               print "FAIL\n";
+               next;
+       }
+
+       my ($type,$qname,$qclass,$qtype,$id,$ip)=split(/\t/);
+
+       if(($qtype eq "A" || $qtype eq "ANY") && $qname eq "webserver.example.com") {
+               print STDERR "$$ Sent A records\n";
+               print "DATA     $qname  $qclass A       3600    -1      1.2.3.4\n";
+               print "DATA     $qname  $qclass A       3600    -1      1.2.3.5\n";
+               print "DATA     $qname  $qclass A       3600    -1      1.2.3.6\n";
+       }
+       elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname eq "www.example.com") {
+               print STDERR "$$ Sent CNAME records\n";
+               print "DATA     $qname  $qclass CNAME   3600    -1      webserver.example.com\n";
+       }
+       elsif($qtype eq "MBOXFW") {
+               print STDERR "$$ Sent MBOXFW records\n";
+               print "DATA     $qname  $qclass MBOXFW  3600    -1      powerdns\@example.com\n";
+       }
+
+
+       print STDERR "$$ End of data\n";
+       print "END\n";
+}
+