AC_DEFUN([AC_LIBNFSIDMAP], [
dnl Check for libnfsidmap, but do not add -lnfsidmap to LIBS
- AC_CHECK_LIB([nfsidmap], [nfs4_init_name_mapping], [libnfsidmap=1],
+ AC_CHECK_LIB([nfsidmap], [nfs4_init_name_mapping], [LIBNFSIDMAP=-lnfsidmap],
[AC_MSG_ERROR([libnfsidmap not found.])])
AC_CHECK_HEADERS([nfsidmap.h], ,
[AC_DEFINE([HAVE_NFS4_SET_DEBUG], 1,
[Define to 1 if you have the `nfs4_set_debug' function.])])
- dnl only enable nfsidmap when libnfsidmap supports it
- AC_CHECK_LIB([nfsidmap], [nfs4_owner_to_uid])
+ dnl nfs4_owner_to_uid() doesn't appear in all versions of libnfsidmap
+ dnl We just need this test to set $ac_cv_lib_nfsidmap_nfs4_owner_to_uid
+ AC_CHECK_LIB([nfsidmap], [nfs4_owner_to_uid], [:])
+
+ AC_SUBST(LIBNFSIDMAP)
])dnl
svcgssd_LDADD = \
../../support/nfs/libnfs.a \
- $(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) -lnfsidmap \
+ $(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) $(LIBNFSIDMAP) \
$(KRBLIBS)
svcgssd_LDFLAGS = $(KRBLDFLAGS)
nfs_idmap.h \
queue.h
-idmapd_LDADD = $(LIBEVENT) -lnfsidmap ../../support/nfs/libnfs.a
+idmapd_LDADD = $(LIBEVENT) $(LIBNFSIDMAP) ../../support/nfs/libnfs.a
MAINTAINERCLEANFILES = Makefile.in
sbin_PROGRAMS = nfsidmap
nfsidmap_SOURCES = nfsidmap.c
-nfsidmap_LDADD = -lnfsidmap -lkeyutils ../../support/nfs/libnfs.a
+nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.a
MAINTAINERCLEANFILES = Makefile.in