summaryrefslogtreecommitdiffstats
path: root/aclocal/libtirpc.m4
blob: 19b8361794854d0b616db61891e68aa1074cc7d3 (plain)
1
2
3
4
5
6
7
8
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
dnl Checks for TI-RPC library and headers
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.

  if test "$enable_tirpc" != "no"; then

    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 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])

  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

  AC_SUBST(LIBTIRPC)

])dnl