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 09:38:32 -0600
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.

-- 
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	27 Feb 2003 15:37:24 -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)