prior <sys/types.h>.
+2007-03-02 Bruno Haible <bruno@clisp.org>
+
+ * lib/netinet_in_.h: New file.
+ * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): Test whether netinet/in.h
+ is self-contained. Set ABSOLUTE_NETINET_IN_H, HAVE_NETINET_IN_H.
+ * modules/netinet_in (Files): Add lib/netinet_in_.h.
+ (Depends-on): Add absolute-header.
+ (Makefile.am): Substitute ABSOLUTE_NETINET_IN_H, HAVE_NETINET_IN_H
+ into netinet/in.h.
+
2007-03-03 Bruno Haible <bruno@clisp.org>
* lib/sys_select_.h: New file.
--- /dev/null
+/* Substitute for <netinet/in.h>.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _GL_NETINET_IN_H
+#define _GL_NETINET_IN_H
+
+#if @HAVE_NETINET_IN_H@
+
+/* On many platforms, <netinet/in.h> assumes prior inclusion of
+ <sys/types.h>. */
+
+# include <sys/types.h>
+# include @ABSOLUTE_NETINET_IN_H@
+
+#else
+
+/* A platform that lacks <netinet/in.h>. */
+
+# include <sys/socket.h>
+
+#endif
+
+#endif /* _GL_NETINET_IN_H */
-# netinet_in_h.m4 serial 1
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
+# netinet_in_h.m4 serial 2
+dnl Copyright (C) 2006-2007 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
+ AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
+ [gl_cv_header_netinet_in_h_selfcontained],
+ [
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/in.h>], [])],
+ [gl_cv_header_netinet_in_h_selfcontained=yes],
+ [gl_cv_header_netinet_in_h_selfcontained=no])
+ ])
+ if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
NETINET_IN_H=''
else
NETINET_IN_H='netinet/in.h'
+ AC_CHECK_HEADERS([netinet/in.h])
+ gl_ABSOLUTE_HEADER([netinet/in.h])
+ ABSOLUTE_NETINET_IN_H=\"$gl_cv_absolute_netinet_in_h\"
+ AC_SUBST([ABSOLUTE_NETINET_IN_H])
+ if test $ac_cv_header_netinet_in_h = yes; then
+ HAVE_NETINET_IN_H=1
+ else
+ HAVE_NETINET_IN_H=0
+ fi
+ AC_SUBST([HAVE_NETINET_IN_H])
fi
- AC_SUBST(NETINET_IN_H)
+ AC_SUBST([NETINET_IN_H])
])
Description:
-A <netinet/in.h> for systems lacking it (e.g., Mingw).
+A <netinet/in.h> for systems lacking it.
Files:
+lib/netinet_in_.h
m4/netinet_in_h.m4
Depends-on:
+absolute-header
sys_socket
configure.ac:
@MKDIR_P@ netinet
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- echo '#include <sys/socket.h>'; \
+ sed -e 's|@''ABSOLUTE_NETINET_IN_H''@|$(ABSOLUTE_NETINET_IN_H)|g' \
+ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
+ < $(srcdir)/netinet_in_.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t