build: Conditionalize getprogname()/setprogname on macOS These functions are provided by the system libc, so there is no need for us to provide them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
diff --git a/configure.ac b/configure.ac
index f0762f6..624494e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -320,6 +320,7 @@ AC_CHECK_FUNCS([\
need_arc4random=yes
need_bsd_getopt=yes
+need_progname=yes
need_md5=yes
need_nlist=yes
need_strl=yes
@@ -348,6 +349,7 @@ AS_CASE([$host_os],
# there, so we can avoid providing these with no ABI breakage.
need_arc4random=no
need_bsd_getopt=no
+ need_progname=no
need_transparent_libmd=no
need_md5=no
need_nlist=no
@@ -364,6 +366,7 @@ 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_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"])
diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index bba13af..51c58e8 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -65,8 +65,10 @@ void arc4random_addrandom(unsigned char *dat, int datlen);
int dehumanize_number(const char *str, int64_t *size);
+#if !defined(__APPLE__)
const char *getprogname(void);
void setprogname(const char *);
+#endif
int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
int mergesort(void *base, size_t nmemb, size_t size,
diff --git a/man/Makefile.am b/man/Makefile.am
index bc30c87..91499e1 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -180,7 +180,6 @@ dist_man_MANS = \
getbsize.3bsd \
getmode.3bsd \
getpeereid.3bsd \
- getprogname.3bsd \
heapsort.3bsd \
humanize_number.3bsd \
le16dec.3bsd \
@@ -205,7 +204,6 @@ dist_man_MANS = \
setmode.3bsd \
setproctitle.3bsd \
setproctitle_init.3bsd \
- setprogname.3bsd \
sl_add.3bsd \
sl_delete.3bsd \
sl_find.3bsd \
@@ -241,6 +239,13 @@ dist_man_MANS = \
wcslcpy.3bsd \
# EOL
+if NEED_PROGNAME
+dist_man_MANS += \
+ getprogname.3bsd \
+ setprogname.3bsd \
+ # EOL
+endif
+
if NEED_MD5
dist_man_MANS += \
md5.3bsd \
diff --git a/test/Makefile.am b/test/Makefile.am
index 7d220f7..13c2ae1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,7 +41,6 @@ check_PROGRAMS = \
fgetln \
fparseln \
proctitle-init \
- progname \
setmode \
strnstr \
strtonum \
@@ -49,6 +48,10 @@ check_PROGRAMS = \
vis-openbsd \
# EOL
+if NEED_PROGNAME
+check_PROGRAMS += progname
+endif
+
if NEED_NLIST
check_PROGRAMS += nlist
endif