mirror_zfs/config/user-libtirpc.m4
Arvind Sankar f040a7b0f8 Fix up FIND_SYSTEM_LIBRARY to work with cross-compiling
Make FIND_SYSTEM_LIBRARY respect a configured sysroot, otherwise it
might find headers from the build machine and assume the library is
available on the host/target.

Tighten up error checking: if pkg-config or the user specified _CFLAGS
or _LIBS but we can't find the header/library, issue a fatal error.

Fix the -L flag to /usr/local/lib instead of just /usr/local.

Clean out the _CFLAGS and _LIBS if we located something that we later
find doesn't work.

Rename FIND_SYSTEM_LIBRARY into the ZFS_AC_ scope.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10538
2020-07-10 14:26:40 -07:00

31 lines
990 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])
have_xdr=
AS_IF([test "x$with_tirpc" != "xyes"], [
AC_SEARCH_LIBS([xdrmem_create], [], [have_xdr=1], [
AS_IF([test "x$with_tirpc" = "xno"], [
AC_MSG_FAILURE([xdrmem_create() requires sunrpc support in libc if not using libtirpc])
])
])
])
AS_IF([test "x$have_xdr" = "x"], [
ZFS_AC_FIND_SYSTEM_LIBRARY(LIBTIRPC, [libtirpc], [rpc/xdr.h], [tirpc], [tirpc], [xdrmem_create], [], [
AS_IF([test "x$with_tirpc" = "xyes"], [
AC_MSG_FAILURE([--with-tirpc was given, but libtirpc is not available, try installing libtirpc-devel])
],[dnl ELSE
AC_MSG_FAILURE([neither libc sunrpc support nor libtirpc is available, try installing libtirpc-devel])
])
])
])
])