Subject: pkg/20238: Fix devel/libast on Solaris
To: None <gnats-bugs@gnats.netbsd.org>
From: Jonathan Perkin <sketch@rd.bbc.co.uk>
List: netbsd-bugs
Date: 02/07/2003 17:58:12
>Number:         20238
>Category:       pkg
>Synopsis:       libast fails to check for hstrerror presence
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 07 09:59:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        NetBSD 1.6M
>Organization:
	British Broadcasting Corporation
>Environment:
System: NetBSD munkeh.intra.nut 1.6M NetBSD 1.6M (GENERIC) #0: Tue Jan 21 11:42:54 GMT 2003 sketch@munkeh.intra.nut:/usr/src/sys/arch/sparc64/compile/GENERIC sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	devel/libast builds ok on Solaris, but as soon as you try to build
	something else which depends on it (e.g. x11/eterm) then the compile
	fails due to hstrerror() being missing.

	There's nothing in libast to check for the presence hstrerror() even
	though it is missing on at least Solaris.
>How-To-Repeat:
	Build x11/eterm on Solaris
>Fix:
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/libast/distinfo,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 distinfo
--- distinfo	2002/12/26 04:52:19	1.1.1.1
+++ distinfo	2003/02/07 17:51:20
@@ -3,3 +3,7 @@
 SHA1 (libast-0.5.tar.gz) = e5e8305283bf64c7392ec752542ea27a3bccb350
 Size (libast-0.5.tar.gz) = 276591 bytes
 SHA1 (patch-aa) = 0a870149b7750089aef347a878f3953a66b16c37
+SHA1 (patch-ab) = c23fabaffbac08585f22a8775cc1e0f2e0328ef1
+SHA1 (patch-ac) = 8ee460d934567ef988346da7bef585e1f01f9489
+SHA1 (patch-ad) = 83d75730ffa7c10597677364b88580be47c18c7e
+SHA1 (patch-ae) = 4a1a8a2e0d89e127009dc614a18389068a811f0e
--- /dev/null	Fri Feb  7 17:50:48 2003
+++ patches/patch-ab	Fri Feb  7 17:52:14 2003
@@ -0,0 +1,13 @@
+$NetBSD$
+--- config.h.in.orig	Fri Feb  7 16:48:55 2003
++++ config.h.in	Fri Feb  7 16:49:38 2003
+@@ -91,6 +91,9 @@
+ /* The number of bytes in a short.  */
+ #undef SIZEOF_SHORT
+ 
++/* Define if you have the hstrerror function.  */
++#undef HAVE_HSTRERROR
++
+ /* Define if you have the memmem function.  */
+ #undef HAVE_MEMMEM
+ 
--- /dev/null	Fri Feb  7 17:50:48 2003
+++ patches/patch-ac	Fri Feb  7 17:52:18 2003
@@ -0,0 +1,14 @@
+$NetBSD$
+--- aclocal.m4.orig	Mon Sep 30 16:45:26 2002
++++ aclocal.m4	Fri Feb  7 16:51:16 2003
+@@ -421,8 +421,8 @@
+ ])
+ AC_DEFUN(AST_FUNC_CHECKS, [
+     AC_TYPE_SIGNAL
+-    AC_CHECK_FUNCS(memmove putenv strsep memmem usleep snprintf vsnprintf \
+-                   strcasestr strcasechr strcasepbrk strrev strnlen)
++    AC_CHECK_FUNCS(hstrerror memmove putenv strsep memmem usleep snprintf \
++                   vsnprintf strcasestr strcasechr strcasepbrk strrev strnlen)
+     dps_snprintf_oflow()
+     dps_vsnprintf_oflow()
+     dps_symlink_open_bug()
--- /dev/null	Fri Feb  7 17:50:48 2003
+++ patches/patch-ad	Fri Feb  7 17:52:22 2003
@@ -0,0 +1,14 @@
+$NetBSD$
+--- configure.orig	Fri Feb  7 16:52:54 2003
++++ configure	Fri Feb  7 16:53:17 2003
+@@ -6805,8 +6805,8 @@
+ EOF
+ 
+ 
+-    for ac_func in memmove putenv strsep memmem usleep snprintf vsnprintf \
+-                   strcasestr strcasechr strcasepbrk strrev strnlen
++    for ac_func in hstrerror memmove putenv strsep memmem usleep snprintf \
++                   vsnprintf strcasestr strcasechr strcasepbrk strrev strnlen
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:6813: checking for $ac_func" >&5
--- /dev/null	Fri Feb  7 17:50:48 2003
+++ patches/patch-ae	Fri Feb  7 17:52:27 2003
@@ -0,0 +1,34 @@
+$NetBSD$
+--- src/socket.c.orig	Fri Feb  7 16:53:42 2003
++++ src/socket.c	Fri Feb  7 16:57:42 2003
+@@ -27,6 +27,30 @@
+ # include <config.h>
+ #endif
+ 
++#ifndef HAVE_HSTRERROR
++const char *hstrerror(int);
++
++const char *const h_errlist[] = {
++	"Resolver Error 0 (no error)",
++	"Unknown host",				/* 1 HOST_NOT_FOUND */
++	"Host name lookup failure",		/* 2 TRY_AGAIN */
++	"Unknown server error",			/* 3 NO_RECOVERY */
++	"No address associated with name",	/* 4 NO_ADDRESS */
++};
++
++const int h_nerr = { sizeof h_errlist/sizeof h_errlist[0] };
++
++const char *
++hstrerror(int err)
++{
++	if (err < 0)
++		return ("Resolver internal error");
++	else if (err < h_nerr)
++		return (h_errlist[err]);
++	return ("Unknown resolver error");
++}
++#endif /* !HAVE_HSTRERROR */
++
+ #include <libast_internal.h>
+ 
+ static spif_url_t spif_url_new_from_ipaddr(spif_ipsockaddr_t);
>Release-Note:
>Audit-Trail:
>Unformatted: