watchdog/0010-Choose-libtirpc-or-ano...

58 lines
1.8 KiB
Diff

From 93f5334052cf14ae1149aa0f0b3178137eec01dd Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 6 Feb 2019 13:25:47 +0000
Subject: [PATCH 10/10] Choose libtirpc or another RPC library for XDR headers
and library.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
configure.ac | 20 ++++++++++++++++++++
src/Makefile.am | 2 ++
2 files changed, 22 insertions(+)
diff --git a/configure.ac b/configure.ac
index f100829..4220411 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,4 +156,24 @@ AC_ARG_WITH(randomseed,
AC_MSG_RESULT("/var/run/random-seed")
])
+# Check for an RPC library, starting with libtirpc.
+PKG_CHECK_MODULES([RPC], [libtirpc], [], [
+ # If we don't have libtirpc, then we must have <rpc/rpc.h> and
+ # some library to link to in libdir.
+ RPC_CFLAGS=""
+ AC_CHECK_HEADER([rpc/rpc.h],[],[
+ AC_MSG_ERROR([XDR header files are required])
+ ],
+ [#include <rpc/types.h>])
+
+ old_LIBS="$LIBS"
+ LIBS=""
+ AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl])
+ RPC_LIBS="$LIBS"
+ LIBS="$old_LIBS"
+
+ AC_SUBST([RPC_CFLAGS])
+ AC_SUBST([RPC_LIBS])
+])
+
AC_OUTPUT([Makefile src/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
index 4ecfd97..7f63be5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,8 @@ watchdog_SOURCES = file_stat.c file_table.c fstab.c iface.c ifdown.c keep_alive.
temp.c test_binary.c umount.c version.c watchdog.c \
logmessage.c xmalloc.c heartbeat.c lock_mem.c daemon-pid.c configfile.c \
errorcodes.c read-conf.c sigterm.c
+watchdog_CFLAGS = $(RPC_CFLAGS)
+watchdog_LDADD = $(RPC_LIBS)
wd_keepalive_SOURCES = wd_keepalive.c logmessage.c lock_mem.c daemon-pid.c xmalloc.c \
configfile.c keep_alive.c read-conf.c sigterm.c
--
2.20.1