rework ldns-src inclusion.

git-svn-id: file:///svn/unbound/trunk@706 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-10-19 10:38:27 +00:00
parent da79cd57d9
commit 391504fd03
5 changed files with 116 additions and 91 deletions

View 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)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
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-checkconf: $(CHECKCONF_OBJ)
unbound: $(DAEMON_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) $(LIBS)
unittest: $(UNITTEST_OBJ)
unbound-checkconf: $(CHECKCONF_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
testbound: $(TESTBOUND_OBJ)
unittest: $(UNITTEST_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
lock-verify: $(LOCKVERIFY_OBJ)
testbound: $(TESTBOUND_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) $(LIBS)
pktview: $(PKTVIEW_OBJ)
lock-verify: $(LOCKVERIFY_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
signit: $(SIGNIT_OBJ)
pktview: $(PKTVIEW_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
memstats: $(MEMSTATS_OBJ)
signit: $(SIGNIT_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $^ $(LIBS)
$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
memstats: $(MEMSTATS_OBJ) $(ldnslib)
$(INFO) Link $@
$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'\'' > $@; \

View 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

102
configure vendored
View File

@ -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

View 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([

View 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.