[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
netinet_in (was: Re: [PATCH]: arpa/inet.h inclusion warning under FreeBS
From: |
jas |
Subject: |
netinet_in (was: Re: [PATCH]: arpa/inet.h inclusion warning under FreeBSD 4.x) |
Date: |
Fri, 28 Jul 2006 19:26:57 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
address@hidden writes:
> address@hidden writes:
>
>> Yoann Vandoorselaere <address@hidden> writes:
>>
>>> On Fri, 2006-07-28 at 14:13 +0200, Bruno Haible wrote:
>>>> Yoann Vandoorselaere wrote:
>>>> >
>>>> > #include <sys/types.h>
>>>> > #include <sys/socket.h>
>>>> > +
>>>> > +#ifdef HAVE_NETINET_IN_H
>>>> > +# include <netinet/in.h>
>>>> > +#endif
>>>> > +
>>>> > #ifdef HAVE_ARPA_INET_H
>>>> > # include <arpa/inet.h>
>>>> > #endif
>>>>
>>>> Also, how about using #if instead of #ifdef, like in the rest of gnulib?
>>>
>>> Sound good, although I guess you can also update the HAVE_ARPA_INET_H
>>> check then. :-)
>>
>> I've installed your patch.
>
> On second thought, it seems as if inet_?to? should depend on the
> arpa_inet module, to avoid the need for the HAVE_ARPA_INET_H checks.
And having a netinet/in.h replacement module would simplify things
further. I installed this.
/Simon
Index: m4/ChangeLog
===================================================================
RCS file: /sources/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.890
diff -u -p -r1.890 ChangeLog
--- m4/ChangeLog 28 Jul 2006 16:31:48 -0000 1.890
+++ m4/ChangeLog 28 Jul 2006 17:26:44 -0000
@@ -1,3 +1,7 @@
+2006-07-28 Simon Josefsson <address@hidden>
+
+ * netinet_in_h.m4: New file.
+
2006-07-28 Yoann Vandoorselaere <address@hidden>
* inet_pton.m4, inet_ntop.m4: Check for netinet/in.h too.
Index: m4/netinet_in_h.m4
===================================================================
RCS file: m4/netinet_in_h.m4
diff -N m4/netinet_in_h.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/netinet_in_h.m4 28 Jul 2006 17:26:44 -0000
@@ -0,0 +1,18 @@
+# netinet_in_h.m4 serial 1
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Simon Josefsson
+
+AC_DEFUN([gl_HEADER_NETINET_IN],
+[
+ AC_CHECK_HEADERS_ONCE([netinet/in.h])
+ if test $ac_cv_header_netinet_in_h = yes; then
+ NETINET_IN_H=''
+ else
+ NETINET_IN_H='netinet/in.h'
+ fi
+ AC_SUBST(NETINET_IN_H)
+])
Index: modules/netinet_in
===================================================================
RCS file: modules/netinet_in
diff -N modules/netinet_in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/netinet_in 28 Jul 2006 17:26:44 -0000
@@ -0,0 +1,32 @@
+Description:
+A <netinet/in.h> for systems lacking it (e.g., Mingw).
+
+Files:
+m4/netinet_in_h.m4
+
+Depends-on:
+sys_socket
+
+configure.ac:
+gl_HEADER_NETINET_IN
+
+Makefile.am:
+BUILT_SOURCES += $(NETINET_IN_H)
+
+# We need the following in order to create <netinet/in.h> when the system
+# doesn't have one.
+netinet/in.h:
+ test -d netinet || mkdir netinet
+ echo '#include <sys/socket.h>' >address@hidden
+ mv address@hidden $@
+MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
+MOSTLYCLEANDIRS += netinet
+
+Include:
+#include <netinet/in.h>
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson
Index: modules/inet_ntop
===================================================================
RCS file: /sources/gnulib/gnulib/modules/inet_ntop,v
retrieving revision 1.6
diff -u -p -r1.6 inet_ntop
--- modules/inet_ntop 28 Jul 2006 16:47:24 -0000 1.6
+++ modules/inet_ntop 28 Jul 2006 17:26:44 -0000
@@ -11,6 +11,7 @@ restrict
socklen
sys_socket
arpa_inet
+netinet_in
configure.ac:
gl_INET_NTOP
Index: modules/inet_pton
===================================================================
RCS file: /sources/gnulib/gnulib/modules/inet_pton,v
retrieving revision 1.3
diff -u -p -r1.3 inet_pton
--- modules/inet_pton 28 Jul 2006 16:47:24 -0000 1.3
+++ modules/inet_pton 28 Jul 2006 17:26:44 -0000
@@ -11,6 +11,7 @@ restrict
socklen
sys_socket
arpa_inet
+netinet_in
configure.ac:
gl_INET_PTON
Index: lib/ChangeLog
===================================================================
RCS file: /sources/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.1232
diff -u -p -r1.1232 ChangeLog
--- lib/ChangeLog 28 Jul 2006 16:47:24 -0000 1.1232
+++ lib/ChangeLog 28 Jul 2006 17:26:45 -0000
@@ -1,5 +1,10 @@
2006-07-28 Simon Josefsson <address@hidden>
+ * inet_ntop.h, inet_pton.h: No need to guard netinet/in.h
+ #include's.
+
+2006-07-28 Simon Josefsson <address@hidden>
+
* inet_ntop.h, inet_pton.h: No need to guard arpa/inet.h
#include's.
Index: lib/inet_ntop.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/inet_ntop.h,v
retrieving revision 1.8
diff -u -p -r1.8 inet_ntop.h
--- lib/inet_ntop.h 28 Jul 2006 16:47:24 -0000 1.8
+++ lib/inet_ntop.h 28 Jul 2006 17:26:45 -0000
@@ -17,9 +17,7 @@
#include <sys/types.h>
#include <sys/socket.h>
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
+#include <netinet/in.h>
#include <arpa/inet.h>
/* Converts an internet address from internal format to a printable,
Index: lib/inet_pton.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/inet_pton.h,v
retrieving revision 1.3
diff -u -p -r1.3 inet_pton.h
--- lib/inet_pton.h 28 Jul 2006 16:47:24 -0000 1.3
+++ lib/inet_pton.h 28 Jul 2006 17:26:45 -0000
@@ -17,9 +17,7 @@
#include <sys/types.h>
#include <sys/socket.h>
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
+#include <netinet/in.h>
#include <arpa/inet.h>
#if !HAVE_DECL_INET_PTON