libbsd: Branch 'main' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 14 01:10:15 UTC 2024


 configure.ac          |   17 ++++++++++++++++-
 m4/libbsd-compiler.m4 |   16 ++++++++++++++++
 m4/libbsd-large.m4    |   22 ++++++++++++++++------
 man/Makefile.am       |    9 +++++++--
 4 files changed, 55 insertions(+), 9 deletions(-)

New commits:
commit 2a3d521318533bb1d0535b989be578b4f5c5ff1a
Author: Guillem Jover <guillem at hadrons.org>
Date:   Thu Mar 14 01:56:36 2024 +0100

    build: Do not rely on internal autoconf ac_cv_sys_file_offset_bits variable
    
    This is an internal implementation detail from AC_SYS_LARGEFILE, which
    happened to change with autoconf 2.72. Instead compute our own size
    for off_t.
    
    Closes: #28

diff --git a/m4/libbsd-large.m4 b/m4/libbsd-large.m4
index dc00c6e..213f2cb 100644
--- a/m4/libbsd-large.m4
+++ b/m4/libbsd-large.m4
@@ -43,7 +43,17 @@ AC_DEFUN([LIBBSD_SYS_TIME64], [
   ])
   LIBBSD_SELECT_ABI([time64], [explicit time64 time_t support])
 
-  AS_IF([test $ac_cv_sys_file_offset_bits -eq 64 && \
+  AC_CHECK_SIZEOF([off_t], [], [[
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+]])
+  AS_IF([test $ac_cv_sizeof_off_t = 8], [
+    libbsd_sys_has_lfs=1
+  ], [
+    libbsd_sys_has_lfs=0
+  ])
+
+  AS_IF([test $libbsd_sys_has_lfs -eq 1 && \
          test $libbsd_sys_time_bits -eq 32 && \
          test $ac_cv_sizeof_time_t -eq 8], [
     AC_DEFINE([_TIME_BITS], [64], [Enable 64-bit time_t support])
commit 149aafe1983893c44265352e47aca1cae73b9508
Author: Guillem Jover <guillem at hadrons.org>
Date:   Thu Mar 14 01:59:19 2024 +0100

    build: Use -eq instead of = as test operators for arithmetic tests

diff --git a/m4/libbsd-large.m4 b/m4/libbsd-large.m4
index d279111..dc00c6e 100644
--- a/m4/libbsd-large.m4
+++ b/m4/libbsd-large.m4
@@ -9,7 +9,7 @@ AC_DEFUN([LIBBSD_SYS_TIME64], [
 #undef _TIME_BITS
 #include <time.h>
 ]])
-  AS_IF([test $ac_cv_sizeof_time_t = 8], [
+  AS_IF([test $ac_cv_sizeof_time_t -eq 8], [
     libbsd_sys_time_bits=64
   ], [
     libbsd_sys_time_bits=32
@@ -26,7 +26,7 @@ AC_DEFUN([LIBBSD_SYS_TIME64], [
 #define _TIME_BITS 64
 #include <time.h>
 ]])
-  AS_IF([test $ac_cv_sizeof_time_t = 8], [
+  AS_IF([test $ac_cv_sizeof_time_t -eq 8], [
     libbsd_sys_has_time64=1
   ], [
     libbsd_sys_has_time64=0
@@ -35,7 +35,7 @@ AC_DEFUN([LIBBSD_SYS_TIME64], [
     [Enable if the system supports 64-bit time_t])
   AC_SUBST([LIBBSD_SYS_HAS_TIME64], [$libbsd_sys_has_time64])
   AM_CONDITIONAL([LIBBSD_SYS_HAS_TIME64], [test "$libbsd_sys_has_time64" -eq 1])
-  AS_IF([test "$libbsd_sys_time_bits" = 32 && \
+  AS_IF([test "$libbsd_sys_time_bits" -eq 32 && \
          test "$libbsd_sys_has_time64" -eq 1], [
     abi_time64=yes
   ], [
@@ -43,9 +43,9 @@ AC_DEFUN([LIBBSD_SYS_TIME64], [
   ])
   LIBBSD_SELECT_ABI([time64], [explicit time64 time_t support])
 
-  AS_IF([test $ac_cv_sys_file_offset_bits = 64 && \
-         test $libbsd_sys_time_bits = 32 && \
-         test $ac_cv_sizeof_time_t = 8], [
+  AS_IF([test $ac_cv_sys_file_offset_bits -eq 64 && \
+         test $libbsd_sys_time_bits -eq 32 && \
+         test $ac_cv_sizeof_time_t -eq 8], [
     AC_DEFINE([_TIME_BITS], [64], [Enable 64-bit time_t support])
   ])
 ])
commit 435825784ffaf7e514558a6537bb53835692ae33
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Mar 13 00:56:59 2024 +0100

    build: Fix typo in ABI selection description

diff --git a/configure.ac b/configure.ac
index 09bc0f4..bc0e1d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -601,7 +601,7 @@ LIBBSD_SELECT_ABI([strmode], [strmode()])
 LIBBSD_SELECT_ABI([strnstr], [strnstr()])
 LIBBSD_SELECT_ABI([strtonum], [strtonum()])
 LIBBSD_SELECT_ABI([strtox], [strtoi()/strtou()])
-LIBBSD_SELECT_ABI([timeconv], [timeconf.h API])
+LIBBSD_SELECT_ABI([timeconv], [timeconv.h API])
 LIBBSD_SELECT_ABI([transparent_libmd], [transparent libmd support])
 LIBBSD_SELECT_ABI([vis], [vis API])
 LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()])
commit 31e9396bf215cbaf224b99617ef683950f0aae02
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Mar 13 00:56:07 2024 +0100

    build: Only install time struct conversion macros where missing
    
    These macros are available in several systems, and we should not install
    the man pages for them, otherwise we might end up shadowing the system
    man pages if present.

diff --git a/configure.ac b/configure.ac
index c7c2e13..09bc0f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,8 @@ LIBBSD_LINKER_VERSION_SCRIPT
 
 is_windows=no
 
+api_time_macros=unknown
+
 abi_accmode=unknown
 abi_arc4random=unknown
 abi_arc4random_stir=unknown
@@ -86,6 +88,8 @@ abi_wcsl=unknown
 
 AS_CASE([$host_os],
   [*-gnu* | gnu*], [
+    api_time_macros=no
+
     abi_accmode=yes
     # DROP: On glibc >= 2.36.
     #abi_arc4random=no
@@ -145,6 +149,8 @@ AS_CASE([$host_os],
     abi_wcsl=yes
   ],
   [*-musl*], [
+    api_time_macros=no
+
     abi_accmode=yes
     abi_arc4random=yes
     abi_arc4random_stir=yes
@@ -209,6 +215,8 @@ AS_CASE([$host_os],
     abi_wcsl=yes
   ],
   [darwin*], [
+    api_time_macros=no
+
     abi_accmode=no
     abi_arc4random=no
     abi_arc4random_stir=no
@@ -255,6 +263,8 @@ AS_CASE([$host_os],
     abi_wcsl=no
   ],
   [solaris2*], [
+    api_time_macros=yes
+
     abi_accmode=yes
     abi_arc4random=no
     abi_arc4random_stir=no
@@ -301,6 +311,8 @@ AS_CASE([$host_os],
     abi_wcsl=yes
   ],
   [aix*], [
+    api_time_macros=yes
+
     abi_accmode=yes
     abi_arc4random=yes
     abi_arc4random_stir=yes
@@ -545,6 +557,9 @@ AC_CHECK_FUNCS([\
 
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
+# API selection
+LIBBSD_SELECT_API([time_macros], [time struct conversion macros])
+
 # ABI selection
 LIBBSD_SELECT_ABI([accmode], [setmode()/getmode()])
 LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
diff --git a/m4/libbsd-compiler.m4 b/m4/libbsd-compiler.m4
index 0708f57..ace5ce1 100644
--- a/m4/libbsd-compiler.m4
+++ b/m4/libbsd-compiler.m4
@@ -71,6 +71,22 @@ int main() { return rc; }
     [test "$libbsd_cv_gnu_init_array_support" = yes])
 ])
 
+# LIBBSD_SELECT_API(name, desc)
+# -----------------
+AC_DEFUN([LIBBSD_SELECT_API], [
+  AS_IF([test -z "$AS_TR_SH([api_$1])"], [
+    AC_MSG_ERROR([missing API selection for $1])
+  ], [test "$AS_TR_SH([api_$1])" = "unknown"], [
+    AC_MSG_ERROR([unknown ABI selection for $1])
+  ], [test "$AS_TR_SH([api_$1])" = "yes"], [
+    AC_DEFINE(AS_TR_CPP([LIBBSD_API_$1]), [1], [Provide API for $2])
+  ], [
+    AC_DEFINE(AS_TR_CPP([LIBBSD_API_$1]), [0])
+  ])
+  AM_CONDITIONAL(AS_TR_CPP([API_$1]),
+    [test "x$AS_TR_SH([api_$1])" = "xyes"])
+])
+
 # LIBBSD_SELECT_ABI(name, desc)
 # -----------------
 AC_DEFUN([LIBBSD_SELECT_ABI], [
diff --git a/man/Makefile.am b/man/Makefile.am
index cb2252b..02c8ffb 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -141,8 +141,6 @@ dist_man_MANS = \
 	TAILQ_PREV.3bsd \
 	TAILQ_REMOVE.3bsd \
 	TAILQ_SWAP.3bsd \
-	TIMESPEC_TO_TIMEVAL.3bsd \
-	TIMEVAL_TO_TIMESPEC.3bsd \
 	be16dec.3bsd \
 	be16enc.3bsd \
 	be32dec.3bsd \
@@ -182,6 +180,13 @@ dist_man_MANS = \
 	tree.3bsd \
 	# EOL
 
+if API_TIME_MACROS
+dist_man_MANS += \
+	TIMESPEC_TO_TIMEVAL.3bsd \
+	TIMEVAL_TO_TIMESPEC.3bsd \
+	# EOL
+endif
+
 if ABI_ACCMODE
 dist_man_MANS += \
 	getmode.3bsd \


More information about the libbsd mailing list