|
|
fad460 |
From 960bee12f1ceca0d6fa97e0423be2ea0a162df96 Mon Sep 17 00:00:00 2001
|
|
|
fad460 |
From: Petr Mensik <pemensik@redhat.com>
|
|
|
fad460 |
Date: Fri, 9 Feb 2018 15:24:53 +0100
|
|
|
fad460 |
Subject: [PATCH] Support for isc-config.sh script on --with-libbind parameter
|
|
|
fad460 |
|
|
|
fad460 |
Move checks only to isc-config section
|
|
|
fad460 |
|
|
|
fad460 |
Fix detection of bind flags from config
|
|
|
fad460 |
|
|
|
fad460 |
Add support for with-libbind=config, Improve help message
|
|
|
fad460 |
---
|
|
|
fad460 |
client/Makefile.am | 4 +-
|
|
|
fad460 |
common/tests/Makefile.am | 4 +-
|
|
|
fad460 |
configure.ac | 91 ++++++++++++++++++++++++++++++++++++----
|
|
|
fad460 |
dhcpctl/Makefile.am | 6 ++-
|
|
|
fad460 |
omapip/Makefile.am | 4 +-
|
|
|
fad460 |
relay/Makefile.am | 4 +-
|
|
|
fad460 |
server/Makefile.am | 4 +-
|
|
|
fad460 |
server/tests/Makefile.am | 7 +++-
|
|
|
fad460 |
8 files changed, 108 insertions(+), 16 deletions(-)
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/client/Makefile.am b/client/Makefile.am
|
|
|
fad460 |
index b78a915..b764a11 100644
|
|
|
fad460 |
--- a/client/Makefile.am
|
|
|
fad460 |
+++ b/client/Makefile.am
|
|
|
fad460 |
@@ -1,3 +1,5 @@
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
dist_sysconf_DATA = dhclient.conf.example
|
|
|
fad460 |
sbin_PROGRAMS = dhclient
|
|
|
fad460 |
dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
|
|
|
fad460 |
@@ -5,7 +7,7 @@ dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
|
|
|
fad460 |
scripts/netbsd scripts/nextstep scripts/openbsd \
|
|
|
fad460 |
scripts/solaris scripts/openwrt
|
|
|
fad460 |
dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \
|
|
|
fad460 |
- $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD)
|
|
|
fad460 |
+ $(CAPNG_LDADD) $(BIND_LIBS)
|
|
|
fad460 |
man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
|
|
|
fad460 |
EXTRA_DIST = $(man_MANS)
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/common/tests/Makefile.am b/common/tests/Makefile.am
|
|
|
fad460 |
index df68621..067acd3 100644
|
|
|
fad460 |
--- a/common/tests/Makefile.am
|
|
|
fad460 |
+++ b/common/tests/Makefile.am
|
|
|
fad460 |
@@ -1,5 +1,7 @@
|
|
|
fad460 |
SUBDIRS = .
|
|
|
fad460 |
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
AM_CPPFLAGS = $(ATF_CFLAGS) -I$(top_srcdir)/includes
|
|
|
fad460 |
|
|
|
fad460 |
EXTRA_DIST = Atffile
|
|
|
fad460 |
@@ -14,7 +16,7 @@ alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c
|
|
|
fad460 |
alloc_unittest_LDADD = $(ATF_LDFLAGS)
|
|
|
fad460 |
alloc_unittest_LDADD += ../libdhcp.a \
|
|
|
fad460 |
../../omapip/libomapi.la \
|
|
|
fad460 |
- $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+ $(BIND_LIBS)
|
|
|
fad460 |
|
|
|
fad460 |
check: $(ATF_TESTS)
|
|
|
fad460 |
atf-run | atf-report
|
|
|
fad460 |
diff --git a/configure.ac b/configure.ac
|
|
|
fad460 |
index 7ef5588..f849f4b 100644
|
|
|
fad460 |
--- a/configure.ac
|
|
|
fad460 |
+++ b/configure.ac
|
|
|
fad460 |
@@ -650,6 +650,10 @@ AC_CHECK_MEMBER(struct msghdr.msg_control,,
|
|
|
fad460 |
])
|
|
|
fad460 |
|
|
|
fad460 |
libbind=
|
|
|
fad460 |
+BIND_CONFIG=
|
|
|
fad460 |
+BIND_CPPFLAGS=
|
|
|
fad460 |
+BIND_LIBS=
|
|
|
fad460 |
+
|
|
|
fad460 |
AC_ARG_WITH(libbind,
|
|
|
fad460 |
AC_HELP_STRING([--with-libbind=PATH],
|
|
|
fad460 |
[bind includes are in PATH
|
|
|
fad460 |
@@ -657,14 +661,32 @@ AC_ARG_WITH(libbind,
|
|
|
fad460 |
use_libbind="$withval", use_libbind="no")
|
|
|
fad460 |
case "$use_libbind" in
|
|
|
fad460 |
yes|no)
|
|
|
fad460 |
- libbind="\${top_srcdir}/bind/include"
|
|
|
fad460 |
+ libbind="\${top_srcdir}/bind"
|
|
|
fad460 |
+ ;;
|
|
|
fad460 |
+config)
|
|
|
fad460 |
+ AC_PATH_PROG(BIND_CONFIG, [isc-config.sh bind9-config])
|
|
|
fad460 |
;;
|
|
|
fad460 |
*)
|
|
|
fad460 |
- libbind="$use_libbind"
|
|
|
fad460 |
+ if test -f "$use_libbind" -a -x "$use_libbind"; then
|
|
|
fad460 |
+ # passed full path of isc-config.sh
|
|
|
fad460 |
+ BIND_CONFIG="$use_libbind"
|
|
|
fad460 |
+ else
|
|
|
fad460 |
+ libbind="$use_libbind"
|
|
|
fad460 |
+ if test ! -d "$srcdir/bind"; then
|
|
|
fad460 |
+ # no bind directory, create it with a fake Makefile.in
|
|
|
fad460 |
+ # (AC_CONFIG_FILES and top Makefile refer to it so
|
|
|
fad460 |
+ # it must exits)
|
|
|
fad460 |
+ mkdir $srcdir/bind
|
|
|
fad460 |
+ cat > $srcdir/bind/Makefile.in << EOF
|
|
|
fad460 |
+# placeholder
|
|
|
fad460 |
+all check clean distclean distdir install uninstall:
|
|
|
fad460 |
+EOF
|
|
|
fad460 |
+ fi
|
|
|
fad460 |
+ fi
|
|
|
fad460 |
;;
|
|
|
fad460 |
esac
|
|
|
fad460 |
-
|
|
|
fad460 |
-BIND9_LIBDIR='-L$(top_builddir)/bind/lib'
|
|
|
fad460 |
+
|
|
|
fad460 |
+BIND_LIBDIR='$(top_builddir)/bind/lib'
|
|
|
fad460 |
AC_ARG_WITH(libbind-libs,
|
|
|
fad460 |
AC_HELP_STRING([--with-libbind-libs=PATH],
|
|
|
fad460 |
[bind9 export libraries are in PATH]),
|
|
|
fad460 |
@@ -677,13 +699,68 @@ no)
|
|
|
fad460 |
BUNDLED_BIND=yes
|
|
|
fad460 |
;;
|
|
|
fad460 |
*)
|
|
|
fad460 |
- BIND9_LIBDIR="-L$libbind_libs"
|
|
|
fad460 |
+ BIND_LIBDIR="$libbind_libs"
|
|
|
fad460 |
BUNDLED_BIND=no
|
|
|
fad460 |
;;
|
|
|
fad460 |
esac
|
|
|
fad460 |
-AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes])
|
|
|
fad460 |
+BIND9_LIBDIR="-L$BIND_LIBDIR"
|
|
|
fad460 |
AC_SUBST([BIND9_LIBDIR])
|
|
|
fad460 |
|
|
|
fad460 |
+if test -z "$BIND_CONFIG"; then
|
|
|
fad460 |
+ BIND_CPPFLAGS="-I${libbind}/include"
|
|
|
fad460 |
+ BIND_LIBS="$BIND9_LIBDIR -ldns -lisc"
|
|
|
fad460 |
+else
|
|
|
fad460 |
+ BIND_CPPFLAGS=`$BIND_CONFIG --cflags`
|
|
|
fad460 |
+ BIND_LIBS=`$BIND_CONFIG --libs dns isc`
|
|
|
fad460 |
+ BUNDLED_BIND=no
|
|
|
fad460 |
+
|
|
|
fad460 |
+ # bind is already built
|
|
|
fad460 |
+ AC_CHECKING([Checking bind libraries have no thread support])
|
|
|
fad460 |
+ saved_libs="$LIBS"
|
|
|
fad460 |
+ saved_CPPFLAGS="$CPPFLAGS"
|
|
|
fad460 |
+ CPPFLAGS="${CPPFLAGS} ${BIND_CPPFLAGS}"
|
|
|
fad460 |
+ LIBS="${LIBS} ${BIND_LIBS}"
|
|
|
fad460 |
+AC_TRY_LINK([
|
|
|
fad460 |
+#include <isc/bind9.h>
|
|
|
fad460 |
+#include <isc/lib.h>
|
|
|
fad460 |
+],[
|
|
|
fad460 |
+#ifdef BIND9
|
|
|
fad460 |
+#error Export BIND library has to be used with BIND version up to 9.9
|
|
|
fad460 |
+#endif
|
|
|
fad460 |
+isc_lib_register();
|
|
|
fad460 |
+], [AC_MSG_RESULT(Bind export library found)
|
|
|
fad460 |
+ BIND_EXPORT=yes], [BIND_EXPORT=no]
|
|
|
fad460 |
+)
|
|
|
fad460 |
+
|
|
|
fad460 |
+# Allow build with disabled threads for dhcp
|
|
|
fad460 |
+AC_TRY_LINK([
|
|
|
fad460 |
+#include <isc/platform.h>
|
|
|
fad460 |
+#include <isc/bind9.h>
|
|
|
fad460 |
+#include <isc/lib.h>
|
|
|
fad460 |
+],[
|
|
|
fad460 |
+#ifdef ISC_PLATFORM_USETHREADS
|
|
|
fad460 |
+#error Bind library must not be compiled with threads
|
|
|
fad460 |
+#endif
|
|
|
fad460 |
+isc_lib_register();
|
|
|
fad460 |
+if (isc_bind9 != 0) {}
|
|
|
fad460 |
+], [AC_MSG_RESULT(Bind single thread library found)
|
|
|
fad460 |
+ BIND_SINGLETHREAD=yes], [BIND_SINGLETHREAD=no]
|
|
|
fad460 |
+)
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if test "x$BIND_EXPORT" != xyes -a "x$BIND_SINGLETHREADED" != xyes
|
|
|
fad460 |
+ then
|
|
|
fad460 |
+ AC_MSG_RESULT([BIND_CONFIG=${BIND_CONFIG}])
|
|
|
fad460 |
+ AC_MSG_RESULT([BIND_CPPFLAGS=${BIND_CPPFLAGS}])
|
|
|
fad460 |
+ AC_MSG_RESULT([BIND_LIBS=${BIND_LIBS}])
|
|
|
fad460 |
+ AC_MSG_ERROR([Bind libraries are not useable for dhcp])
|
|
|
fad460 |
+ fi
|
|
|
fad460 |
+ CPPFLAGS="$saved_CPPFLAGS"
|
|
|
fad460 |
+ LIBS="$saved_LIBS"
|
|
|
fad460 |
+fi
|
|
|
fad460 |
+AC_SUBST(BIND_CPPFLAGS)
|
|
|
fad460 |
+AC_SUBST(BIND_LIBS)
|
|
|
fad460 |
+AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes])
|
|
|
fad460 |
+
|
|
|
fad460 |
# OpenLDAP support.
|
|
|
fad460 |
AC_ARG_WITH(ldap,
|
|
|
fad460 |
AC_HELP_STRING([--with-ldap],
|
|
|
fad460 |
@@ -730,7 +807,7 @@ fi
|
|
|
fad460 |
CFLAGS="$CFLAGS $STD_CWARNINGS"
|
|
|
fad460 |
|
|
|
fad460 |
# Try to add the bind include directory
|
|
|
fad460 |
-CFLAGS="$CFLAGS -I$libbind"
|
|
|
fad460 |
+CFLAGS="$CFLAGS $BIND_CPPFLAGS"
|
|
|
fad460 |
|
|
|
fad460 |
AC_C_FLEXIBLE_ARRAY_MEMBER
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/dhcpctl/Makefile.am b/dhcpctl/Makefile.am
|
|
|
fad460 |
index fb7a840..4f59dcf 100644
|
|
|
fad460 |
--- a/dhcpctl/Makefile.am
|
|
|
fad460 |
+++ b/dhcpctl/Makefile.am
|
|
|
fad460 |
@@ -1,3 +1,5 @@
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
bin_PROGRAMS = omshell
|
|
|
fad460 |
lib_LTLIBRARIES = libdhcpctl.la
|
|
|
fad460 |
noinst_PROGRAMS = cltest
|
|
|
fad460 |
@@ -6,10 +8,10 @@ EXTRA_DIST = $(man_MANS)
|
|
|
fad460 |
|
|
|
fad460 |
omshell_SOURCES = omshell.c
|
|
|
fad460 |
omshell_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \
|
|
|
fad460 |
- $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+ $(BIND_LIBS)
|
|
|
fad460 |
|
|
|
fad460 |
libdhcpctl_la_SOURCES = dhcpctl.c callback.c remote.c
|
|
|
fad460 |
|
|
|
fad460 |
cltest_SOURCES = cltest.c
|
|
|
fad460 |
cltest_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \
|
|
|
fad460 |
- $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+ $(BIND_LIBS)
|
|
|
fad460 |
diff --git a/omapip/Makefile.am b/omapip/Makefile.am
|
|
|
fad460 |
index 6247549..265bcef 100644
|
|
|
fad460 |
--- a/omapip/Makefile.am
|
|
|
fad460 |
+++ b/omapip/Makefile.am
|
|
|
fad460 |
@@ -1,3 +1,5 @@
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
lib_LTLIBRARIES = libomapi.la
|
|
|
fad460 |
noinst_PROGRAMS = svtest
|
|
|
fad460 |
|
|
|
fad460 |
@@ -10,5 +12,5 @@ man_MANS = omapi.3
|
|
|
fad460 |
EXTRA_DIST = $(man_MANS)
|
|
|
fad460 |
|
|
|
fad460 |
svtest_SOURCES = test.c
|
|
|
fad460 |
-svtest_LDADD = libomapi.la $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+svtest_LDADD = libomapi.la $(BIND_LIBS)
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/relay/Makefile.am b/relay/Makefile.am
|
|
|
fad460 |
index 1885c82..999e543 100644
|
|
|
fad460 |
--- a/relay/Makefile.am
|
|
|
fad460 |
+++ b/relay/Makefile.am
|
|
|
fad460 |
@@ -1,9 +1,11 @@
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
AM_CPPFLAGS = -DLOCALSTATEDIR='"@localstatedir@"'
|
|
|
fad460 |
|
|
|
fad460 |
sbin_PROGRAMS = dhcrelay
|
|
|
fad460 |
dhcrelay_SOURCES = dhcrelay.c
|
|
|
fad460 |
dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \
|
|
|
fad460 |
- $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD)
|
|
|
fad460 |
+ $(CAPNG_LDADD) $(BIND_LIBS)
|
|
|
fad460 |
man_MANS = dhcrelay.8
|
|
|
fad460 |
EXTRA_DIST = $(man_MANS)
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/server/Makefile.am b/server/Makefile.am
|
|
|
fad460 |
index 1d1122d..e593898 100644
|
|
|
fad460 |
--- a/server/Makefile.am
|
|
|
fad460 |
+++ b/server/Makefile.am
|
|
|
fad460 |
@@ -4,6 +4,8 @@
|
|
|
fad460 |
# production code. Sadly, we are not there yet.
|
|
|
fad460 |
SUBDIRS = . tests
|
|
|
fad460 |
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+
|
|
|
fad460 |
AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
|
|
|
fad460 |
|
|
|
fad460 |
dist_sysconf_DATA = dhcpd.conf.example
|
|
|
fad460 |
@@ -14,7 +16,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
|
|
|
fad460 |
|
|
|
fad460 |
dhcpd_CFLAGS = $(LDAP_CFLAGS)
|
|
|
fad460 |
dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \
|
|
|
fad460 |
- ../dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+ ../dhcpctl/libdhcpctl.la $(BIND_LIBS)
|
|
|
fad460 |
|
|
|
fad460 |
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
|
|
|
fad460 |
EXTRA_DIST = $(man_MANS)
|
|
|
fad460 |
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
|
|
|
fad460 |
index 5f2c5a8..4522f6b 100644
|
|
|
fad460 |
--- a/server/tests/Makefile.am
|
|
|
fad460 |
+++ b/server/tests/Makefile.am
|
|
|
fad460 |
@@ -1,7 +1,10 @@
|
|
|
fad460 |
SUBDIRS = .
|
|
|
fad460 |
|
|
|
fad460 |
+BIND_LIBS = @BIND_LIBS@
|
|
|
fad460 |
+BIND_CPPFLAGS = @BIND_CPPFLAGS@
|
|
|
fad460 |
+
|
|
|
fad460 |
AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes
|
|
|
fad460 |
-AM_CPPFLAGS += -I$(top_srcdir)/bind/include -I$(top_srcdir)
|
|
|
fad460 |
+AM_CPPFLAGS += $(BIND_CPPFLAGS) -I$(top_srcdir)
|
|
|
fad460 |
AM_CPPFLAGS += -DLOCALSTATEDIR='"."'
|
|
|
fad460 |
|
|
|
fad460 |
EXTRA_DIST = Atffile
|
|
|
fad460 |
@@ -18,7 +21,7 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpars.c ../db.c ../class.c \
|
|
|
fad460 |
../ldap.c ../ldap_casa.c ../dhcpd.c
|
|
|
fad460 |
|
|
|
fad460 |
DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \
|
|
|
fad460 |
- $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export
|
|
|
fad460 |
+ $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND_LIBS)
|
|
|
fad460 |
|
|
|
fad460 |
if ENABLE_SYSTEMTAP
|
|
|
fad460 |
DHCPLIBS += ../probes.o
|
|
|
fad460 |
--
|
|
|
fad460 |
2.20.1
|
|
|
fad460 |
|