Commit 4973e638 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] Merge branch 'trac1870'

parents d41d8af0 0d4a6b6b
......@@ -1099,7 +1099,6 @@ AC_CONFIG_FILES([Makefile
src/bin/dbutil/Makefile
src/bin/dbutil/tests/Makefile
src/bin/dbutil/tests/testdata/Makefile
src/bin/host/Makefile
src/bin/loadzone/Makefile
src/bin/loadzone/tests/correct/Makefile
src/bin/loadzone/tests/error/Makefile
......
Copyright (C) 2012 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.
If using git (not the tarball), build the "configure" file:
autoreconf --install
To then build from source:
./configure
make
You may have to specify the location of BIND 10 header files and
library objects. See configure options by ./configure --help.
SUBDIRS = host
# Make sure macros under m4 will be included
ACLOCAL_AMFLAGS = -I m4
This is the top directory for sample programs that can be developed
using public BIND 10 libraries outside of the BIND 10 project. It's
intended to be built with installed BIND 10 header files and library
objects, so it's not a target of the main build tree, and does not
refer to any other part of the BIND 10 source tree that contains
this directory.
On the top (sub) directory (where this README file is stored), we
provide a sample configure.ac and Makefile.am files for GNU automake
environments with helper autoconf macros to detect the available and
location of BIND 10 header files and library objects.
You can use the configure.ac and Makefile.am files with macros under
the "m4" subdirectory as a template for your own project. The key is
to call the AX_ISC_BIND10 function (as the sample configure.ac does)
from your configure.ac. Then it will check the availability of
necessary stuff and set some corresponding AC variables. You can then
use the resulting variables in your Makefile.in or Makefile.ac.
If you use automake, don't forget adding the following line to the top
level Makefile.am:
ACLOCAL_AMFLAGS = -I m4
This is necessary to incorporate the helper macro definitions.
If you don't use automake but autoconf, make sure to add the following
to the configure.ac file:
sinclude(m4/ax_boost_include.m4)
sinclude(m4/ax_isc_bind10.m4)
(and same for other m4 files as they are added under m4/)
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT(bind10-examples, 20120817, bind10-dev@isc.org)
AC_CONFIG_SRCDIR([README])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])
# Checks for BIND 10 headers and libraries
AX_ISC_BIND10
# For the example host program, we require the BIND 10 DNS library
if test "x$BIND10_DNS_LIB" = "x"; then
AC_MSG_ERROR([unable to find BIND 10 DNS library needed to build 'host'])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_CONFIG_FILES([Makefile
host/Makefile])
AC_OUTPUT
AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(BIND10_CPPFLAGS)
bin_PROGRAMS = b10-host
b10_host_SOURCES = host.cc
b10_host_LDFLAGS = ${BIND10_LDFLAGS}
b10_host_LDADD = ${BIND10_DNS_LIB}
dnl @synopsis AX_BOOST_INCLUDE
dnl
dnl Test for the Boost C++ header files
dnl
dnl If no path to the installed boost header files is given via the
dnl --with-boost-include option, the macro searchs under
dnl /usr/local /usr/pkg /opt /opt/local directories.
dnl
dnl This macro calls:
dnl
dnl AC_SUBST(BOOST_CPPFLAGS)
dnl
AC_DEFUN([AX_BOOST_INCLUDE], [
AC_LANG_SAVE
AC_LANG([C++])
#
# Configure Boost header path
#
# If explicitly specified, use it.
AC_ARG_WITH([boost-include],
AS_HELP_STRING([--with-boost-include=PATH],
[specify exact directory for Boost headers]),
[boost_include_path="$withval"])
# If not specified, try some common paths.
if test -z "$with_boost_include"; then
boostdirs="/usr/local /usr/pkg /opt /opt/local"
for d in $boostdirs
do
if test -f $d/include/boost/shared_ptr.hpp; then
boost_include_path=$d/include
break
fi
done
fi
CPPFLAGS_SAVES="$CPPFLAGS"
if test "${boost_include_path}" ; then
BOOST_CPPFLAGS="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
fi
# Make sure some commonly used headers are available
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/bind.hpp boost/function.hpp],,
AC_MSG_ERROR([Missing required Boost header files.]))
# Detect whether Boost tries to use threads by default, and, if not,
# make it sure explicitly. In some systems the automatic detection
# may depend on preceding header files, and if inconsistency happens
# it could lead to a critical disruption.
AC_MSG_CHECKING([whether Boost tries to use threads])
AC_TRY_COMPILE([
#include <boost/config.hpp>
#ifdef BOOST_HAS_THREADS
#error "boost will use threads"
#endif],,
[AC_MSG_RESULT(no)
CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"],
[AC_MSG_RESULT(yes)])
CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
AC_SUBST(BOOST_CPPFLAGS)
AC_LANG_RESTORE
])dnl AX_BOOST_INCLUDE
dnl @synopsis AX_BIND10
dnl
dnl @summary figure out how to build C++ programs using ISC BIND 10 libraries
dnl
dnl If no path to the installed BIND 10 header files or libraries is given
dnl via the --with-bind10-include or --with-bind10-lib option, the macro
dnl searchs under /usr/local/{include, lib}, /usr/pkg/{include, lib},
dnl /opt/{include, lib}, /opt/local/{include, lib} directories, respectively.
dnl
dnl This macro calls:
dnl
dnl AC_SUBST(BIND10_CPPFLAGS)
dnl AC_SUBST(BIND10_LDFLAGS)
dnl AC_SUBST(BIND10_COMMON_LIB)
dnl AC_SUBST(BIND10_DNS_LIB)
dnl
dnl If this macro finds CPPFLAGS, LDFLAGS or COMMON_LIB unavailable, it treats
dnl that as a fatal error.
dnl Checks for other BIND 10 module libraries are option, as not all
dnl applications need all libraries. The main configure.ac can handle any
dnl missing library as fatal by checking whether the corresponding
dnl BIND10_xxx_LIB is defined.
AC_DEFUN([AX_ISC_BIND10], [
AC_REQUIRE([AX_BOOST_INCLUDE])
AC_LANG_SAVE
AC_LANG([C++])
# Check for BIND10 common headers
AC_ARG_WITH(bind10-include,
AS_HELP_STRING([--with-bind10-include=PATH],
[specify a path to BIND 10 header files]),
bind10_inc_path="$withval", bind10_inc_path="no")
# If not specified, try some common paths.
if test "$bind10_inc_path" = "no"; then
for d in /usr/local /usr/pkg /opt /opt/local
do
if test -f $d/include/util/buffer.h; then
bind10_inc_path=$d
break
fi
done
fi
CPPFLAGS_SAVES="$CPPFLAGS"
if test "${bind10_inc_path}" != "no"; then
BIND10_CPPFLAGS="-I${bind10_inc_path}"
CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS"
fi
AC_CHECK_HEADERS([util/buffer.h],,
AC_MSG_ERROR([Missing a commonly used BIND 10 header files]))
CPPFLAGS="$CPPFLAGS_SAVES"
AC_SUBST(BIND10_CPPFLAGS)
# Check for BIND10 libraries
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS"
AC_ARG_WITH(bind10-lib,
AS_HELP_STRING([--with-bind10-lib=PATH],
[specify a path to BIND 10 library files]),
bind10_lib_path="$withval", bind10_lib_path="no")
if test $bind10_lib_path != "no"; then
bind10_lib_dirs=$bind10_lib_path
else
# If not specified, try some common paths.
bind10_lib_dirs="/usr/local/lib /usr/pkg/lib /opt/lib /opt/local/lib"
fi
# make sure we have buildable libraries
AC_MSG_CHECKING([for BIND 10 common library])
BIND10_COMMON_LIB="-lb10-util -lb10-exceptions"
LDFLAGS="$LDFLAGS $BIND10_LDFLAGS"
LIBS="$LIBS $BIND10_COMMON_LIB"
for d in $bind10_lib_dirs
do
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$d"
AC_TRY_LINK([
#include <util/buffer.h>
],[
isc::util::OutputBuffer buffer(0);
], [BIND10_LDFLAGS="-L${d}"])
if test "x$BIND10_LDFLAGS" != "x"; then
break
fi
LDFLAGS="$LDFLAGS_SAVED"
done
if test "x$BIND10_LDFLAGS" != "x"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([unable to find required BIND 10 libraries])
fi
# restore LIBS once at this point
LIBS="$LIBS_SAVES"
AC_SUBST(BIND10_LDFLAGS)
AC_SUBST(BIND10_COMMON_LIB)
# Check per-module BIND 10 libraries
# DNS library
AC_MSG_CHECKING([for BIND 10 DNS library])
LIBS="$LIBS $BIND10_COMMON_LIB -lb10-dns++"
AC_TRY_LINK([
#include <dns/rrtype.h>
],[
isc::dns::RRType rrtype(1);
], [BIND10_DNS_LIB="-lb10-dns++"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_SAVES"
AC_SUBST(BIND10_DNS_LIB)
# Restore other flags
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVES"
AC_LANG_RESTORE
])dnl AX_ISC_BIND10
SUBDIRS = bind10 bindctl cfgmgr ddns loadzone msgq host cmdctl auth xfrin \
SUBDIRS = bind10 bindctl cfgmgr ddns loadzone msgq cmdctl auth xfrin \
xfrout usermgr zonemgr stats tests resolver sockcreator dhcp4 dhcp6 \
dbutil sysinfo
......
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 += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
CLEANFILES = *.gcno *.gcda
bin_PROGRAMS = b10-host
b10_host_SOURCES = host.cc
b10_host_LDADD = $(top_builddir)/src/lib/dns/libb10-dns++.la
b10_host_LDADD += $(top_builddir)/src/lib/util/libb10-util.la
b10_host_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
man_MANS = b10-host.1
DISTCLEANFILES = $(man_MANS)
EXTRA_DIST = $(man_MANS) b10-host.xml
.PHONY: man
if GENERATE_DOCS
man: b10-host.1
b10-host.1: b10-host.xml
@XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/b10-host.xml
else
$(man_MANS):
@echo Man generation disabled. Creating dummy $@. Configure with --enable-generate-docs to enable it.
@echo Man generation disabled. Remove this file, configure with --enable-generate-docs, and rebuild BIND 10 > $@
endif
......@@ -149,11 +149,11 @@ libdns___include_HEADERS = \
messagerenderer.h \
name.h \
question.h \
opcode.h \
rcode.h \
rdata.h \
rrparamregistry.h \
rrset.h \
rrsetlist.h \
rrttl.h \
tsigkey.h
# Purposely not installing these headers:
......
......@@ -33,3 +33,6 @@ EXTRA_DIST = python/pycppwrapper_util.h
libb10_util_la_LIBADD = $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
CLEANFILES = *.gcno *.gcda
libb10_util_includedir = $(includedir)/$(PACKAGE_NAME)/util
libb10_util_include_HEADERS = buffer.h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment