BIND 10 master, updated. 36514ddc884c02a063e166d44319467ce6fb1d8f [master] Merge remote-tracking branch 'origin/trac2356'
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Nov 5 22:45:22 UTC 2012
The branch, master has been updated
via 36514ddc884c02a063e166d44319467ce6fb1d8f (commit)
via 18520152ce6097c22024bca864ec53643be3ef84 (commit)
via 1f2f8e9d497246e335dcbb9604521eb70ccd4524 (commit)
via f2b5789e89f48e5a045f8c921f09b5c3caddea3a (commit)
via d12d0c3368d26ab81c5a3c63bad696ee2282530f (commit)
via 8df24b61c35bf2e4963c195e1c927980e16c4a9c (commit)
via 9f360b39c79ef71edb474fb6fe443ff30b479fb6 (commit)
via 5e97750478c1a655d85107bbbda556c8e8bcfec0 (commit)
via b1f95f0359a425b9d758cfacffc75a4517fb342f (commit)
via 82c05da76c188848bb0c0fa2e93c0e90178b5008 (commit)
via 5ee9df691d301f7a6b3c422013336f229292da35 (commit)
via 240c5dfdc3f777eb49b41423dbaec2f9479c4eb6 (commit)
from c19c1fff5013cec501f7c36fe272ecf2bc65d695 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 36514ddc884c02a063e166d44319467ce6fb1d8f
Merge: c19c1ff 1852015
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Mon Nov 5 14:37:29 2012 -0800
[master] Merge remote-tracking branch 'origin/trac2356'
-----------------------------------------------------------------------
Summary of changes:
Makefile.am | 2 +-
configure.ac | 30 ++++++-------------------
examples/README | 15 +++++++++++++
examples/configure.ac | 7 ++++++
examples/m4/ax_boost_include.m4 | 4 ++--
examples/m4/ax_isc_bind10.m4 | 40 +++++++++++++++++++++++-----------
examples/m4/ax_isc_rpath.m4 | 46 +++++++++++++++++++++++++++++++++++++++
7 files changed, 105 insertions(+), 39 deletions(-)
create mode 100644 examples/m4/ax_isc_rpath.m4
-----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 1ed0d63..2f3ce85 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
+ACLOCAL_AMFLAGS = -I m4macros -I examples/m4 ${ACLOCAL_FLAGS}
# ^^^^^^^^ This has to be the first line and cannot come later in this
# Makefile.am due to some bork in some versions of autotools.
diff --git a/configure.ac b/configure.ac
index a037fdf..754d667 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,25 +64,9 @@ AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
# Linker options
-# check -R and -Wl,-R rather than gcc specific -rpath to be as portable
-# as possible.
-AC_MSG_CHECKING([whether -R flag is available in linker])
-LDFLAGS_SAVED="$LDFLAGS"
-LDFLAGS="$LDFLAGS -R/usr/lib"
-AC_TRY_LINK([],[],
- [ AC_MSG_RESULT(yes)
- rpath_flag=-R
- ],[ AC_MSG_RESULT(no)
- AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
- LDFLAGS="$LDFLAGS_SAVED -Wl,-R"
- AC_TRY_LINK([], [],
- [ AC_MSG_RESULT(yes)
- rpath_flag=-Wl,-R
- ],[ AC_MSG_RESULT(no)
- rpath_flag=no
- ])
- ])
-LDFLAGS=$LDFLAGS_SAVED
+# check -R, "-Wl,-R" or -rpath (we share the AX function defined in
+# examples/m4)
+AX_ISC_RPATH
# Compiler dependent settings: define some mandatory CXXFLAGS here.
# We also use a separate variable B10_CXXFLAGS. This will (and should) be
@@ -332,10 +316,10 @@ fi
# modules, we embed the path to the modules when possible. We do this even
# when the path is known in the common operational environment (e.g. when
# it's stored in a common "hint" file) for simplicity.
-if test $rpath_flag != no; then
+if test "x$ISC_RPATH_FLAG" != "x"; then
python_rpath=
for flag in ${PYTHON_LDFLAGS}; do
- python_rpath="${python_rpath} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
+ python_rpath="${python_rpath} `echo $flag | sed -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
done
PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
fi
@@ -701,10 +685,10 @@ for flag in ${BOTAN_LIBS}; do
done
# See python_rpath for some info on why we do this
-if test $rpath_flag != no; then
+if test "x$ISC_RPATH_FLAG" != "x"; then
BOTAN_RPATH=
for flag in ${BOTAN_LIBS}; do
- BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne "s/^\(\-L\)/${rpath_flag}/p"`"
+ BOTAN_RPATH="${BOTAN_RPATH} `echo $flag | sed -ne "s/^\(\-L\)/${ISC_RPATH_FLAG}/p"`"
done
AC_SUBST(BOTAN_RPATH)
diff --git a/examples/README b/examples/README
index 65f777b..08f53fa 100644
--- a/examples/README
+++ b/examples/README
@@ -30,3 +30,18 @@ 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/)
+
+On some systems, espeically if you have installed the BIND 10
+libraries in an uncommon path, programs linked with the BIND 10
+library may not work at run time due to the "missing" shared library.
+Normally, you should be able to avoid this problem by making sure
+to invoking the program explicitly specifying the path to the library,
+e.g., "LD_LIBRARY_PATH=/usr/local/lib/bind10 ./my_bind10_app", or
+you may not even notice the issue if you have installed BIND 10
+library in a common library path on your system (sometimes you may
+still need to run ldconfig(8) beforehand). Another option is to embed
+the path to the library in your program. While this approach is
+controversial, and some people rather choose the alternatives, we
+provide a helper tool in case you want to use this option: see the
+lines using BIND10_RPATH in the sample configure.ac file of this
+directory.
diff --git a/examples/configure.ac b/examples/configure.ac
index 9379687..ef9cce0 100644
--- a/examples/configure.ac
+++ b/examples/configure.ac
@@ -14,6 +14,13 @@ AC_LANG([C++])
# Checks for BIND 10 headers and libraries
AX_ISC_BIND10
+# We use -R, -rpath etc so the resulting program will be more likekly to
+# "just work" by default. Embedding a specific library path is a controversial
+# practice, though; if you don't like it you can remove the following setting.
+if test "x$BIND10_RPATH" != "x"; then
+ LDFLAGS="$LDFLAGS $BIND10_RPATH"
+fi
+
# 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'])
diff --git a/examples/m4/ax_boost_include.m4 b/examples/m4/ax_boost_include.m4
index e41614d..77d19ca 100644
--- a/examples/m4/ax_boost_include.m4
+++ b/examples/m4/ax_boost_include.m4
@@ -34,7 +34,7 @@ if test -z "$with_boost_include"; then
fi
done
fi
-CPPFLAGS_SAVES="$CPPFLAGS"
+CPPFLAGS_SAVED="$CPPFLAGS"
if test "${boost_include_path}" ; then
BOOST_CPPFLAGS="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
@@ -57,7 +57,7 @@ AC_TRY_COMPILE([
CPPFLAGS_BOOST_THREADCONF="-DBOOST_DISABLE_THREADS=1"],
[AC_MSG_RESULT(yes)])
-CPPFLAGS="$CPPFLAGS_SAVES $CPPFLAGS_BOOST_THREADCONF"
+CPPFLAGS="$CPPFLAGS_SAVED $CPPFLAGS_BOOST_THREADCONF"
AC_SUBST(BOOST_CPPFLAGS)
AC_LANG_RESTORE
diff --git a/examples/m4/ax_isc_bind10.m4 b/examples/m4/ax_isc_bind10.m4
index 63e028c..75c37c5 100644
--- a/examples/m4/ax_isc_bind10.m4
+++ b/examples/m4/ax_isc_bind10.m4
@@ -1,4 +1,4 @@
-dnl @synopsis AX_BIND10
+dnl @synopsis AX_ISC_BIND10
dnl
dnl @summary figure out how to build C++ programs using ISC BIND 10 libraries
dnl
@@ -20,9 +20,18 @@ 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.
+dnl
+dnl In addition, it sets the BIND10_RPATH variable to a usable linker option
+dnl to embed the path to the BIND 10 library to the programs that are to be
+dnl linked with the library. If the developer wants to use the option,
+dnl it can be used as follows:
+dnl if test "x$BIND10_RPATH" != "x"; then
+dnl LDFLAGS="$LDFLAGS $BIND10_RPATH"
+dnl fi
AC_DEFUN([AX_ISC_BIND10], [
AC_REQUIRE([AX_BOOST_INCLUDE])
+AC_REQUIRE([AX_ISC_RPATH])
AC_LANG_SAVE
AC_LANG([C++])
@@ -42,19 +51,20 @@ if test "$bind10_inc_path" = "no"; then
fi
done
fi
-CPPFLAGS_SAVES="$CPPFLAGS"
+CPPFLAGS_SAVED="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" # boost headers will be used in buffer.h
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_MSG_ERROR([Missing a commonly used BIND 10 header file]))
+CPPFLAGS="$CPPFLAGS_SAVED"
AC_SUBST(BIND10_CPPFLAGS)
# Check for BIND10 libraries
CPPFLAGS_SAVED="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $BIND10_CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS $BIND10_CPPFLAGS"
AC_ARG_WITH(bind10-lib,
AS_HELP_STRING([--with-bind10-lib=PATH],
@@ -70,21 +80,25 @@ 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"
+LDFLAGS_SAVED="$LDFLAGS"
+LDFLAGS_CHECK_COMMON="$LDFLAGS $BIND10_LDFLAGS"
+LIBS_SAVED="$LIBS"
LIBS="$LIBS $BIND10_COMMON_LIB"
for d in $bind10_lib_dirs
do
- LDFLAGS_SAVED="$LDFLAGS"
- LDFLAGS="$LDFLAGS -L$d"
+ LDFLAGS="$LDFLAGS_CHECK_COMMON -L$d"
AC_TRY_LINK([
#include <util/buffer.h>
],[
isc::util::OutputBuffer buffer(0);
-], [BIND10_LDFLAGS="-L${d}"])
+], [BIND10_LDFLAGS="-L${d}"
+ if test "x$ISC_RPATH_FLAG" != "x"; then
+ BIND10_RPATH="${ISC_RPATH_FLAG}${d}"
+ fi
+ ])
if test "x$BIND10_LDFLAGS" != "x"; then
break
fi
- LDFLAGS="$LDFLAGS_SAVED"
done
if test "x$BIND10_LDFLAGS" != "x"; then
AC_MSG_RESULT(yes)
@@ -94,7 +108,7 @@ else
fi
# restore LIBS once at this point
-LIBS="$LIBS_SAVES"
+LIBS="$LIBS_SAVED"
AC_SUBST(BIND10_LDFLAGS)
AC_SUBST(BIND10_COMMON_LIB)
@@ -111,12 +125,12 @@ isc::dns::RRType rrtype(1);
], [BIND10_DNS_LIB="-lb10-dns++"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
-LIBS="$LIBS_SAVES"
+LIBS="$LIBS_SAVED"
AC_SUBST(BIND10_DNS_LIB)
# Restore other flags
CPPFLAGS="$CPPFLAGS_SAVED"
-LDFLAGS="$LDFLAGS_SAVES"
+LDFLAGS="$LDFLAGS_SAVED"
AC_LANG_RESTORE
])dnl AX_ISC_BIND10
diff --git a/examples/m4/ax_isc_rpath.m4 b/examples/m4/ax_isc_rpath.m4
new file mode 100644
index 0000000..91d9b8a
--- /dev/null
+++ b/examples/m4/ax_isc_rpath.m4
@@ -0,0 +1,46 @@
+dnl @synopsis AX_ISC_RPATH
+dnl
+dnl @summary figure out whether and which "rpath" linker option is available
+dnl
+dnl This macro checks if the linker supports an option to embed a path
+dnl to a runtime library (often installed in an uncommon place), such as
+dnl gcc's -rpath option. If found, it sets the ISC_RPATH_FLAG variable to
+dnl the found option flag. The main configure.ac can use it as follows:
+dnl if test "x$ISC_RPATH_FLAG" != "x"; then
+dnl LDFLAGS="$LDFLAGS ${ISC_RPATH_FLAG}/usr/local/lib/some_library"
+dnl fi
+
+AC_DEFUN([AX_ISC_RPATH], [
+
+# We'll tweak both CXXFLAGS and CCFLAGS so this function will work whichever
+# language is used in the main script. Note also that it's not LDFLAGS;
+# technically this is a linker flag, but we've noticed $LDFLAGS can be placed
+# where the compiler could interpret it as a compiler option, leading to
+# subtle failure mode. So, in the check below using the compiler flag is
+# safer (in the actual Makefiles the flag should be set in LDFLAGS).
+CXXFLAGS_SAVED="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -Wl,-R/usr/lib"
+CCFLAGS_SAVED="$CCFLAGS"
+CCFLAGS="$CCFLAGS -Wl,-R/usr/lib"
+
+# check -Wl,-R and -R rather than gcc specific -rpath to be as portable
+# as possible. -Wl,-R seems to be safer, so we try it first. In some cases
+# -R is not actually recognized but AC_TRY_LINK doesn't fail due to that.
+AC_MSG_CHECKING([whether -Wl,-R flag is available in linker])
+AC_TRY_LINK([],[],
+ [ AC_MSG_RESULT(yes)
+ ISC_RPATH_FLAG=-Wl,-R
+ ],[ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING([whether -R flag is available in linker])
+ CXXFLAGS="$CXXFLAGS_SAVED -R"
+ CCFLAGS="$CCFLAGS_SAVED -R"
+ AC_TRY_LINK([], [],
+ [ AC_MSG_RESULT([yes; note that -R is more sensitive about the position in option arguments])
+ ISC_RPATH_FLAG=-R
+ ],[ AC_MSG_RESULT(no) ])
+ ])
+
+CXXFLAGS=$CXXFLAGS_SAVED
+CCFLAGS=$CCFLAGS_SAVED
+
+])dnl AX_ISC_RPATH
More information about the bind10-changes
mailing list