]> git.decadent.org.uk Git - nfs-utils.git/blob - aclocal/libtirpc.m4
Imported upstream 1.2.8
[nfs-utils.git] / aclocal / libtirpc.m4
1 dnl Checks for TI-RPC library and headers
2 dnl
3 AC_DEFUN([AC_LIBTIRPC], [
4
5   AC_ARG_WITH([tirpcinclude],
6               [AC_HELP_STRING([--with-tirpcinclude=DIR],
7                               [use TI-RPC headers in DIR])],
8               [tirpc_header_dir=$withval],
9               [tirpc_header_dir=/usr/include/tirpc])
10
11   dnl if --enable-tirpc was specifed, the following components
12   dnl must be present, and we set up HAVE_ macros for them.
13
14   if test "$enable_tirpc" != "no"; then
15
16     dnl look for the library
17     AC_CHECK_LIB([tirpc], [clnt_tli_create], [:],
18                  [if test "$enable_tirpc" = "yes"; then
19                         AC_MSG_ERROR([libtirpc not found.])
20                   else
21                         AC_MSG_WARN([libtirpc not found. TIRPC disabled!])
22                         enable_tirpc="no"
23                   fi])
24   fi
25
26   if test "$enable_tirpc" != "no"; then
27
28     dnl Check if library contains authgss_free_private_data
29     AC_CHECK_LIB([tirpc], [authgss_free_private_data], [have_free_private_data=yes],
30                         [have_free_private_data=no])
31   fi
32
33   if test "$enable_tirpc" != "no"; then
34     dnl also must have the headers installed where we expect
35     dnl look for headers; add -I compiler option if found
36     AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h],
37                       AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"]),
38                       [if test "$enable_tirpc" = "yes"; then
39                          AC_MSG_ERROR([libtirpc headers not found.])
40                        else
41                          AC_MSG_WARN([libtirpc headers not found. TIRPC disabled!])
42                          enable_tirpc="no"
43                        fi])
44
45   fi
46
47   dnl now set $LIBTIRPC accordingly
48   if test "$enable_tirpc" != "no"; then
49     AC_DEFINE([HAVE_LIBTIRPC], 1,
50               [Define to 1 if you have and wish to use libtirpc.])
51     LIBTIRPC="-ltirpc"
52     if test "$have_free_private_data" = "yes"; then
53       AC_DEFINE([HAVE_AUTHGSS_FREE_PRIVATE_DATA], 1,
54               [Define to 1 if your rpcsec library provides authgss_free_private_data,])
55     fi
56   else
57     LIBTIRPC=""
58   fi
59
60   AC_SUBST(LIBTIRPC)
61
62 ])dnl