tirpc: use pkg-config to find details
[deb_libnfs.git] / configure.ac
CommitLineData
84004dbf 1AC_PREREQ(2.50)
5a1f1454 2AC_INIT([libnfs], [1.0.0], [ronniesahlberg@gmail.com])
6c437065
TN
3AC_CONFIG_HEADERS([config.h])
4AM_INIT_AUTOMAKE([foreign])
5AC_CANONICAL_HOST
84004dbf 6
6c437065
TN
7# Work around stupid autoconf default cflags. pt 1
8SAVE_CFLAGS="x${CFLAGS}"
84004dbf 9
6c437065
TN
10AC_PROG_CC
11AC_PROG_LIBTOOL
84004dbf 12
6c437065 13AM_PROG_CC_C_O
6a14f02f 14PKG_PROG_PKG_CONFIG
84004dbf 15
6c437065
TN
16# Work around stupid autoconf default cflags. pt 2
17if test "$SAVE_CFLAGS" = "x"; then
18 CFLAGS=""
84004dbf 19fi
e644e700 20
6c437065
TN
21AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no])
22if test x$HAVE_RPCGEN != xyes; then
23 AC_MSG_ERROR([Can not find required program])
d20a6d6b
SR
24fi
25
6c437065
TN
26#option: examples
27AC_ARG_ENABLE([examples],
28 [AC_HELP_STRING([--enable-examples],
29 [Build example programs])],
30 [ENABLE_EXAMPLES=$enableval],
31 [ENABLE_EXAMPLES="no"])
13283beb
TN
32
33if test x$ENABLE_EXAMPLES = xyes; then
34 MAYBE_EXAMPLES="examples"
35fi
6c437065
TN
36AC_SUBST(MAYBE_EXAMPLES)
37
fc4bdc22
RS
38AC_ARG_ENABLE(tirpc,
39 [AC_HELP_STRING([--enable-tirpc],
40 [enable use of TI-RPC @<:@default=no@:>@])],
41 enable_tirpc=$enableval,
42 enable_tirpc='no')
43
fc01d2a9
TN
44case $host in
45 *darwin*)
46 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
47 ;;
2b50be4e
RS
48 *cygwin*)
49 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
50 ;;
fc01d2a9
TN
51 *solaris*)
52 AC_CHECK_HEADERS([sys/filio.h])
647d2ea1 53 AC_CHECK_HEADERS([sys/sockio.h])
4a75cfa2
TN
54 if test x$ENABLE_EXAMPLES = xyes; then
55 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
56 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
57 fi
fc01d2a9
TN
58 ;;
59 *)
60 ;;
61esac
62
63AC_SUBST(RPCGENFLAGS)
64
f7f931c7
RS
65# check for SA_LEN
66dnl Check if sockaddr data structure includes a "sa_len"
67AC_CHECK_MEMBER([struct sockaddr.sa_len],
68 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
69 [],
70 [
71#include <sys/types.h>
72#include <sys/socket.h>
73])
74
6a14f02f
MF
75LIBNFS_PC_REQ_PRIVATE=
76
fc4bdc22 77if test "$enable_tirpc" = "yes"; then
6a14f02f
MF
78 PKG_CHECK_MODULES(TIRPC, libtirpc, [],
79 AC_MSG_ERROR([unable to locate libtirpc files]))
80 CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
81 LIBS="${LIBS} ${TIRPC_LIBS}"
82 LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
fc4bdc22
RS
83fi
84
6a14f02f
MF
85AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
86
6c437065
TN
87#output
88AC_CONFIG_FILES([Makefile]
89 [include/Makefile]
90 [lib/Makefile]
91 [mount/Makefile]
92 [nfs/Makefile]
93 [portmap/Makefile]
94 [rquota/Makefile]
95 [examples/Makefile]
96 )
97
ea545df9 98AC_OUTPUT([libnfs.pc])