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