[svn] commit: r1617 - in /trunk: ./ src/bin/auth/ src/bin/auth/tests/ src/bin/host/ src/bin/xfrin/ src/lib/auth/ src/lib/auth/tests/ src/lib/cc/ src/lib/config/ src/lib/config/tests/ src/lib/dns/ src/lib/dns/tests/

BIND 10 source code commits bind10-changes at lists.isc.org
Sat Mar 20 22:50:15 UTC 2010


Author: jinmei
Date: Sat Mar 20 22:50:15 2010
New Revision: 1617

Log:
allow the python binding of libdns to be built using automake.
additional related cleanups were made as well.

Added:
    trunk/src/lib/dns/python_dns.cc
      - copied, changed from r1611, trunk/src/lib/dns/message_python.cc
Removed:
    trunk/src/lib/dns/Makefile.dat
    trunk/src/lib/dns/message_python.cc
Modified:
    trunk/configure.ac
    trunk/src/bin/auth/Makefile.am
    trunk/src/bin/auth/main.cc
    trunk/src/bin/auth/tests/Makefile.am
    trunk/src/bin/host/Makefile.am
    trunk/src/bin/xfrin/xfrin.py.in
    trunk/src/lib/auth/Makefile.am
    trunk/src/lib/auth/tests/Makefile.am
    trunk/src/lib/cc/Makefile.am
    trunk/src/lib/cc/session.cc
    trunk/src/lib/config/Makefile.am
    trunk/src/lib/config/ccsession.cc
    trunk/src/lib/config/tests/Makefile.am
    trunk/src/lib/config/tests/fake_session.cc
    trunk/src/lib/dns/Makefile.am
    trunk/src/lib/dns/buffer.h
    trunk/src/lib/dns/message_test.py
    trunk/src/lib/dns/tests/Makefile.am

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sat Mar 20 22:50:15 2010
@@ -44,6 +44,24 @@
 	AC_SUBST(pkgpyexecdir)
 fi
 
+PYTHON_INCLUDES=`${PYTHON}-config --includes`
+AC_SUBST(PYTHON_INCLUDES)
+for flag in `${PYTHON}-config --ldflags`; do
+	PYTHON_LDFLAGS="$PYTHON_LDFLAGS `echo $flag | sed -ne 's/^\(\-L.*\)$/\1/p'`"
+done
+AC_SUBST(PYTHON_LDFLAGS)
+
+# Check for python library (not absolutely mandatory, but needed for
+# Boost.Python when we use it.  See below.)
+LDFLAGS_SAVED="$LDFLAGS"
+LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
+python_bin="python${PYTHON_VERSION}"
+AC_CHECK_LIB($python_bin, main, python_lib=$python_bin, python_lib=no)
+if test $python_lib != "no"; then
+	PYTHON_LIB="-l$python_lib"
+fi
+AC_SUBST(PYTHON_LIB)
+
 # TODO: check for _sqlite3.py module
 
 # default compiler warning settings
@@ -139,25 +157,29 @@
     [specify exact directory for Boost headers]),
     [boost_include_path="$withval"])
 if test "${boost_include_path}" ; then
-  CPPFLAGS="$CPPFLAGS -I${boost_include_path}"
-else
-# abs_top_srcdir not defined yet
-# so this is only useful to check but not to use later
-  CPPFLAGS="$CPPFLAGS -Iext"
-fi
+	BOOST_INCLUDES="-I${boost_include_path}"
+	CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
+fi
+AC_SUBST(BOOST_INCLUDES)
+
+AC_ARG_WITH([boost-lib],
+AC_HELP_STRING([--with-boost-lib=PATH],
+  [specify exact directory for Boost libraries]),
+  [boostlib_path="$withval"], [boostlib_path="auto"])
+if test "$boostlib_path" != "no"; then
+	BOOST_LDFLAGS="-L$boostlib_path"
+fi
+AC_SUBST(BOOST_LDFLAGS)
 
 # Check availability of the Boost System library
 
 AC_MSG_CHECKING([for boost::system library])
-AC_ARG_WITH([boostlib],
-AC_HELP_STRING([--with-boostlib=PATH],
-  [specify a path to boost libraries if it is not automatically found, or "no" to disable it]),
-  [boostlib_path="$withval"], [boostlib_path="auto"])
-if test "$boostlib_path" != "no" -a "$boostlib_path" != "auto" -a "$boostlib_path" != "yes"; then
-	BOOST_LDFLAGS="-L$boostlib_path"
-fi
-
-if test "$boostlib_path" != "no"; then
+AC_ARG_WITH([boost-system],
+AC_HELP_STRING([--with-boost-system],
+  [specify whether to use the boost system library]),
+  [with_boost_system="$withval"], [with_boost_system="auto"])
+
+if test "$with_boost_system" != "no"; then
 	LDFLAGS_SAVED="$LDFLAGS"
 	LIBS_SAVED="$LIBS"
 	CPPFLAGS_SAVED="$CPPFLAGS"
@@ -185,13 +207,63 @@
 
 if test "X${BOOST_SYSTEM_LIB}" = X; then
 	AC_MSG_RESULT(no)
+	if test "$with_boost_system" = "yes"; then
+	   AC_MSG_ERROR([boost system library is requested but not found])
+	fi
 else
-	AC_DEFINE(HAVE_BOOSTLIB, 1, Define to 1 if boost libraries are available)
-fi
-
-AM_CONDITIONAL(HAVE_BOOSTLIB, test "X${BOOST_SYSTEM_LIB}" != X)
-AC_SUBST(BOOST_LDFLAGS)
+	AC_DEFINE(HAVE_BOOST_SYSTEM, 1, Define to 1 if boost system library is available)
+fi
+
+AM_CONDITIONAL(HAVE_BOOST_SYSTEM, test "X${BOOST_SYSTEM_LIB}" != X)
 AC_SUBST(BOOST_SYSTEM_LIB)
+
+# Check availability of the Boost Python library
+
+AC_MSG_CHECKING([for boost::python library])
+AC_ARG_WITH([boost-python],
+AC_HELP_STRING([--with-boost-python],
+  [specify whether to use the boost python library]),
+  [with_boost_python="$withval"], [with_boost_python="auto"])
+if test "$with_boost_python" != "no"; then
+	if test "$with_boost_python" != "auto" -a "X$PYTHON_LIB" = X; then
+		AC_MSG_ERROR([Boost.Python requested but python library is not available])
+	fi
+	LDFLAGS_SAVED="$LDFLAGS"
+	LIBS_SAVED="$LIBS"
+	CPPFLAGS_SAVED="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+
+	for BOOST_TRY_LIB in boost_python boost_python-mt; do
+		LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS} ${PYTHON_LDFLAGS}"
+		LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB} ${PYTHON_LIB}"
+		AC_TRY_LINK([#include <boost/python/module.hpp>
+	      using namespace boost::python;
+	      BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }],
+			[ return 0; ],
+			[ AC_MSG_RESULT(yes)
+			BOOST_PYTHON_LIB="-l${BOOST_TRY_LIB}"
+			],[])
+		if test "X${BOOST_PYTHON_LIB}" != X; then
+        		break
+		fi
+	done
+
+	LDFLAGS="$LDFLAGS_SAVED"
+	CPPFLAGS="$CPPFLAGS_SAVED"
+	LIBS="$LIBS_SAVED"
+fi
+
+if test "X${BOOST_PYTHON_LIB}" = X; then
+	AC_MSG_RESULT(no)
+	if test "$with_boost_python" = "yes"; then
+	   AC_MSG_ERROR([boost python library is requested but not found])
+	fi
+else
+	AC_DEFINE(HAVE_BOOST_PYTHON, 1, Define to 1 if boost python library is available)
+fi
+
+AM_CONDITIONAL(HAVE_BOOST_PYTHON, test "X${BOOST_PYTHON_LIB}" != X)
+AC_SUBST(BOOST_PYTHON_LIB)
 
 #
 # Check availability of gtest, which will be used for unit tests.
@@ -248,8 +320,18 @@
 
 # Check for headers from required devel kits.
 # boost/shared_ptr.hpp is in ext in svn but not in tarball.
+CPPFLAGS_SAVED=$CPPFLAGS
+if test "X$BOOST_INCLUDES" = "X"; then
+	# abs_top_srcdir not defined yet
+	# so this is only useful to check.  We'll replace it after the check.
+	CPPFLAGS="$CPPFLAGS -Iext"
+fi
 AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
   AC_MSG_ERROR([Missing required header files.]))
+CPPFLAGS=$CPPFLAGS_SAVED
+if test "X$BOOST_INCLUDES" = "X"; then
+	CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext"
+fi
 
 AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
   [regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)

Modified: trunk/src/bin/auth/Makefile.am
==============================================================================
--- trunk/src/bin/auth/Makefile.am (original)
+++ trunk/src/bin/auth/Makefile.am Sat Mar 20 22:50:15 2010
@@ -2,7 +2,6 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
-AM_CPPFLAGS += -I$(top_srcdir)/ext  
 if GCC_WERROR_OK
 AM_CPPFLAGS += -Werror
 endif
@@ -34,7 +33,7 @@
 b10_auth_LDADD += $(top_builddir)/src/lib/cc/libcc.a
 b10_auth_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
 b10_auth_LDADD += $(SQLITE_LIBS)
-if HAVE_BOOSTLIB
+if HAVE_BOOST_SYSTEM
 b10_auth_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS)
 b10_auth_LDADD += $(BOOST_SYSTEM_LIB)
 endif

Modified: trunk/src/bin/auth/main.cc
==============================================================================
--- trunk/src/bin/auth/main.cc (original)
+++ trunk/src/bin/auth/main.cc Sat Mar 20 22:50:15 2010
@@ -28,10 +28,10 @@
 #include <iostream>
 
 #include <boost/foreach.hpp>
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 #include <boost/bind.hpp>
 #include <boost/asio.hpp>
-#endif  // HAVE_BOOSTLIB
+#endif  // HAVE_BOOST_SYSTEM
 
 #include <exceptions/exceptions.h>
 
@@ -49,11 +49,11 @@
 
 using namespace std;
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 using namespace boost::asio;
 using ip::udp;
 using ip::tcp;
-#endif  // HAVE_BOOSTLIB
+#endif  // HAVE_BOOST_SYSTEM
 
 using namespace isc::data;
 using namespace isc::cc;
@@ -71,13 +71,13 @@
  * todo: turn this around, and put handlers in the authserver
  * class itself? */
 AuthSrv *auth_server;
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 // TODO: this should be a property of AuthSrv, and AuthSrv needs
 // a stop() method (so the shutdown command can be handled)
 boost::asio::io_service io_service_;
 #else
 bool running;
-#endif  // HAVE_BOOSTLIB
+#endif  // HAVE_BOOST_SYSTEM
 
 ElementPtr
 my_config_handler(ElementPtr new_config) {
@@ -93,17 +93,17 @@
         /* let's add that message to our answer as well */
         answer->get("result")->add(args);
     } else if (command == "shutdown") {
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
         io_service_.stop();
 #else
         running = false;
-#endif  // HAVE_BOOSTLIB
+#endif  // HAVE_BOOST_SYSTEM
     }
     
     return answer;
 }
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 //
 // Helper classes for asynchronous I/O using boost::asio
 //
@@ -349,7 +349,7 @@
     cout << "Server started." << endl;
     io_service_.run();
 }
-#else  // !HAVE_BOOSTLIB
+#else  // !HAVE_BOOST_SYSTEM
 struct SocketSet {
     SocketSet() : ups4(-1), tps4(-1), ups6(-1), tps6(-1) {}
     ~SocketSet() {
@@ -638,7 +638,7 @@
         }
     }
 }
-#endif // HAVE_BOOSTLIB
+#endif // HAVE_BOOST_SYSTEM
 
 void
 usage() {
@@ -701,7 +701,7 @@
         auth_server = new AuthSrv;
         auth_server->setVerbose(verbose_mode);
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
         ModuleCCSession cs(specfile, io_service_, my_config_handler,
                            my_command_handler);
 #else

Modified: trunk/src/bin/auth/tests/Makefile.am
==============================================================================
--- trunk/src/bin/auth/tests/Makefile.am (original)
+++ trunk/src/bin/auth/tests/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/bin -I$(top_srcdir)/ext
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/bin
 
 CLEANFILES = *.gcno *.gcda
 
@@ -19,7 +19,7 @@
 run_unittests_LDADD += $(top_builddir)/src/lib/config/.libs/libcfgclient.a
 run_unittests_LDADD += $(top_builddir)/src/lib/cc/libcc.a
 run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/.libs/libexceptions.a
-if HAVE_BOOSTLIB
+if HAVE_BOOST_SYSTEM
 run_unittests_LDFLAGS += $(BOOST_LDFLAGS)
 run_unittests_LDADD += $(BOOST_SYSTEM_LIB)
 endif

Modified: trunk/src/bin/host/Makefile.am
==============================================================================
--- trunk/src/bin/host/Makefile.am (original)
+++ trunk/src/bin/host/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,6 +1,5 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
-AM_CPPFLAGS += -I$(top_srcdir)/ext
 
 CLEANFILES = *.gcno *.gcda
 

Modified: trunk/src/bin/xfrin/xfrin.py.in
==============================================================================
--- trunk/src/bin/xfrin/xfrin.py.in (original)
+++ trunk/src/bin/xfrin/xfrin.py.in Sat Mar 20 22:50:15 2010
@@ -28,7 +28,7 @@
 from optparse import OptionParser, OptionValueError
 from isc.config.ccsession import *
 try:
-    from bind10_message import *
+    from bind10_dns import *
 except:
     pass
 
@@ -399,8 +399,8 @@
     def xfrin_start(self, zone_name, db_file, master_addr, 
                     port = 53, 
                     check_soa = True):
-        if "bind10_message" not in sys.modules:
-            return (1, "xfrin failed, can't load dns message python library: 'bind10_message'")
+        if "bind10_dns" not in sys.modules:
+            return (1, "xfrin failed, can't load dns message python library: 'bind10_dns'")
 
         # check max_transfer_in, else return quota error
         if self.recorder.count() >= self._max_transfers_in:

Modified: trunk/src/lib/auth/Makefile.am
==============================================================================
--- trunk/src/lib/auth/Makefile.am (original)
+++ trunk/src/lib/auth/Makefile.am Sat Mar 20 22:50:15 2010
@@ -2,7 +2,7 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
-AM_CPPFLAGS += -I$(top_srcdir)/ext $(SQLITE_CFLAGS)
+AM_CPPFLAGS += $(SQLITE_CFLAGS)
 
 CLEANFILES = *.gcno *.gcda
 

Modified: trunk/src/lib/auth/tests/Makefile.am
==============================================================================
--- trunk/src/lib/auth/tests/Makefile.am (original)
+++ trunk/src/lib/auth/tests/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/ext
+AM_CPPFLAGS = -I$(top_builddir)/src/lib
 
 CLEANFILES = *.gcno *.gcda
 

Modified: trunk/src/lib/cc/Makefile.am
==============================================================================
--- trunk/src/lib/cc/Makefile.am (original)
+++ trunk/src/lib/cc/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,5 +1,4 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
-AM_CPPFLAGS += -I$(top_srcdir)/ext
 
 lib_LIBRARIES = libcc.a
 libcc_a_SOURCES = data.cc data.h session.cc session.h

Modified: trunk/src/lib/cc/session.cc
==============================================================================
--- trunk/src/lib/cc/session.cc (original)
+++ trunk/src/lib/cc/session.cc Sat Mar 20 22:50:15 2010
@@ -23,7 +23,7 @@
 #include <iostream>
 #include <sstream>
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
 #include <boost/asio.hpp>
@@ -38,7 +38,7 @@
 using namespace isc::cc;
 using namespace isc::data;
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 // some of the boost::asio names conflict with socket API system calls
 // (e.g. write(2)) so we don't import the entire boost::asio namespace.
 using boost::asio::io_service;
@@ -68,7 +68,7 @@
     std::string lname_;
 };
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 class ASIOSession : public SessionImpl {
 public:
     ASIOSession(io_service& io_service) :
@@ -270,7 +270,7 @@
 Session::Session() : impl_(new SocketSession)
 {}
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 Session::Session(io_service& io_service) : impl_(new ASIOSession(io_service))
 {}
 #endif

Modified: trunk/src/lib/config/Makefile.am
==============================================================================
--- trunk/src/lib/config/Makefile.am (original)
+++ trunk/src/lib/config/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,5 +1,4 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib -Wno-strict-aliasing
-AM_CPPFLAGS += -I$(top_srcdir)/ext
 
 lib_LTLIBRARIES = libcfgclient.la
 libcfgclient_la_SOURCES = config_data.h config_data.cc module_spec.h module_spec.cc ccsession.cc ccsession.h

Modified: trunk/src/lib/config/ccsession.cc
==============================================================================
--- trunk/src/lib/config/ccsession.cc (original)
+++ trunk/src/lib/config/ccsession.cc Sat Mar 20 22:50:15 2010
@@ -32,7 +32,7 @@
 #include <sstream>
 #include <cerrno>
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 #include <boost/bind.hpp>
 #endif
 #include <boost/foreach.hpp>
@@ -188,7 +188,7 @@
     return module_spec;
 }
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 void
 ModuleCCSession::startCheck() {
     // data available on the command channel.  process it in the synchronous

Modified: trunk/src/lib/config/tests/Makefile.am
==============================================================================
--- trunk/src/lib/config/tests/Makefile.am (original)
+++ trunk/src/lib/config/tests/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/ext
+AM_CPPFLAGS = -I$(top_builddir)/src/lib
 
 CLEANFILES = *.gcno *.gcda
 
@@ -18,7 +18,7 @@
 run_unittests_LDADD += $(top_builddir)/src/lib/cc/data.o
 run_unittests_LDADD += libfake_session.la
 
-if HAVE_BOOSTLIB
+if HAVE_BOOST_SYSTEM
 run_unittests_LDFLAGS += $(AM_LDFLAGS) $(BOOST_LDFLAGS)
 run_unittests_LDADD += $(BOOST_SYSTEM_LIB)
 endif

Modified: trunk/src/lib/config/tests/fake_session.cc
==============================================================================
--- trunk/src/lib/config/tests/fake_session.cc (original)
+++ trunk/src/lib/config/tests/fake_session.cc Sat Mar 20 22:50:15 2010
@@ -23,7 +23,7 @@
 #include <iostream>
 #include <sstream>
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 #include <boost/bind.hpp>
 #include <boost/function.hpp>
 #include <boost/asio.hpp>
@@ -40,7 +40,7 @@
 using namespace isc::cc;
 using namespace isc::data;
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 // some of the boost::asio names conflict with socket API system calls
 // (e.g. write(2)) so we don't import the entire boost::asio namespace.
 using boost::asio::io_service;
@@ -144,7 +144,7 @@
 {
 }
 
-#ifdef HAVE_BOOSTLIB
+#ifdef HAVE_BOOST_SYSTEM
 Session::Session(io_service& io_service UNUSED_PARAM)
 {
 }

Modified: trunk/src/lib/dns/Makefile.am
==============================================================================
--- trunk/src/lib/dns/Makefile.am (original)
+++ trunk/src/lib/dns/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,7 +1,6 @@
 SUBDIRS = . tests
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
-AM_CPPFLAGS += -I$(top_srcdir)/ext
 if GCC_WERROR_OK
 AM_CPPFLAGS += -Werror
 endif
@@ -59,23 +58,46 @@
 #TODO: check this###BUILT_SOURCES = rdataclass.h rdataclass.cc
 
 lib_LTLIBRARIES = libdns.la
-libdns_la_SOURCES = buffer.h name.cc name.h messagerenderer.h messagerenderer.cc
+
+libdns_la_SOURCES = base32.h base32.cc
+libdns_la_SOURCES += base64.h base64.cc
+libdns_la_SOURCES += buffer.h
+libdns_la_SOURCES += dnssectime.h dnssectime.cc
 libdns_la_SOURCES += exceptions.h exceptions.cc
-libdns_la_SOURCES += rrparamregistry.h
-libdns_la_SOURCES += rrclass.cc
-libdns_la_SOURCES += rrtype.cc
-libdns_la_SOURCES += rrttl.h rrttl.cc
+libdns_la_SOURCES += hex.h hex.cc
+libdns_la_SOURCES += message.h message.cc
+libdns_la_SOURCES += messagerenderer.h messagerenderer.cc
+libdns_la_SOURCES += name.h name.cc
 libdns_la_SOURCES += rdata.h rdata.cc
+libdns_la_SOURCES += rrclass.h rrclass.cc
 libdns_la_SOURCES += rrset.h rrset.cc
 libdns_la_SOURCES += rrsetlist.h rrsetlist.cc
+libdns_la_SOURCES += rrttl.h rrttl.cc
+libdns_la_SOURCES += rrtype.h rrtype.cc
 libdns_la_SOURCES += question.h question.cc
-libdns_la_SOURCES += message.h message.cc
-libdns_la_SOURCES += base32.h base32.cc
-libdns_la_SOURCES += base64.h base64.cc
 libdns_la_SOURCES += sha1.h sha1.cc
 libdns_la_SOURCES += tsig.h tsig.cc
-libdns_la_SOURCES += dnssectime.h dnssectime.cc
-libdns_la_SOURCES += hex.h hex.cc
+
+if HAVE_BOOST_PYTHON
+# This is a loadable module for python scripts, so we use the prefix "pyexec"
+# to make sure the object files will be installed in the appropriate place
+# for this purpose.
+pyexec_LTLIBRARIES = bind10_dns.la
+bind10_dns_la_SOURCES = python_dns.cc
+bind10_dns_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
+if GCC_WERROR_OK
+# XXX: Boost.Python triggers strict aliasing violation, so if we use -Werror
+# we need to suppress the warnings.
+bind10_dns_la_CPPFLAGS += -fno-strict-aliasing
+endif
+bind10_dns_la_LDFLAGS = $(BOOST_LDFLAGS) $(PYTHON_LDFLAGS)
+# Python prefers .so, while some OSes (specifically MacOS) use a different
+# suffix for dynamic objects.  -module is necessary to work this around.
+bind10_dns_la_LDFLAGS += -module
+bind10_dns_la_LIBADD = $(top_builddir)/src/lib/dns/libdns.la
+bind10_dns_la_LIBADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
+bind10_dns_la_LIBADD += $(BOOST_PYTHON_LIB) $(PYTHON_LIB)
+endif
 
 nodist_libdns_la_SOURCES = rrparamregistry.cc
 nodist_libdns_la_SOURCES += rdataclass.cc

Modified: trunk/src/lib/dns/buffer.h
==============================================================================
--- trunk/src/lib/dns/buffer.h (original)
+++ trunk/src/lib/dns/buffer.h Sat Mar 20 22:50:15 2010
@@ -207,6 +207,11 @@
 
 private:
     size_t position_;
+
+    // XXX: The following must be private, but for a short term workaround with
+    // Boost.Python binding, we changed it to protected.  We should soon
+    // revisit it.
+protected:
     const uint8_t* data_;
     size_t len_;
 };

Modified: trunk/src/lib/dns/message_test.py
==============================================================================
--- trunk/src/lib/dns/message_test.py (original)
+++ trunk/src/lib/dns/message_test.py Sat Mar 20 22:50:15 2010
@@ -1,4 +1,5 @@
-from bind10_message import *
+import sys; sys.path.append ('/Users/jinmei/opt/lib/python3.1/site-packages')
+from bind10_dns import *
 from struct import *
 
 id = ["10","35"]

Modified: trunk/src/lib/dns/tests/Makefile.am
==============================================================================
--- trunk/src/lib/dns/tests/Makefile.am (original)
+++ trunk/src/lib/dns/tests/Makefile.am Sat Mar 20 22:50:15 2010
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/ext
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_builddir)/src/lib
 
 CLEANFILES = *.gcno *.gcda
 




More information about the bind10-changes mailing list