Skip to content

Commit

Permalink
Merge pull request #256 from radvd-project/robbat2/20250102-strlcpy
Browse files Browse the repository at this point in the history
feat: allow libc strlcpy
  • Loading branch information
robbat2 authored Jan 17, 2025
2 parents 70ec538 + b4eba9a commit ea2fd30
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea2fd30

Please sign in to comment.