@if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
$Q$(COMPILE) -c $< -o $@
-.PHONY: clean realclean doc lint all install uninstall tests test
+.PHONY: clean realclean doc lint all install uninstall tests test download_ldns strip
all: $(COMMON_OBJ) unbound unbound-checkconf
rm -f config.status config.log config.h.in config.h
rm -f configure config.sub config.guess ltmain.sh aclocal.m4 libtool
rm -f util/configlexer.c util/configparser.c util/configparser.h
+ if test -d ldns-src; then rm -rf ldns-src; fi
rm -f Makefile
$(BUILD)%.lint: $(srcdir)/%.c
$(doxygen) $(srcdir)/doc/unbound.doxygen
endif
+strip:
+ strip unbound
+ strip unbound-checkconf
+
install:
$(INSTALL) -d $(bindir)
$(INSTALL) -d $(mandir)
rm -f -- $(bindir)/unbound $(bindir)/unbound-checkconf
rm -f -- $(mandir)/man8/unbound.8 $(mandir)/man8/unbound-checkconf.8 $(mandir)/man5/unbound.conf.5
+download_ldns:
+ svn export https://www.nlnetlabs.nl/ldns/svn/trunk/makedist.sh ldns_makedist.sh
+ ./ldns_makedist.sh -s -d https://www.nlnetlabs.nl/ldns/svn/trunk
+ mv ldns-*_pre_*.tar.gz ldns-src.tar.gz
+ rm ldns-*_pre_*.tar.gz.sha1 ldns_makedist.sh
+
# Automatic dependencies.
$(BUILD)%.d: $(srcdir)/%.c
$(INFO) Depend $<
AC_FUNC_FSEEKO
AC_SYS_LARGEFILE
+# check this after all other compilation checks, since the linking of the lib
+# may break checks after this.
+AC_ARG_WITH(ldns,
+ AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use])
+ , [ specialldnsdir="$withval"
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ LDFLAGS="$LDFLAGS -L$withval -L$withval/lib -lldns"
+ ldnsdir="$withval"
+ AC_SUBST(ldnsdir)
+])
+
+AC_CHECK_LIB(ldns, ldns_rr_new,, [
+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.])
+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*`
+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])
+CPPFLAGS="$CPPFLAGS -I$ldnsdir/include"
+LDFLAGS="$LDFLAGS $ldnsdir/lib/*.o"
+AC_SUBST(ldnsdir)
+])
+
+# 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_LIBOBJ([fake-rfc2553])
fi
-# check this after all other compilation checks, since the linking of the lib
-# may break checks after this.
-AC_ARG_WITH(ldns,
- AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use])
- , [ specialldnsdir="$withval"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- LDFLAGS="$LDFLAGS -L$withval -L$withval/lib -lldns"
- ldnsdir="$withval"
- AC_SUBST(ldnsdir)
-])
-
-AC_CHECK_LIB(ldns, ldns_rr_new,, [AC_MSG_ERROR([Can't find ldns library])])
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
- fixup testcode fake event to remove pending before callback
since the callback may create new pending items.
- tests updated because retries are now in iterator module.
+ - ldns-testpkts code is checked for differences between unbound
+ and ldns by makedist.sh.
+ - ldns trunk from today added in svn repo for fallback in case
+ no ldns is installed on the system.
+ make download_ldns refreshes the tarball with ldns svn trunk.
+ - ldns-src.tar.gz is used if no ldns is found on the system, and
+ statically linked into unbound.
17 October 2007: Wouter
- fixup another cycle detect and ns-addr timeout resolution bug.
or get a beta version from the svn repository at
http://unbound.net/svn/
-* Needs the following libraries
+* Uses the following libraries;
* ldns http://www.nlnetlabs.nl/ldns/ (BSD license)
* libevent http://www.monkey.org/~provos/libevent/ (BSD license)
* Make and install: ./configure; make; make install
* --with-ldns=/path/to/ldns
+ If ldns is not detected on the system, a prepackaged incuded tarball
+ of the ldns library is used to compile and statically link against.
+ If detected on the system, it will dynamically link against it.
* --with-libevent=/path/to/libevent
Can be set to either the system install or the build directory.
--with-libevent=no gives a builtin alternative implementation.
README unbound tests
-There is a test setup for unbound.
+There is a test setup for unbound. Use
+ make test
+To make and run the tests. The results are summarized at the end.
+You can also run ./unittest by hand, if the system lacks other debug tools.
testdata/ contains the data for tests.
testcode/ contains scripts and c code for the tests.
do-tests.sh : runs all the tests in the testdata directory.
testbed.sh : compiles on a set of (user specific) hosts and runs do-tests.
-Tests are run using tpkg.
+Tests are run using testcode/mini_tpkg.sh.
eval `grep 'ldnsdir=' Makefile`
LDNSDIR="$ldnsdir"
fi
- if test -z "$LDNSDIR"; then
- error "LDNSDIR not detected in Makefile, specify manually (using -l)"
- fi
fi
# Start the packaging process.
info "SVNROOT is $SVNROOT"
info "SNAPSHOT is $SNAPSHOT"
-info "LDNSDIR is $LDNSDIR"
#question "Do you wish to continue with these settings?" || error "User abort."
flex -i -t util/configlexer.lex >> util/configlexer.c || error_cleanup "Failed to create configlexer"
bison -y -d -o util/configparser.c util/configparser.y || error_cleanup "Failed to create configparser"
-# copy ldns-testpkts from ldns examples
-#cp $LDNSDIR/examples/ldns-testpkts.c testcode/ldns-testpkts.c || error_cleanup "copy ldns/examples/.. failed"
-#cp $LDNSDIR/examples/ldns-testpkts.h testcode/ldns-testpkts.h || error_cleanup "copy ldns/examples/.. failed"
+# check shared code, ldns-testpkts from ldns examples, if possible.
+if test ! -z "$LDNSDIR"; then
+ if diff -q $LDNSDIR/examples/ldns-testpkts.c testcode/ldns-testpkts.c &&
+ diff -q $LDNSDIR/examples/ldns-testpkts.h testcode/ldns-testpkts.h; then
+ info "ldns-testpkts.c and ldns-testpkts.h are OK"
+ else
+ error_cleanup "ldns-testpkts is different in ldns and unbound"
+ fi
+fi
find . -name .c-mode-rc.el -exec rm {} \;
find . -name .cvsignore -exec rm {} \;