2 AC_INIT([libnfs], [1.3.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"
24 AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no])
25 if test x$HAVE_RPCGEN != xyes; then
26 AC_MSG_ERROR([Can not find required program])
30 AC_ARG_ENABLE([examples],
31 [AC_HELP_STRING([--enable-examples],
32 [Build example programs])],
33 [ENABLE_EXAMPLES=$enableval],
34 [ENABLE_EXAMPLES="no"])
36 # We need popt to compile the examples
37 if test x$ENABLE_EXAMPLES = xyes; then
38 AC_MSG_CHECKING(whether libpopt is available)
39 ac_save_CFLAGS="$CFLAGS"
41 CFLAGS="$CFLAGS $GLIB_CFLAGS"
42 LIBS="$GLIB_LIBS $LIBS -lpopt"
45 * Just see if we can compile/link with popt
49 int main(int argc, const char *argv[])
51 struct poptOption popt_options[] = {
54 poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
58 ], ac_cv_have_popt=yes, ac_cv_have_popt=no,
59 [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
61 CFLAGS="$ac_save_CFLAGS"
63 if test "$ac_cv_have_popt" = yes ; then
65 MAYBE_EXAMPLES="examples"
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.)
73 AC_SUBST(MAYBE_EXAMPLES)
77 [AC_HELP_STRING([--enable-tirpc],
78 [enable use of TI-RPC @<:@default=no@:>@])],
79 enable_tirpc=$enableval,
84 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
87 RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
90 AC_CHECK_HEADERS([sys/filio.h])
91 AC_CHECK_HEADERS([sys/sockio.h])
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])])
101 AC_SUBST(RPCGENFLAGS)
104 dnl Check if sockaddr data structure includes a "sa_len"
105 AC_CHECK_MEMBER([struct sockaddr.sa_len],
106 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
109 #include <sys/types.h>
110 #include <sys/socket.h>
113 LIBNFS_PC_REQ_PRIVATE=
115 if test "$enable_tirpc" = "yes"; then
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"
123 AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
126 AC_CONFIG_FILES([Makefile]
137 AC_OUTPUT([libnfs.pc])