freebsd-dev/config/user-libtirpc.m4
Brian Behlendorf 1ab3678b5d Add support for libtirpc
While OpenSolaris libc and glibc both include XDR support, the musl libc
does not in favor of depending on the BSD-licensed libtirpc library.

Adding support is a simple matter of detecting the library, including
the headers and linking against it.  By default libtirpc will be checked
for and if available used.  Otherwise, configure will fall back to using
the xdr implementation provided by libc if available.  The options
--with-tirpc/--without-tirpc can be used to disable this checking.

In addition, the xdr_control() function has been simplied to only
handle ZFSs specific use case.

Original-patch-by: stf <s@ctrlc.hu>
Original-patch-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Signed-off-by: Carlo Landmeter <clandmeter@gmail.com>
Closes #2254
Closes #4559
2016-04-28 09:27:40 -07:00

31 lines
910 B
Plaintext

dnl #
dnl # Check for libtirpc - may be needed for xdr functionality
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBTIRPC], [
AC_ARG_WITH([tirpc],
[AS_HELP_STRING([--with-tirpc],
[use tirpc for xdr encoding @<:@default=check@:>@])],
[],
[with_tirpc=check])
LIBTIRPC=
LIBTIRPC_CFLAGS=
AS_IF([test "x$with_tirpc" != xno],
[AC_CHECK_LIB([tirpc], [xdrmem_create],
[AC_SUBST([LIBTIRPC], [-ltirpc])
AC_SUBST([LIBTIRPC_CFLAGS], [-I/usr/include/tirpc])
AC_DEFINE([HAVE_LIBTIRPC], [1], [Define if you have libtirpc])
],
[if test "x$with_tirpc" != xcheck; then
AC_MSG_FAILURE(
[--with-tirpc was given, but test for tirpc failed])
fi
AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [
AC_MSG_FAILURE([xdrmem_create() requires tirpc or libc])])
])],
[AC_SEARCH_LIBS([xdrmem_create], [tirpc], [], [
AC_MSG_FAILURE([xdrmem_create() requires libc])])
])
])