virt-xdr.m4 1 KB
Newer Older
1 2
AC_DEFUN([LIBVIRT_SANDBOX_XDR], [
    old_LIBS="$LIBS"
3
    XDR_LIBS=
4
    AC_SEARCH_LIBS([xdrmem_create], [portablexdr rpc xdr nsl tirpc], [
5 6 7 8
      if test "$ac_cv_search_xdrmem_create" != "none required"
      then
          XDR_LIBS="$ac_cv_search_xdrmem_create"
      fi
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    ],[
      AC_MSG_ERROR([Cannot find a XDR library])
    ])
    LIBS="$old_LIBS"

    AC_CACHE_CHECK([where to find <rpc/rpc.h>], [lv_cv_xdr_cflags], [
      for add_CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do
        if test x"$add_CFLAGS" = xmissing; then
          lv_cv_xdr_cflags=missing; break
        fi
        CFLAGS="$old_CFLAGS $add_CFLAGS"
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rpc/rpc.h>
        ]])], [lv_cv_xdr_cflags=${add_CFLAGS:-none}; break])
      done
    ])
    CFLAGS=$old_CFLAGS
    case $lv_cv_xdr_cflags in
      none) XDR_CFLAGS= ;;
      missing) AC_MSG_ERROR([Unable to find <rpc/rpc.h>]) ;;
      *) XDR_CFLAGS=$lv_cv_xdr_cflags ;;
    esac

    AC_SUBST([XDR_LIBS])
    AC_SUBST([XDR_CFLAGS])
])