build: Conditionalize wcslcpy() and wcslcat() functions on macOS These functions are provided by the system libc.
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
diff --git a/configure.ac b/configure.ac
index 9b2c277..aabe28e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,6 +324,7 @@ need_progname=yes
need_md5=yes
need_nlist=yes
need_strl=yes
+need_wcsl=yes
need_strmode=yes
need_id_from_name=yes
need_fpurge=yes
@@ -354,6 +355,7 @@ AS_CASE([$host_os],
need_md5=no
need_nlist=no
need_strl=no
+ need_wcsl=no
need_strmode=no
need_id_from_name=no
need_fpurge=no
@@ -371,6 +373,7 @@ AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xye
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_ID_FROM_NAME], [test "x$need_id_from_name" = "xyes"])
AM_CONDITIONAL([NEED_FPURGE], [test "x$need_fpurge" = "xyes"])
diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h
index 7216503..8edef23 100644
--- a/include/bsd/wchar.h
+++ b/include/bsd/wchar.h
@@ -50,8 +50,10 @@
__BEGIN_DECLS
wchar_t *fgetwln(FILE *stream, size_t *len);
+#if !defined(__APPLE__)
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
+#endif
__END_DECLS
#endif
diff --git a/man/Makefile.am b/man/Makefile.am
index 118ab2d..b89c3dd 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -238,8 +238,6 @@ dist_man_MANS = \
unvis.3bsd \
user_from_uid.3bsd \
vis.3bsd \
- wcslcat.3bsd \
- wcslcpy.3bsd \
# EOL
if NEED_PROGNAME
@@ -268,6 +266,13 @@ dist_man_MANS += \
# EOL
endif
+if NEED_WCSL
+dist_man_MANS += \
+ wcslcat.3bsd \
+ wcslcpy.3bsd \
+ # EOL
+endif
+
if NEED_STRMODE
dist_man_MANS += \
strmode.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index 0648b03..fd4bee9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -112,8 +112,6 @@ libbsd_la_SOURCES = \
timeconv.c \
unvis.c \
vis.c \
- wcslcat.c \
- wcslcpy.c \
# EOL
if NEED_BSD_GETOPT
@@ -158,6 +156,13 @@ libbsd_la_SOURCES += \
# EOL
endif
+if NEED_WCSL
+libbsd_la_SOURCES += \
+ wcslcat.c \
+ wcslcpy.c \
+ # EOL
+endif
+
if NEED_STRMODE
libbsd_la_SOURCES += \
strmode.c \