Ethereal-dev: Re: [Ethereal-dev] inet_ntop and inet_pton checks in 0.9.9

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Albert Chin <ethereal-dev@xxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Feb 2003 22:41:38 -0600
On Thu, Feb 27, 2003 at 02:17:24PM -0800, Guy Harris wrote:
> On Thu, Feb 27, 2003 at 09:38:32AM -0600, Albert Chin wrote:
> > On Wed, Feb 26, 2003 at 07:03:22PM -0800, Guy Harris wrote:
> > > Unfortunately, the patch doesn't apply to the current CVS vrsion - we no
> > > longer have acconfig.h files, as per Pavel Roskin's mail.  Could you
> > > generate a patch against the current CVS version?
> > 
> > Attached. Untested.
> 
> Unfortunately, there's a bug somewhere - on Solaris 2.8/SPARC, with GLib
> 1.2.7, autoconf 2.57, and automake 1.4, the new epan configure script
> doesn't think GLib supports loadable modules, although the top-level
> script does.

Sorry. Try this. I missed a comma.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

-- snip snip
Index: epan/configure.in
===================================================================
RCS file: /cvsroot/ethereal/epan/configure.in,v
retrieving revision 1.37
diff -u -3 -p -r1.37 configure.in
--- epan/configure.in	26 Feb 2003 20:08:32 -0000	1.37
+++ epan/configure.in	28 Feb 2003 04:41:04 -0000
@@ -154,7 +154,7 @@ fi
 AC_SUBST(INET_ATON_C)
 AC_SUBST(INET_ATON_O)
 
-AC_CHECK_FUNC(inet_pton, [
+AC_SEARCH_LIBS(inet_pton, [socket nsl], [
   dnl check for pre-BIND82 inet_pton() bug.
   AC_MSG_CHECKING(for broken inet_pton)
   AC_TRY_RUN([#include <sys/types.h>
@@ -185,13 +185,34 @@ fi
 AC_SUBST(INET_PTON_C)
 AC_SUBST(INET_PTON_O)
 
-AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
-  INET_NTOP_O="inet_ntop.o")
-if test "$ac_cv_func_inet_ntop" = no ; then
+AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
+  AC_MSG_CHECKING([for inet_ntop prototype])
+  AC_TRY_COMPILE([#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+extern const char *inet_ntop(int, const void *, char *, size_t);],, [
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
+    [Define if inet_ntop() prototype exists])], [
+    AC_TRY_COMPILE([#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
+      AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
+      [Define if inet_ntop() prototype exists])], [
+      AC_MSG_RESULT(no)])])
+  INET_NTOP_O=""], [
   INET_NTOP_C="inet_ntop.c"
   INET_NTOP_O="inet_ntop.o"
-  AC_DEFINE(NEED_INET_V6DEFS_H, 1, [Define if inet/v6defs.h needs to be included])
-fi
+  AC_DEFINE(NEED_INET_V6DEFS_H, 1,
+  [Define if inet/v6defs.h needs to be included])])
 AC_SUBST(INET_NTOP_C)
 AC_SUBST(INET_NTOP_O)
 
Index: epan/inet_v6defs.h
===================================================================
RCS file: /cvsroot/ethereal/epan/inet_v6defs.h,v
retrieving revision 1.2
diff -u -3 -p -r1.2 inet_v6defs.h
--- epan/inet_v6defs.h	28 Aug 2002 20:40:44 -0000	1.2
+++ epan/inet_v6defs.h	28 Feb 2003 04:41:04 -0000
@@ -29,8 +29,10 @@
  * don't have it.
  */
 extern int inet_pton(int af, const char *src, void *dst);
+#ifndef HAVE_INET_NTOP_PROTO
 extern const char *inet_ntop(int af, const void *src, char *dst,
     size_t size);
+#endif
 
 /*
  * Those OSes may also not have AF_INET6, so declare it here if it's not