])
LIBS="$saved_LIBS"
-AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD],
- [test "x$need_transparent_libmd" = "xyes"])
-
AS_CASE([$host_os],
[*-gnu*], [
# In old glibc versions (< 2.17) clock_gettime() is in librt.
open_memstream \
pstat_getproc \
sysconf \
+ uid_from_user \
+ gid_from_group \
+ user_from_uid \
+ group_from_gid \
])
+need_arc4random=yes
+need_md5=yes
+need_nlist=yes
+need_strl=yes
+need_strmode=yes
+need_pwcache=yes
+need_fpurge=yes
need_funopen=yes
AS_CASE([$host_os],
[*-musl*], [
need_funopen=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.
+ need_arc4random=no
+ need_transparent_libmd=no
+ need_md5=no
+ need_nlist=no
+ need_strl=no
+ need_strmode=no
+ need_pwcache=no
+ need_fpurge=no
# On macOS we do not have fopencookie(), and cannot implement it.
need_funopen=no
],
)
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
+
+AM_CONDITIONAL([NEED_ARC4RANDOM], [test "x$need_arc4random" = "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_STRMODE], [test "x$need_strmode" = "xyes"])
+AM_CONDITIONAL([NEED_PWCACHE], [test "x$need_pwcache" = "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" && \
test "x$ac_cv_func_funopen" != "xyes" && \
bsd/grp.h \
bsd/inttypes.h \
bsd/libutil.h \
- bsd/md5.h \
- bsd/nlist.h \
bsd/pwd.h \
bsd/readpassphrase.h \
bsd/stdio.h \
bsd/vis.h \
bsd/wchar.h \
# EOL
+
+if NEED_MD5
+nobase_include_HEADERS += \
+ bsd/md5.h \
+ # EOL
+endif
+
+if NEED_NLIST
+nobase_include_HEADERS += \
+ bsd/nlist.h \
+ # EOL
+endif
__BEGIN_DECLS
int
gid_from_group(const char *, gid_t *);
+#ifndef __APPLE__
const char *
group_from_gid(gid_t, int);
+#endif
__END_DECLS
#endif
__BEGIN_DECLS
int
uid_from_user(const char *, uid_t *);
+#ifndef __APPLE__
const char *
user_from_uid(uid_t, int);
+#endif
__END_DECLS
#endif
#include <stdint.h>
__BEGIN_DECLS
+#if !defined(__APPLE__)
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 36) || \
!defined(_DEFAULT_SOURCE)
#endif
void arc4random_stir(void);
void arc4random_addrandom(unsigned char *dat, int datlen);
+#endif
int dehumanize_number(const char *str, int64_t *size);
#include <sys/types.h>
__BEGIN_DECLS
+#ifndef __APPLE__
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);
+#endif
char *strnstr(const char *str, const char *find, size_t str_len);
+#ifndef __APPLE__
void strmode(mode_t mode, char *str);
+#endif
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 25) || \
freezero.3bsd \
fmtcheck.3bsd \
fparseln.3bsd \
- fpurge.3bsd \
getbsize.3bsd \
getmode.3bsd \
getpeereid.3bsd \
getprogname.3bsd \
- gid_from_group.3bsd \
- group_from_gid.3bsd \
heapsort.3bsd \
humanize_number.3bsd \
le16dec.3bsd \
le64dec.3bsd \
le64enc.3bsd \
libbsd.7 \
- md5.3bsd \
mergesort.3bsd \
- nlist.3bsd \
pidfile.3bsd \
pidfile_close.3bsd \
pidfile_open.3bsd \
pidfile_remove.3bsd \
pidfile_write.3bsd \
- pwcache.3bsd \
queue.3bsd \
radixsort.3bsd \
readpassphrase.3bsd \
sl_init.3bsd \
sradixsort.3bsd \
stringlist.3bsd \
- strlcat.3bsd \
- strlcpy.3bsd \
- strmode.3bsd \
strnstr.3bsd \
strnunvis.3bsd \
strnvis.3bsd \
timespecsub.3bsd \
timeval.3bsd \
tree.3bsd \
- uid_from_user.3bsd \
unvis.3bsd \
- user_from_uid.3bsd \
vis.3bsd \
wcslcat.3bsd \
wcslcpy.3bsd \
# EOL
+if NEED_MD5
+dist_man_MANS += \
+ md5.3bsd \
+ # EOL
+endif
+
+if NEED_NLIST
+dist_man_MANS += \
+ nlist.3bsd \
+ # EOL
+endif
+
+if NEED_STRL
+dist_man_MANS += \
+ strlcat.3bsd \
+ strlcpy.3bsd \
+ # EOL
+endif
+
+if NEED_STRMODE
+dist_man_MANS += \
+ strmode.3bsd \
+ # EOL
+endif
+
+if NEED_PWCACHE
+dist_man_MANS += \
+ pwcache.3bsd \
+ uid_from_user.3bsd \
+ user_from_uid.3bsd \
+ gid_from_group.3bsd \
+ group_from_gid.3bsd \
+ # EOL
+endif
+
+if NEED_FPURGE
+dist_man_MANS += \
+ fpurge.3bsd \
+ # EOL
+endif
+
if NEED_FUNOPEN
dist_man_MANS += \
funopen.3bsd \
# EOL
endif
libbsd_la_SOURCES = \
- arc4random.c \
- arc4random.h \
- arc4random_linux.h \
- arc4random_uniform.c \
- arc4random_unix.h \
- arc4random_win.h \
bsd_getopt.c \
- chacha_private.h \
closefrom.c \
dehumanize_number.c \
err.c \
flopen.c \
fmtcheck.c \
fparseln.c \
- fpurge.c \
getbsize.c \
getpeereid.c \
heapsort.c \
inet_net_pton.c \
local-elf.h \
local-link.h \
- md5.c \
merge.c \
- nlist.c \
pidfile.c \
progname.c \
- pwcache.c \
radixsort.c \
readpassphrase.c \
reallocarray.c \
recallocarray.c \
setmode.c \
setproctitle.c \
- strlcat.c \
- strlcpy.c \
stringlist.c \
- strmode.c \
strnstr.c \
strtoi.c \
strtonum.c \
wcslcpy.c \
# EOL
+if NEED_ARC4RANDOM
if !HAVE_GETENTROPY
libbsd_la_SOURCES += \
getentropy.c \
# EOL
endif
+libbsd_la_SOURCES += \
+ arc4random.c \
+ arc4random.h \
+ arc4random_linux.h \
+ arc4random_uniform.c \
+ arc4random_unix.h \
+ arc4random_win.h \
+ chacha_private.h \
+ # EOL
+endif
+
+if NEED_MD5
+libbsd_la_SOURCES += \
+ md5.c \
+ # EOL
+endif
+
+if NEED_NLIST
+libbsd_la_SOURCES += \
+ nlist.c \
+ # EOL
+endif
+
+if NEED_STRL
+libbsd_la_SOURCES += \
+ strlcat.c \
+ strlcpy.c \
+ # EOL
+endif
+
+if NEED_STRMODE
+libbsd_la_SOURCES += \
+ strmode.c \
+ # EOL
+endif
+
+if NEED_PWCACHE
+libbsd_la_SOURCES += \
+ pwcache.c \
+ # EOL
+endif
+
+if NEED_FPURGE
+libbsd_la_SOURCES += \
+ fpurge.c \
+ # EOL
+endif
if NEED_FUNOPEN
libbsd_la_SOURCES += \
return key % tabsz;
}
+#ifndef HAVE_USER_FROM_UID
/*
* uidtb_start
* creates an an empty uidtb
}
return 0;
}
+#endif
+#ifndef HAVE_GROUP_FROM_GID
/*
* gidtb_start
* creates an an empty gidtb
}
return 0;
}
+#endif
/*
* usrtb_start
return 0;
}
+#ifndef HAVE_USER_FROM_UID
/*
* user_from_uid()
* caches the name (if any) for the uid. If noname clear, we always
}
return ptr->name;
}
+#endif
+#ifndef HAVE_GROUP_FROM_GID
/*
* group_from_gid()
* caches the name (if any) for the gid. If noname clear, we always
}
return ptr->name;
}
+#endif
/*
* uid_from_user()
humanize \
fgetln \
fparseln \
- fpurge \
- md5 \
- nlist \
proctitle-init \
progname \
- pwcache \
setmode \
- strl \
- strmode \
strnstr \
strtonum \
vis \
vis-openbsd \
# EOL
+if NEED_NLIST
+check_PROGRAMS += nlist
+endif
+
+if NEED_STRL
+check_PROGRAMS += strl
+endif
+
+if NEED_STRMODE
+check_PROGRAMS += strmode
+endif
+
+if NEED_PWCACHE
+check_PROGRAMS += pwcache
+endif
+
+if NEED_FPURGE
+check_PROGRAMS += fpurge
+endif
+
if NEED_FUNOPEN
check_PROGRAMS += funopen
endif
+if NEED_ARC4RANDOM
if HAVE_LIBTESTU01
arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
check_PROGRAMS += arc4random
endif
+endif
if BUILD_LIBBSD_CTOR
proctitle_LDFLAGS = \
check_PROGRAMS += proctitle
endif
+if NEED_MD5
+check_PROGRAMS += md5
+
if NEED_TRANSPARENT_LIBMD
# On the installed system this is handled via the ld script.
md5_LDADD = $(LDADD) $(MD5_LIBS)
endif
+endif
fgetln_SOURCES = test-stream.c test-stream.h fgetln.c
fgetln_CFLAGS = -Wno-deprecated-declarations
* other headers through magic macros, to check that the overlay is working
* properly. */
#include <errno.h>
+#ifndef __APPLE__
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
+#endif
#include <stdint.h>
/* Include libbsd overlayed headers that might get partially included. */