* doc/posix-headers/sys_un.texi (sys/un.h): Mention it.
* lib/sys_un.in.h: New file.
* m4/sys_un_h.m4: New file.
* modules/sys_un: New file.
+2024-07-24 Collin Funk <collin.funk1@gmail.com>
+
+ sys_un: New module.
+ * doc/posix-headers/sys_un.texi (sys/un.h): Mention it.
+ * lib/sys_un.in.h: New file.
+ * m4/sys_un_h.m4: New file.
+ * modules/sys_un: New file.
+
2024-07-24 Bruno Haible <bruno@clisp.org>
Avoid false select_used_without_requesting_gnulib_module_select.
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_un.h.html}
-Gnulib module: ---
+Gnulib module: sys_un
Portability problems fixed by Gnulib:
@itemize
+@item
+@c Added in Windows 10 Insider Build 17063:
+@c <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>
+@c <https://blogs.windows.com/windows-insider/2017/12/19/announcing-windows-10-insider-preview-build-17063-pc/>
+This header file is missing on some platforms:
+mingw, MSVC 14.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This header file is missing on some platforms:
-mingw, MSVC 14.
-@item
This header requires <code>sys/socket.h</code> to be included first on
some platforms:
Cygwin 1.7.18.
--- /dev/null
+/* sys/un.h - definitions for UNIX domain sockets
+
+ Copyright 2024 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ This file 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Collin Funk. */
+
+#ifndef _@GUARD_PREFIX@_SYS_UN_H
+#define _@GUARD_PREFIX@_SYS_UN_H 1
+
+/* Windows requires <winsock2.h> to be included before <afunix.h>. */
+#if @HAVE_WINSOCK2_H@
+# include <winsock2.h>
+#endif
+#if @HAVE_AFUNIX_H@
+# include <afunix.h>
+#endif
+
+/* If a platform does not support AF_UNIX sockets 'struct sockaddr_un' will
+ not be defined. You may use HAVE_UNIXSOCKET after including <config.h>. */
+
+#endif
--- /dev/null
+# sys_un_h.m4
+# serial 1
+dnl Copyright 2024 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.
+
+AC_DEFUN_ONCE([gl_SYS_UN_H],
+[
+ dnl Check if UNIX domain sockets are supported.
+ AC_REQUIRE([gl_SOCKET_FAMILY_UNIX])
+
+ GL_GENERATE_SYS_UN_H=false
+
+ if test $gl_cv_socket_unix = yes; then
+
+ dnl Check if using a Windows version that supports AF_UNIX.
+ dnl See <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>.
+ if test "$ac_cv_header_winsock2_h" = yes \
+ && test "$ac_cv_header_afunix_h" = yes; then
+ GL_GENERATE_SYS_UN_H=true
+ fi
+ fi
+
+ dnl Checked in gl_SOCKET_FAMILY_UNIX.
+ if test "$ac_cv_header_afunix_h" = yes; then
+ HAVE_AFUNIX_H=1
+ else
+ HAVE_AFUNIX_H=0
+ fi
+ AC_SUBST([HAVE_AFUNIX_H])
+])
--- /dev/null
+Description:
+A POSIX-like <sys/un.h>.
+
+Files:
+lib/sys_un.in.h
+m4/sys_un_h.m4
+
+Depends-on:
+gen-header
+sys_socket
+
+configure.ac:
+gl_SYS_UN_H
+gl_CONDITIONAL_HEADER([sys/un.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(SYS_UN_H)
+
+# We need the following in order to create <sys/un.h> when the system
+# doesn't have one.
+if GL_GENERATE_SYS_UN_H
+sys/un.h: sys_un.in.h $(top_builddir)/config.status
+@NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%'
+ $(gl_V_at)$(SED_HEADER_STDOUT) \
+ -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+ -e 's|@''HAVE_AFUNIX_H''@|$(HAVE_AFUNIX_H)|g' \
+ $(srcdir)/sys_un.in.h > $@-t
+ $(AM_V_at)mv $@-t $@
+else
+sys/un.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += sys/un.h sys/un.h-t
+
+Include:
+<sys/un.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all