[Openvpn-devel] Fix building with --enable-async-push in FreeBSD

Message ID 20200312020135.20510-1-lstipakov@gmail.com
State Superseded
Headers show
Series [Openvpn-devel] Fix building with --enable-async-push in FreeBSD | expand

Commit Message

Lev Stipakov March 11, 2020, 3:01 p.m. UTC
This option can be used in FreedBSD with devel/libinotify
installed, however it requires linkage with -linotify.

Trac #1256

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
---
 configure.ac            | 4 ++++
 src/openvpn/Makefile.am | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Patch

diff --git a/configure.ac b/configure.ac
index a47ef3e7..d3a4158a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1344,6 +1344,9 @@  if test "${enable_async_push}" = "yes"; then
 		AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push]),
 		AC_MSG_ERROR([inotify.h not found.])
 	)
+	case "$host" in
+		*-*-freebsd*) OPTIONAL_INOTIFY_LIBS="-linotify";;
+	esac
 fi
 
 CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
@@ -1370,6 +1373,7 @@  AC_SUBST([OPTIONAL_LZ4_LIBS])
 AC_SUBST([OPTIONAL_SYSTEMD_LIBS])
 AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
 AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
+AC_SUBST([OPTIONAL_INOTIFY_LIBS])
 
 AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS])
 AC_SUBST([PLUGIN_AUTH_PAM_LIBS])
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 2ea47cda..b924014d 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -137,7 +137,8 @@  openvpn_LDADD = \
 	$(OPTIONAL_CRYPTO_LIBS) \
 	$(OPTIONAL_SELINUX_LIBS) \
 	$(OPTIONAL_SYSTEMD_LIBS) \
-	$(OPTIONAL_DL_LIBS)
+	$(OPTIONAL_DL_LIBS) \
+	$(OPTIONAL_INOTIFY_LIBS)
 if WIN32
 openvpn_SOURCES += openvpn_win32_resources.rc block_dns.c block_dns.h ring_buffer.c ring_buffer.h
 openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4 -lncrypt -lsetupapi