]> Savannah Git Hosting - gnulib.git/commitdiff
sys_msg: New module.
authorBruno Haible <bruno@clisp.org>
Fri, 14 Apr 2023 10:47:03 +0000 (12:47 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 14 Apr 2023 10:47:03 +0000 (12:47 +0200)
* lib/sys_msg.in.h: New file.
* m4/sys_msg_h.m4: New file.
* modules/sys_msg: New file.
* doc/posix-headers/sys_msg.texi: Mention the new module.

ChangeLog
doc/posix-headers/sys_msg.texi
lib/sys_msg.in.h [new file with mode: 0644]
m4/sys_msg_h.m4 [new file with mode: 0644]
modules/sys_msg [new file with mode: 0644]

index 8a88a904fc892f3b22ac25103541a50202f939ea..08f7bcb103bea631848f56ca36b9d21c3baec128 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-04-14  Bruno Haible  <bruno@clisp.org>
+
+       sys_msg: New module.
+       * lib/sys_msg.in.h: New file.
+       * m4/sys_msg_h.m4: New file.
+       * modules/sys_msg: New file.
+       * doc/posix-headers/sys_msg.texi: Mention the new module.
+
 2023-04-13  Bruno Haible  <bruno@clisp.org>
 
        Add more reminders to include <config.h>.
index 6b15537d628178a992f7dabcd4aa8b0c6e7bf36c..8a4578d78b25a5753701a2742d7ffd96273b824a 100644 (file)
@@ -3,7 +3,7 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_msg.h.html}
 
-Gnulib module: ---
+Gnulib module: sys_msg
 
 Portability problems fixed by Gnulib:
 @itemize
diff --git a/lib/sys_msg.in.h b/lib/sys_msg.in.h
new file mode 100644 (file)
index 0000000..46cf7c1
--- /dev/null
@@ -0,0 +1,30 @@
+/* Provide a more reliable sys/msg.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_MSG_H@
diff --git a/m4/sys_msg_h.m4 b/m4/sys_msg_h.m4
new file mode 100644 (file)
index 0000000..c62cdab
--- /dev/null
@@ -0,0 +1,20 @@
+# sys_msg_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_MSG_H],
+[
+  AC_CHECK_HEADERS_ONCE([sys/msg.h])
+  dnl For now, we provide a <sys/msg.h> wrapper only if the system already has
+  dnl a <sys/msg.h>.
+  if test $ac_cv_header_sys_msg_h = yes; then
+    GL_GENERATE_SYS_MSG_H=true
+    gl_CHECK_NEXT_HEADERS([sys/msg.h])
+  else
+    GL_GENERATE_SYS_MSG_H=false
+  fi
+])
diff --git a/modules/sys_msg b/modules/sys_msg
new file mode 100644 (file)
index 0000000..6b059cf
--- /dev/null
@@ -0,0 +1,48 @@
+Description:
+<sys/msg.h> with extra checks.
+
+Files:
+lib/sys_msg.in.h
+m4/sys_msg_h.m4
+
+Depends-on:
+gen-header
+include_next
+
+configure.ac:
+gl_SYS_MSG_H
+gl_CONDITIONAL_HEADER([sys/msg.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(SYS_MSG_H)
+
+# We need the following in order to create <sys/msg.h> when desired.
+if GL_GENERATE_SYS_MSG_H
+sys/msg.h: sys_msg.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_MSG_H''@|$(NEXT_SYS_MSG_H)|g' \
+             $(srcdir)/sys_msg.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+else
+sys/msg.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += sys/msg.h sys/msg.h-t
+MOSTLYCLEANDIRS += sys
+
+Include:
+#if HAVE_SYS_MSG_H
+<sys/msg.h>
+#endif
+
+License:
+LGPLv2+
+
+Maintainer:
+all