2 AC_INIT([libnfs], [1.5.0], [ronniesahlberg@gmail.com])
3 AC_CONFIG_HEADERS([config.h])
4 AM_INIT_AUTOMAKE([foreign])
7 # Work around stupid autoconf default cflags. pt 1
8 SAVE_CFLAGS="x${CFLAGS}"
16 # Work around stupid autoconf default cflags. pt 2
17 if test "$SAVE_CFLAGS" = "x"; then
21 # We always want 64 bit file offsets
22 CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
25 AC_ARG_ENABLE([examples],
26 [AC_HELP_STRING([--enable-examples],
27 [Build example programs])],
28 [ENABLE_EXAMPLES=$enableval],
29 [ENABLE_EXAMPLES="no"])
31 # We need popt to compile the examples
32 if test x$ENABLE_EXAMPLES = xyes; then
33 AC_MSG_CHECKING(whether libpopt is available)
34 ac_save_CFLAGS="$CFLAGS"
36 CFLAGS="$CFLAGS $GLIB_CFLAGS"
37 LIBS="$GLIB_LIBS $LIBS -lpopt"
40 * Just see if we can compile/link with popt
44 int main(int argc, const char *argv[])
46 struct poptOption popt_options[] = {
49 poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
53 ], ac_cv_have_popt=yes, ac_cv_have_popt=no,
54 [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
56 CFLAGS="$ac_save_CFLAGS"
58 if test "$ac_cv_have_popt" = yes ; then
60 MAYBE_EXAMPLES="examples"
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.)
68 AC_SUBST(MAYBE_EXAMPLES)
72 [AC_HELP_STRING([--enable-tirpc],
73 [enable use of TI-RPC @<:@default=no@:>@])],
74 enable_tirpc=$enableval,
79 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
82 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
85 AC_CHECK_HEADERS([sys/filio.h])
86 AC_CHECK_HEADERS([sys/sockio.h])
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])])
99 dnl Check if sockaddr data structure includes a "sa_len"
100 AC_CHECK_MEMBER([struct sockaddr.sa_len],
101 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
104 #include <sys/types.h>
105 #include <sys/socket.h>
108 LIBNFS_PC_REQ_PRIVATE=
110 if test "$enable_tirpc" = "yes"; then
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"
118 AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
121 AC_CONFIG_FILES([Makefile]
132 AC_OUTPUT([libnfs.pc])