summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-08-22 02:07:14 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-08-22 02:07:14 +0200
commit3b378a6535bc8d9942875ba094301274819905e4 (patch)
treef6d9cf51c64f56c1b12dd7fb99ca7ba38b79e53c
parentcd10e825fe4b5458c0deaa300449e0cd872570ef (diff)
nfs/nfsd: Use libtirpc
Sun RPC is being phased out from glibc. * configure.ac: Detect libtirpc.pc, subst libtirpc_CFLAGS and libtirpc_LIBS. * config.make.in: Subst libtirpc_CFLAGS and libtirpc_LIBS. * nfs/Makefile, nfsd/Makefile: Include libtirpc_CFLAGS and libtirpc_LIBS * nfs/mount.c: Include <rpc/xdr.h> * nfsd/main.c: Likewise. * nfsd/ops.c: Likewise. * nfsd/cache.c: Undef TRUE/FALSE after including rpc/ headers. * nfsd/loop.c: Likewise.
-rw-r--r--config.make.in4
-rw-r--r--configure.ac5
-rw-r--r--nfs/Makefile3
-rw-r--r--nfs/mount.c1
-rw-r--r--nfsd/Makefile3
-rw-r--r--nfsd/cache.c4
-rw-r--r--nfsd/loop.c8
-rw-r--r--nfsd/main.c1
-rw-r--r--nfsd/ops.c1
9 files changed, 22 insertions, 8 deletions
diff --git a/config.make.in b/config.make.in
index 349fca87..e4f856f2 100644
--- a/config.make.in
+++ b/config.make.in
@@ -93,6 +93,10 @@ libblkid_LIBS = @libblkid_LIBS@
# Whether Sun RPC support is available.
HAVE_SUN_RPC = @HAVE_SUN_RPC@
+# How to compile and link against libtirpc.
+libtirpc_CFLAGS = @libtirpc_CFLAGS@
+libtirpc_LIBS = @libtirpc_LIBS@
+
# Whether we found libcrypt.
HAVE_LIBCRYPT = @HAVE_LIBCRYPT@
diff --git a/configure.ac b/configure.ac
index 182548f2..63ba7c1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -317,9 +317,10 @@ AC_DEFINE_UNQUOTED([X11_PREFIX], "$X11_PREFIX")
AC_SUBST([X11_KEYSYMDEF_H])
# Check for Sun RPC headers and library.
-AC_CHECK_HEADER([rpc/types.h], [HAVE_SUN_RPC=yes], [HAVE_SUN_RPC=no])
-AC_SEARCH_LIBS([clnt_create], [], [:], [HAVE_SUN_RPC=no])
+PKG_CHECK_MODULES([libtirpc], [libtirpc], [HAVE_SUN_RPC=yes])
AC_SUBST([HAVE_SUN_RPC])
+AC_SUBST([libtirpc_CFLAGS])
+AC_SUBST([libtirpc_LIBS])
if test -f ./$ac_unique_file; then
# Configuring in source directory; don't create any Makefiles.
diff --git a/nfs/Makefile b/nfs/Makefile
index 265d0273..32cf4f53 100644
--- a/nfs/Makefile
+++ b/nfs/Makefile
@@ -30,3 +30,6 @@ HURDLIBS = netfs fshelp iohelp ports ihash shouldbeinlibc
LDLIBS = -lpthread
include ../Makeconf
+
+CFLAGS += $(libtirpc_CFLAGS)
+LDLIBS += $(libtirpc_LIBS)
diff --git a/nfs/mount.c b/nfs/mount.c
index 29b203aa..f8318c27 100644
--- a/nfs/mount.c
+++ b/nfs/mount.c
@@ -20,6 +20,7 @@
#define malloc a_byte_for_every_bozotic_sun_lossage_and_youd_need_a_lotta_ram
#include <rpc/types.h>
+#include <rpc/xdr.h>
#undef TRUE /* Get rid of sun defs. */
#undef FALSE
#undef malloc
diff --git a/nfsd/Makefile b/nfsd/Makefile
index 5dc9a4da..ef75db03 100644
--- a/nfsd/Makefile
+++ b/nfsd/Makefile
@@ -30,3 +30,6 @@ LDLIBS = -lpthread
include ../Makeconf
CPPFLAGS += -DLOCALSTATEDIR=\"$(localstatedir)\"
+
+CFLAGS += $(libtirpc_CFLAGS)
+LDLIBS += $(libtirpc_LIBS)
diff --git a/nfsd/cache.c b/nfsd/cache.c
index 45234d89..d3ee7659 100644
--- a/nfsd/cache.c
+++ b/nfsd/cache.c
@@ -32,11 +32,11 @@
#include "nfsd.h"
-#undef TRUE
-#undef FALSE
#define malloc spoogie_woogie /* ugh^2. */
#include <rpc/types.h>
#include <rpc/auth.h>
+#undef TRUE
+#undef FALSE
#undef malloc
#define IDHASH_TABLE_SIZE 1024
diff --git a/nfsd/loop.c b/nfsd/loop.c
index f2d6d546..d94c5d10 100644
--- a/nfsd/loop.c
+++ b/nfsd/loop.c
@@ -23,14 +23,14 @@
#include "nfsd.h"
-#include <rpc/pmap_prot.h>
#include "../nfs/mount.h"
-#undef TRUE
-#undef FALSE
#define malloc spoogie_woogie /* barf */
-#include <rpc/xdr.h>
#include <rpc/types.h>
+#include <rpc/xdr.h>
+#undef TRUE
+#undef FALSE
+#include <rpc/pmap_prot.h>
#include <rpc/auth.h>
#include <rpc/rpc_msg.h>
#undef malloc
diff --git a/nfsd/main.c b/nfsd/main.c
index ee14e240..3f1fa9a5 100644
--- a/nfsd/main.c
+++ b/nfsd/main.c
@@ -21,6 +21,7 @@
#include "nfsd.h"
#include <stdio.h>
#include <unistd.h>
+#include <rpc/xdr.h>
#include <rpc/pmap_prot.h>
#include <maptime.h>
#include <hurd.h>
diff --git a/nfsd/ops.c b/nfsd/ops.c
index 4be45fb2..463a9c87 100644
--- a/nfsd/ops.c
+++ b/nfsd/ops.c
@@ -31,6 +31,7 @@
#include "nfsd.h"
#include "../nfs/mount.h" /* XXX */
+#include <rpc/xdr.h>
#include <rpc/pmap_prot.h>
static error_t