]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
rework ldns-src inclusion.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 19 Oct 2007 10:38:27 +0000 (10:38 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 19 Oct 2007 10:38:27 +0000 (10:38 +0000)
git-svn-id: file:///svn/unbound/trunk@706 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
config.h.in
configure
configure.ac
doc/Changelog

index d04f8c3741f56ba3e8e9c10c7ccd643460269c1f..08debb5a19a2cb4f92287e0a86bbb6487769f4c7 100644 (file)
@@ -88,13 +88,15 @@ COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS)
 LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -release $(VERSION)
 
+.PHONY:        clean realclean doc lint all install uninstall tests test download_ldns strip
+
 $(BUILD)%.o:    $(srcdir)/%.c 
        $(INFO) Build $<
+       @if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
+               then (cd $(ldnsdir); $(MAKE) copy-headers); fi
        @if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
        $Q$(COMPILE) -c $< -o $@
 
-.PHONY:        clean realclean doc lint all install uninstall tests test download_ldns strip
-
 all:   $(COMMON_OBJ) unbound unbound-checkconf
 
 tests: unittest testbound lock-verify pktview signit memstats
@@ -102,37 +104,46 @@ tests:    unittest testbound lock-verify pktview signit memstats
 test:  tests
        bash testcode/do-tests.sh
 
-unbound:       $(DAEMON_OBJ)
+ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
+ldnslib=$(ldnsdir)/lib/libldns.a
+$(ldnslib):
+       @if test ! -z "$(ldnsdir)"; \
+       then (cd $(ldnsdir) && $(MAKE)); fi
+else
+ldnslib=
+endif
+
+unbound:       $(DAEMON_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) $(LIBS)
 
-unbound-checkconf:     $(CHECKCONF_OBJ)
+unbound-checkconf:     $(CHECKCONF_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
 
-unittest:      $(UNITTEST_OBJ)
+unittest:      $(UNITTEST_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
 
-testbound:     $(TESTBOUND_OBJ)
+testbound:     $(TESTBOUND_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) $(LIBS)
 
-lock-verify:   $(LOCKVERIFY_OBJ)
+lock-verify:   $(LOCKVERIFY_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
 
-pktview:       $(PKTVIEW_OBJ)
+pktview:       $(PKTVIEW_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
 
-signit:        $(SIGNIT_OBJ)
+signit:        $(SIGNIT_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
 
-memstats:      $(MEMSTATS_OBJ)
+memstats:      $(MEMSTATS_OBJ) $(ldnslib)
        $(INFO) Link $@
-       $Q$(LINK) -o $@ $^ $(LIBS)
+       $Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)
 
 #testcode/ldns-testpkts.c:     $(ldnsdir)/examples/ldns-testpkts.c \
 #                      $(ldnsdir)/examples/ldns-testpkts.h
@@ -210,6 +221,8 @@ download_ldns:
 # Automatic dependencies.
 $(BUILD)%.d: $(srcdir)/%.c
        $(INFO) Depend $<
+       @if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
+               then (cd $(ldnsdir); $(MAKE) copy-headers); fi
        @if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
        $Q$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< \
                      | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \
index 6ba313cd86bbc30a353ca9734e83e2c194d67cb8..5f169c811372f61bb14bbf082e45fa577548ecc8 100644 (file)
@@ -54,9 +54,6 @@
 /* Define to 1 if you have the `crypto' library (-lcrypto). */
 #undef HAVE_LIBCRYPTO
 
-/* Define to 1 if you have the `ldns' library (-lldns). */
-#undef HAVE_LIBLDNS
-
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
index 21496c731708a2c14955a52e1a9e32445bc37d3d..8b2f879f1e6706df0267737bcbb3b9d7e93fd0f8 100755 (executable)
--- a/configure
+++ b/configure
@@ -23693,7 +23693,6 @@ if test "${with_ldns+set}" = set; then
 fi
 
 
-
 { echo "$as_me:$LINENO: checking for ldns_rr_new in -lldns" >&5
 echo $ECHO_N "checking for ldns_rr_new in -lldns... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ldns_ldns_rr_new+set}" = set; then
 { echo "$as_me:$LINENO: result: $ac_cv_lib_ldns_ldns_rr_new" >&5
 echo "${ECHO_T}$ac_cv_lib_ldns_ldns_rr_new" >&6; }
 if test $ac_cv_lib_ldns_ldns_rr_new = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBLDNS 1
-_ACEOF
 
-  LIBS="-lldns $LIBS"
-
-else
-
-if test ! -f ldns-src.tar.gz; then
-       { { echo "$as_me:$LINENO: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&5
-echo "$as_me: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-echo "****************************************************************"
-echo "***                                                          ***"
-echo "*** ldns library not found (--with-ldns= to specify by hand) ***"
-echo "*** Building ldns library from package included in this one. ***"
-echo "***                                                          ***"
-echo "****************************************************************"
-if test -d ldns-src; then rm -rf ldns-src; fi
-mkdir ldns-src; (cd ldns-src; gzip -cd ../ldns-src.tar.gz | tar xf -)
-ldnsdir=`ls -d ldns-src/ldns*`
-{ echo "$as_me:$LINENO: Configure $ldnsdir" >&5
-echo "$as_me: Configure $ldnsdir" >&6;}
-echo "(cd $ldnsdir; ./configure)"
-(cd $ldnsdir; ./configure)
-{ echo "$as_me:$LINENO: Build $ldnsdir" >&5
-echo "$as_me: Build $ldnsdir" >&6;}
-if test ! -x "`which gmake`"; then
-       echo "(cd $ldnsdir; make)"
-       (cd $ldnsdir; make)
-else
-       echo "(cd $ldnsdir; gmake)"
-       (cd $ldnsdir; gmake)
-fi
-{ echo "$as_me:$LINENO: Finished $ldnsdir" >&5
-echo "$as_me: Finished $ldnsdir" >&6;}
-CPPFLAGS="$CPPFLAGS -I$ldnsdir/include"
-LDFLAGS="$LDFLAGS $ldnsdir/lib/*.o"
-
-
-fi
-
-
-# check func replacements after ldns had a chance to already provide them.
 
 for ac_func in inet_aton
 do
@@ -24518,6 +24473,63 @@ esac
 fi
 
 
+else
+
+if test ! -f ldns-src.tar.gz; then
+       { { echo "$as_me:$LINENO: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&5
+echo "$as_me: error: No ldns library found and no ldns-src.tar.gz, use --with-ldns=path." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "****************************************************************"
+echo "***                                                          ***"
+echo "*** ldns library not found (--with-ldns= to specify by hand) ***"
+echo "*** Building ldns library from package included in this one. ***"
+echo "***                                                          ***"
+echo "****************************************************************"
+if test -d ldns-src; then rm -rf ldns-src; fi
+mkdir ldns-src; (cd ldns-src; gzip -cd ../ldns-src.tar.gz | tar xf -)
+ldnsdir=`ls -d ldns-src/ldns*`
+{ echo "$as_me:$LINENO: Configure $ldnsdir" >&5
+echo "$as_me: Configure $ldnsdir" >&6;}
+echo "(cd $ldnsdir; ./configure)"
+(cd $ldnsdir; ./configure)
+{ echo "$as_me:$LINENO: Finished $ldnsdir configure" >&5
+echo "$as_me: Finished $ldnsdir configure" >&6;}
+CPPFLAGS="$CPPFLAGS -I$ldnsdir/include"
+LDFLAGS="$LDFLAGS $ldnsdir/lib/*.o"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INET_ATON 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INET_PTON 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INET_NTOP 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SNPRINTF 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRLCPY 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMMOVE 1
+_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETADDRINFO 1
+_ACEOF
+
+
+fi
+
+
 
 cat >>confdefs.h <<_ACEOF
 #define MAXSYSLOGMSGLEN 5120
index 61987610673168c292e56e269bfa544f72051287..e4d70fd775187c9033323b13de07a7e9c16c03a5 100644 (file)
@@ -543,7 +543,21 @@ AC_ARG_WITH(ldns,
        AC_SUBST(ldnsdir)
 ])
 
-AC_CHECK_LIB(ldns, ldns_rr_new,, [
+AC_CHECK_LIB(ldns, ldns_rr_new, [
+dnl ldns was found, check compat functions
+AC_REPLACE_FUNCS(inet_aton)
+AC_REPLACE_FUNCS(inet_pton)
+AC_REPLACE_FUNCS(inet_ntop)
+AC_REPLACE_FUNCS(snprintf)
+AC_REPLACE_FUNCS(strlcpy)
+AC_REPLACE_FUNCS(memmove)
+
+AC_CHECK_FUNCS([getaddrinfo])
+if test $ac_cv_func_getaddrinfo = no; then
+AC_LIBOBJ([fake-rfc2553])
+fi
+
+] , [
 dnl use the builtin ldns-src.tar.gz file to build ldns.
 if test ! -f ldns-src.tar.gz; then
        AC_MSG_ERROR([No ldns library found and no ldns-src.tar.gz, use --with-ldns=path.])
@@ -560,34 +574,20 @@ ldnsdir=`ls -d ldns-src/ldns*`
 AC_MSG_NOTICE([Configure $ldnsdir])
 echo "(cd $ldnsdir; ./configure)"
 (cd $ldnsdir; ./configure)
-AC_MSG_NOTICE([Build $ldnsdir])
-if test ! -x "`which gmake`"; then
-       echo "(cd $ldnsdir; make)"
-       (cd $ldnsdir; make)
-else
-       echo "(cd $ldnsdir; gmake)"
-       (cd $ldnsdir; gmake)
-fi
-AC_MSG_NOTICE([Finished $ldnsdir])
+AC_MSG_NOTICE([Finished $ldnsdir configure])
 CPPFLAGS="$CPPFLAGS -I$ldnsdir/include"
 LDFLAGS="$LDFLAGS $ldnsdir/lib/*.o"
 AC_SUBST(ldnsdir)
+dnl use ldns compat functions
+AC_DEFINE(HAVE_INET_ATON)
+AC_DEFINE(HAVE_INET_PTON)
+AC_DEFINE(HAVE_INET_NTOP)
+AC_DEFINE(HAVE_SNPRINTF)
+AC_DEFINE(HAVE_STRLCPY)
+AC_DEFINE(HAVE_MEMMOVE)
+AC_DEFINE(HAVE_GETADDRINFO)
 ])
 
-# check func replacements after ldns had a chance to already provide them.
-AC_REPLACE_FUNCS(inet_aton)
-AC_REPLACE_FUNCS(inet_pton)
-AC_REPLACE_FUNCS(inet_ntop)
-AC_REPLACE_FUNCS(snprintf)
-AC_REPLACE_FUNCS(strlcpy)
-AC_REPLACE_FUNCS(memmove)
-
-AC_CHECK_FUNCS([getaddrinfo])
-if test $ac_cv_func_getaddrinfo = no; then
-AC_LIBOBJ([fake-rfc2553])
-fi
-
-
 AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
 
 AH_BOTTOM([
index 0683a52f95be03c4544bb7eaf6190e2b75491dfa..e2ee3b98bc8950c8af8f0c66a0c2c211919b6c36 100644 (file)
@@ -8,6 +8,9 @@
        - unsecure response validation collated into one block.
        - remove warning about const cast of cfgfile name.
        - outgoing-interfaces can be different from service interfaces.
+       - ldns-src configure is done during unbound configure and
+         ldns-src make is done during unbound make, and so inherits the
+         make arguments from the unbound make invocation.
          
 18 October 2007: Wouter
        - addresses are logged with errors.