Commit Diff


commit - 7eaf997f527107beac3379da6b814ac7b783ebc0
commit + 86ce72dbe36b318515c45babe875842d0005109f
blob - ea03666a0ed569fc992b5d10526381f43a9bf5bf
blob + e2b2e707b1a3c8e811b63d6bea3bddc5802096b3
--- README.md
+++ README.md
@@ -86,6 +86,7 @@ To build from a release tarball just execute:
 The configure script has optional support for building with libraries
 provided by your distribution instead of internal compatibility funcs:
 
+ - `--with-libbsd`: link with [libbsd](https://libbsd.freedesktop.org)
  - `--with-libimsg`: link with the
    [imsg-compat](https://github.com/bsd-ac/imsg-compat) library
 
blob - dd2c97f2053529099aeed212f71d8b28769559db
blob + 65e3dc53a1767771219a79bf017f40c3ff13bb40
--- configure.ac
+++ configure.ac
@@ -12,6 +12,17 @@ AC_ARG_WITH([libimsg],
 	AS_HELP_STRING([--with-libimsg],
 		[Build with imsg-compat library (default: disabled)]))
 
+AC_ARG_WITH([libbsd],
+	AS_HELP_STRING([--with-libbsd],
+		[Build with libbsd library (default: disabled)]))
+
+AS_IF([test "x$with_libbsd" = "xyes"], [
+	PKG_CHECK_MODULES([libbsd], [libbsd-overlay libbsd-ctor], [
+		CFLAGS="$libbsd_CFLAGS $CFLAGS"
+		LIBS="$libbsd_LIBS $LIBS"
+	])
+])
+
 AC_REPLACE_FUNCS([
 	asprintf \
 	err \