The configuration step of detecting presence of <resolv.h>
is failing on BSD systems like FreeBSD and NetBSD, since
it is a requirement to invoke <netinet/in.h>:

   #include <sys/types.h>
   #include <netinet/in.h>
   #include <resolv.h>

in order to avoid errors.

In addition, BSD systems carry res_query() already in libc,
are thus not in need of libresolv.

The following patch allows build of libshishi on FreeBSD,
NetBSD, and DragonflyBSD.

Best regards,
  Mats Erik Andersson
>From 81fc232f7acdcb4a7f0da4aa5dcff3071ab1ed30 Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <g...@gisladisker.se>
Date: Mon, 2 Jul 2012 20:36:25 +0200
Subject: [PATCH 1/2] Issues with libresolv.

Some BSD variants must use <netinet/in.h> before
including <resolv.h>.  Additionally, res_query()
is present in libc on most BSD systems.
---
 configure.ac |    6 ++++--
 lib/resolv.c |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 06b70d5..40d8a3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,9 @@ gl_EARLY
 gl2_EARLY
 gl3_EARLY
 AC_HEADER_STDC
-AC_CHECK_HEADERS(termios.h pwd.h syslog.h resolv.h arpa/nameser.h netinet/in6.h)
+AC_CHECK_HEADERS(termios.h pwd.h syslog.h arpa/nameser.h netinet/in6.h)
+AC_CHECK_HEADERS(resolv.h, , , [#include <sys/types.h>
+#include <netinet/in.h>])
 
 # Used when creating libshishi-XX.def.
 SOVERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
@@ -81,7 +83,7 @@ if test "$ac_cv_libgcrypt" != yes; then
 fi
 
 # Checks for library functions.
-AC_CHECK_FUNCS(signal select ngettext gethostbyname getpwnam getuid)
+AC_CHECK_FUNCS(signal select ngettext gethostbyname getpwnam getuid res_query)
 AC_CHECK_LIB(resolv, res_query,, AC_MSG_WARN([[no libresolv, SRV RRs not used]]))
 AC_SEARCH_LIBS(socket, socket)
 AC_SEARCH_LIBS(gethostbyname, nsl)
diff --git a/lib/resolv.c b/lib/resolv.c
index d2eff5c..61062b4 100644
--- a/lib/resolv.c
+++ b/lib/resolv.c
@@ -30,7 +30,7 @@
 
 #include "internal.h"
 
-#ifdef HAVE_LIBRESOLV
+#if defined HAVE_LIBRESOLV || defined HAVE_RES_QUERY
 
 /* the largest packet we'll send and receive */
 #if PACKETSZ > 1024
-- 
1.7.2.5

_______________________________________________
Help-shishi mailing list
Help-shishi@gnu.org
https://lists.gnu.org/mailman/listinfo/help-shishi

Reply via email to