libbsd: Branch 'main' - 6 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 13 02:50:30 UTC 2022


 configure.ac          |  211 +++++++++++++++++++++++++++++---------------------
 man/setproctitle.3bsd |    3 
 2 files changed, 125 insertions(+), 89 deletions(-)

New commits:
commit 23377191e85267c091d8ae79cb1dd5c21a6cf305
Author: Guilherme Janczak <guilherme.janczak at yandex.com>
Date:   Wed Dec 7 04:06:37 2022 +0000

    man: Prune unneeded <sys/types.h> include in setproctitle(3)
    
    FreeBSD first declared the function in unistd.h in 2000:
    https://cgit.freebsd.org/src/commit/include/unistd.h?id=9feac5c21886
    No other #include line was needed to use the function, but the man page
    unnecessarily instructed users to include sys/types.h until 2022-11-29:
    https://cgit.freebsd.org/src/commit/?id=5b6f0a5012e9bc37dcb32b57b41e2443a46da620
    
    libbsd first declared the function in unistd.h in 2010 with commit
    3fed78e5b08f78256e533788b4bcd6502b0949d7 and inherited the bug from
    FreeBSD's man page.
    
    No need to do anything for backwards compat.
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/man/setproctitle.3bsd b/man/setproctitle.3bsd
index 1a79088..4a6609f 100644
--- a/man/setproctitle.3bsd
+++ b/man/setproctitle.3bsd
@@ -20,7 +20,7 @@
 .\" $FreeBSD$
 .\"
 .\" The following requests are required for all man pages.
-.Dd December 16, 1995
+.Dd December 7, 2022
 .Dt setproctitle 3bsd
 .Os
 .Sh NAME
@@ -31,7 +31,6 @@
 .ds doc-str-Lb-libbsd \*[str-Lb-libbsd]
 .Lb libbsd
 .Sh SYNOPSIS
-.In sys/types.h
 .In unistd.h
 (See
 .Xr libbsd 7
commit 5dea9da38d9e657c10de099bce68c12fc38a39dc
Author: Florian Weimer <fweimer at redhat.com>
Date:   Tue Dec 13 03:37:06 2022 +0100

    build: Improve C99 compatibility of __progname configure check
    
    The check uses printf, so it needs to include <stdio.h> for
    compilers which do not support implicit function declarations.
    (They were removed from C99.)
    
    Closes: !23
    Signed-off-by: Guillem Jover <guillem at hadrons.org>

diff --git a/configure.ac b/configure.ac
index 3a1f19a..875ff04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,6 +241,7 @@ const char *p = program_invocation_short_name;
 AC_MSG_CHECKING([for __progname])
 AC_LINK_IFELSE([
   AC_LANG_PROGRAM([[
+#include <stdio.h>
 extern char *__progname;
   ]], [[
 printf("%s", __progname);
commit b9bf42ddc3c428c7d31f1fbf68bdf6e6542f1bbe
Author: Guillem Jover <guillem at hadrons.org>
Date:   Tue Dec 13 03:35:05 2022 +0100

    build: Enable -Wall for automake
    
    This will make sure to warn about bogus or deprecated constructs.

diff --git a/configure.ac b/configure.ac
index 59689db..3a1f19a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,7 @@ AC_CONFIG_MACRO_DIR([m4])
 
 AM_INIT_AUTOMAKE(
   [1.11]
+  [-Wall]
   [foreign]
   [nostdinc]
   [subdir-objects]
commit e57c07875c6d7f85562c028f2a9eb8490ab94333
Author: Guillem Jover <guillem at hadrons.org>
Date:   Tue Dec 13 03:34:37 2022 +0100

    build: Add missing AM_PROG_AR macro call to configure.ac
    
    Warned-by: autoreconf

diff --git a/configure.ac b/configure.ac
index 090cee0..59689db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,7 @@ user_CFLAGS=${CFLAGS-unset}
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 
+AM_PROG_AR
 LT_INIT
 
 AC_CACHE_CHECK([if ld supports --version-script flag],
commit 80f1927dcd3a2541f6aa74b0c9fa21446253d13a
Author: Guillem Jover <guillem at hadrons.org>
Date:   Tue Dec 13 03:31:38 2022 +0100

    build: Fix configure.ac indentation
    
    Use the same style as the newly added code, which should make the code
    more readable, and produce more conforming C output.

diff --git a/configure.ac b/configure.ac
index 9b22866..090cee0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,13 @@ AC_CONFIG_SRCDIR([src/strlcpy.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.11 foreign nostdinc subdir-objects no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE(
+  [1.11]
+  [foreign]
+  [nostdinc]
+  [subdir-objects]
+  [no-dist-gzip dist-xz]
+)
 AM_SILENT_RULES([yes])
 
 LIBBSD_ABI_MAJOR=0
@@ -27,20 +33,19 @@ LT_INIT
 
 AC_CACHE_CHECK([if ld supports --version-script flag],
   [libbsd_cv_version_script], [
-    echo "{ global: symbol; local: *; };" >conftest.map
-    save_LDFLAGS=$LDFLAGS
-    LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
-    AC_LINK_IFELSE([
-      AC_LANG_PROGRAM([], [])
-    ], [
-      libbsd_cv_version_script=yes
-    ], [
-      libbsd_cv_version_script=no
-    ])
-    LDFLAGS="$save_LDFLAGS"
-    rm -f conftest.map
-  ]
-)
+  echo "{ global: symbol; local: *; };" >conftest.map
+  save_LDFLAGS=$LDFLAGS
+  LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+  AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([], [])
+  ], [
+    libbsd_cv_version_script=yes
+  ], [
+    libbsd_cv_version_script=no
+  ])
+  LDFLAGS="$save_LDFLAGS"
+  rm -f conftest.map
+])
 AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
   [test "x$libbsd_cv_version_script" = "xyes"])
 
@@ -94,10 +99,10 @@ AS_IF([test "$user_CFLAGS" = unset], [
 
 # Checks for libraries.
 AC_CHECK_LIB([testu01], [unif01_CreateExternGenBits],
-             [TESTU01_LIBS="-ltestu01"])
+  [TESTU01_LIBS="-ltestu01"])
 AC_SUBST([TESTU01_LIBS])
 AM_CONDITIONAL([HAVE_LIBTESTU01],
-               [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
+  [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
 
 saved_LIBS="$LIBS"
 AC_SEARCH_LIBS([MD5Update], [md], [
@@ -118,7 +123,7 @@ AC_SEARCH_LIBS([SHA512Update], [md], [
 LIBS="$saved_LIBS"
 
 AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD],
-               [test "x$need_transparent_libmd" = "xyes"])
+  [test "x$need_transparent_libmd" = "xyes"])
 
 is_windows=no
 AS_CASE([$host_os],
@@ -143,7 +148,14 @@ AS_CASE([$host_os],
 AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
 
 # Checks for header files.
-AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h pwd.h grp.h])
+AC_CHECK_HEADERS([\
+  sys/ndir.h \
+  sys/dir.h \
+  ndir.h \
+  dirent.h \
+  pwd.h \
+  grp.h \
+])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
@@ -156,30 +168,30 @@ AC_TYPE_UID_T
 AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
 
-AC_CHECK_DECL([F_CLOSEM],
-              [AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
-                         [Define to 1 if you have fcntl(F_CLOSEM)])],
-              [],
-              [#include <limits.h>
-               #include <fcntl.h>])
+AC_CHECK_DECL([F_CLOSEM], [
+  AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
+    [Define to 1 if you have fcntl(F_CLOSEM)])
+], [], [[
+#include <limits.h>
+#include <fcntl.h>
+]])
 
-AC_CACHE_CHECK(
-	[for GNU .init_array section support],
-	[libbsd_cv_gnu_init_array_support],
-	[AC_RUN_IFELSE(
-		[AC_LANG_SOURCE(
-[[
+AC_CACHE_CHECK([for GNU .init_array section support],
+  [libbsd_cv_gnu_init_array_support], [
+  AC_RUN_IFELSE([
+    AC_LANG_SOURCE([[
 static int rc = 1;
 static void init(int argc) { if (argc == 1) rc = 0; }
 void (*init_func)(int argc) __attribute__((__section__(".init_array"), __used__)) = init;
 int main() { return rc; }
-]]
-		)],
-		[libbsd_cv_gnu_init_array_support=yes],
-		[libbsd_cv_gnu_init_array_support=no],
-		[AC_PREPROC_IFELSE(
-			[AC_LANG_SOURCE(
-[[
+    ]])
+  ], [
+    libbsd_cv_gnu_init_array_support=yes
+  ], [
+    libbsd_cv_gnu_init_array_support=no
+  ], [
+    AC_PREPROC_IFELSE([
+      AC_LANG_SOURCE([[
 /* Look for a known libc that supports .init_array with the GNU extension
  * to pass main() arguments to the init functions. */
 #include <stdlib.h>
@@ -197,53 +209,77 @@ int main() { return rc; }
  */
 #  error unknown whether libc supports GNU .init_array
 #endif
-]]
-			)],
-			[libbsd_cv_gnu_init_array_support=yes],
-			[libbsd_cv_gnu_init_array_support=no])
-		]
-	)]
-)
+      ]])
+    ], [
+      libbsd_cv_gnu_init_array_support=yes
+    ], [
+      libbsd_cv_gnu_init_array_support=no
+    ])
+  ])
+])
 AM_CONDITIONAL([BUILD_LIBBSD_CTOR],
-               [test "$libbsd_cv_gnu_init_array_support" = yes])
+  [test "$libbsd_cv_gnu_init_array_support" = yes])
 
 # Checks for library functions.
 AC_MSG_CHECKING([for program_invocation_short_name])
-AC_LINK_IFELSE(
-	[AC_LANG_PROGRAM([[#include <errno.h>]],
-	                 [[const char *p = program_invocation_short_name;]])],
-	[AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
-	           [Define to 1 if you have program_invocation_short_name])
-	 AC_MSG_RESULT([yes])],
-	[AC_MSG_RESULT([no])])
+AC_LINK_IFELSE([
+  AC_LANG_PROGRAM([[
+#include <errno.h>
+  ]], [[
+const char *p = program_invocation_short_name;
+  ]])
+], [
+  AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
+    [Define to 1 if you have program_invocation_short_name])
+  AC_MSG_RESULT([yes])
+], [
+  AC_MSG_RESULT([no])
+])
 
 AC_MSG_CHECKING([for __progname])
-AC_LINK_IFELSE(
-	[AC_LANG_PROGRAM([[extern char *__progname;]],
-	                 [[printf("%s", __progname);]])],
-	[AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
-	 AC_MSG_RESULT([yes])],
-	[AC_MSG_RESULT([no])])
+AC_LINK_IFELSE([
+  AC_LANG_PROGRAM([[
+extern char *__progname;
+  ]], [[
+printf("%s", __progname);
+  ]])
+], [
+  AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
+  AC_MSG_RESULT([yes])
+], [
+  AC_MSG_RESULT([no])
+])
 
 AC_MSG_CHECKING([for __register_atfork])
-AC_LINK_IFELSE(
-	[AC_LANG_PROGRAM([[
-		#include <stddef.h>
-		extern void *__dso_handle;
-		extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
-	]], [[
-		__register_atfork(NULL, NULL, NULL, __dso_handle);
-	]])],
-	[AC_DEFINE([HAVE___REGISTER_ATFORK], [1],
-	           [Define to 1 if you have __register_atfork])
-	 AC_MSG_RESULT([yes])],
-	[LIBBSD_LIBS="$LIBBSD_LIBS -pthread"
-	 AC_MSG_RESULT([no])
-	])
+AC_LINK_IFELSE([
+  AC_LANG_PROGRAM([[
+#include <stddef.h>
+extern void *__dso_handle;
+extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
+  ]], [[
+__register_atfork(NULL, NULL, NULL, __dso_handle);
+  ]])
+], [
+  AC_DEFINE([HAVE___REGISTER_ATFORK], [1],
+    [Define to 1 if you have __register_atfork])
+  AC_MSG_RESULT([yes])
+], [
+  LIBBSD_LIBS="$LIBBSD_LIBS -pthread"
+  AC_MSG_RESULT([no])
+])
 
-AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
-                getauxval getentropy getexecname getline \
-                pstat_getproc sysconf])
+AC_CHECK_FUNCS([\
+  clearenv \
+  dirfd \
+  fopencookie \
+  __fpurge \
+  getauxval \
+  getentropy \
+  getexecname \
+  getline \
+  pstat_getproc \
+  sysconf \
+])
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 AM_CONDITIONAL([HAVE_FOPENCOOKIE], [test "x$ac_cv_func_fopencookie" = "xyes"])
 
@@ -251,14 +287,14 @@ AC_SUBST([MD5_LIBS])
 AC_SUBST([LIBBSD_LIBS])
 
 AC_CONFIG_FILES([
-	Makefile
-	include/Makefile
-	man/Makefile
-	src/Makefile
-	src/libbsd.pc
-	src/libbsd-ctor.pc
-	src/libbsd-overlay.pc
-	test/Makefile
+  Makefile
+  include/Makefile
+  man/Makefile
+  src/Makefile
+  src/libbsd.pc
+  src/libbsd-ctor.pc
+  src/libbsd-overlay.pc
+  test/Makefile
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_OUTPUT
commit b7a8bc22c998f99756aa012197870a94d2f3df96
Author: Guillem Jover <guillem at hadrons.org>
Date:   Tue Dec 13 03:10:28 2022 +0100

    build: Require automake 1.11
    
    This is a rather old release (from 2009), that provides AM_SILENT_RULES.

diff --git a/configure.ac b/configure.ac
index 95a4be3..9b22866 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,10 +6,8 @@ AC_CONFIG_SRCDIR([src/strlcpy.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.9 foreign nostdinc subdir-objects no-dist-gzip dist-xz])
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
-                            [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
+AM_INIT_AUTOMAKE([1.11 foreign nostdinc subdir-objects no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
 
 LIBBSD_ABI_MAJOR=0
 LIBBSD_ABI_MINOR=11


More information about the libbsd mailing list