Remove rpcgen check as it is not needed anymore
[deb_libnfs.git] / configure.ac
CommitLineData
84004dbf 1AC_PREREQ(2.50)
8afcdc95 2AC_INIT([libnfs], [1.5.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
71f48059
RS
21# We always want 64 bit file offsets
22CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
23
6c437065
TN
24#option: examples
25AC_ARG_ENABLE([examples],
26 [AC_HELP_STRING([--enable-examples],
27 [Build example programs])],
28 [ENABLE_EXAMPLES=$enableval],
29 [ENABLE_EXAMPLES="no"])
13283beb 30
d70bb152 31# We need popt to compile the examples
13283beb 32if test x$ENABLE_EXAMPLES = xyes; then
d70bb152
RS
33AC_MSG_CHECKING(whether libpopt is available)
34ac_save_CFLAGS="$CFLAGS"
35ac_save_LIBS="$LIBS"
36CFLAGS="$CFLAGS $GLIB_CFLAGS"
37LIBS="$GLIB_LIBS $LIBS -lpopt"
38AC_TRY_RUN([
39/*
40 * Just see if we can compile/link with popt
41 */
42#include <popt.h>
43
44int main(int argc, const char *argv[])
45{
46 struct poptOption popt_options[] = {
47 POPT_TABLEEND
48 };
49 poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
50
51 return 0;
52}
53], ac_cv_have_popt=yes, ac_cv_have_popt=no,
54 [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
55 ac_cv_have_popt=yes])
56CFLAGS="$ac_save_CFLAGS"
57LIBS="$ac_save_LIBS"
58if test "$ac_cv_have_popt" = yes ; then
59 AC_MSG_RESULT(yes)
13283beb 60 MAYBE_EXAMPLES="examples"
d70bb152
RS
61else
62 AC_MSG_RESULT(no)
63 AC_MSG_NOTICE(You need libpopt to compile the sample libnfs clients.)
64 AC_MSG_NOTICE(Only the library will be compiled and installed.)
65fi
13283beb 66fi
d70bb152 67
6c437065
TN
68AC_SUBST(MAYBE_EXAMPLES)
69
d70bb152 70
fc4bdc22
RS
71AC_ARG_ENABLE(tirpc,
72 [AC_HELP_STRING([--enable-tirpc],
73 [enable use of TI-RPC @<:@default=no@:>@])],
74 enable_tirpc=$enableval,
75 enable_tirpc='no')
76
fc01d2a9
TN
77case $host in
78 *darwin*)
79 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
80 ;;
2b50be4e
RS
81 *cygwin*)
82 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
83 ;;
fc01d2a9
TN
84 *solaris*)
85 AC_CHECK_HEADERS([sys/filio.h])
647d2ea1 86 AC_CHECK_HEADERS([sys/sockio.h])
4a75cfa2
TN
87 if test x$ENABLE_EXAMPLES = xyes; then
88 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
89 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
90 fi
fc01d2a9
TN
91 ;;
92 *)
93 ;;
94esac
95
96AC_SUBST(RPCGENFLAGS)
97
f7f931c7
RS
98# check for SA_LEN
99dnl Check if sockaddr data structure includes a "sa_len"
100AC_CHECK_MEMBER([struct sockaddr.sa_len],
101 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
102 [],
103 [
104#include <sys/types.h>
105#include <sys/socket.h>
106])
107
6a14f02f
MF
108LIBNFS_PC_REQ_PRIVATE=
109
fc4bdc22 110if test "$enable_tirpc" = "yes"; then
6a14f02f
MF
111 PKG_CHECK_MODULES(TIRPC, libtirpc, [],
112 AC_MSG_ERROR([unable to locate libtirpc files]))
113 CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
114 LIBS="${LIBS} ${TIRPC_LIBS}"
115 LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
fc4bdc22
RS
116fi
117
6a14f02f
MF
118AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
119
6c437065
TN
120#output
121AC_CONFIG_FILES([Makefile]
122 [include/Makefile]
123 [lib/Makefile]
124 [mount/Makefile]
125 [nfs/Makefile]
6916a665 126 [nlm/Makefile]
6c437065
TN
127 [portmap/Makefile]
128 [rquota/Makefile]
129 [examples/Makefile]
130 )
131
ea545df9 132AC_OUTPUT([libnfs.pc])