From: Wouter Wijngaards Date: Fri, 19 Oct 2007 10:38:27 +0000 (+0000) Subject: rework ldns-src inclusion. X-Git-Tag: release-0.6~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=391504fd03ed78341767169b76a660cc76d84a5f;p=thirdparty%2Funbound.git rework ldns-src inclusion. git-svn-id: file:///svn/unbound/trunk@706 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/Makefile.in b/Makefile.in index d04f8c374..08debb5a1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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'\'' > $@; \ diff --git a/config.h.in b/config.h.in index 6ba313cd8..5f169c811 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure b/configure index 21496c731..8b2f879f1 100755 --- 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 @@ -23756,51 +23755,7 @@ fi { 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 diff --git a/configure.ac b/configure.ac index 619876106..e4d70fd77 100644 --- a/configure.ac +++ b/configure.ac @@ -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([ diff --git a/doc/Changelog b/doc/Changelog index 0683a52f9..e2ee3b98b 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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.