summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-14 12:48:46 +0200
committerBruno Haible <bruno@clisp.org>2023-04-14 12:48:46 +0200
commit09596027f260ff0de0e9932b88b90e0d06c71b6f (patch)
treeafbbfabaea64581bb316a9987555c27d04bcb37f
parente8bbebe5b5cc672aa28e5b4fb91e3624415d0e00 (diff)
downloadgnulib-09596027f260ff0de0e9932b88b90e0d06c71b6f.tar.gz
sys_shm: New module.
* lib/sys_shm.in.h: New file. * m4/sys_shm_h.m4: New file. * modules/sys_shm: New file. * doc/posix-headers/sys_shm.texi: Mention the new module.
-rw-r--r--ChangeLog6
-rw-r--r--doc/posix-headers/sys_shm.texi2
-rw-r--r--lib/sys_shm.in.h30
-rw-r--r--m4/sys_shm_h.m420
-rw-r--r--modules/sys_shm48
5 files changed, 105 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index efcaeaba16..58a28aef68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2023-04-14 Bruno Haible <bruno@clisp.org>
+ sys_shm: New module.
+ * lib/sys_shm.in.h: New file.
+ * m4/sys_shm_h.m4: New file.
+ * modules/sys_shm: New file.
+ * doc/posix-headers/sys_shm.texi: Mention the new module.
+
sys_sem: New module.
* lib/sys_sem.in.h: New file.
* m4/sys_sem_h.m4: New file.
diff --git a/doc/posix-headers/sys_shm.texi b/doc/posix-headers/sys_shm.texi
index 9807057378..8efbb0dcd3 100644
--- a/doc/posix-headers/sys_shm.texi
+++ b/doc/posix-headers/sys_shm.texi
@@ -3,7 +3,7 @@
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html}
-Gnulib module: ---
+Gnulib module: sys_shm
Portability problems fixed by Gnulib:
@itemize
diff --git a/lib/sys_shm.in.h b/lib/sys_shm.in.h
new file mode 100644
index 0000000000..1c58f992fc
--- /dev/null
+++ b/lib/sys_shm.in.h
@@ -0,0 +1,30 @@
+/* Provide a more reliable sys/shm.h.
+
+ Copyright (C) 2023 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/>. */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+ For the 'year2038' module to work right, <config.h> needs to have been
+ included before. */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#@INCLUDE_NEXT@ @NEXT_SYS_SHM_H@
diff --git a/m4/sys_shm_h.m4 b/m4/sys_shm_h.m4
new file mode 100644
index 0000000000..8804ad2ce8
--- /dev/null
+++ b/m4/sys_shm_h.m4
@@ -0,0 +1,20 @@
+# sys_shm_h.m4 serial 1
+dnl Copyright (C) 2023 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_SYS_SHM_H],
+[
+ AC_CHECK_HEADERS_ONCE([sys/shm.h])
+ dnl For now, we provide a <sys/shm.h> wrapper only if the system already has
+ dnl a <sys/shm.h>.
+ if test $ac_cv_header_sys_shm_h = yes; then
+ GL_GENERATE_SYS_SHM_H=true
+ gl_CHECK_NEXT_HEADERS([sys/shm.h])
+ else
+ GL_GENERATE_SYS_SHM_H=false
+ fi
+])
diff --git a/modules/sys_shm b/modules/sys_shm
new file mode 100644
index 0000000000..fd2a5fb196
--- /dev/null
+++ b/modules/sys_shm
@@ -0,0 +1,48 @@
+Description:
+<sys/shm.h> with extra checks.
+
+Files:
+lib/sys_shm.in.h
+m4/sys_shm_h.m4
+
+Depends-on:
+gen-header
+include_next
+
+configure.ac:
+gl_SYS_SHM_H
+gl_CONDITIONAL_HEADER([sys/shm.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(SYS_SHM_H)
+
+# We need the following in order to create <sys/shm.h> when desired.
+if GL_GENERATE_SYS_SHM_H
+sys/shm.h: sys_shm.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)$(MKDIR_P) '%reldir%/sys'
+ $(AM_V_at)$(SED_HEADER_STDOUT) \
+ -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_SYS_SHM_H''@|$(NEXT_SYS_SHM_H)|g' \
+ $(srcdir)/sys_shm.in.h > $@-t
+ $(AM_V_at)mv $@-t $@
+else
+sys/shm.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += sys/shm.h sys/shm.h-t
+MOSTLYCLEANDIRS += sys
+
+Include:
+#if HAVE_SYS_SHM_H
+<sys/shm.h>
+#endif
+
+License:
+LGPLv2+
+
+Maintainer:
+all