42 lines
1.2 KiB
Diff
42 lines
1.2 KiB
Diff
From b4eba9a0259abb4a9c2337c77758072130e1b6ff Mon Sep 17 00:00:00 2001
|
|
From: "Robin H. Johnson" <robbat2@gentoo.org>
|
|
Date: Thu, 2 Jan 2025 17:26:51 -0800
|
|
Subject: [PATCH] feat: allow libc strlcpy
|
|
|
|
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
|
|
Fixes: https://github.com/radvd-project/radvd/issues/248
|
|
---
|
|
configure.ac | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index a0b2804..d6f7287 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -93,8 +93,23 @@ AC_MSG_RESULT(no)
|
|
|
|
dnl clock_gettime is in librt for glibc <2.17
|
|
AC_SEARCH_LIBS(clock_gettime, rt)
|
|
-dnl strlcpy is in libbsd
|
|
-AC_SEARCH_LIBS(strlcpy, bsd)
|
|
+
|
|
+AC_CHECK_FUNC(strlcpy, found_strlcpy=yes, found_strlcpy=no)
|
|
+if test "x$found_strlcpy" = xno; then
|
|
+ dnl check libbsd for strlcpy
|
|
+ PKG_CHECK_MODULES([BSD], [libbsd >= 0])
|
|
+ AC_SEARCH_LIBS(strlcpy, bsd,
|
|
+ [
|
|
+ found_bsd_strlcpy=yes
|
|
+ CFLAGS="$BSD_CFLAGS $CFLAGS"
|
|
+ LIBS="$BSD_LIBS $LIBS"
|
|
+ ],
|
|
+ found_bsd_strlcpy=no)
|
|
+fi
|
|
+
|
|
+if test "x$found_strlcpy" = xno && test "x$found_bsd_strlcpy" = xno; then
|
|
+ AC_MSG_ERROR(cannot find strlcpy - upgrade your libc or install libbsd)
|
|
+fi
|
|
|
|
dnl Needed for normal compile
|
|
AC_PROG_INSTALL
|