libbsd: Branch 'main' - 6 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Feb 25 03:27:19 UTC 2024


 COPYING               |    2 
 configure.ac          |  411 ++++++++++++++++++++++++++++++++++++++++++--------
 include/Makefile.am   |   55 +++++-
 include/bsd/md5.h     |    2 
 include/bsd/stdio.h   |   12 +
 m4/libbsd-compiler.m4 |   16 +
 man/Makefile.am       |  248 ++++++++++++++++++++++--------
 src/Makefile.am       |  231 ++++++++++++++++++++++------
 src/asprintf.c        |   43 +++++
 src/libbsd.map.in     |  125 ++++++++++++++-
 src/local-link.h      |    2 
 src/vasprintf.c       |   64 +++++++
 test/Makefile.am      |  104 ++++++++++--
 13 files changed, 1102 insertions(+), 213 deletions(-)

New commits:
commit 605614d6423083863c7c71bf53786bfec77bbf6a
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Feb 12 03:00:06 2024 +0100

    build: Add support for AIX

diff --git a/configure.ac b/configure.ac
index 1df73de..bedc615 100644
--- a/configure.ac
+++ b/configure.ac
@@ -299,6 +299,52 @@ AS_CASE([$host_os],
     abi_vis=yes
     abi_wcsl=yes
   ],
+  [aix*], [
+    abi_accmode=yes
+    abi_arc4random=yes
+    abi_arc4random_stir=yes
+    abi_asprintf=yes
+    abi_bsd_getopt=yes
+    abi_closefrom=yes
+    abi_err=yes
+    abi_errc=yes
+    abi_expand_number=yes
+    abi_explicit_bzero=yes
+    abi_fgetln=yes
+    abi_flopen=yes
+    abi_fmtcheck=yes
+    abi_fpurge=no
+    abi_freezero=yes
+    abi_funopen=no
+    abi_getbsize=yes
+    abi_getpeereid=yes
+    abi_humanize_number=yes
+    abi_id_from_name=yes
+    abi_inet_net_pton=no
+    # On libmd.
+    abi_md5=no
+    abi_name_from_id=yes
+    abi_nlist=no
+    abi_pidfile=yes
+    abi_proctitle=yes
+    abi_progname=yes
+    abi_readpassphrase=yes
+    abi_reallocarray=yes
+    abi_reallocf=yes
+    abi_recallocarray=yes
+    abi_stringlist=yes
+    abi_sort=yes
+    abi_strl=yes
+    abi_strmode=yes
+    abi_strnstr=yes
+    abi_strtonum=yes
+    abi_strtox=yes
+    abi_timeconv=yes
+    # On libmd.
+    abi_transparent_libmd=no
+    abi_vis=yes
+    abi_wcsl=yes
+  ],
   [mingw*], [
     is_windows=yes
   ],
diff --git a/include/bsd/md5.h b/include/bsd/md5.h
index 5bd58d8..bfeecfd 100644
--- a/include/bsd/md5.h
+++ b/include/bsd/md5.h
@@ -24,8 +24,10 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _AIX
 #ifdef LIBBSD_OVERLAY
 #include_next <md5.h>
 #else
 #include <md5.h>
 #endif
+#endif
commit ec7f5ee984c55659f77c73db00457d3bcbeb040c
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Feb 12 01:04:37 2024 +0100

    Add vasprintf() and asprintf() functions missing on AIX
    
    These functions are used by code in the library, even though these
    functions started as GNU extensions, they are present in all BSDs,
    so we expose them as part of our interface on AIX.

diff --git a/COPYING b/COPYING
index a3b2cd9..7814d8f 100644
--- a/COPYING
+++ b/COPYING
@@ -3,7 +3,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Files:
  *
 Copyright:
- Copyright © 2004-2006, 2008-2022 Guillem Jover <guillem at hadrons.org>
+ Copyright © 2004-2024 Guillem Jover <guillem at hadrons.org>
 License: BSD-3-clause
 
 Files:
diff --git a/configure.ac b/configure.ac
index c00aa0f..1df73de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,7 @@ is_windows=no
 abi_accmode=unknown
 abi_arc4random=unknown
 abi_arc4random_stir=unknown
+abi_asprintf=unknown
 abi_bsd_getopt=unknown
 abi_closefrom=unknown
 abi_err=unknown
@@ -89,6 +90,7 @@ AS_CASE([$host_os],
     #abi_arc4random=no
     abi_arc4random=yes
     abi_arc4random_stir=yes
+    abi_asprintf=no
     abi_bsd_getopt=yes
     # DROP: On glibc >= 2.34.
     #abi_closefrom=no
@@ -145,6 +147,7 @@ AS_CASE([$host_os],
     abi_accmode=yes
     abi_arc4random=yes
     abi_arc4random_stir=yes
+    abi_asprintf=no
     # DROP: On musl >= 0.9.7, optreset got implemented.
     #abi_bsd_getopt=no
     abi_bsd_getopt=yes
@@ -208,6 +211,7 @@ AS_CASE([$host_os],
     abi_accmode=no
     abi_arc4random=no
     abi_arc4random_stir=no
+    abi_asprintf=no
     abi_bsd_getopt=no
     abi_closefrom=yes
     abi_err=no
@@ -253,6 +257,7 @@ AS_CASE([$host_os],
     abi_accmode=yes
     abi_arc4random=no
     abi_arc4random_stir=no
+    abi_asprintf=no
     abi_bsd_getopt=yes
     abi_closefrom=no
     abi_err=no
@@ -465,6 +470,8 @@ LIBBSD_CHECK_PROGNAME
 LIBBSD_CHECK_REGISTER_ATFORK
 
 AC_CHECK_FUNCS([\
+  vasprintf \
+  asprintf \
   clearenv \
   dirfd \
   flock \
@@ -490,6 +497,7 @@ AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 LIBBSD_SELECT_ABI([accmode], [setmode()/getmode()])
 LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
 LIBBSD_SELECT_ABI([arc4random_stir], [arc4random_stir()/arc4random_addrandom()])
+LIBBSD_SELECT_ABI([asprintf], [vasprintf()/asprintf()])
 LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()])
 LIBBSD_SELECT_ABI([closefrom], [closefrom()])
 LIBBSD_SELECT_ABI([err], [err API])
diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h
index 4b69983..d67aab1 100644
--- a/include/bsd/stdio.h
+++ b/include/bsd/stdio.h
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2004-2005, 2009, 2011-2013 Guillem Jover <guillem at hadrons.org>
+ * Copyright © 2004-2024 Guillem Jover <guillem at hadrons.org>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,8 +44,18 @@
 #include <bsd/sys/cdefs.h>
 #endif
 #include <sys/types.h>
+#if defined(_AIX)
+#include <stdarg.h>
+#endif
 
 __BEGIN_DECLS
+#if defined(_AIX)
+int asprintf(char **strp, char const *fmt, ...)
+	__printflike(2, 3);
+int vasprintf(char **strp, char const *fmt, va_list args)
+	__printflike(2, 0);
+#endif
+
 const char *fmtcheck(const char *, const char *);
 
 /* XXX: The function requires cooperation from the system libc to store the
diff --git a/src/Makefile.am b/src/Makefile.am
index a85b705..00181bd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,6 +103,13 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if ABI_ASPRINTF
+libbsd_la_SOURCES += \
+	asprintf.c \
+	vasprintf.c \
+	# EOL
+endif
+
 if ABI_BSD_GETOPT
 libbsd_la_SOURCES += \
 	bsd_getopt.c \
diff --git a/src/asprintf.c b/src/asprintf.c
new file mode 100644
index 0000000..23576e3
--- /dev/null
+++ b/src/asprintf.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2010-2024 Guillem Jover <guillem at hadrons.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+
+int
+asprintf(char **strp, char const *fmt, ...)
+{
+	va_list args;
+	int n;
+
+	va_start(args, fmt);
+	n = vasprintf(strp, fmt, args);
+	va_end(args);
+
+	return n;
+}
diff --git a/src/libbsd.map.in b/src/libbsd.map.in
index 81e431f..9670d4c 100644
--- a/src/libbsd.map.in
+++ b/src/libbsd.map.in
@@ -299,3 +299,10 @@ LIBBSD_0.11.0 {
     group_from_gid;
 #endif
 } LIBBSD_0.10.0;
+
+LIBBSD_0.12.0 {
+#if LIBBSD_ABI_ASPRINTF
+    vasprintf;
+    asprintf;
+#endif
+} LIBBSD_0.11.0;
diff --git a/src/vasprintf.c b/src/vasprintf.c
new file mode 100644
index 0000000..d9ae8bb
--- /dev/null
+++ b/src/vasprintf.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2010-2024 Guillem Jover <guillem at hadrons.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+vasprintf(char **strp, char const *fmt, va_list args)
+{
+	va_list args_copy;
+	int needed, n;
+	char *str;
+
+	va_copy(args_copy, args);
+	needed = vsnprintf(NULL, 0, fmt, args_copy);
+	va_end(args_copy);
+
+	if (needed < 0) {
+		*strp = NULL;
+		return -1;
+	}
+
+	str = malloc(needed + 1);
+	if (str == NULL) {
+		*strp = NULL;
+		return -1;
+	}
+
+	n = vsnprintf(str, needed + 1, fmt, args);
+	if (n < 0) {
+		free(str);
+		str = NULL;
+	}
+
+	*strp = str;
+
+	return n;
+}
commit 5392f0c1a44f5898eec4ff6ab0866b2f5c917855
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Feb 12 02:55:08 2024 +0100

    build: Add support for Solaris

diff --git a/configure.ac b/configure.ac
index a761d9c..c00aa0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,6 +249,51 @@ AS_CASE([$host_os],
     abi_vis=no
     abi_wcsl=no
   ],
+  [solaris2*], [
+    abi_accmode=yes
+    abi_arc4random=no
+    abi_arc4random_stir=no
+    abi_bsd_getopt=yes
+    abi_closefrom=no
+    abi_err=no
+    abi_errc=yes
+    abi_expand_number=yes
+    abi_explicit_bzero=yes
+    abi_fgetln=yes
+    abi_flopen=yes
+    abi_fmtcheck=no
+    abi_fpurge=yes
+    abi_freezero=yes
+    abi_funopen=no
+    abi_getbsize=yes
+    abi_getpeereid=yes
+    abi_humanize_number=yes
+    abi_id_from_name=yes
+    abi_inet_net_pton=yes
+    # On libmd.
+    abi_md5=no
+    abi_name_from_id=yes
+    abi_nlist=no
+    abi_pidfile=yes
+    abi_proctitle=yes
+    abi_progname=no
+    abi_readpassphrase=yes
+    abi_reallocarray=yes
+    abi_reallocf=no
+    abi_recallocarray=yes
+    abi_stringlist=yes
+    abi_sort=yes
+    abi_strl=no
+    abi_strmode=yes
+    abi_strnstr=no
+    abi_strtonum=no
+    abi_strtox=yes
+    abi_timeconv=yes
+    # On libmd.
+    abi_transparent_libmd=no
+    abi_vis=yes
+    abi_wcsl=yes
+  ],
   [mingw*], [
     is_windows=yes
   ],
diff --git a/src/local-link.h b/src/local-link.h
index d6bd77f..dd67c70 100644
--- a/src/local-link.h
+++ b/src/local-link.h
@@ -47,7 +47,7 @@
 	extern __typeof__(symbol) alias __attribute__((__alias__(#symbol)))
 #endif
 
-#ifdef __ELF__
+#if defined(__ELF__) && !defined(__sun)
 #  if __has_attribute(symver)
 /* The symver attribute is supported since gcc 10.x. */
 #define libbsd_symver_default(symbol, alias, version) \
commit be4aced4c50e3125f95b090c3b6d78f9ccb217a1
Author: Guillem Jover <guillem at hadrons.org>
Date:   Sun Feb 11 23:55:40 2024 +0100

    build: Make almost all exposed interfaces use the new ABI selection
    
    Explicitly select what to include as part of the target ABI, instead of
    letting autoconfiguration potentially break ABI if the system grows
    functionality provided by the library.
    
    Make almost all the library selectable per target. Do not install manual
    pages for interfaces not included in the library. Control inclusion of
    symbols in map file via pre-processor macros, and move the comments
    describing the ABI selection to configure.ac.
    
    For now the header files are included as is and filtered through
    pre-processor conditionals. Eventually they might get switched to be
    autogenerated at build time.

diff --git a/configure.ac b/configure.ac
index ef79d0a..a761d9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,85 +41,212 @@ LIBBSD_LINKER_VERSION_SCRIPT
 
 is_windows=no
 
+abi_accmode=unknown
 abi_arc4random=unknown
+abi_arc4random_stir=unknown
 abi_bsd_getopt=unknown
+abi_closefrom=unknown
 abi_err=unknown
 abi_errc=unknown
+abi_expand_number=unknown
+abi_explicit_bzero=unknown
+abi_fgetln=unknown
+abi_flopen=unknown
+abi_fmtcheck=unknown
 abi_fpurge=unknown
+abi_freezero=unknown
 abi_funopen=unknown
+abi_getbsize=unknown
+abi_getpeereid=unknown
+abi_humanize_number=unknown
+abi_id_from_name=unknown
+abi_inet_net_pton=unknown
 abi_md5=unknown
 abi_name_from_id=unknown
 abi_nlist=unknown
+abi_pidfile=unknown
+abi_proctitle=unknown
 abi_progname=unknown
+abi_readpassphrase=unknown
+abi_reallocarray=unknown
+abi_reallocf=unknown
+abi_recallocarray=unknown
+abi_stringlist=unknown
+abi_sort=unknown
 abi_strl=unknown
 abi_strmode=unknown
+abi_strnstr=unknown
+abi_strtonum=unknown
+abi_strtox=unknown
+abi_timeconv=unknown
+abi_vis=unknown
 abi_wcsl=unknown
 
 AS_CASE([$host_os],
   [*-gnu*], [
-    # DROP: On glibc >= 2.36, parts the arc4random() API got added.
+    abi_accmode=yes
+    # DROP: On glibc >= 2.36.
     #abi_arc4random=no
     abi_arc4random=yes
+    abi_arc4random_stir=yes
     abi_bsd_getopt=yes
+    # DROP: On glibc >= 2.34.
+    #abi_closefrom=no
+    abi_closefrom=yes
     abi_err=no
     abi_errc=yes
+    abi_expand_number=yes
+    # DROP: On glibc >= 2.25.
+    #abi_explicit_bzero=no
+    abi_explicit_bzero=yes
+    abi_fgetln=yes
+    abi_flopen=yes
+    abi_fmtcheck=yes
     abi_fpurge=yes
+    abi_freezero=yes
     abi_funopen=yes
+    abi_getbsize=yes
+    abi_getpeereid=yes
+    abi_humanize_number=yes
+    abi_id_from_name=yes
+    # DROP: On glibc.
+    #abi_inet_net_pton=no
+    abi_inet_net_pton=yes
     # DROP: On libmd.
     #abi_md5=no
     abi_md5=yes
     abi_name_from_id=yes
     abi_nlist=yes
+    abi_pidfile=yes
+    abi_proctitle=yes
     abi_progname=yes
+    abi_readpassphrase=yes
+    # DROP: On glibc >= 2.26.
+    #abi_reallocarray=no
+    abi_reallocarray=yes
+    abi_reallocf=yes
+    abi_recallocarray=yes
+    abi_stringlist=yes
+    abi_sort=yes
     # DROP: On glibc >= 2.38.
     #abi_strl=no
     abi_strl=yes
     abi_strmode=yes
+    abi_strnstr=yes
+    abi_strtonum=yes
+    abi_strtox=yes
+    abi_timeconv=yes
+    # DROP: On libmd.
+    abi_transparent_libmd=yes
+    abi_vis=yes
     abi_wcsl=yes
   ],
   [*-musl*], [
+    abi_accmode=yes
     abi_arc4random=yes
+    abi_arc4random_stir=yes
     # DROP: On musl >= 0.9.7, optreset got implemented.
     #abi_bsd_getopt=no
     abi_bsd_getopt=yes
+    abi_closefrom=yes
     abi_err=no
     abi_errc=yes
+    abi_expand_number=yes
+    # DROP: On musl >= 1.1.20.
+    #abi_explicit_bzero=no
+    abi_explicit_bzero=yes
+    # DROP: On musl >= 0.9.4.
+    #abi_fgetln=no
+    abi_fgetln=yes
+    abi_flopen=yes
+    abi_fmtcheck=yes
     abi_fpurge=yes
+    abi_freezero=yes
     # On musl >= 1.1.19, fopencookie() got implemented, and because we were
     # checking for its presence to decide whether to build funopen(), it got
     # included in builds even when previously it had not been included, which
     # is partially an ABI issue, but given that disabling it now would be
     # worse, we'll ignore this as this is only a problem with downgrades. And
     # enable it explicitly
+    #abi_funopen=no
     abi_funopen=yes
+    abi_getbsize=yes
+    abi_getpeereid=yes
+    abi_humanize_number=yes
+    abi_id_from_name=yes
+    abi_inet_net_pton=yes
     # DROP: On libmd.
     #abi_md5=no
     abi_md5=yes
     abi_name_from_id=yes
     abi_nlist=yes
+    abi_pidfile=yes
+    abi_proctitle=yes
     abi_progname=yes
+    abi_readpassphrase=yes
+    # DROP: On musl >= 1.2.2.
+    #abi_reallocarray=no
+    abi_reallocarray=yes
+    abi_reallocf=ues
+    abi_recallocarray=yes
+    abi_stringlist=yes
+    abi_sort=yes
     # DROP: On musl >= 0.5.0, strlcpy() and strlcat() were already implemented.
     #abi_strl=no
     abi_strl=yes
     abi_strmode=yes
+    abi_strnstr=yes
+    abi_strtonum=yes
+    abi_strtox=yes
+    abi_timeconv=yes
+    # DROP: On libmd.
+    abi_transparent_libmd=yes
+    abi_vis=yes
     abi_wcsl=yes
   ],
   [darwin*], [
-    # On macOS these are provided by the system, and libbsd has never built
-    # there, so we can avoid providing these with no ABI breakage.
+    abi_accmode=no
     abi_arc4random=no
+    abi_arc4random_stir=no
     abi_bsd_getopt=no
+    abi_closefrom=yes
     abi_err=no
     abi_errc=no
+    abi_expand_number=yes
+    abi_explicit_bzero=yes
+    abi_fgetln=no
+    abi_flopen=yes
+    abi_fmtcheck=no
     abi_fpurge=no
+    abi_freezero=yes
     abi_funopen=no
+    abi_getbsize=yes
+    abi_getpeereid=no
+    abi_humanize_number=yes
+    abi_id_from_name=yes
+    abi_inet_net_pton=no
+    # On libmd.
     abi_md5=no
     abi_name_from_id=no
     abi_nlist=no
+    abi_pidfile=yes
+    abi_proctitle=yes
     abi_progname=no
+    abi_readpassphrase=no
+    abi_reallocarray=yes
+    abi_reallocf=no
+    abi_recallocarray=yes
+    abi_stringlist=no
+    abi_sort=no
     abi_strl=no
     abi_strmode=no
+    abi_strnstr=no
+    abi_strtonum=no
+    abi_strtox=yes
+    abi_timeconv=no
+    # On libmd.
     abi_transparent_libmd=no
+    abi_vis=no
     abi_wcsl=no
   ],
   [mingw*], [
@@ -127,6 +254,13 @@ AS_CASE([$host_os],
   ],
 )
 
+# Handle artificial ABI selections that are combinations of others.
+AS_IF([test "$abi_name_from_id" = "yes" || test "$abi_id_from_name" = "yes"], [
+  abi_pwcache=yes
+], [
+  abi_pwcache=no
+])
+
 AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
 
 # Checks for programs.
@@ -308,19 +442,47 @@ AC_CHECK_FUNCS([\
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
 # ABI selection
+LIBBSD_SELECT_ABI([accmode], [setmode()/getmode()])
 LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
+LIBBSD_SELECT_ABI([arc4random_stir], [arc4random_stir()/arc4random_addrandom()])
 LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()])
+LIBBSD_SELECT_ABI([closefrom], [closefrom()])
 LIBBSD_SELECT_ABI([err], [err API])
 LIBBSD_SELECT_ABI([errc], [errc API])
+LIBBSD_SELECT_ABI([expand_number], [expand_number()])
+LIBBSD_SELECT_ABI([explicit_bzero], [explicit_bzero()])
+LIBBSD_SELECT_ABI([fgetln], [fgetln/fgetwln()])
+LIBBSD_SELECT_ABI([flopen], [flopen()/flopenat()])
+LIBBSD_SELECT_ABI([fmtcheck], [fmtcheck()])
 LIBBSD_SELECT_ABI([fpurge], [fpurge()])
+LIBBSD_SELECT_ABI([freezero], [freezero()])
 LIBBSD_SELECT_ABI([funopen], [funopen()])
+LIBBSD_SELECT_ABI([getbsize], [getbsize()])
+LIBBSD_SELECT_ABI([getpeereid], [getpeereid()])
+LIBBSD_SELECT_ABI([humanize_number], [humanize_number()/dehumanize_number()])
+LIBBSD_SELECT_ABI([id_from_name], [uid_from_user()/gid_from_user()])
+LIBBSD_SELECT_ABI([inet_net_pton], [inet_net_pton()])
 LIBBSD_SELECT_ABI([md5], [MD5 digest functions])
 LIBBSD_SELECT_ABI([name_from_id], [user_from_uid()/group_from_gid()])
 LIBBSD_SELECT_ABI([nlist], [nlist()])
+LIBBSD_SELECT_ABI([pidfile], [pidfile API])
+LIBBSD_SELECT_ABI([proctitle], [setproctitle() API])
 LIBBSD_SELECT_ABI([progname], [setprogname()/getprogname()])
+LIBBSD_SELECT_ABI([pwcache], [password cache API])
+LIBBSD_SELECT_ABI([readpassphrase], [readpassphrase()])
+LIBBSD_SELECT_ABI([reallocarray], [reallocarray()])
+LIBBSD_SELECT_ABI([reallocf], [reallocf()])
+LIBBSD_SELECT_ABI([recallocarray], [recallocarray()])
+LIBBSD_SELECT_ABI([stringlist], [stringlist sl_*() API])
+LIBBSD_SELECT_ABI([sort], [BSD sort functions])
 LIBBSD_SELECT_ABI([strl], [strlcpy()/strlcat()])
 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([transparent_libmd], [transparent libmd support])
+LIBBSD_SELECT_ABI([vis], [vis API])
 LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()])
 
 AS_IF([test "x$abi_funopen" = "xno" && \
diff --git a/include/Makefile.am b/include/Makefile.am
index 46925b6..9a75b97 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -12,23 +12,27 @@ nobase_include_HEADERS = \
 	bsd/netinet/ip_icmp.h \
 	bsd/bitstring.h \
 	bsd/bsd.h \
-	bsd/err.h \
-	bsd/getopt.h \
-	bsd/grp.h \
 	bsd/inttypes.h \
 	bsd/libutil.h \
-	bsd/pwd.h \
-	bsd/readpassphrase.h \
 	bsd/stdio.h \
 	bsd/stdlib.h \
 	bsd/string.h \
-	bsd/stringlist.h \
-	bsd/timeconv.h \
 	bsd/unistd.h \
-	bsd/vis.h \
 	bsd/wchar.h \
 	# EOL
 
+if ABI_ERR
+nobase_include_HEADERS += \
+	bsd/err.h \
+	# EOL
+endif
+
+if ABI_BSD_GETOPT
+nobase_include_HEADERS += \
+	bsd/getopt.h \
+	# EOL
+endif
+
 if ABI_MD5
 nobase_include_HEADERS += \
 	bsd/md5.h \
@@ -40,3 +44,34 @@ nobase_include_HEADERS += \
 	bsd/nlist.h \
 	# EOL
 endif
+
+if ABI_READPASSPHRASE
+nobase_include_HEADERS += \
+	bsd/readpassphrase.h \
+	# EOL
+endif
+
+if ABI_PWCACHE
+nobase_include_HEADERS += \
+	bsd/grp.h \
+	bsd/pwd.h \
+	# EOL
+endif
+
+if ABI_STRINGLIST
+nobase_include_HEADERS += \
+	bsd/stringlist.h \
+	# EOL
+endif
+
+if ABI_TIMECONV
+nobase_include_HEADERS += \
+	bsd/timeconv.h \
+	# EOL
+endif
+
+if ABI_VIS
+nobase_include_HEADERS += \
+	bsd/vis.h \
+	# EOL
+endif
diff --git a/man/Makefile.am b/man/Makefile.am
index ed55988..27aae67 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -143,11 +143,6 @@ dist_man_MANS = \
 	TAILQ_SWAP.3bsd \
 	TIMESPEC_TO_TIMEVAL.3bsd \
 	TIMEVAL_TO_TIMESPEC.3bsd \
-	arc4random.3bsd \
-	arc4random_addrandom.3bsd \
-	arc4random_buf.3bsd \
-	arc4random_stir.3bsd \
-	arc4random_uniform.3bsd \
 	be16dec.3bsd \
 	be16enc.3bsd \
 	be32dec.3bsd \
@@ -166,21 +161,6 @@ dist_man_MANS = \
 	bitstr_size.3bsd \
 	bitstring.3bsd \
 	byteorder.3bsd \
-	closefrom.3bsd \
-	dehumanize_number.3bsd \
-	expand_number.3bsd \
-	explicit_bzero.3bsd \
-	fgetln.3bsd \
-	fgetwln.3bsd \
-	flopen.3bsd \
-	fmtcheck.3bsd \
-	fparseln.3bsd \
-	freezero.3bsd \
-	getbsize.3bsd \
-	getmode.3bsd \
-	getpeereid.3bsd \
-	heapsort.3bsd \
-	humanize_number.3bsd \
 	le16dec.3bsd \
 	le16enc.3bsd \
 	le32dec.3bsd \
@@ -188,38 +168,7 @@ dist_man_MANS = \
 	le64dec.3bsd \
 	le64enc.3bsd \
 	libbsd.7 \
-	mergesort.3bsd \
-	pidfile.3bsd \
-	pidfile_close.3bsd \
-	pidfile_open.3bsd \
-	pidfile_remove.3bsd \
-	pidfile_write.3bsd \
-	pwcache.3bsd \
 	queue.3bsd \
-	radixsort.3bsd \
-	readpassphrase.3bsd \
-	reallocarray.3bsd \
-	reallocf.3bsd \
-	recallocarray.3bsd \
-	setmode.3bsd \
-	setproctitle.3bsd \
-	setproctitle_init.3bsd \
-	sl_add.3bsd \
-	sl_delete.3bsd \
-	sl_find.3bsd \
-	sl_free.3bsd \
-	sl_init.3bsd \
-	sradixsort.3bsd \
-	stringlist.3bsd \
-	strnstr.3bsd \
-	strnunvis.3bsd \
-	strnvis.3bsd \
-	strtoi.3bsd \
-	strtonum.3bsd \
-	strtou.3bsd \
-	strunvis.3bsd \
-	strvis.3bsd \
-	strvisx.3bsd \
 	timeradd.3bsd \
 	timerclear.3bsd \
 	timercmp.3bsd \
@@ -233,28 +182,106 @@ dist_man_MANS = \
 	timespecsub.3bsd \
 	timeval.3bsd \
 	tree.3bsd \
-	unvis.3bsd \
-	vis.3bsd \
 	# EOL
 
+if ABI_ACCMODE
+dist_man_MANS += \
+	getmode.3bsd \
+	setmode.3bsd \
+	# EOL
+endif
+
+if ABI_ARC4RANDOM
+dist_man_MANS += \
+	arc4random.3bsd \
+	arc4random_addrandom.3bsd \
+	arc4random_buf.3bsd \
+	arc4random_stir.3bsd \
+	arc4random_uniform.3bsd \
+	# EOL
+endif
+
+if ABI_CLOSEFROM
+dist_man_MANS += \
+	closefrom.3bsd \
+	# EOL
+endif
+
 if ABI_ERRC
 dist_man_MANS += \
 	errc.3bsd \
 	# EOL
 endif
 
+if ABI_EXPAND_NUMBER
+dist_man_MANS += \
+	expand_number.3bsd \
+	# EOL
+endif
+
+if ABI_EXPLICIT_BZERO
+dist_man_MANS += \
+	explicit_bzero.3bsd \
+	# EOL
+endif
+
+if ABI_FGETLN
+dist_man_MANS += \
+	fgetln.3bsd \
+	fgetwln.3bsd \
+	fparseln.3bsd \
+	# EOL
+endif
+
+if ABI_FLOPEN
+dist_man_MANS += \
+	flopen.3bsd \
+	# EOL
+endif
+
+if ABI_FMTCHECK
+dist_man_MANS += \
+	fmtcheck.3bsd \
+	# EOL
+endif
+
 if ABI_FPURGE
 dist_man_MANS += \
 	fpurge.3bsd \
 	# EOL
 endif
 
+if ABI_FREEZERO
+dist_man_MANS += \
+	freezero.3bsd \
+	# EOL
+endif
+
 if ABI_FUNOPEN
 dist_man_MANS += \
 	funopen.3bsd \
 	# EOL
 endif
 
+if ABI_GETBSIZE
+dist_man_MANS += \
+	getbsize.3bsd \
+	# EOL
+endif
+
+if ABI_GETPEEREID
+dist_man_MANS += \
+	getpeereid.3bsd \
+	# EOL
+endif
+
+if ABI_HUMANIZE_NUMBER
+dist_man_MANS += \
+	dehumanize_number.3bsd \
+	humanize_number.3bsd \
+	# EOL
+endif
+
 if ABI_MD5
 dist_man_MANS += \
 	md5.3bsd \
@@ -267,6 +294,23 @@ dist_man_MANS += \
 	# EOL
 endif
 
+if ABI_PIDFILE
+dist_man_MANS += \
+	pidfile.3bsd \
+	pidfile_close.3bsd \
+	pidfile_open.3bsd \
+	pidfile_remove.3bsd \
+	pidfile_write.3bsd \
+	# EOL
+endif
+
+if ABI_PROCTITLE
+dist_man_MANS += \
+	setproctitle.3bsd \
+	setproctitle_init.3bsd \
+	# EOL
+endif
+
 if ABI_PROGNAME
 dist_man_MANS += \
 	getprogname.3bsd \
@@ -274,7 +318,9 @@ dist_man_MANS += \
 	# EOL
 endif
 
+if ABI_PWCACHE
 dist_man_MANS += \
+	pwcache.3bsd \
 	gid_from_group.3bsd \
 	uid_from_user.3bsd \
 	# EOL
@@ -285,6 +331,51 @@ dist_man_MANS += \
 	user_from_uid.3bsd \
 	# EOL
 endif
+endif
+
+if ABI_READPASSPHRASE
+dist_man_MANS += \
+	readpassphrase.3bsd \
+	# EOL
+endif
+
+if ABI_REALLOCARRAY
+dist_man_MANS += \
+	reallocarray.3bsd \
+	# EOL
+endif
+
+if ABI_REALLOCF
+dist_man_MANS += \
+	reallocf.3bsd \
+	# EOL
+endif
+
+if ABI_RECALLOCARRAY
+dist_man_MANS += \
+	recallocarray.3bsd \
+	# EOL
+endif
+
+if ABI_SORT
+dist_man_MANS += \
+	heapsort.3bsd \
+	mergesort.3bsd \
+	radixsort.3bsd \
+	sradixsort.3bsd \
+	# EOL
+endif
+
+if ABI_STRINGLIST
+dist_man_MANS += \
+	sl_add.3bsd \
+	sl_delete.3bsd \
+	sl_find.3bsd \
+	sl_free.3bsd \
+	sl_init.3bsd \
+	stringlist.3bsd \
+	# EOL
+endif
 
 if ABI_STRL
 dist_man_MANS += \
@@ -299,6 +390,37 @@ dist_man_MANS += \
 	# EOL
 endif
 
+if ABI_STRNSTR
+dist_man_MANS += \
+	strnstr.3bsd \
+	# EOL
+endif
+
+if ABI_STRTOX
+dist_man_MANS += \
+	strtoi.3bsd \
+	strtou.3bsd \
+	# EOL
+endif
+
+if ABI_STRTONUM
+dist_man_MANS += \
+	strtonum.3bsd \
+	# EOL
+endif
+
+if ABI_VIS
+dist_man_MANS += \
+	strnunvis.3bsd \
+	strnvis.3bsd \
+	strunvis.3bsd \
+	strvis.3bsd \
+	strvisx.3bsd \
+	unvis.3bsd \
+	vis.3bsd \
+	# EOL
+endif
+
 if ABI_WCSL
 dist_man_MANS += \
 	wcslcat.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index 21ed1c7..a85b705 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,42 +76,15 @@ EXTRA_libbsd_la_DEPENDENCIES += \
 	# EOL
 endif
 libbsd_la_SOURCES = \
-	closefrom.c \
-	dehumanize_number.c \
-	expand_number.c \
-	explicit_bzero.c \
-	fgetln.c \
-	fgetwln.c \
-	flopen.c \
-	fmtcheck.c \
-	fparseln.c \
-	freezero.c \
-	getbsize.c \
-	getpeereid.c \
-	heapsort.c \
-	humanize_number.c \
-	inet_net_pton.c \
 	local-elf.h \
 	local-link.h \
-	merge.c \
-	pidfile.c \
-	pwcache.c \
-	radixsort.c \
-	readpassphrase.c \
-	reallocarray.c \
-	reallocf.c \
-	recallocarray.c \
+	# EOL
+
+if ABI_ACCMODE
+libbsd_la_SOURCES += \
 	setmode.c \
-	setproctitle.c \
-	stringlist.c \
-	strnstr.c \
-	strtoi.c \
-	strtonum.c \
-	strtou.c \
-	timeconv.c \
-	unvis.c \
-	vis.c \
 	# EOL
+endif
 
 if ABI_ARC4RANDOM
 if !HAVE_GETENTROPY
@@ -136,6 +109,12 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if ABI_CLOSEFROM
+libbsd_la_SOURCES += \
+	closefrom.c \
+	# EOL
+endif
+
 if ABI_ERR
 libbsd_la_SOURCES += \
 	err.c \
@@ -148,18 +127,81 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if ABI_EXPAND_NUMBER
+libbsd_la_SOURCES += \
+	expand_number.c \
+	# EOL
+endif
+
+if ABI_EXPLICIT_BZERO
+libbsd_la_SOURCES += \
+	explicit_bzero.c \
+	# EOL
+endif
+
+if ABI_FGETLN
+libbsd_la_SOURCES += \
+	fgetln.c \
+	fgetwln.c \
+	fparseln.c \
+	# EOL
+endif
+
+if ABI_FLOPEN
+libbsd_la_SOURCES += \
+	flopen.c \
+	# EOL
+endif
+
+if ABI_FMTCHECK
+libbsd_la_SOURCES += \
+	fmtcheck.c \
+	# EOL
+endif
+
 if ABI_FPURGE
 libbsd_la_SOURCES += \
 	fpurge.c \
 	# EOL
 endif
 
+if ABI_FREEZERO
+libbsd_la_SOURCES += \
+	freezero.c \
+	# EOL
+endif
+
 if ABI_FUNOPEN
 libbsd_la_SOURCES += \
 	funopen.c \
 	# EOL
 endif
 
+if ABI_GETBSIZE
+libbsd_la_SOURCES += \
+	getbsize.c \
+	# EOL
+endif
+
+if ABI_GETPEEREID
+libbsd_la_SOURCES += \
+	getpeereid.c \
+	# EOL
+endif
+
+if ABI_HUMANIZE_NUMBER
+libbsd_la_SOURCES += \
+	dehumanize_number.c \
+	humanize_number.c \
+	# EOL
+endif
+
+if ABI_INET_NET_PTON
+libbsd_la_SOURCES += \
+	inet_net_pton.c \
+	# EOL
+endif
+
 if ABI_MD5
 libbsd_la_SOURCES += \
 	md5.c \
@@ -172,12 +214,68 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if ABI_PIDFILE
+libbsd_la_SOURCES += \
+	pidfile.c \
+	# EOL
+endif
+
+if ABI_PROCTITLE
+libbsd_la_SOURCES += \
+	setproctitle.c \
+	# EOL
+endif
+
 if ABI_PROGNAME
 libbsd_la_SOURCES += \
 	progname.c \
 	# EOL
 endif
 
+if ABI_PWCACHE
+libbsd_la_SOURCES += \
+	pwcache.c \
+	# EOL
+endif
+
+if ABI_READPASSPHRASE
+libbsd_la_SOURCES += \
+	readpassphrase.c \
+	# EOL
+endif
+
+if ABI_REALLOCARRAY
+libbsd_la_SOURCES += \
+	reallocarray.c \
+	# EOL
+endif
+
+if ABI_REALLOCF
+libbsd_la_SOURCES += \
+	reallocf.c \
+	# EOL
+endif
+
+if ABI_RECALLOCARRAY
+libbsd_la_SOURCES += \
+	recallocarray.c \
+	# EOL
+endif
+
+if ABI_SORT
+libbsd_la_SOURCES += \
+	heapsort.c \
+	merge.c \
+	radixsort.c \
+	# EOL
+endif
+
+if ABI_STRINGLIST
+libbsd_la_SOURCES += \
+	stringlist.c \
+	# EOL
+endif
+
 if ABI_STRL
 libbsd_la_SOURCES += \
 	strlcat.c \
@@ -191,6 +289,38 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
+if ABI_STRNSTR
+libbsd_la_SOURCES += \
+	strnstr.c \
+	# EOL
+endif
+
+if ABI_STRTONUM
+libbsd_la_SOURCES += \
+	strtonum.c \
+	# EOL
+endif
+
+if ABI_STRTOX
+libbsd_la_SOURCES += \
+	strtoi.c \
+	strtou.c \
+	# EOL
+endif
+
+if ABI_TIMECONV
+libbsd_la_SOURCES += \
+	timeconv.c \
+	# EOL
+endif
+
+if ABI_VIS
+libbsd_la_SOURCES += \
+	unvis.c \
+	vis.c \
+	# EOL
+endif
+
 if ABI_WCSL
 libbsd_la_SOURCES += \
 	wcslcat.c \
diff --git a/src/libbsd.map.in b/src/libbsd.map.in
index 06550ea..81e431f 100644
--- a/src/libbsd.map.in
+++ b/src/libbsd.map.in
@@ -2,44 +2,71 @@
 
 LIBBSD_0.0 {
   global:
+#if LIBBSD_ABI_ARC4RANDOM
     arc4random;
+#endif
+#if LIBBSD_ABI_ARC4RANDOM_STIR
     arc4random_stir;
     arc4random_addrandom;
+#endif
 
+#if LIBBSD_ABI_BSD_GETOPT
     bsd_getopt;
     optreset;
+#endif
 
+#if LIBBSD_ABI_ERRC
     errc;
     warnc;
     verrc;
     vwarnc;
+#endif
 
+#if LIBBSD_ABI_FGETLN
     fgetln;
+#endif
+
+#if LIBBSD_ABI_FMTCHECK
     fmtcheck;
+#endif
+
+#if LIBBSD_ABI_SORT
     heapsort;
+#endif
+
+#if LIBBSD_ABI_HUMANIZE_NUMBER
     humanize_number;
+#endif
 
-    /* XXX: Already provided by glibc, remove. */
+#if LIBBSD_ABI_INET_NET_PTON
     inet_net_pton;
+#endif
 
+#if LIBBSD_ABI_PROGNAME
     getprogname;
     setprogname;
+#endif
 
+#if LIBBSD_ABI_STRL
     strlcpy;
     strlcat;
+#endif
 
+#if LIBBSD_ABI_ACCMODE
     setmode;
     getmode;
+#endif
 
+#if LIBBSD_ABI_VIS
     vis;
     strvis;
     strvisx;
     unvis;
     strunvis;
     strunvisx;
+#endif
 
-    /* The following functions are provided via the system libc or libmd
-     * implementations. */
+#if LIBBSD_ABI_MD5
     MD5Init;
     MD5Update;
     MD5Pad;
@@ -49,89 +76,138 @@ LIBBSD_0.0 {
     MD5File;
     MD5FileChunk;
     MD5Data;
+#endif
 
   local:
     *;
 };
 
 LIBBSD_0.1 {
+#if LIBBSD_ABI_STRMODE
     strmode;
+#endif
 
+#if LIBBSD_ABI_NLIST
     /* Private symbol, but libkvm uses it. */
     __fdnlist;
     nlist;
+#endif
 } LIBBSD_0.0;
 
 LIBBSD_0.2 {
+#if LIBBSD_ABI_STRTONUM
     strtonum;
+#endif
 
+#if LIBBSD_ABI_VIS
     strnvis;
     strnunvis;
+#endif
 
+#if LIBBSD_ABI_HUMANIZE_NUMBER
     dehumanize_number;
+#endif
 
+#if LIBBSD_ABI_READPASSPHRASE
     readpassphrase;
+#endif
 
+#if LIBBSD_ABI_FLOPEN
     flopen;
+#endif
 
+#if LIBBSD_ABI_PIDFILE
     pidfile_open;
     pidfile_write;
     pidfile_close;
     pidfile_remove;
+#endif
 
+#if LIBBSD_ABI_ARC4RANDOM
     arc4random_buf;
     arc4random_uniform;
+#endif
 } LIBBSD_0.1;
 
 LIBBSD_0.3 {
+#if LIBBSD_ABI_REALLOCF
     reallocf;
+#endif
+
+#if LIBBSD_ABI_GETPEEREID
     getpeereid;
+#endif
 
+#if LIBBSD_ABI_SORT
     mergesort;
     radixsort;
     sradixsort;
+#endif
 
+#if LIBBSD_ABI_FPURGE
     fpurge;
+#endif
 } LIBBSD_0.2;
 
 LIBBSD_0.4 {
+#if LIBBSD_ABI_CLOSEFROM
     closefrom;
+#endif
+
+#if LIBBSD_ABI_EXPAND_NUMBER
     expand_number;
+#endif
 } LIBBSD_0.3;
 
 LIBBSD_0.5 {
+#if LIBBSD_ABI_FGETLN
     fgetwln;
     fparseln;
+#endif
 
+#if LIBBSD_ABI_PROCTITLE
     /* Introduced in 0.2 as a stub, implemented in 0.5. */
     setproctitle;
+#endif
 
+#if LIBBSD_ABI_STRNSTR
     strnstr;
+#endif
 
+#if LIBBSD_ABI_WCSL
     wcslcat;
     wcslcpy;
+#endif
 } LIBBSD_0.4;
 
 LIBBSD_0.6 {
+#if LIBBSD_ABI_PROCTITLE
     /* Exported to cope with the constructor+dlopen+threads mess. */
     setproctitle_init;
+#endif
 } LIBBSD_0.5;
 
 LIBBSD_0.7 {
+#if LIBBSD_ABI_GETBSIZE
     getbsize;
+#endif
 
-    /* This symbol might not be present on some specific systems, such
-     * as musl based ones. It might need to be removed on SOVERSION bump,
-     * as it cannot be portabily implemented everywhere. */
+#if LIBBSD_ABI_FUNOPEN
     funopen;
+#endif
 
+#if LIBBSD_ABI_REALLOCARRAY
     reallocarray;
+#endif
 
+#if LIBBSD_ABI_STRINGLIST
     sl_init;
     sl_add;
     sl_free;
     sl_find;
+#endif
 
+#if LIBBSD_ABI_TIMECONV
     _time32_to_time;
     _time_to_time32;
     _time64_to_time;
@@ -140,20 +216,30 @@ LIBBSD_0.7 {
     _long_to_time;
     _time_to_int;
     _int_to_time;
+#endif
 } LIBBSD_0.6;
 
 LIBBSD_0.8 {
+#if LIBBSD_ABI_EXPLICIT_BZERO
     explicit_bzero;
+#endif
 } LIBBSD_0.7;
 
 LIBBSD_0.9 {
+#if LIBBSD_ABI_FLOPEN
     flopenat;
+#endif
 
+#if LIBBSD_ABI_PIDFILE
     pidfile_fileno;
+#endif
 
+#if LIBBSD_ABI_STRTOX
     strtoi;
     strtou;
+#endif
 
+#if LIBBSD_ABI_VIS
     nvis;
     snvis;
     stravis;
@@ -165,19 +251,21 @@ LIBBSD_0.9 {
     strsvis;
     strsvisx;
     svis;
+#endif
 } LIBBSD_0.8;
 
 LIBBSD_0.9.1 {
+#if LIBBSD_ABI_VIS
     /* The strnvis() and strnunvis() symbols changed prototype to match
      * the NetBSD implementation. Provided as versioned nodes in 0.9.1, and
      * exposed here explicitly so that we can redirect at compile-time. */
     strnvis_netbsd;
     strnunvis_netbsd;
+#endif
 } LIBBSD_0.9;
 
 LIBBSD_0.10.0 {
-    /* These BSD extensions are available on GNU systems, but not on other
-     * systems such as Windows or musl libc based ones. */
+#if LIBBSD_ABI_ERR
     vwarn;
     vwarnx;
     warn;
@@ -186,16 +274,28 @@ LIBBSD_0.10.0 {
     verrx;
     err;
     errx;
+#endif
 } LIBBSD_0.9.1;
 
 LIBBSD_0.11.0 {
+#if LIBBSD_ABI_VIS
     strnvisx;
+#endif
 
+#if LIBBSD_ABI_RECALLOCARRAY
     recallocarray;
+#endif
+
+#if LIBBSD_ABI_FREEZERO
     freezero;
+#endif
 
+#if LIBBSD_ABI_ID_FROM_NAME
     gid_from_group;
-    group_from_gid;
     uid_from_user;
+#endif
+#if LIBBSD_ABI_NAME_FROM_ID
     user_from_uid;
+    group_from_gid;
+#endif
 } LIBBSD_0.10.0;
diff --git a/test/Makefile.am b/test/Makefile.am
index 64c6610..1c64abb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,21 +33,14 @@ check_SCRIPTS = \
 
 check_PROGRAMS = \
 	overlay \
-	bzero \
-	closefrom \
 	endian \
-	explicit_bzero \
-	humanize \
-	fgetln \
-	fparseln \
-	proctitle-init \
-	pwcache \
+	# EOL
+
+if ABI_ACCMODE
+check_PROGRAMS += \
 	setmode \
-	strnstr \
-	strtonum \
-	vis \
-	vis-openbsd \
 	# EOL
+endif
 
 if ABI_ARC4RANDOM
 if HAVE_LIBTESTU01
@@ -57,6 +50,25 @@ arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
 endif
 endif
 
+if ABI_CLOSEFROM
+check_PROGRAMS += \
+	closefrom \
+	# EOL
+endif
+
+if ABI_EXPLICIT_BZERO
+check_PROGRAMS += \
+	bzero \
+	explicit_bzero \
+	# EOL
+endif
+
+if ABI_FGETLN
+check_PROGRAMS += \
+	fgetln \
+	fparseln \
+	# EOL
+
 fgetln_SOURCES = \
 	test-stream.c \
 	test-stream.h \
@@ -70,6 +82,21 @@ fparseln_SOURCES = \
 	test-stream.h \
 	fparseln.c \
 	# EOL
+endif
+
+if ABI_FPURGE
+check_PROGRAMS += fpurge
+endif
+
+if ABI_FUNOPEN
+check_PROGRAMS += funopen
+endif
+
+if ABI_HUMANIZE_NUMBER
+check_PROGRAMS += \
+	humanize \
+	# EOL
+endif
 
 if ABI_FPURGE
 check_PROGRAMS += fpurge
@@ -92,6 +119,15 @@ if ABI_NLIST
 check_PROGRAMS += nlist
 endif
 
+if ABI_PROGNAME
+check_PROGRAMS += progname
+endif
+
+if ABI_PROCTITLE
+check_PROGRAMS += \
+	proctitle-init \
+	# EOL
+
 proctitle_init_SOURCES = \
 	proctitle.c \
 	# EOL
@@ -107,6 +143,13 @@ proctitle_LDFLAGS = \
 	$(top_builddir)/src/libbsd.la \
 	# EOL
 endif
+endif
+
+if ABI_PWCACHE
+check_PROGRAMS += \
+	pwcache \
+	# EOL
+endif
 
 if ABI_PROGNAME
 check_PROGRAMS += progname
@@ -120,4 +163,23 @@ if ABI_STRMODE
 check_PROGRAMS += strmode
 endif
 
+if ABI_STRNSTR
+check_PROGRAMS += \
+	strnstr \
+	# EOL
+endif
+
+if ABI_STRTONUM
+check_PROGRAMS += \
+	strtonum \
+	# EOL
+endif
+
+if ABI_VIS
+check_PROGRAMS += \
+	vis \
+	vis-openbsd \
+	# EOL
+endif
+
 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
commit 27503a1066fe28ebc84d080f24a475c99f82b48e
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Feb 14 04:59:44 2024 +0100

    build: Rework ABI selection logic
    
    Add a new LIBBSD_SELECT_ABI m4 macro, and use it to setup the ABI
    interfaces to expose and the various variables and conditionals
    to be used by the build system.
    
    Switch to set the initial values to unknown and then set every one
    of the selections explicitly by supported target.
    
    Update comments for rationale for things to DROP, or for why some
    selections are enabled.

diff --git a/configure.ac b/configure.ac
index c6163e7..ef79d0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,35 +35,56 @@ LT_INIT
 LIBBSD_LINKER_VERSION_SCRIPT
 
 ## Select library ABI to expose.
+#
+# The systems have DROP comments for interfaces that could be dropped on
+# the next SOVERSION bump.
 
 is_windows=no
 
-abi_arc4random=no
-abi_bsd_getopt=no
-abi_err=no
-abi_errc=no
-abi_fpurge=no
-abi_funopen=no
-abi_md5=no
-abi_name_from_id=no
-abi_nlist=no
-abi_progname=no
-abi_strl=no
-abi_strmode=no
-abi_wcsl=no
+abi_arc4random=unknown
+abi_bsd_getopt=unknown
+abi_err=unknown
+abi_errc=unknown
+abi_fpurge=unknown
+abi_funopen=unknown
+abi_md5=unknown
+abi_name_from_id=unknown
+abi_nlist=unknown
+abi_progname=unknown
+abi_strl=unknown
+abi_strmode=unknown
+abi_wcsl=unknown
 
 AS_CASE([$host_os],
   [*-gnu*], [
+    # DROP: On glibc >= 2.36, parts the arc4random() API got added.
+    #abi_arc4random=no
+    abi_arc4random=yes
+    abi_bsd_getopt=yes
+    abi_err=no
     abi_errc=yes
-    # On glibc >= 2.38, strlcpy() and strlcat() got added,
-    # so these could then be dropped on the next SOVERSION bump.
+    abi_fpurge=yes
+    abi_funopen=yes
+    # DROP: On libmd.
+    #abi_md5=no
+    abi_md5=yes
+    abi_name_from_id=yes
+    abi_nlist=yes
+    abi_progname=yes
+    # DROP: On glibc >= 2.38.
     #abi_strl=no
+    abi_strl=yes
+    abi_strmode=yes
+    abi_wcsl=yes
   ],
   [*-musl*], [
-    # On musl >= 0.9.7, optreset got implemented, so bsd_getopt() can then
-    # be dropped on the next SOVERSION bump.
+    abi_arc4random=yes
+    # DROP: On musl >= 0.9.7, optreset got implemented.
     #abi_bsd_getopt=no
+    abi_bsd_getopt=yes
     abi_err=no
+    abi_errc=yes
+    abi_fpurge=yes
     # On musl >= 1.1.19, fopencookie() got implemented, and because we were
     # checking for its presence to decide whether to build funopen(), it got
     # included in builds even when previously it had not been included, which
@@ -71,9 +92,17 @@ AS_CASE([$host_os],
     # worse, we'll ignore this as this is only a problem with downgrades. And
     # enable it explicitly
     abi_funopen=yes
-    # On musl >= 0.5.0, strlcpy() and strlcat() were already implemented,
-    # so these can then be dropped on the next SOVERSION bump.
+    # DROP: On libmd.
+    #abi_md5=no
+    abi_md5=yes
+    abi_name_from_id=yes
+    abi_nlist=yes
+    abi_progname=yes
+    # DROP: On musl >= 0.5.0, strlcpy() and strlcat() were already implemented.
     #abi_strl=no
+    abi_strl=yes
+    abi_strmode=yes
+    abi_wcsl=yes
   ],
   [darwin*], [
     # On macOS these are provided by the system, and libbsd has never built
@@ -83,7 +112,6 @@ AS_CASE([$host_os],
     abi_err=no
     abi_errc=no
     abi_fpurge=no
-    # On macOS we do not have fopencookie(), and cannot implement it.
     abi_funopen=no
     abi_md5=no
     abi_name_from_id=no
@@ -280,20 +308,20 @@ AC_CHECK_FUNCS([\
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
 # ABI selection
-AM_CONDITIONAL([ABI_ARC4RANDOM], [test "x$abi_arc4random" = "xyes"])
-AM_CONDITIONAL([ABI_BSD_GETOPT], [test "x$abi_bsd_getopt" = "xyes"])
-AM_CONDITIONAL([ABI_ERR], [test "x$abi_err" = "xyes"])
-AM_CONDITIONAL([ABI_ERRC], [test "x$abi_errc" = "xyes"])
-AM_CONDITIONAL([ABI_PROGNAME], [test "x$abi_progname" = "xyes"])
-AM_CONDITIONAL([ABI_TRANSPARENT_LIBMD], [test "x$abi_transparent_libmd" = "xyes"])
-AM_CONDITIONAL([ABI_MD5], [test "x$abi_md5" = "xyes"])
-AM_CONDITIONAL([ABI_NLIST], [test "x$abi_nlist" = "xyes"])
-AM_CONDITIONAL([ABI_STRL], [test "x$abi_strl" = "xyes"])
-AM_CONDITIONAL([ABI_WCSL], [test "x$abi_wcsl" = "xyes"])
-AM_CONDITIONAL([ABI_STRMODE], [test "x$abi_strmode" = "xyes"])
-AM_CONDITIONAL([ABI_NAME_FROM_ID], [test "x$abi_name_from_id" = "xyes"])
-AM_CONDITIONAL([ABI_FPURGE], [test "x$abi_fpurge" = "xyes"])
-AM_CONDITIONAL([ABI_FUNOPEN], [test "x$abi_funopen" = "xyes"])
+LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
+LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()])
+LIBBSD_SELECT_ABI([err], [err API])
+LIBBSD_SELECT_ABI([errc], [errc API])
+LIBBSD_SELECT_ABI([fpurge], [fpurge()])
+LIBBSD_SELECT_ABI([funopen], [funopen()])
+LIBBSD_SELECT_ABI([md5], [MD5 digest functions])
+LIBBSD_SELECT_ABI([name_from_id], [user_from_uid()/group_from_gid()])
+LIBBSD_SELECT_ABI([nlist], [nlist()])
+LIBBSD_SELECT_ABI([progname], [setprogname()/getprogname()])
+LIBBSD_SELECT_ABI([strl], [strlcpy()/strlcat()])
+LIBBSD_SELECT_ABI([strmode], [strmode()])
+LIBBSD_SELECT_ABI([transparent_libmd], [transparent libmd support])
+LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()])
 
 AS_IF([test "x$abi_funopen" = "xno" && \
        test "x$ac_cv_func_funopen" != "xyes" && \
diff --git a/m4/libbsd-compiler.m4 b/m4/libbsd-compiler.m4
index 135f38c..0708f57 100644
--- a/m4/libbsd-compiler.m4
+++ b/m4/libbsd-compiler.m4
@@ -70,3 +70,19 @@ int main() { return rc; }
   AM_CONDITIONAL([BUILD_LIBBSD_CTOR],
     [test "$libbsd_cv_gnu_init_array_support" = yes])
 ])
+
+# LIBBSD_SELECT_ABI(name, desc)
+# -----------------
+AC_DEFUN([LIBBSD_SELECT_ABI], [
+  AS_IF([test -z "$AS_TR_SH([abi_$1])"], [
+    AC_MSG_ERROR([missing ABI selection for $1])
+  ], [test "$AS_TR_SH([abi_$1])" = "unknown"], [
+    AC_MSG_ERROR([unknown ABI selection for $1])
+  ], [test "$AS_TR_SH([abi_$1])" = "yes"], [
+    AC_DEFINE(AS_TR_CPP([LIBBSD_ABI_$1]), [1], [Provide ABI for $2])
+  ], [
+    AC_DEFINE(AS_TR_CPP([LIBBSD_ABI_$1]), [0])
+  ])
+  AM_CONDITIONAL(AS_TR_CPP([ABI_$1]),
+    [test "x$AS_TR_SH([abi_$1])" = "xyes"])
+])
commit 99739877be6e3eaa28681201019ec16788c789fe
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Feb 14 04:59:44 2024 +0100

    build: Rename ABI selection variables from need_ to abi_
    
    This should make the purpose of these variables more clear.

diff --git a/configure.ac b/configure.ac
index 806808d..c6163e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,61 +38,61 @@ LIBBSD_LINKER_VERSION_SCRIPT
 
 is_windows=no
 
-need_arc4random=yes
-need_bsd_getopt=yes
-need_err=yes
-need_errc=yes
-need_fpurge=yes
-need_funopen=yes
-need_md5=yes
-need_name_from_id=yes
-need_nlist=yes
-need_progname=yes
-need_strl=yes
-need_strmode=yes
-need_wcsl=yes
+abi_arc4random=no
+abi_bsd_getopt=no
+abi_err=no
+abi_errc=no
+abi_fpurge=no
+abi_funopen=no
+abi_md5=no
+abi_name_from_id=no
+abi_nlist=no
+abi_progname=no
+abi_strl=no
+abi_strmode=no
+abi_wcsl=no
 
 AS_CASE([$host_os],
   [*-gnu*], [
+    abi_errc=yes
     # On glibc >= 2.38, strlcpy() and strlcat() got added,
     # so these could then be dropped on the next SOVERSION bump.
-    #need_strl=no
-    need_err=no
+    #abi_strl=no
   ],
   [*-musl*], [
     # On musl >= 0.9.7, optreset got implemented, so bsd_getopt() can then
     # be dropped on the next SOVERSION bump.
-    #need_bsd_getopt=no
-    need_err=no
+    #abi_bsd_getopt=no
+    abi_err=no
     # On musl >= 1.1.19, fopencookie() got implemented, and because we were
     # checking for its presence to decide whether to build funopen(), it got
     # included in builds even when previously it had not been included, which
     # is partially an ABI issue, but given that disabling it now would be
     # worse, we'll ignore this as this is only a problem with downgrades. And
     # enable it explicitly
-    need_funopen=yes
+    abi_funopen=yes
     # On musl >= 0.5.0, strlcpy() and strlcat() were already implemented,
     # so these can then be dropped on the next SOVERSION bump.
-    #need_strl=no
+    #abi_strl=no
   ],
   [darwin*], [
     # On macOS these are provided by the system, and libbsd has never built
     # there, so we can avoid providing these with no ABI breakage.
-    need_arc4random=no
-    need_bsd_getopt=no
-    need_err=no
-    need_errc=no
-    need_fpurge=no
+    abi_arc4random=no
+    abi_bsd_getopt=no
+    abi_err=no
+    abi_errc=no
+    abi_fpurge=no
     # On macOS we do not have fopencookie(), and cannot implement it.
-    need_funopen=no
-    need_md5=no
-    need_name_from_id=no
-    need_nlist=no
-    need_progname=no
-    need_strl=no
-    need_strmode=no
-    need_transparent_libmd=no
-    need_wcsl=no
+    abi_funopen=no
+    abi_md5=no
+    abi_name_from_id=no
+    abi_nlist=no
+    abi_progname=no
+    abi_strl=no
+    abi_strmode=no
+    abi_transparent_libmd=no
+    abi_wcsl=no
   ],
   [mingw*], [
     is_windows=yes
@@ -169,17 +169,17 @@ AM_CONDITIONAL([HAVE_LIBTESTU01],
   [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
 
 saved_LIBS="$LIBS"
-AS_IF([test "$need_md5" = "yes"], [
+AS_IF([test "$abi_md5" = "yes"], [
   AC_SEARCH_LIBS([MD5Update], [md], [
     AS_IF([test "x$ac_cv_search_MD5Update" != "xnone required"], [
       MD5_LIBS="$MD5_LIBS $ac_cv_search_MD5Update"
-      need_transparent_libmd=yes
+      abi_transparent_libmd=yes
     ])
   ], [
     AC_MSG_ERROR([cannot find required MD5 functions in libc or libmd])
   ])
 ])
-AS_IF([test "$need_arc4random" = "yes"], [
+AS_IF([test "$abi_arc4random" = "yes"], [
   AC_CHECK_FUNCS([getentropy])
 
   AS_IF([test "$ac_cv_func_getentropy" != "yes"], [
@@ -279,21 +279,23 @@ AC_CHECK_FUNCS([\
 
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
-AM_CONDITIONAL([NEED_ARC4RANDOM], [test "x$need_arc4random" = "xyes"])
-AM_CONDITIONAL([NEED_BSD_GETOPT], [test "x$need_bsd_getopt" = "xyes"])
-AM_CONDITIONAL([NEED_ERR], [test "x$need_err" = "xyes"])
-AM_CONDITIONAL([NEED_ERRC], [test "x$need_errc" = "xyes"])
-AM_CONDITIONAL([NEED_PROGNAME], [test "x$need_progname" = "xyes"])
-AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xyes"])
-AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
-AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
-AM_CONDITIONAL([NEED_STRL], [test "x$need_strl" = "xyes"])
-AM_CONDITIONAL([NEED_WCSL], [test "x$need_wcsl" = "xyes"])
-AM_CONDITIONAL([NEED_STRMODE], [test "x$need_strmode" = "xyes"])
-AM_CONDITIONAL([NEED_NAME_FROM_ID], [test "x$need_name_from_id" = "xyes"])
-AM_CONDITIONAL([NEED_FPURGE], [test "x$need_fpurge" = "xyes"])
-AM_CONDITIONAL([NEED_FUNOPEN], [test "x$need_funopen" = "xyes"])
-AS_IF([test "x$need_funopen" = "xno" && \
+# ABI selection
+AM_CONDITIONAL([ABI_ARC4RANDOM], [test "x$abi_arc4random" = "xyes"])
+AM_CONDITIONAL([ABI_BSD_GETOPT], [test "x$abi_bsd_getopt" = "xyes"])
+AM_CONDITIONAL([ABI_ERR], [test "x$abi_err" = "xyes"])
+AM_CONDITIONAL([ABI_ERRC], [test "x$abi_errc" = "xyes"])
+AM_CONDITIONAL([ABI_PROGNAME], [test "x$abi_progname" = "xyes"])
+AM_CONDITIONAL([ABI_TRANSPARENT_LIBMD], [test "x$abi_transparent_libmd" = "xyes"])
+AM_CONDITIONAL([ABI_MD5], [test "x$abi_md5" = "xyes"])
+AM_CONDITIONAL([ABI_NLIST], [test "x$abi_nlist" = "xyes"])
+AM_CONDITIONAL([ABI_STRL], [test "x$abi_strl" = "xyes"])
+AM_CONDITIONAL([ABI_WCSL], [test "x$abi_wcsl" = "xyes"])
+AM_CONDITIONAL([ABI_STRMODE], [test "x$abi_strmode" = "xyes"])
+AM_CONDITIONAL([ABI_NAME_FROM_ID], [test "x$abi_name_from_id" = "xyes"])
+AM_CONDITIONAL([ABI_FPURGE], [test "x$abi_fpurge" = "xyes"])
+AM_CONDITIONAL([ABI_FUNOPEN], [test "x$abi_funopen" = "xyes"])
+
+AS_IF([test "x$abi_funopen" = "xno" && \
        test "x$ac_cv_func_funopen" != "xyes" && \
        test "x$ac_cv_func_fopencookie" = "xyes"], [
   AC_MSG_WARN([[can implement funopen() now based on newly added fopencooke(), report upstream]])
diff --git a/include/Makefile.am b/include/Makefile.am
index 31d86b4..46925b6 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -29,13 +29,13 @@ nobase_include_HEADERS = \
 	bsd/wchar.h \
 	# EOL
 
-if NEED_MD5
+if ABI_MD5
 nobase_include_HEADERS += \
 	bsd/md5.h \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 nobase_include_HEADERS += \
 	bsd/nlist.h \
 	# EOL
diff --git a/man/Makefile.am b/man/Makefile.am
index 51cbdd7..ed55988 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -237,37 +237,37 @@ dist_man_MANS = \
 	vis.3bsd \
 	# EOL
 
-if NEED_ERRC
+if ABI_ERRC
 dist_man_MANS += \
 	errc.3bsd \
 	# EOL
 endif
 
-if NEED_FPURGE
+if ABI_FPURGE
 dist_man_MANS += \
 	fpurge.3bsd \
 	# EOL
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 dist_man_MANS += \
 	funopen.3bsd \
 	# EOL
 endif
 
-if NEED_MD5
+if ABI_MD5
 dist_man_MANS += \
 	md5.3bsd \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 dist_man_MANS += \
 	nlist.3bsd \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 dist_man_MANS += \
 	getprogname.3bsd \
 	setprogname.3bsd \
@@ -279,27 +279,27 @@ dist_man_MANS += \
 	uid_from_user.3bsd \
 	# EOL
 
-if NEED_NAME_FROM_ID
+if ABI_NAME_FROM_ID
 dist_man_MANS += \
 	group_from_gid.3bsd \
 	user_from_uid.3bsd \
 	# EOL
 endif
 
-if NEED_STRL
+if ABI_STRL
 dist_man_MANS += \
 	strlcat.3bsd \
 	strlcpy.3bsd \
 	# EOL
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 dist_man_MANS += \
 	strmode.3bsd \
 	# EOL
 endif
 
-if NEED_WCSL
+if ABI_WCSL
 dist_man_MANS += \
 	wcslcat.3bsd \
 	wcslcpy.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index b4ec241..21ed1c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,7 +113,7 @@ libbsd_la_SOURCES = \
 	vis.c \
 	# EOL
 
-if NEED_ARC4RANDOM
+if ABI_ARC4RANDOM
 if !HAVE_GETENTROPY
 libbsd_la_SOURCES += \
 	getentropy.c \
@@ -130,75 +130,75 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
-if NEED_BSD_GETOPT
+if ABI_BSD_GETOPT
 libbsd_la_SOURCES += \
 	bsd_getopt.c \
 	# EOL
 endif
 
-if NEED_ERR
+if ABI_ERR
 libbsd_la_SOURCES += \
 	err.c \
 	# EOL
 endif
 
-if NEED_ERRC
+if ABI_ERRC
 libbsd_la_SOURCES += \
 	errc.c \
 	# EOL
 endif
 
-if NEED_FPURGE
+if ABI_FPURGE
 libbsd_la_SOURCES += \
 	fpurge.c \
 	# EOL
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 libbsd_la_SOURCES += \
 	funopen.c \
 	# EOL
 endif
 
-if NEED_MD5
+if ABI_MD5
 libbsd_la_SOURCES += \
 	md5.c \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 libbsd_la_SOURCES += \
 	nlist.c \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 libbsd_la_SOURCES += \
 	progname.c \
 	# EOL
 endif
 
-if NEED_STRL
+if ABI_STRL
 libbsd_la_SOURCES += \
 	strlcat.c \
 	strlcpy.c \
 	# EOL
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 libbsd_la_SOURCES += \
 	strmode.c \
 	# EOL
 endif
 
-if NEED_WCSL
+if ABI_WCSL
 libbsd_la_SOURCES += \
 	wcslcat.c \
 	wcslcpy.c \
 	# EOL
 endif
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 CLEANFILES += \
 	format.ld \
 	# EOL
@@ -223,7 +223,7 @@ libbsd.map: libbsd.map.in
 libbsd.sym: libbsd.map
 	$(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libbsd.map >$@
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 TRANSPARENT_LIBMD_DEPENDS = format.ld
 
 format.ld:
@@ -240,7 +240,7 @@ install-exec-hook: $(TRANSPARENT_LIBMD_DEPENDS)
 		mv $(DESTDIR)$(libdir)/libbsd*.so.* \
 		   $(DESTDIR)$(runtimelibdir)/; \
 	fi
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 # The "GNU ld script" magic is required so that GNU ldconfig does not complain
 # about an unknown format file.
 	soname=`readlink $(DESTDIR)$(libdir)/libbsd.so`; \
diff --git a/test/Makefile.am b/test/Makefile.am
index 7b53bc1..64c6610 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -49,7 +49,7 @@ check_PROGRAMS = \
 	vis-openbsd \
 	# EOL
 
-if NEED_ARC4RANDOM
+if ABI_ARC4RANDOM
 if HAVE_LIBTESTU01
 check_PROGRAMS += arc4random
 
@@ -71,24 +71,24 @@ fparseln_SOURCES = \
 	fparseln.c \
 	# EOL
 
-if NEED_FPURGE
+if ABI_FPURGE
 check_PROGRAMS += fpurge
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 check_PROGRAMS += funopen
 endif
 
-if NEED_MD5
+if ABI_MD5
 check_PROGRAMS += md5
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 # On the installed system this is handled via the ld script.
 md5_LDADD = $(LDADD) $(MD5_LIBS)
 endif
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 check_PROGRAMS += nlist
 endif
 
@@ -108,15 +108,15 @@ proctitle_LDFLAGS = \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 check_PROGRAMS += progname
 endif
 
-if NEED_STRL
+if ABI_STRL
 check_PROGRAMS += strl
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 check_PROGRAMS += strmode
 endif
 


More information about the libbsd mailing list