ldns still (but only) needed for unit tests

This commit is contained in:
Willem Toorop 2015-09-28 11:44:39 +02:00
parent 59f4feb5e6
commit 7bf481d812
2 changed files with 73 additions and 5 deletions

View File

@ -554,6 +554,7 @@ AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
# afterwards.
getdns_LIBS="$LIBS"
getdns_LDFLAGS="$LDFLAGS"
getdns_CFLAGS="$CFLAGS"
#-------------------- libraries needed for libcheck
LIBS="$initial_LIBS"
@ -579,6 +580,60 @@ AC_SUBST([CHECK_LIBS])
AC_SUBST([CHECK_CFLAGS])
# end libraries needed for libcheck
# find libldns
LIBS="$initial_LIBS"
LDNS_LIBS=""
LDNS_CFLAGS=""
LDNS_LDFLAGS=""
NOLIBLDNS=""
AC_ARG_WITH(libldns, AS_HELP_STRING([--with-libldns=pathname],
[path to libldns (default: search /usr/local ..)]),
[], [withval="yes"])
if test x_$withval = x_yes; then
for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
if test -f "$dir/include/ldns/ldns.h"; then
LDNS_CFLAGS="-I$dir/include"
LDNS_LDFLAGS="-L$dir/lib"
CFLAGS="$CFLAGS $LDNS_CFLAGS"
LDFLAGS="$LDFLAGS $LDNS_LDFLAGS"
AC_MSG_NOTICE([Found libldns in $dir])
break
fi
done
else
if test x_$withval != x_no; then
LDNS_CFLAGS="-I$withval/include"
LDNS_LDFLAGS="-L$withval/lib"
CFLAGS="$CFLAGS $LDNS_CFLAGS"
LDFLAGS="$LDFLAGS $LDNS_LDFLAGS"
else
NOLIBLDNS="nolibldns"
AC_MSG_WARN([libldns not found or usable; unit tests will not be compiled and run])
fi
fi
if test x$NOLIBLDNS = x
then
AC_CHECK_LIB([ldns], [ldns_dname_new_frm_str], [
LDNS_LIBS="-lldns"
AC_DEFINE_UNQUOTED(HAVE_LIBLDNS, [1], [Have libldns])
], [
NOLIBLDNS="nolibldns"
AC_MSG_WARN([libldns not found or usable; unit tests will not be compiled and run])
])
fi
AC_SUBST([LDNS_LIBS])
AC_SUBST([LDNS_CFLAGS])
AC_SUBST([LDNS_LDFLAGS])
AC_SUBST([NOLIBLDNS])
LIBS="$getdns_LIBS"
CFLAGS="$getdns_CFLAGS"
LDFLAGS="$getdns_LDFLAGS"
#-------------------- libevent extension
AC_ARG_WITH([libevent],
[AS_HELP_STRING([--with-libevent], [path to libevent (default: search /usr/local ..)])],

View File

@ -43,6 +43,7 @@ have_libevent = @have_libevent@
have_libuv = @have_libuv@
have_libev = @have_libev@
NOLIBCHECK = @NOLIBCHECK@
NOLIBLDNS = @NOLIBLDNS@
EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@
EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@
@ -62,6 +63,9 @@ LDFLAGS=-L.. @LDFLAGS@
LDLIBS=../libgetdns.la @LIBS@
CHECK_LIBS=@CHECK_LIBS@
CHECK_CFLAGS=@CHECK_CFLAGS@
LDNS_LIBS=@LDNS_LIBS@
LDNS_CFLAGS=@LDNS_CFLAGS@
LDNS_LDFLAGS=@LDNS_LDFLAGS@
CHECK_OBJS=check_getdns_common.lo check_getdns_context_set_timeout.lo \
check_getdns.lo check_getdns_transport.lo
@ -113,16 +117,16 @@ check_getdns_common: check_getdns_common.lo
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo
check_getdns: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) $(LDNS_CFLAGS) $(LDNS_LDFLAGS) $(LDNS_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
check_getdns_event: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo ../libgetdns_ext_event.la
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) $(LDNS_CFLAGS) $(LDNS_LDFLAGS) $(LDNS_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
check_getdns_uv: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo ../libgetdns_ext_uv.la
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) $(LDNS_CFLAGS) $(LDNS_LDFLAGS) $(LDNS_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
check_getdns_ev: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo ../libgetdns_ext_ev.la
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) $(LDNS_CFLAGS) $(LDNS_LDFLAGS) $(LDNS_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
getdns_query: getdns_query.lo
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ getdns_query.lo $(LDFLAGS) $(LDLIBS)
@ -143,7 +147,16 @@ nolibcheck:
@echo "***"
@false
test: $(NOLIBCHECK) all
nolibldns:
@echo "***"
@echo "*** Cannot run unit tests, because they could not be compiled,"
@echo "*** because libldns was not found or usable at configure time."
@echo "*** To compile and run unit tests make sure libldns is available"
@echo "*** and usable during configuration"
@echo "***"
@false
test: $(NOLIBCHECK) $(NOLIBLDNS) all
(cd $(srcdir)/../.. && find . -type f -executable -and \( -name "*.[ch]" -or -name "*.html" -or -name "*.in" -or -name "*.good" -or -name "*.ac" \) | awk 'BEGIN{e=0}{print("ERROR! Executable bit found on", $$0);e=1}END{exit(e)}')
./$(CHECK_GETDNS)
if test $(have_libevent) = 1 ; then ./$(CHECK_EVENT_PROG) ; fi