xref: /freebsd/sys/contrib/openzfs/config/user-libtirpc.m4 (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
1dnl #
2dnl # Check for libtirpc - may be needed for xdr functionality
3dnl #
4AC_DEFUN([ZFS_AC_CONFIG_USER_LIBTIRPC], [
5	AC_ARG_WITH([tirpc],
6	    [AS_HELP_STRING([--with-tirpc],
7		[use tirpc for xdr encoding @<:@default=check@:>@])],
8	    [],
9	    [with_tirpc=check])
10
11	have_xdr=
12
13        AS_IF([test "x$with_tirpc" != "xyes"], [
14	    AC_SEARCH_LIBS([xdrmem_create], [], [have_xdr=1], [
15		AS_IF([test "x$with_tirpc" = "xno"], [
16		    AC_MSG_FAILURE([xdrmem_create() requires sunrpc support in libc if not using libtirpc])
17		])
18	    ])
19        ])
20
21	AS_IF([test "x$have_xdr" = "x"], [
22            ZFS_AC_FIND_SYSTEM_LIBRARY(LIBTIRPC, [libtirpc], [rpc/xdr.h], [tirpc], [tirpc], [xdrmem_create], [], [
23		AS_IF([test "x$with_tirpc" = "xyes"], [
24		    AC_MSG_FAILURE([--with-tirpc was given, but libtirpc is not available, try installing libtirpc-devel])
25		],[dnl ELSE
26		    AC_MSG_FAILURE([neither libc sunrpc support nor libtirpc is available, try installing libtirpc-devel])
27		])
28	    ])
29	])
30])
31