seems to work on osx, bsd and linux now, and in any directory (no relative dependency on the source dirs)
bindir = @bindir@
mandir = @mandir@
doxygen = @doxygen@
+glibtool = @glibtool@
+libtool = @libtool@
+ifdef glibtool
+libtool = $(glibtool)
+endif
CC = @CC@
CPPFLAGS = @CPPFLAGS@ @DEFS@ -I. -I$(srcdir)
LIBS = @LIBS@
LIBOBJS = @LIBOBJS@
DATE = $(shell date +%Y%m%d)
-LIBTOOL = libtool --tag=CXX
+LIBTOOL = $(libtool) --tag=CXX
LINT = splint
LINTFLAGS = +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t
host2str.c buffer.c str2host.c tsig.c resolver.c \
net.c host2wire.c dname.c dnssec.c keys.c \
higher.c rr_functions.c parse.c update.c error.c zone.c
-LIBDNS_HEADERS = ldns/error.h \
- ldns/packet.h \
- ldns/common.h \
- ldns/rdata.h \
- ldns/rr.h \
- ldns/wire2host.h \
- ldns/host2str.h \
- ldns/host2wire.h \
- ldns/str2host.h \
- ldns/buffer.h \
- ldns/resolver.h \
- ldns/net.h \
- ldns/dname.h \
- ldns/dnssec.h \
- ldns/keys.h \
- ldns/higher.h \
- ldns/parse.h \
- ldns/rr_functions.h \
- ldns/dns.h \
- ldns/zone.h \
+LIBDNS_HEADERS = $(srcdir)/ldns/error.h \
+ $(srcdir)/ldns/packet.h \
+ $(srcdir)/ldns/common.h \
+ $(srcdir)/ldns/rdata.h \
+ $(srcdir)/ldns/rr.h \
+ $(srcdir)/ldns/wire2host.h \
+ $(srcdir)/ldns/host2str.h \
+ $(srcdir)/ldns/host2wire.h \
+ $(srcdir)/ldns/str2host.h \
+ $(srcdir)/ldns/buffer.h \
+ $(srcdir)/ldns/resolver.h \
+ $(srcdir)/ldns/net.h \
+ $(srcdir)/ldns/dname.h \
+ $(srcdir)/ldns/dnssec.h \
+ $(srcdir)/ldns/keys.h \
+ $(srcdir)/ldns/higher.h \
+ $(srcdir)/ldns/parse.h \
+ $(srcdir)/ldns/rr_functions.h \
+ $(srcdir)/ldns/dns.h \
+ $(srcdir)/ldns/zone.h \
ldns/util.h \
- ldns/update.h \
- ldns/tsig.h
+ $(srcdir)/ldns/update.h \
+ $(srcdir)/ldns/tsig.h
PROG_SOURCES = ldns-keygen.c ldns-key2ds.c ldns-signzone.c \
ldns-version.c
PROG_TARGETS = $(PROG_SOURCES:.c=)
tools: $(PROG_TARGETS) drill
./drill/config.log:
- ( mkdir drill ; cd drill ; ../$(srcdir)/drill/configure --with-ldns=$(srcdir))
+ ( mkdir drill ; cd drill ; ../$(srcdir)/drill/configure LDFLAGS="-L../.libs" CPPFLAGS="-I.. -I../..")
drill: ./drill/config.log
( cd drill ; $(MAKE) -f Makefile all)
$(LINK_LIB) -o libldns.la $(LIBDNS_LOBJECTS) b64_pton$U.lo b64_ntop$U.lo \
-rpath $(prefix)/lib
-doc: doc/function_manpages
- $(doxygen)
- cat ldns/*.h | doc/doxyparse.pl -m doc/function_manpages 2>&1 | \
+doc: $(srcdir)/doc/function_manpages
+ $(INSTALL) -d doc
+ifdef doxygen
+ $(doxygen) $(srcdir)/libdns.doxygen
+endif
+ cat $(srcdir)/ldns/*.h | $(srcdir)/doc/doxyparse.pl -m $(srcdir)/doc/function_manpages 2>&1 | \
grep -v ^doxygen | grep -v ^cat > doc/ldns_manpages
install: install-h install-lib install-progs install-doc
cp -Rp doc/man/man3/* $(mandir)/man3/
${INSTALL} -d $(mandir)/man1
for i in $(PROG_TARGETS); do \
- ${INSTALL} -c -m 644 doc/$$i.1 $(mandir)/man1 ; done
+ ${INSTALL} -c -m 644 $(srcdir)/doc/$$i.1 $(mandir)/man1 ; done
exit 0
uninstall-doc: doc
REQUIREMENTS
- OpenSSL
-- libtool package
+- (GNU) libtool (that's glibtool, not libtool in OSX)
+- GNU make
INSTALLATION
1. Unpack the tarball
* Examples
There are some examples in the examples/ directory. These can be built with:
1. autoreconf
-2. ./configure --with-ldns=../
+2. ./configure
3. gmake
-When running the examples the main library has to be installed (gmake
-install) or your LD_LIBRARY_PATH must contain the ldns-<VERSION>/.libs
-directory.
+The library has to be installed in order for this to work. If it is not
+installed in one of the default paths you should add the following arguments to
+the configure command:
+LDFLAGS="-L<path_to_library_dir>" CPPFLAGS="-I<path_to_header_dir>"
+
+If you have only built the library and not installed it anywhere, these
+values should be:
+LDFLAGS="-L<build-dir>/.libs" CPPFLAGS="-I<build-dir> -I<src_dir>"
+
+In that last case, you will also need to have your LD_LIBRARY_PATH set to
+the .libs directory to be able to run the examples.
+
+
+* Drill
+
+Drill is automatically built alongside with the main library. If you want to
+build drill by hand, the configure and running options are the same as those
+for the examples. You can use the make target 'lib' if you only want to
+build the library and not drill (and make install-lib to install it).
* Developers
ldns is developed by the ldns team at NLnet Labs. This team currently
])dnl
# my own checks
-AC_CHECK_PROG(doxygen, doxygen, [doxygen libdns.doxygen])
+AC_CHECK_PROG(doxygen, doxygen, doxygen)
# Checks for libraries.
# Check for SSL, original taken from
fi
# Use libtool
+# for macosx, see if glibtool exists and use that
+# BSD's need to know the version...
+AC_CHECK_PROG(glibtool, glibtool, [glibtool], )
+AC_CHECK_PROG(libtool, libtool15, [libtool15], libtool)
AC_PROG_LIBTOOL
+
# Checks for header files.
AC_HEADER_STDC
#AC_HEADER_SYS_WAIT
LDNSDIR = @LDNSDIR@
CC = @CC@
CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
INSTALL = $(srcdir)/install-sh -c
install: all
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) drill $(DESTDIR)$(bindir)/drill
- $(INSTALL) -m 644 drill.1 $(DESTDIR)$(mandir)/man1/drill.1
+ $(INSTALL) -m 644 $(srcdir)/drill.1 $(DESTDIR)$(mandir)/man1/drill.1
uninstall:
@echo
# ripped from http://autoconf-archive.cryp.to/check_ssl.html
# check for ldns
+AC_CHECK_LIB(ldns, ldns_rr_new,, [
+ AC_MSG_ERROR([Can't find ldns library])
+ ]
+)
+
AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATHNAME],[]))
-AC_MSG_CHECKING(for ldns/dns.h)
-#echo "[" $withval "]"
-for dir in $withval /usr/local/ldns /usr/lib/ldns /usr/ldns /usr/pkg /usr/local /usr; do
-ldnsdir="$dir"
-#echo "$dir/include/ldns/dns.h"
-#echo "$dir/ldns/dns.h"
-if test -f "$dir/include/ldns/dns.h"; then
- found_ldns="yes";
- LDNSDIR="$ldnsdir/include/"
- CFLAGS="$CFLAGS -I$LDNSDIR -DHAVE_LDNS";
- CXXFLAGS="$CXXFLAGS -I$ldnsdir/include/ -DHAVE_LDNS";
- break;
-fi
-if test -f "$dir/ldns/dns.h"; then
- found_ldns="yes";
- LDNSDIR="$ldnsdir/"
- CFLAGS="$CFLAGS -I$LDNSDIR -DHAVE_LDNS";
- CXXFLAGS="$CXXFLAGS -I$ldnsdir/ -DHAVE_LDNS";
- break
-fi
-done
-if test x_$found_ldns != x_yes; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Cannot find ldns libraries)
-else
-# printf "ldns found in $ldnsdir\n";
- LIBS="$LIBS -lldns";
- LDFLAGS="$LDFLAGS -L$ldnsdir/lib";
- LDFLAGS="$LDFLAGS -L$ldnsdir/.libs"; # hack for dev.
- HAVE_LDNS=yes
- AC_MSG_RESULT(yes)
-fi
-AC_SUBST(HAVE_LDNS)
-AC_SUBST(LDNSDIR, [$LDNSDIR])
-# I don't use these
-# Checks for typedefs, structures, and compiler characteristics.
-#AC_TYPE_UID_T
-#AC_TYPE_MODE_T
-#AC_TYPE_OFF_T
-#AC_TYPE_SIZE_T
-#AC_STRUCT_TM
+AC_CHECK_HEADER(ldns/dns.h,, [
+ AC_MSG_ERROR([Can't find ldns headers])
+ ]
+)
-# Checks for library functions.
-# check for ldns
-#AC_FUNC_CHOWN
-#AC_FUNC_FORK
-#AC_FUNC_MALLOC
-#AC_FUNC_MKTIME
-#AC_FUNC_STAT
#AC_CHECK_FUNCS([mkdir rmdir strchr strrchr strstr])
#AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
CC = @CC@
CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT(libdns-tests, 1.0.0, ldns@nlnetlabs.nl, ldns-tests-1.0.0)
-AC_CONFIG_SRCDIR([../ldns/config.h])
+AC_INIT(drill, 1.0.0, drill@nlnetlabs.nl, drill)
+AC_CONFIG_SRCDIR([ldns-read-zone.c])
AC_AIX
# Checks for programs.
])
# ripped from http://autoconf-archive.cryp.to/check_ssl.html
-
-
# check for ldns
-AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=pathname],[]))
-AC_MSG_CHECKING(for ldns/dns.h)
-for dir in $withval /usr/local/ldns /usr/lib/ldns /usr/ldns /usr/pkg /usr/local /usr; do
-ldnsdir="$dir"
-if test -f "$dir/include/ldns/dns.h"; then
- found_ldns="yes";
- CFLAGS="$CFLAGS -I$ldnsdir/include/ -DHAVE_LDNS";
- CXXFLAGS="$CXXFLAGS -I$ldnsdir/include/ -DHAVE_LDNS";
- break;
-fi
-if test -f "$dir/ldns/dns.h"; then
- found_ldns="yes";
- CFLAGS="$CFLAGS -I$ldnsdir/ -DHAVE_LDNS";
- CXXFLAGS="$CXXFLAGS -I$ldnsdir/ -DHAVE_LDNS";
- break
-fi
-done
-if test x_$found_ldns != x_yes; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Cannot find ldns libraries)
-else
-# printf "ldns found in $ldnsdir\n";
- LIBS="$LIBS -lldns";
- LDFLAGS="$LDFLAGS -L$ldnsdir/lib";
- LDFLAGS="$LDFLAGS -L$ldnsdir/.libs"; # hack for dev.
- HAVE_LDNS=yes
- AC_MSG_RESULT(yes)
-fi
-AC_SUBST(HAVE_LDNS)
+AC_CHECK_LIB(ldns, ldns_rr_new,, [
+ AC_MSG_ERROR([Can't find ldns library])
+ ]
+)
-# I don't use these
-# Checks for typedefs, structures, and compiler characteristics.
-#AC_TYPE_UID_T
-#AC_TYPE_MODE_T
-#AC_TYPE_OFF_T
-#AC_TYPE_SIZE_T
-#AC_STRUCT_TM
+AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATHNAME],[]))
+
+AC_CHECK_HEADER(ldns/dns.h,, [
+ AC_MSG_ERROR([Can't find ldns headers])
+ ]
+)
-# Checks for library functions.
-# check for ldns
-#AC_FUNC_CHOWN
-#AC_FUNC_FORK
-#AC_FUNC_MALLOC
-#AC_FUNC_MKTIME
-#AC_FUNC_STAT
#AC_CHECK_FUNCS([mkdir rmdir strchr strrchr strstr])
#AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
-AC_CONFIG_FILES([Makefile])
+#AC_CONFIG_FILES([Makefile
+# drill.h
+# ])
AC_CONFIG_HEADER([config.h])
AC_OUTPUT
* Licensed under the GPL version 2
*/
-#include <ldns/config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#include <stdint.h>
#include <ldns/dns.h>
* Licensed under the GPL version 2
*/
-#include <ldns/config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#include <stdint.h>
#include <ldns/dns.h>
#include <stdio.h>
#include <sys/types.h>
-#include <ldns/config.h>
+#include "config.h"
+
+#include <stdint.h>
#include <ldns/dns.h>
i = 0;
do {
rr = ldns_rr_new_frm_fp_l(fp, &my_ttl, &my_origin, line_nr);
-printf("RR at %p\n", rr);
i++;
} while (!rr && i <= 9);