2 AC_INIT([libnfs], [1.9.6], [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)
73 AC_CHECK_HEADERS([sys/filio.h])
74 AC_CHECK_HEADERS([sys/sockio.h])
75 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
76 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
84 AC_CHECK_HEADERS([poll.h])
87 dnl Check for unistd.h
88 AC_CHECK_HEADERS([unistd.h])
92 AC_CHECK_HEADERS([netdb.h])
96 AC_CHECK_HEADERS([utime.h])
99 dnl Check for net/if.h
100 AC_CHECK_HEADERS([net/if.h])
102 # check for sys/time.h
103 dnl Check for sys/time.h
104 AC_CHECK_HEADERS([sys/time.h])
106 # check for sys/ioctl.h
107 dnl Check for sys/ioctl.h
108 AC_CHECK_HEADERS([sys/ioctl.h])
110 # check for sys/vfs.h
111 dnl Check for sys/vfs.h
112 AC_CHECK_HEADERS([sys/vfs.h])
114 # check for sys/statvfs.h
115 dnl Check for sys/statvfs.h
116 AC_CHECK_HEADERS([sys/statvfs.h])
118 # check for sys/socket.h
119 dnl Check for sys/socket.h
120 AC_CHECK_HEADERS([sys/socket.h])
122 # check for netinet/tcp.h
123 dnl Check for netinet/tcp.h
124 AC_CHECK_HEADERS([netinet/tcp.h])
126 # check for netinet/in.h
127 dnl Check for netinet/in.h
128 AC_CHECK_HEADERS([netinet/in.h])
130 # check for arpa/inet.h
131 dnl Check for arpa/inet.h
132 AC_CHECK_HEADERS([arpa/inet.h])
135 dnl Check if sockaddr data structure includes a "sa_len"
136 AC_CHECK_MEMBER([struct sockaddr.sa_len],
137 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
140 #include <sys/types.h>
141 #include <sys/socket.h>
144 # check for sockaddr_storage
145 dnl Check if sockaddr structure includes a "ss_family"
146 AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
147 [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ],
150 #include <sys/types.h>
151 #include <sys/socket.h>
154 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
156 # check where makedev is defined
160 AC_CONFIG_FILES([Makefile]
174 AC_OUTPUT([libnfs.pc])