From e8bbebe5b5cc672aa28e5b4fb91e3624415d0e00 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 14 Apr 2023 12:48:01 +0200 Subject: [PATCH] sys_sem: New module. * lib/sys_sem.in.h: New file. * m4/sys_sem_h.m4: New file. * modules/sys_sem: New file. * doc/posix-headers/sys_sem.texi: Mention the new module. --- ChangeLog | 6 +++++ doc/posix-headers/sys_sem.texi | 2 +- lib/sys_sem.in.h | 30 +++++++++++++++++++++ m4/sys_sem_h.m4 | 20 ++++++++++++++ modules/sys_sem | 48 ++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 lib/sys_sem.in.h create mode 100644 m4/sys_sem_h.m4 create mode 100644 modules/sys_sem diff --git a/ChangeLog b/ChangeLog index 08f7bcb103..efcaeaba16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2023-04-14 Bruno Haible + sys_sem: New module. + * lib/sys_sem.in.h: New file. + * m4/sys_sem_h.m4: New file. + * modules/sys_sem: New file. + * doc/posix-headers/sys_sem.texi: Mention the new module. + sys_msg: New module. * lib/sys_msg.in.h: New file. * m4/sys_msg_h.m4: New file. diff --git a/doc/posix-headers/sys_sem.texi b/doc/posix-headers/sys_sem.texi index 86d17961bb..fa2e4ce70a 100644 --- a/doc/posix-headers/sys_sem.texi +++ b/doc/posix-headers/sys_sem.texi @@ -3,7 +3,7 @@ POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_sem.h.html} -Gnulib module: --- +Gnulib module: sys_sem Portability problems fixed by Gnulib: @itemize diff --git a/lib/sys_sem.in.h b/lib/sys_sem.in.h new file mode 100644 index 0000000000..2896a7b49a --- /dev/null +++ b/lib/sys_sem.in.h @@ -0,0 +1,30 @@ +/* Provide a more reliable sys/sem.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 . */ + +#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, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#@INCLUDE_NEXT@ @NEXT_SYS_SEM_H@ diff --git a/m4/sys_sem_h.m4 b/m4/sys_sem_h.m4 new file mode 100644 index 0000000000..20510f1fbe --- /dev/null +++ b/m4/sys_sem_h.m4 @@ -0,0 +1,20 @@ +# sys_sem_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_SEM_H], +[ + AC_CHECK_HEADERS_ONCE([sys/sem.h]) + dnl For now, we provide a wrapper only if the system already has + dnl a . + if test $ac_cv_header_sys_sem_h = yes; then + GL_GENERATE_SYS_SEM_H=true + gl_CHECK_NEXT_HEADERS([sys/sem.h]) + else + GL_GENERATE_SYS_SEM_H=false + fi +]) diff --git a/modules/sys_sem b/modules/sys_sem new file mode 100644 index 0000000000..6fc4229a72 --- /dev/null +++ b/modules/sys_sem @@ -0,0 +1,48 @@ +Description: + with extra checks. + +Files: +lib/sys_sem.in.h +m4/sys_sem_h.m4 + +Depends-on: +gen-header +include_next + +configure.ac: +gl_SYS_SEM_H +gl_CONDITIONAL_HEADER([sys/sem.h]) +AC_PROG_MKDIR_P + +Makefile.am: +BUILT_SOURCES += $(SYS_SEM_H) + +# We need the following in order to create when desired. +if GL_GENERATE_SYS_SEM_H +sys/sem.h: sys_sem.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_SEM_H''@|$(NEXT_SYS_SEM_H)|g' \ + $(srcdir)/sys_sem.in.h > $@-t + $(AM_V_at)mv $@-t $@ +else +sys/sem.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += sys/sem.h sys/sem.h-t +MOSTLYCLEANDIRS += sys + +Include: +#if HAVE_SYS_SEM_H + +#endif + +License: +LGPLv2+ + +Maintainer: +all -- 2.39.5