]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Rebased to post #43227
authorFrancis Dupont <fdupont@isc.org>
Fri, 23 Sep 2016 21:14:56 +0000 (23:14 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 23 Sep 2016 21:14:56 +0000 (23:14 +0200)
12 files changed:
Makefile.am
Makefile.in
RELNOTES
common/parse.c
common/print.c
common/tests/misc_unittest.c
configure
configure.ac
util/Makefile.bind.in
util/Makefile.git [deleted file]
util/bind.sh
util/bindvar.sh [deleted file]

index 1f31e6a206a269d97021743cc3e60ed8cd387c2c..2371e1de926bb136e9c15c3de51ddc389cf8d649 100644 (file)
@@ -22,7 +22,7 @@ EXTRA_DIST = RELNOTES LICENSE \
             doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \
             doc/devel/arch.dox doc/devel/atf.dox doc/devel/contrib.dox \
             doc/devel/debug.dox doc/devel/isc-logo.jpg doc/devel/mainpage.dox \
-            doc/devel/omapi.dox doc/devel/qa.dox util/bindvar.sh \
+            doc/devel/omapi.dox doc/devel/qa.dox \
             bind/Makefile.in bind/bind.tar.gz bind/version.tmp \
             common/tests/Atffile server/tests/Atffile
 
index b914a8367dc3557d123e26be244c111da19334bd..2dac656d45a238ec0dc2dd37cd609dd59aa26a55 100644 (file)
@@ -362,7 +362,7 @@ EXTRA_DIST = RELNOTES LICENSE \
             doc/examples/dhclient-dhcpv6.conf doc/examples/dhcpd-dhcpv6.conf \
             doc/devel/arch.dox doc/devel/atf.dox doc/devel/contrib.dox \
             doc/devel/debug.dox doc/devel/isc-logo.jpg doc/devel/mainpage.dox \
-            doc/devel/omapi.dox doc/devel/qa.dox util/bindvar.sh \
+            doc/devel/omapi.dox doc/devel/qa.dox \
             bind/Makefile.in bind/bind.tar.gz bind/version.tmp \
             common/tests/Atffile server/tests/Atffile
 
index 3b1ed215baf2987ce65a87e0770a14e7c1ecf82d..f02df24b6dd20033b9d7e02168413aaa7fb52be3 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -63,9 +63,31 @@ by Eric Young (eay@cryptsoft.com).
 - Removed an extraneous expression in omapi socket callback function. Prior
   to this change, the logic was techinically incorrect but other factors
   ensured the outcome itself was correct.  This change was made primarily
-  for code clarity.
+  for code clarity. Thanks to Ganesh Pinjala for bringing the issue to our
+  attention.
   [ISC-Bugs #42834]
 
+- Corrected a bug which could cause the server to sporadically crash while
+  loading lease files with the lease-id-format is set to "hex".  Our thanks
+  to Jay Ford, University of Iowa for reporting the issue.
+  [ISC-Bugs #43185]
+
+- Pass configure arguments which begin with an upper case letter, e.g.
+  CFLAGS, to the embedded bind configure, so it is no longer required
+  to use environment variables to get the same effect.
+  [ISC-Bugs #35143]
+
+- Added --enable-kqueue, --enable-epoll, --enable-devpoll and a more
+  general --with-bind-extra-config to pass extra options to the
+  embedded bind configure. Note we had mixed experiences with this
+  so it is at the user risk, i.e., they are NOT SUPPORTED yet.
+  [ISC-Bugs #20890]
+
+- Changed the way the embedded bind Makefile is updated by configure.
+  The only user visible side effect is that --with-libbind now requires
+  either "no" or an (absolute) path, i.e. "yes" is no longer valid.
+  [ISC-Bugs #43227]
+
                        Changes since 4.3.0 (bug fixes)
 
 - Tidy up several small tickets.
index 22e7d58210f2ae280be2634948bda686ecffca68..b8ccf9df77bab8491fcddaa605e0b43e7b53ea39 100644 (file)
@@ -98,7 +98,7 @@ void skip_to_rbrace (cfile, brace_count)
        enum dhcp_token token;
        const char *val;
 
-#if defined (DEBUG_TOKEN)
+#if defined (DEBUG_TOKENS)
        log_error("skip_to_rbrace: %d\n", brace_count);
 #endif
        do {
index a694fedd9be35f42ae7b2aeb12e3b1ab377eb418..ce368c4dfab63cdaf5754c6d0642afeb233bad13 100644 (file)
@@ -383,15 +383,27 @@ void print_hex_only (len, data, limit, buf)
        unsigned limit;
        char *buf;
 {
-       unsigned i;
+       char *bufptr = buf;
+       int byte = 0;
 
-       if ((buf == NULL) || (limit < 3))
+       if (data == NULL || bufptr == NULL || limit == 0) {
                return;
+       }
 
-       for (i = 0; (i < limit / 3) && (i < len); i++) {
-               sprintf(&buf[i*3], "%02x:", data[i]);
+       if (((len == 0) || ((len * 3) > limit))) {
+               *bufptr = 0x0;
+               return;
        }
-       buf[(i * 3) - 1] = 0;
+
+       for ( ; byte < len; ++byte) {
+               if (byte > 0) {
+                       *bufptr++ = ':';
+               }
+
+               sprintf(bufptr, "%02x", data[byte]);
+               bufptr += 2;
+       }
+
        return;
 }
 
index 6cefa6e773a795f280c97fbd9d0a0313dc987b98..0f9b80cf75644485da75c2159a163a85ccdb402a 100644 (file)
@@ -153,6 +153,69 @@ ATF_TC_BODY(find_percent_adv, tc)
     return;
 }
 
+ATF_TC(print_hex_only);
+
+ATF_TC_HEAD(print_hex_only, tc)
+{
+    atf_tc_set_md_var(tc, "descr", "Verify hex data formatting.");
+}
+
+/* This test exercises the print_hex_only function
+ */
+ATF_TC_BODY(print_hex_only, tc)
+{
+    unsigned char data[] =  {0xaa,0xbb,0xcc,0xdd};
+    char* ref = "aa:bb:cc:dd";
+    char buf[14];
+    memset(buf, 'x', sizeof(buf));
+    int data_len = sizeof(data);
+    int expected_len = 12;
+
+    /* Proper input values should produce proper result */
+    print_hex_only (data_len, data, expected_len, buf);
+    if (strlen(buf) != strlen(ref)) {
+           atf_tc_fail("len of result is wrong");
+    }
+
+    if (strcmp(buf, ref)) {
+           atf_tc_fail("result doesn't match ref");
+    }
+
+    /* Make sure we didn't overrun the buffer */
+    if (buf[expected_len] != 'x') {
+           atf_tc_fail("data over run detected");
+    }
+
+    /* Buffer == null doesn't crash */
+    print_hex_only (data_len, data, expected_len, NULL);
+
+    /* Limit == 0 doesn't write (or crash) */
+    *buf = '-';
+    print_hex_only (data_len, data, 0, buf);
+    if (*buf != '-') {
+           atf_tc_fail("limit of zero, altered buffer");
+    }
+
+    /* data == NULL doesn't write (or crash) */
+    print_hex_only (data_len, NULL, expected_len, buf);
+    if (*buf != '-') {
+           atf_tc_fail("limit of zero, altered buffer");
+    }
+
+    /* Limit too small should produce zero length string */
+    *buf = '-';
+    print_hex_only (data_len, data, expected_len - 1, buf);
+    if (*buf != 0x0) {
+           atf_tc_fail("limit too small should have failed");
+    }
+
+    /* Data length of 0 should produce zero length string */
+    *buf = '-';
+    print_hex_only (0, data, expected_len, buf);
+    if (*buf != 0x0) {
+           atf_tc_fail("limit too small should have failed");
+    }
+}
        
 /* This macro defines main() method that will call specified
    test cases. tp and simple_test_case names can be whatever you want
@@ -161,6 +224,7 @@ ATF_TP_ADD_TCS(tp)
 {
     ATF_TP_ADD_TC(tp, find_percent_basic);
     ATF_TP_ADD_TC(tp, find_percent_adv);
+    ATF_TP_ADD_TC(tp, print_hex_only);
 
     return (atf_no_error());
 }
index 4f4552f09cee351b1d2c4747da4a9e95079c850d..bb7c6b884653bd790fe852febbcc86443a53f6ca 100755 (executable)
--- a/configure
+++ b/configure
@@ -627,8 +627,11 @@ LTLIBOBJS
 LIBOBJS
 LDAP_CFLAGS
 LDAP_LIBS
+BINDBUILD
+BINDBIND
 BINDSRCDIR
 BINDDIR
+BINDIOMUX
 ac_prefix_program
 DISTCHECK_ATF_CONFIGURE_FLAG
 HAVE_ATF_FALSE
@@ -773,6 +776,10 @@ with_cli6_pid_file
 with_relay_pid_file
 with_relay6_pid_file
 with_randomdev
+enable_kqueue
+enable_epoll
+enable_devpoll
+with_bind_extra_config
 with_libbind
 with_ldap
 with_ldapcrypto
@@ -1437,6 +1444,9 @@ Optional Features:
   --enable-log-pid        Include PIDs in syslog messages (default is no).
   --enable-binary-leases  enable support for binary insertion of leases
                           (default is no)
+  --enable-kqueue         use BSD kqueue (default is no)
+  --enable-epoll          use Linux epoll (default is no)
+  --enable-devpoll        use /dev/poll (default is no)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1473,8 +1483,10 @@ Optional Packages:
                           File for dhcrelay6 process information (default is
                           LOCALSTATEDIR/run/dhcrelay6.pid)
   --with-randomdev=PATH   Path for random device (default is /dev/random)
-  --with-libbind=PATH     bind includes and libraries are in PATH (default is
-                          ./bind)
+  --with-bind-extra-config
+                          configure bind librairies with some extra options
+                          (default is none)
+  --with-libbind=PATH     bind includes and libraries are in PATH
   --with-ldap             enable OpenLDAP support in dhcpd (default is no)
   --with-ldapcrypto       enable OpenLDAP crypto support in dhcpd (default is
                           no)
@@ -4475,6 +4487,19 @@ BINDCONFIG=
 if test "$cross_compiling" = "yes"; then
        BINDCONFIG="--host=$host"
 fi
+# Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..."
+# and as there can be a space inside an argument some magic is required.
+# This sets $1 ... $N to my_configure_args, arg1 ... argN
+eval "set my_configure_args $ac_configure_args"
+# remove my_configure_args, i.e., the guard against empty $ac_configure_args
+shift
+# iterate on arguments and copying 'arg' when it begins by an upper case
+for a
+do
+       case $a in
+               [A-Z]*) BINDCONFIG="$BINDCONFIG '$a'" ;;
+       esac
+done
 
  if test "$cross_compiling" = "yes"; then
   CROSS_COMPILING_TRUE=
@@ -5657,8 +5682,8 @@ fi
         fi
 
         if test ! -x $ATF_BIN/atf-run  -o  ! -x $ATF_BIN/atf-report ; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: atf-run,atf-report not found, assuming they are in your path" >&5
-$as_echo "$as_me: WARNING: atf-run,atf-report not found, assuming they are in your path" >&2;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: atf-run/atf-report not found, assuming they are in your path" >&5
+$as_echo "$as_me: WARNING: atf-run/atf-report not found, assuming they are in your path" >&2;}
         fi
 
 
@@ -6722,6 +6747,65 @@ fi
        BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev"
 fi
 
+BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll"
+# check kqueue/epoll/devpoll alternative to select
+# Check whether --enable-kqueue was given.
+if test "${enable_kqueue+set}" = set; then :
+  enableval=$enable_kqueue; want_kqueue="$enableval"
+else
+  want_kqueue="no"
+fi
+
+if test "$want_kqueue" = "yes"; then
+       BINDIOMUX="--enable-kqueue"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-kqueue is not supported: it may lead to issues such as server looping" >&5
+$as_echo "$as_me: WARNING: --enable-kqueue is not supported: it may lead to issues such as server looping" >&2;}
+fi
+# Check whether --enable-epoll was given.
+if test "${enable_epoll+set}" = set; then :
+  enableval=$enable_epoll; want_epoll="$enableval"
+else
+  want_epoll="no"
+fi
+
+if test "$want_epoll" = "yes"; then
+       BINDIOMUX="--enable-epoll"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-epoll is not supported: it may lead to issues such as server looping" >&5
+$as_echo "$as_me: WARNING: --enable-epoll is not supported: it may lead to issues such as server looping" >&2;}
+fi
+# Check whether --enable-devpoll was given.
+if test "${enable_devpoll+set}" = set; then :
+  enableval=$enable_devpoll; want_devpoll="$enableval"
+else
+  want_devpoll="no"
+fi
+
+if test "$want_devpoll" = "yes"; then
+       BINDIOMUX="--enable-devpoll"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-devpoll is not supported: it may lead to issues such as server looping" >&5
+$as_echo "$as_me: WARNING: --enable-devpoll is not supported: it may lead to issues such as server looping" >&2;}
+fi
+
+
+# general extra bind configure arguments
+
+# Check whether --with-bind-extra-config was given.
+if test "${with_bind_extra_config+set}" = set; then :
+  withval=$with_bind_extra_config; use_xbindconfig="$withval"
+else
+  use_xbindconfig=""
+fi
+
+case "$use_xbindconfig" in
+yes|no|'')
+       ;;
+*)
+       BINDCONFIG="$BINDCONFIG $use_xbindconfig"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Most options to bind configure are not supported when used by ISC DHCP" >&5
+$as_echo "$as_me: WARNING: Most options to bind configure are not supported when used by ISC DHCP" >&2;}
+       ;;
+esac
+
 # see if there is a "sa_len" field in our interface information structure
 ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include <sys/socket.h>
 "
@@ -6822,8 +6906,11 @@ $as_echo "#define VLAN_TCI_PRESENT 1" >>confdefs.h
 fi
 
 
+# bind/Makefile.in is not from automake so we need 2 sets of variables
 BINDDIR=
 BINDSRCDIR=
+BINDBIND=
+BINDBUILD=
 
 # Check whether --with-libbind was given.
 if test "${with_libbind+set}" = set; then :
@@ -6834,31 +6921,47 @@ fi
 
 case "$use_libbind" in
 yes)
-       BINDDIR="\${top_srcdir}/bind"
-       BINDSRCDIR="\${top_srcdir}/bind"
+       as_fn_error $? "PATH is required in --with-libbind=PATH" "$LINENO" 5
        ;;
 no)
        BINDDIR="\${top_srcdir}/bind"
        BINDSRCDIR="\${top_srcdir}/bind"
+       my_abs_srcdir=`cd $srcdir && pwd`
+       BINDBIND="${my_abs_srcdir}/bind"
+       if test ! -d "$srcdir/bind"; then
+               as_fn_error $? "Where to find or build bind includes and libraries must be specified" "$LINENO" 5
+       fi
+       if test -d "$srcdir/bind/bind9"; then
+               BINDBUILD="${my_abs_srcdir}/bind/bind9"
+       else
+               if test ! -f "$srcdir/bind/version.tmp"; then
+                       as_fn_error $? "Cannot find $srcdir/bind/version.tmp" "$LINENO" 5
+               fi
+               . "$srcdir/bind/version.tmp"
+               bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
+               BINDBUILD="${my_abs_srcdir}/bind/bind-$bindversion"
+       fi
+       ac_config_files="$ac_config_files $srcdir/bind/Makefile"
+
        ;;
 *)
-       BINDDIR="$use_libbind"
-       if test ! -d "$srcdir/bind"; then
-               # no bind directory, create it with a fake Makefile.in
-               # (AC_CONFIG_FILES and top Makefile refer to it so
-               # it must exits)
-               mkdir $srcdir/bind
-               cat > $srcdir/bind/Makefile.in << EOF
-# placeholder
-all check clean distclean distdir install uninstall:
-
-EOF
+       if test ! -d "$use_libbind"; then
+               as_fn_error $? "Cannot find bind directory at $use_libbind" "$LINENO" 5
+       fi
+       if test ! -d "$use_libbind/include"; then
+               as_fn_error $? "Cannot find bind includes at $use_libbind/include" "$LINENO" 5
+       fi
+       if test ! -d "$use_libbind/lib"; then
+               as_fn_error $? "Cannot find bind libraries at $use_libbind/lib" "$LINENO" 5
        fi
+       BINDDIR="$use_libbind"
        ;;
 esac
 
 
 
+
+
 # OpenLDAP support.
 
 # Check whether --with-ldap was given.
@@ -7240,7 +7343,7 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h
   fi
 
 
-ac_config_files="$ac_config_files Makefile $srcdir/bind/Makefile client/Makefile client/tests/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile tests/unittest.sh server/tests/Makefile doc/devel/doxyfile"
+ac_config_files="$ac_config_files Makefile client/Makefile client/tests/Makefile common/Makefile common/tests/Makefile dhcpctl/Makefile includes/Makefile omapip/Makefile relay/Makefile server/Makefile tests/Makefile tests/unittest.sh server/tests/Makefile doc/devel/doxyfile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -7986,8 +8089,8 @@ do
   case $ac_config_target in
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "includes/config.h") CONFIG_HEADERS="$CONFIG_HEADERS includes/config.h" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "$srcdir/bind/Makefile") CONFIG_FILES="$CONFIG_FILES $srcdir/bind/Makefile" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "client/Makefile") CONFIG_FILES="$CONFIG_FILES client/Makefile" ;;
     "client/tests/Makefile") CONFIG_FILES="$CONFIG_FILES client/tests/Makefile" ;;
     "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
@@ -8697,16 +8800,6 @@ else
        DHCP_VERSIONS="DHCPv4"
 fi
 
-(cd $srcdir
-    sh util/bindvar.sh
-    if test $? -ne 0; then
-        as_fn_error $? "*** util/bindvar.sh failed" "$LINENO" 5
-    fi
-)
-if test $? -ne 0; then
-    exit $?
-fi
-
 cat > config.report << END
 
      ISC DHCP source configure results:
index 8b58835c4a1611f0ac69a049cda47b48fbc13516..f5345550b93af95d1253890b24c6c2a715d009a4 100644 (file)
@@ -37,6 +37,19 @@ BINDCONFIG=
 if test "$cross_compiling" = "yes"; then
        BINDCONFIG="--host=$host"
 fi
+# Pass CFLAGS and co. $ac_configure_args looks like "'arg1' 'arg2' ..."
+# and as there can be a space inside an argument some magic is required.
+# This sets $1 ... $N to my_configure_args, arg1 ... argN
+eval "set my_configure_args $ac_configure_args"
+# remove my_configure_args, i.e., the guard against empty $ac_configure_args
+shift
+# iterate on arguments and copying 'arg' when it begins by an upper case
+for a
+do
+       case $a in
+               [[A-Z]]*) BINDCONFIG="$BINDCONFIG '$a'" ;;
+       esac
+done
 AC_SUBST(BINDCONFIG)
 AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
 
@@ -295,7 +308,7 @@ elif test "$atf_path" != "no" ; then
         fi
 
         if test ! -x $ATF_BIN/atf-run  -o  ! -x $ATF_BIN/atf-report ; then
-            AC_MSG_WARN([atf-run,atf-report not found, assuming they are in your path])
+            AC_MSG_WARN([atf-run/atf-report not found, assuming they are in your path])
         fi
 
         AC_SUBST(ATF_CFLAGS)
@@ -631,6 +644,45 @@ else
        BINDCONFIG="$BINDCONFIG --with-randomdev=$use_randomdev"
 fi
 
+BINDIOMUX="--disable-kqueue --disable-epoll --disable-devpoll"
+# check kqueue/epoll/devpoll alternative to select
+AC_ARG_ENABLE(kqueue,
+       AS_HELP_STRING([--enable-kqueue],[use BSD kqueue (default is no)]),
+       want_kqueue="$enableval", want_kqueue="no")
+if test "$want_kqueue" = "yes"; then
+       BINDIOMUX="--enable-kqueue"
+       AC_MSG_WARN([--enable-kqueue is not supported: it may lead to issues such as server looping])
+fi
+AC_ARG_ENABLE(epoll,
+       AS_HELP_STRING([--enable-epoll],[use Linux epoll (default is no)]),
+       want_epoll="$enableval", want_epoll="no")
+if test "$want_epoll" = "yes"; then
+       BINDIOMUX="--enable-epoll"
+       AC_MSG_WARN([--enable-epoll is not supported: it may lead to issues such as server looping])
+fi
+AC_ARG_ENABLE(devpoll,
+       AS_HELP_STRING([--enable-devpoll],[use /dev/poll (default is no)]),
+       want_devpoll="$enableval", want_devpoll="no")
+if test "$want_devpoll" = "yes"; then
+       BINDIOMUX="--enable-devpoll"
+       AC_MSG_WARN([--enable-devpoll is not supported: it may lead to issues such as server looping])
+fi
+AC_SUBST(BINDIOMUX)
+
+# general extra bind configure arguments
+AC_ARG_WITH(bind-extra-config,
+       AS_HELP_STRING([--with-bind-extra-config],[configure bind librairies
+                      with some extra options (default is none)]),
+       use_xbindconfig="$withval", use_xbindconfig="")
+case "$use_xbindconfig" in
+yes|no|'')
+       ;;
+*)
+       BINDCONFIG="$BINDCONFIG $use_xbindconfig"
+       AC_MSG_WARN([Most options to bind configure are not supported when used by ISC DHCP])
+       ;;
+esac
+
 # see if there is a "sa_len" field in our interface information structure
 AC_CHECK_MEMBER(struct sockaddr.sa_len,
        AC_DEFINE([HAVE_SA_LEN], [],
@@ -679,38 +731,55 @@ AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci,
     [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])]
     ,, [#include <linux/if_packet.h>])
 
+# bind/Makefile.in is not from automake so we need 2 sets of variables
 BINDDIR=
 BINDSRCDIR=
+BINDBIND=
+BINDBUILD=
 AC_ARG_WITH(libbind,
-       AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH
-                       (default is ./bind)]),
+       AS_HELP_STRING([--with-libbind=PATH],[bind includes and libraries are in PATH]),
        use_libbind="$withval", use_libbind="no")
 case "$use_libbind" in
 yes)
-       BINDDIR="\${top_srcdir}/bind"
-       BINDSRCDIR="\${top_srcdir}/bind"
+       AC_MSG_ERROR([PATH is required in --with-libbind=PATH])
        ;;
 no)
        BINDDIR="\${top_srcdir}/bind"
        BINDSRCDIR="\${top_srcdir}/bind"
+       my_abs_srcdir=`cd $srcdir && pwd`
+       BINDBIND="${my_abs_srcdir}/bind"
+       if test ! -d "$srcdir/bind"; then
+               AC_MSG_ERROR([Where to find or build bind includes and libraries must be specified])
+       fi
+       if test -d "$srcdir/bind/bind9"; then
+               BINDBUILD="${my_abs_srcdir}/bind/bind9"
+       else
+               if test ! -f "$srcdir/bind/version.tmp"; then
+                       AC_MSG_ERROR([Cannot find $srcdir/bind/version.tmp])
+               fi
+               . "$srcdir/bind/version.tmp"
+               bindversion=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
+               BINDBUILD="${my_abs_srcdir}/bind/bind-$bindversion"
+       fi
+       AC_CONFIG_FILES([$srcdir/bind/Makefile])
        ;;
 *)
-       BINDDIR="$use_libbind"
-       if test ! -d "$srcdir/bind"; then
-               # no bind directory, create it with a fake Makefile.in
-               # (AC_CONFIG_FILES and top Makefile refer to it so
-               # it must exits)
-               mkdir $srcdir/bind
-               cat > $srcdir/bind/Makefile.in << EOF
-# placeholder
-all check clean distclean distdir install uninstall:
-
-EOF
+       if test ! -d "$use_libbind"; then
+               AC_MSG_ERROR([Cannot find bind directory at $use_libbind])
+       fi
+       if test ! -d "$use_libbind/include"; then
+               AC_MSG_ERROR([Cannot find bind includes at $use_libbind/include])
        fi
+       if test ! -d "$use_libbind/lib"; then
+               AC_MSG_ERROR([Cannot find bind libraries at $use_libbind/lib])
+       fi
+       BINDDIR="$use_libbind"
        ;;
 esac
 AC_SUBST(BINDDIR)
 AC_SUBST(BINDSRCDIR)
+AC_SUBST(BINDBIND)
+AC_SUBST(BINDBUILD)
 
 # OpenLDAP support.
 AC_ARG_WITH(ldap,
@@ -805,7 +874,6 @@ AC_C_FLEXIBLE_ARRAY_MEMBER
 
 AC_CONFIG_FILES([
   Makefile
-  $srcdir/bind/Makefile
   client/Makefile
   client/tests/Makefile
   common/Makefile
@@ -830,16 +898,6 @@ else
        DHCP_VERSIONS="DHCPv4"
 fi
 
-(cd $srcdir
-    sh util/bindvar.sh
-    if test $? -ne 0; then
-        AC_MSG_ERROR([*** util/bindvar.sh failed])
-    fi
-)
-if test $? -ne 0; then
-    exit $?
-fi
-
 cat > config.report << END
 
      ISC DHCP source configure results:
index 495e3919eb10fc6bbeb5cba479273fb9f21ecf3a..95880347ae5472a9a21e6a30d7fdd8b34d6cb31f 100644 (file)
 
 # Configure and build the bind libraries for use by DHCP
 
-include ./version.tmp
-version=${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}
+binddir=@BINDBIND@
+bindsrcdir=@BINDBUILD@
 
-# bindvar.tmp is constructed by configure, it has the paths for bind
-# if GMAKE is blank the shell script couldn't find a gmake to use.
-# binddir=
-# GMAKE=
-include ./bindvar.tmp
-
-bindsrcdir=bind-${version}
-
-bindconfig = --disable-kqueue --disable-epoll --disable-devpoll \
-       --without-openssl --without-libxml2 --enable-exportlib \
-       --with-gssapi=no --enable-threads=no @BINDCONFIG@ \
+bindconfig = --without-openssl --without-libxml2 \
+       --without-gssapi --disable-threads \
+       --enable-exportlib \
        --with-export-includedir=${binddir}/include \
-       --with-export-libdir=${binddir}/lib
+       --with-export-libdir=${binddir}/lib \
+       @BINDIOMUX@ @BINDCONFIG@ --enable-full-report
 
 @BIND_ATF_FALSE@cleandirs = ./lib ./include
 @BIND_ATF_TRUE@cleandirs = ./lib ./include ./atf
@@ -47,11 +40,6 @@ bind1:
                gunzip -c bind.tar.gz | tar xf - ;          \
        fi
 
-       @if test -z "${GMAKE}"; then                        \
-               echo "unable to find gmake" 1>&2 ;          \
-               exit 1;                                     \
-       fi
-
 # Configure the export libraries
 # Currently disable the epoll, devpoll and kqueue options as they
 # don't interact well with the DHCP code.
@@ -74,7 +62,7 @@ atf:
        else                                                          \
                echo Building ATF support ;                           \
                (cd ${bindsrcdir}/unit;                               \
-                MAKE=${GMAKE} ${GMAKE} atf > ${binddir}/build.log ;  \
+                $(MAKE) atf > ${binddir}/build.log ;                 \
                 cp -rp atf ${binddir}) ;                             \
        fi
 
@@ -90,11 +78,11 @@ bind2-noguest:
                echo Building BIND Export libraries - this takes some time. ;\
                (cd ${bindsrcdir}/lib/export ;                               \
                  echo building in `pwd` ;                                   \
-                 MAKE=${GMAKE} ${GMAKE} >> ${binddir}/build.log) ;          \
+                 $(MAKE) >> ${binddir}/build.log) ;                         \
                                                                              \
                echo Installing BIND Export libraries to ${binddir}. ;       \
                (cd ${bindsrcdir}/lib/export ;                               \
-                 MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \
+                 $(MAKE) install > ${binddir}/install.log) ;                \
        fi
 
 bind2-hostgen:
@@ -104,16 +92,16 @@ bind2-hostgen:
                echo Bind export libraries already installed ;               \
        else                                                                 \
                echo Building BIND Export libraries - this takes some time. ;\
-               (cd ${bindsrcdir}/lib/export/dns ; \
-                echo building gen using ${BUILD_CC} in `pwd` ; \
-                MAKE=${GMAKE} ${GMAKE} CC=${BUILD_CC} CFLAGS=${BUILD_CFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} LIBS=${BUILD_LIBS} gen >> ${binddir}/build.log) ; \
+               (cd ${bindsrcdir}/lib/export/dns ;                           \
+                echo building gen using ${BUILD_CC} in `pwd` ;              \
+                $(MAKE) CC=${BUILD_CC} CFLAGS=${BUILD_CFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} LIBS=${BUILD_LIBS} gen >> ${binddir}/build.log) ; \
                (cd ${bindsrcdir}/lib/export ;                               \
                  echo building in `pwd` ;                                   \
-                 MAKE=${GMAKE} ${GMAKE} >> ${binddir}/build.log) ;          \
+                 $(MAKE) >> ${binddir}/build.log) ;                         \
                                                                              \
                echo Installing BIND Export libraries to ${binddir}. ;       \
                (cd ${bindsrcdir}/lib/export ;                               \
-                 MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \
+                 $(MAKE) install > ${binddir}/install.log) ;                \
        fi
 
 clean:
diff --git a/util/Makefile.git b/util/Makefile.git
deleted file mode 100644 (file)
index d681b38..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# Copyright (C) 2009-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.
-
-# $Id: Makefile.bind,v 1.8 2012/04/05 22:16:47 sar Exp $
-
-# bindvar.tmp is constructed by configure, it has the paths for
-# if GMAKE is blank the shell script couldn't find a gmake to use.
-# binddir=
-# GMAKE=
-include ./bindvar.tmp
-
-bindsrcdir=bind9
-
-all:
-# Extract the source from the tarball, if it hasn't been already.
-       @if test -d ${bindsrcdir} ; then                    \
-               echo ${bindsrcdir} already unpacked... ;    \
-       else                                                \
-               gunzip -c bind.tar.gz | tar xf - ;          \
-       fi
-
-       @if test -z "${GMAKE}"; then                        \
-               echo "unable to find gmake" 1>&2 ;          \
-               exit 1;                                     \
-       fi
-
-# Configure the export libraries
-# Currently disable the epoll and devpoll options as they don't interact
-# well with the DHCP code.
-# If the top-level Bind Makefile exists we skip the configuration step
-# as we assume it's done and won't change.  Doing a make clean will
-# reset things if necessary.
-       @if test -f ${bindsrcdir}/Makefile ; then                  \
-               echo Bind export libraries already configured ;    \
-       else                                                       \
-               echo Configuring BIND Export libraries for DHCP. ; \
-               rm -rf ./lib ./include ./configure.log ./build.log ./install.log ; \
-               (cd ${bindsrcdir} && ./configure --disable-kqueue --disable-epoll --disable-devpoll --without-openssl --without-libxml2 --enable-exportlib --enable-threads=no --with-export-includedir=${binddir}/include --with-export-libdir=${binddir}/lib --with-gssapi=no > ${binddir}/configure.log); \
-       fi
-
-# Build and install the export libraries
-# No need to do anything if we already have something installed.
-       @if test -d ${binddir}/lib ; then                                    \
-               echo Bind export libraries already installed ;               \
-       else                                                                 \
-               echo Building BIND Export libraries - this takes some time. ;\
-               (cd ${bindsrcdir}/lib/export ;                               \
-                 echo building in `pwd` ;                                   \
-                 MAKE=${GMAKE} ${GMAKE} > ${binddir}/build.log) ;           \
-                                                                             \
-               echo Installing BIND Export libraries to ${binddir}. ;       \
-               (cd ${bindsrcdir}/lib/export ;                               \
-                 MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \
-       fi
-
-clean:
-       @echo Cleaning BIND export library.
-       (cd ${bindsrcdir}; make -k clean )
-       rm -rf ./lib ./include ./configure.log ./build.log \
-               ./install.log
-
-# Include the following so that this Makefile is happy when the parent
-# tries to use them.
-
-distdir:
-
-distclean:
-
-install:
-
-check:
-
-uninstall:
index 494e2399ad3e54ed4354cc3ec0856cdf8dee5dc7..13f6fb36864b98d963a06e9ad72467b186995b89 100644 (file)
@@ -99,7 +99,7 @@ esac
 
 if test -d bind/bind9/.git
 then
-       cp util/Makefile.git bind/Makefile.in
+       cp util/Makefile.bind.in bind/Makefile.in
        rm -rf bind/include bind/lib
        cd bind/bind9
        test -f Makefile && make distclean
diff --git a/util/bindvar.sh b/util/bindvar.sh
deleted file mode 100644 (file)
index 184a4cc..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2009,2015  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.
-
-# $Id: bindvar.sh,v 1.2 2009/12/02 20:43:52 sar Exp $
-
-# Create a file with the base directory and gmake path for
-# use by the bind/Makefile, we do this to minimize portability
-# concerns.
-
-# Bind requires a GNU style make to compile, if we can't find one
-# exit with a non-zero status, otherwise exit with success (i.e. 0)
-
-binddir=`pwd`
-gmake=
-for x in gmake gnumake make; do
-       if $x --version 2>/dev/null | grep GNU > /dev/null; then
-               gmake=$x
-               break;
-       fi
-done
-
-if [ -z $gmake ]
-then
-    echo "$0: Building Bind requires a GNU style make tool and none were found in your path. We tried gmake, gnumake, and make."
-    exit 1
-fi
-
-cat <<EOF > bind/bindvar.tmp
-binddir=$binddir/bind
-GMAKE=$gmake
-EOF
-
-exit 0