]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - aclocal/libtirpc.m4
mountd: cache.c no longer needs #include xmalloc.h
[nfs-utils.git] / aclocal / libtirpc.m4
index 67c40120cf35df1f46601b00d2e44c85b8837078..19b8361794854d0b616db61891e68aa1074cc7d3 100644 (file)
@@ -2,24 +2,50 @@ dnl Checks for TI-RPC library and headers
 dnl
 AC_DEFUN([AC_LIBTIRPC], [
 
 dnl
 AC_DEFUN([AC_LIBTIRPC], [
 
+  AC_ARG_WITH([tirpcinclude],
+              [AC_HELP_STRING([--with-tirpcinclude=DIR],
+                              [use TI-RPC headers in DIR])],
+              [tirpc_header_dir=$withval],
+              [tirpc_header_dir=/usr/include/tirpc])
+
   dnl if --enable-tirpc was specifed, the following components
   dnl must be present, and we set up HAVE_ macros for them.
 
   dnl if --enable-tirpc was specifed, the following components
   dnl must be present, and we set up HAVE_ macros for them.
 
-  if test "$enable_tirpc" = yes; then
+  if test "$enable_tirpc" != "no"; then
 
 
-    dnl look for the library; add to LIBS if found
-    AC_CHECK_LIB([tirpc], [clnt_tli_create], ,
-                 [AC_MSG_ERROR([libtirpc not found.])])
+    dnl look for the library
+    AC_CHECK_LIB([tirpc], [clnt_tli_create], [:],
+                 [if test "$enable_tirpc" = "yes"; then
+                       AC_MSG_ERROR([libtirpc not found.])
+                 else
+                       AC_MSG_WARN([libtirpc not found. TIRPC disabled!])
+                       enable_tirpc="no"
+                 fi])
+  fi
 
 
+  if test "$enable_tirpc" != "no"; then
     dnl also must have the headers installed where we expect
     dnl also must have the headers installed where we expect
-    AC_CHECK_HEADERS([tirpc/netconfig.h], ,
-                     [AC_MSG_ERROR([libtirpc headers not found.])])
+    dnl look for headers; add -I compiler option if found
+    AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h],
+                     AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"]),
+                     [if test "$enable_tirpc" = "yes"; then
+                        AC_MSG_ERROR([libtirpc headers not found.])
+                      else
+                        AC_MSG_WARN([libtirpc headers not found. TIRPC disabled!])
+                        enable_tirpc="no"
+                      fi])
 
 
-    dnl set up HAVE_FOO for various functions
-    AC_CHECK_FUNCS([getnetconfig \
-                    clnt_create clnt_create_timed \
-                    clnt_vc_create clnt_dg_create xdr_rpcb])
+  fi
 
 
+  dnl now set $LIBTIRPC accordingly
+  if test "$enable_tirpc" != "no"; then
+    AC_DEFINE([HAVE_LIBTIRPC], 1,
+              [Define to 1 if you have and wish to use libtirpc.])
+    LIBTIRPC="-ltirpc"
+  else
+    LIBTIRPC=""
   fi
 
   fi
 
+  AC_SUBST(LIBTIRPC)
+
 ])dnl
 ])dnl