  #include <sys/types.h>
  #include <stdint.h>
 diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h
-index 4b69983..8e2ac75 100644
+index 4b69983..c75151b 100644
 --- a/include/bsd/stdio.h
 +++ b/include/bsd/stdio.h
 @@ -48,12 +48,16 @@

diff --git a/configure.ac b/configure.ac
index c909878..60c540e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AS_CASE([$host_os],

 /* XXX: The function requires cooperation from the system libc to store the
  * line buffer in the FILE struct itself. */
 char *fgetln(FILE *fp, size_t *lenp)
-	LIBBSD_DEPRECATED("This functions cannot be safely ported, "
-	                  "use getline(3) instead, as it is supported "
-	                  "by GNU and POSIX.1-2008.");
+	__attribute__((deprecated("This functions cannot be safely ported, "
+	                          "use getline(3) instead, as it is supported "
+	                          "by GNU and POSIX.1-2008.")));
+#else
+char *fgetln(FILE *fp, size_t *lenp);
+#endif
 
 /*
  * Note: We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,
diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
index ebc9638..6cd7943 100644
--- a/include/bsd/stdlib.h
+++ b/include/bsd/stdlib.h
@@ -67,9 +67,11 @@ int sradixsort(const unsigned char **base, int nmemb,
                const unsigned char *table, unsigned endbyte);
 
 void *reallocf(void *ptr, size_t size);
-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26)
+#if defined(_GNU_SOURCE) && defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+#if !__GLIBC_PREREQ(2, 26)
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #endif
+#endif
 
 long long strtonum(const char *nptr, long long minval, long long maxval,
                    const char **errstr);
diff --git a/include/bsd/string.h b/include/bsd/string.h
index 6798bf6..6baaa14 100644
--- a/include/bsd/string.h
+++ b/include/bsd/string.h
@@ -37,6 +37,12 @@
 #include <sys/types.h>
 
 __BEGIN_DECLS
+#if defined(darwin) || defined(__APPLE__) || defined(MACOSX)
+size_t bsd_strlcpy(char *dst, const char *src, size_t siz);
+size_t bsd_strlcat(char *dst, const char *src, size_t siz);
+char *bsd_strnstr(const char *str, const char *find, size_t str_len);
+void bsd_strmode(mode_t mode, char *str);
+#else
 size_t strlcpy(char *dst, const char *src, size_t siz);
 size_t strlcat(char *dst, const char *src, size_t siz);
 char *strnstr(const char *str, const char *find, size_t str_len);
@@ -45,6 +51,7 @@ void strmode(mode_t mode, char *str);
 #if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25)
 void explicit_bzero(void *buf, size_t len);
 #endif
+#endif
 __END_DECLS
 
 #endif
diff --git a/src/Makefile.am b/src/Makefile.am
index ad83dbf..0f2a7ee 100644
--- a/src/Makefile.am
