Add a flag --enable-tirpc to the configure script
[deb_libnfs.git] / configure.ac
1 AC_PREREQ(2.50)
2 AC_INIT([libnfs], [0.0.0])
3 AC_CONFIG_HEADERS([config.h])
4 AM_INIT_AUTOMAKE([foreign])
5 AC_CANONICAL_HOST
6
7 # Work around stupid autoconf default cflags. pt 1
8 SAVE_CFLAGS="x${CFLAGS}"
9
10 AC_PROG_CC
11 AC_PROG_LIBTOOL
12
13 AM_PROG_CC_C_O
14
15 # Work around stupid autoconf default cflags. pt 2
16 if test "$SAVE_CFLAGS" = "x"; then
17 CFLAGS=""
18 fi
19
20 AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no])
21 if test x$HAVE_RPCGEN != xyes; then
22 AC_MSG_ERROR([Can not find required program])
23 fi
24
25 #option: examples
26 AC_ARG_ENABLE([examples],
27 [AC_HELP_STRING([--enable-examples],
28 [Build example programs])],
29 [ENABLE_EXAMPLES=$enableval],
30 [ENABLE_EXAMPLES="no"])
31
32 if test x$ENABLE_EXAMPLES = xyes; then
33 MAYBE_EXAMPLES="examples"
34 fi
35 AC_SUBST(MAYBE_EXAMPLES)
36
37 AC_ARG_ENABLE(tirpc,
38 [AC_HELP_STRING([--enable-tirpc],
39 [enable use of TI-RPC @<:@default=no@:>@])],
40 enable_tirpc=$enableval,
41 enable_tirpc='no')
42
43 case $host in
44 *darwin*)
45 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
46 ;;
47 *solaris*)
48 AC_CHECK_HEADERS([sys/filio.h])
49 if test x$ENABLE_EXAMPLES = xyes; then
50 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
51 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
52 fi
53 ;;
54 *)
55 ;;
56 esac
57
58 AC_SUBST(RPCGENFLAGS)
59
60 # check for SA_LEN
61 dnl Check if sockaddr data structure includes a "sa_len"
62 AC_CHECK_MEMBER([struct sockaddr.sa_len],
63 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
64 [],
65 [
66 #include <sys/types.h>
67 #include <sys/socket.h>
68 ])
69
70 echo "Use TI-RPC: $enable_tirpc"
71 if test "$enable_tirpc" = "yes"; then
72 CFLAGS="${CFLAGS} -I /usr/include/tirpc"
73 LDFLAGS="${LDFLAGS} -ltirpc"
74 fi
75
76 #output
77 AC_CONFIG_FILES([Makefile]
78 [include/Makefile]
79 [lib/Makefile]
80 [mount/Makefile]
81 [nfs/Makefile]
82 [portmap/Makefile]
83 [rquota/Makefile]
84 [examples/Makefile]
85 )
86
87 AC_OUTPUT