]> Savannah Git Hosting - gnulib.git/commitdiff
mntent: New module.
authorBruno Haible <bruno@clisp.org>
Mon, 19 Aug 2024 11:46:02 +0000 (13:46 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 19 Aug 2024 11:46:02 +0000 (13:46 +0200)
* lib/mntent.in.h: New file.
* m4/mntent_h.m4: New file.
* modules/mntent: New file.
* doc/glibc-headers/mntent.texi: Mention the new module.
* top/maint.mk (gl_prefer_angle_bracket_headers_): Add mntent.h.
* doc/gnulib-tool.texi (Style of #include statements): Add mntent.h to
the list.

ChangeLog
doc/glibc-headers/mntent.texi
doc/gnulib-tool.texi
lib/mntent.in.h [new file with mode: 0644]
m4/mntent_h.m4 [new file with mode: 0644]
modules/mntent [new file with mode: 0644]
top/maint.mk

index 7486fb8047f83293f3225d3e7509f18abb9d8468..390733f163c71040ea05103521885d950c51565f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-08-19  Bruno Haible  <bruno@clisp.org>
+
+       mntent: New module.
+       * lib/mntent.in.h: New file.
+       * m4/mntent_h.m4: New file.
+       * modules/mntent: New file.
+       * doc/glibc-headers/mntent.texi: Mention the new module.
+       * top/maint.mk (gl_prefer_angle_bracket_headers_): Add mntent.h.
+       * doc/gnulib-tool.texi (Style of #include statements): Add mntent.h to
+       the list.
+
 2024-08-17  Bruno Haible  <bruno@clisp.org>
 
        once: Fix pthread-rwlock crashes with clang (regr. 2024-08-07).
index cbaf8054536f65f18b01b233761558063b2b901c..b6fc955fc89628d1b03c22e0a739c19a386d32da 100644 (file)
@@ -19,7 +19,7 @@ Documentation:
 @uref{https://www.kernel.org/doc/man-pages/online/pages/man3/setmntent.3.html,,man setmntent}.
 @end itemize
 
-Gnulib module: ---
+Gnulib module: mntent
 
 Portability problems fixed by Gnulib:
 @itemize
index e26380cd24abee51d5dc58f8024ff267b0f62437..41eccb30191d1ace87ecb4d824c1fd554eb237fa 100644 (file)
@@ -625,6 +625,7 @@ but are not standardized:
 @item @code{error.h}
 @item @code{getopt.h}
 @item @code{malloc.h}
+@item @code{mntent.h}
 @item @code{omp.h}
 @item @code{pty.h}
 @item @code{selinux/selinux.h}
diff --git a/lib/mntent.in.h b/lib/mntent.in.h
new file mode 100644 (file)
index 0000000..4da9d85
--- /dev/null
@@ -0,0 +1,41 @@
+/* Provide a more complete mntent.h.
+
+   Copyright (C) 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/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_MNTENT_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_MNTENT_H@
+
+#ifndef _@GUARD_PREFIX@_MNTENT_H
+#define _@GUARD_PREFIX@_MNTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _@GUARD_PREFIX@_MNTENT_H */
+#endif /* _@GUARD_PREFIX@_MNTENT_H */
diff --git a/m4/mntent_h.m4 b/m4/mntent_h.m4
new file mode 100644 (file)
index 0000000..f067cd0
--- /dev/null
@@ -0,0 +1,52 @@
+# mntent_h.m4
+# serial 1
+dnl Copyright (C) 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_MNTENT_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_MNTENT_H_DEFAULTS])
+
+  AC_CHECK_HEADERS_ONCE([mntent.h])
+  dnl For now, we provide a <mntent.h> wrapper only if the system already has
+  dnl a <mntent.h>.
+  if test $ac_cv_header_mntent_h = yes; then
+    GL_GENERATE_MNTENT_H=true
+    gl_CHECK_NEXT_HEADERS([mntent.h])
+  else
+    GL_GENERATE_MNTENT_H=false
+  fi
+])
+
+# gl_MNTENT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_MNTENT_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_MNTENT_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_MNTENT_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_MNTENT_H_MODULE_INDICATOR_DEFAULTS], [
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_MNTENT_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_MNTENT_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_MNTENT_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+])
diff --git a/modules/mntent b/modules/mntent
new file mode 100644 (file)
index 0000000..eb30116
--- /dev/null
@@ -0,0 +1,47 @@
+Description:
+<mntent.h> with more declarations.
+
+Files:
+lib/mntent.in.h
+m4/mntent_h.m4
+
+Depends-on:
+gen-header
+include_next
+
+configure.ac:
+gl_MNTENT_H
+gl_CONDITIONAL_HEADER([mntent.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(MNTENT_H)
+
+# We need the following in order to create <mntent.h> when desired.
+if GL_GENERATE_MNTENT_H
+mntent.h: mntent.in.h $(top_builddir)/config.status
+       $(AM_V_GEN)$(MKDIR_P) '%reldir%'
+       $(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_MNTENT_H''@|$(NEXT_MNTENT_H)|g' \
+             $(srcdir)/mntent.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+else
+mntent.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += mntent.h mntent.h-t
+
+Include:
+#if HAVE_MNTENT_H
+<mntent.h>
+#endif
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index 37f6889b06a15de697011b7cdf45df0c2ef4b7f3..39372f99f455c736f24a6cf6fd25881e1be2dba4 100644 (file)
@@ -565,6 +565,7 @@ gl_prefer_angle_bracket_headers_ ?= \
   locale.h             \
   malloc.h             \
   math.h               \
+  mntent.h             \
   monetary.h           \
   net/if.h             \
   netdb.h              \