AC_SUBST(PYTHON_LIB)
LDFLAGS=$LDFLAGS_SAVED
+# Python 3.2 changed the return type of internal hash function to
+# Py_hash_t and some platforms (such as Solaris) strictly check for long
+# vs Py_hash_t. So we detect and use the appropriate return type.
+# Remove this test (and associated changes in pydnspp_config.h.in) when
+# we require Python 3.2.
+have_py_hash_t=0
+CPPFLAGS_SAVED="$CPPFLAGS"
+CPPFLAGS=${PYTHON_INCLUDES}
+AC_MSG_CHECKING(for Py_hash_t)
+AC_TRY_COMPILE([#include <Python.h>
+ Py_hash_t h;],,
+ [AC_MSG_RESULT(yes)
+ have_py_hash_t=1],
+ [AC_MSG_RESULT(no)])
+CPPFLAGS="$CPPFLAGS_SAVED"
+HAVE_PY_HASH_T=$have_py_hash_t
+AC_SUBST(HAVE_PY_HASH_T)
+
# Check for the setproctitle module
if test "$setproctitle_check" = "yes" ; then
AC_MSG_CHECKING(for setproctitle module)
src/lib/dns/gen-rdatacode.py
src/lib/dns/Makefile
src/lib/dns/python/Makefile
+ src/lib/dns/python/pydnspp_config.h
src/lib/dns/python/tests/Makefile
src/lib/dns/tests/Makefile
src/lib/dns/tests/testdata/Makefile
/rrclass_constants_inc.cc
/rrtype_constants_inc.cc
+/pydnspp_config.h
AM_CXXFLAGS = $(B10_CXXFLAGS)
lib_LTLIBRARIES = libb10-pydnspp.la
-libb10_pydnspp_la_SOURCES = pydnspp_common.cc pydnspp_common.h pydnspp_towire.h
+libb10_pydnspp_la_SOURCES = pydnspp_common.cc pydnspp_common.h
+libb10_pydnspp_la_SOURCES += pydnspp_config.h pydnspp_towire.h
libb10_pydnspp_la_SOURCES += name_python.cc name_python.h
libb10_pydnspp_la_SOURCES += nsec3hash_python.cc nsec3hash_python.h
libb10_pydnspp_la_SOURCES += rrset_python.cc rrset_python.h
#ifndef LIBDNS_PYTHON_COMMON_H
#define LIBDNS_PYTHON_COMMON_H 1
+#include <dns/python/pydnspp_config.h>
+
#include <Python.h>
#include <boost/static_assert.hpp>
/// \return true on success, false on failure
bool initClass(PyTypeObject& type, const char* name, PyObject* mod);
-// Short term workaround for unifying the return type of tp_hash
-#if PY_MINOR_VERSION < 2
-typedef long Py_hash_t;
-#endif
-
/// \brief Convert a hash value of arbitrary type to a Python hash value.
///
/// This templated function is a convenient wrapper to produce a valid hash
--- /dev/null
+// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef LIBDNS_PYTHON_CONFIG_H
+#define LIBDNS_PYTHON_CONFIG_H 1
+
+// Short term workaround for unifying the return type of tp_hash.
+// Remove this test (and associated changes in configure.ac) when we
+// require Python 3.2.
+#if (!(@HAVE_PY_HASH_T@))
+typedef long Py_hash_t;
+#endif
+
+#endif // LIBDNS_PYTHON_CONFIG_H