netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] Use libbsd for strlcpy if available
@ 2018-10-29 10:46 Luca Boccassi
  2018-10-29 15:27 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Luca Boccassi @ 2018-10-29 10:46 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern

If libc does not provide strlcpy check for libbsd with pkg-config to
avoid relying on inline version.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
This allows distro maintainers to be able to choose to reduce
duplication and let this code be maintained in one place, in the
external library.

 configure | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 744d6282..1dd9ce84 100755
--- a/configure
+++ b/configure
@@ -330,8 +330,16 @@ EOF
     then
 	echo "no"
     else
-	echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
-	echo "yes"
+	if ${PKG_CONFIG} libbsd --exists
+	then
+		echo 'CFLAGS += -include' `${PKG_CONFIG} libbsd --variable=includedir`'/bsd/string.h' \
+			`${PKG_CONFIG} libbsd --cflags` >>$CONFIG
+		echo 'LDLIBS +=' `${PKG_CONFIG} libbsd --libs` >> $CONFIG
+		echo "no"
+	else
+		echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
+		echo "yes"
+	fi
     fi
     rm -f $TMPDIR/strtest.c $TMPDIR/strtest
 }
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-01  2:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-29 10:46 [PATCH iproute2] Use libbsd for strlcpy if available Luca Boccassi
2018-10-29 15:27 ` David Ahern
2018-10-29 15:37   ` Luca Boccassi
2018-10-31 15:09 ` Stephen Hemminger
2018-10-31 17:54   ` Luca Boccassi
2018-10-31 18:00 ` [PATCH iproute2 v2] " Luca Boccassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).