From: Collin Funk Date: Thu, 25 Jul 2024 03:14:49 +0000 (-0700) Subject: sys_un: New module. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=861f4ceeece282892fc58e9278cd2f4dbdbe7d29;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index f7fcead6a4..6342a6ce7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-07-24 Collin Funk + + 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 Avoid false select_used_without_requesting_gnulib_module_select. diff --git a/doc/posix-headers/sys_un.texi b/doc/posix-headers/sys_un.texi index 48ecf3753f..61affda2c6 100644 --- a/doc/posix-headers/sys_un.texi +++ b/doc/posix-headers/sys_un.texi @@ -3,18 +3,21 @@ 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 +@c +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 sys/socket.h to be included first on some platforms: Cygwin 1.7.18. diff --git a/lib/sys_un.in.h b/lib/sys_un.in.h new file mode 100644 index 0000000000..52993d65f5 --- /dev/null +++ b/lib/sys_un.in.h @@ -0,0 +1,34 @@ +/* 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 . */ + +/* Written by Collin Funk. */ + +#ifndef _@GUARD_PREFIX@_SYS_UN_H +#define _@GUARD_PREFIX@_SYS_UN_H 1 + +/* Windows requires to be included before . */ +#if @HAVE_WINSOCK2_H@ +# include +#endif +#if @HAVE_AFUNIX_H@ +# include +#endif + +/* If a platform does not support AF_UNIX sockets 'struct sockaddr_un' will + not be defined. You may use HAVE_UNIXSOCKET after including . */ + +#endif diff --git a/m4/sys_un_h.m4 b/m4/sys_un_h.m4 new file mode 100644 index 0000000000..ed19b70cb5 --- /dev/null +++ b/m4/sys_un_h.m4 @@ -0,0 +1,32 @@ +# 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 . + 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]) +]) diff --git a/modules/sys_un b/modules/sys_un new file mode 100644 index 0000000000..af72a80aab --- /dev/null +++ b/modules/sys_un @@ -0,0 +1,44 @@ +Description: +A POSIX-like . + +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 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: + + +License: +LGPLv2+ + +Maintainer: +all