New version 1.2
[deb_libnfs.git] / configure.ac
CommitLineData
84004dbf 1AC_PREREQ(2.50)
345422a2 2AC_INIT([libnfs], [1.2.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
TN
35
36if test x$ENABLE_EXAMPLES = xyes; then
37 MAYBE_EXAMPLES="examples"
38fi
6c437065
TN
39AC_SUBST(MAYBE_EXAMPLES)
40
fc4bdc22
RS
41AC_ARG_ENABLE(tirpc,
42 [AC_HELP_STRING([--enable-tirpc],
43 [enable use of TI-RPC @<:@default=no@:>@])],
44 enable_tirpc=$enableval,
45 enable_tirpc='no')
46
fc01d2a9
TN
47case $host in
48 *darwin*)
49 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
50 ;;
2b50be4e
RS
51 *cygwin*)
52 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
53 ;;
fc01d2a9
TN
54 *solaris*)
55 AC_CHECK_HEADERS([sys/filio.h])
647d2ea1 56 AC_CHECK_HEADERS([sys/sockio.h])
4a75cfa2
TN
57 if test x$ENABLE_EXAMPLES = xyes; then
58 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
59 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
60 fi
fc01d2a9
TN
61 ;;
62 *)
63 ;;
64esac
65
66AC_SUBST(RPCGENFLAGS)
67
f7f931c7
RS
68# check for SA_LEN
69dnl Check if sockaddr data structure includes a "sa_len"
70AC_CHECK_MEMBER([struct sockaddr.sa_len],
71 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
72 [],
73 [
74#include <sys/types.h>
75#include <sys/socket.h>
76])
77
6a14f02f
MF
78LIBNFS_PC_REQ_PRIVATE=
79
fc4bdc22 80if test "$enable_tirpc" = "yes"; then
6a14f02f
MF
81 PKG_CHECK_MODULES(TIRPC, libtirpc, [],
82 AC_MSG_ERROR([unable to locate libtirpc files]))
83 CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
84 LIBS="${LIBS} ${TIRPC_LIBS}"
85 LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
fc4bdc22
RS
86fi
87
6a14f02f
MF
88AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
89
6c437065
TN
90#output
91AC_CONFIG_FILES([Makefile]
92 [include/Makefile]
93 [lib/Makefile]
94 [mount/Makefile]
95 [nfs/Makefile]
96 [portmap/Makefile]
97 [rquota/Makefile]
98 [examples/Makefile]
99 )
100
ea545df9 101AC_OUTPUT([libnfs.pc])