Take maintenance for libnfs
[deb_libnfs.git] / configure.ac
CommitLineData
dabf4152 1AC_PREREQ(2.50)
ee872606 2AC_INIT([libnfs], [1.9.3], [ronniesahlberg@gmail.com])
dabf4152
AM
3AC_CONFIG_HEADERS([config.h])
4AM_INIT_AUTOMAKE([foreign])
5AC_CANONICAL_HOST
6
7# Work around stupid autoconf default cflags. pt 1
8SAVE_CFLAGS="x${CFLAGS}"
9
10AC_PROG_CC
11AC_PROG_LIBTOOL
12
13AM_PROG_CC_C_O
5670ec6e 14PKG_PROG_PKG_CONFIG
dabf4152
AM
15
16# Work around stupid autoconf default cflags. pt 2
17if test "$SAVE_CFLAGS" = "x"; then
18 CFLAGS=""
19fi
20
5670ec6e
AM
21# We always want 64 bit file offsets
22CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
23
dabf4152
AM
24#option: examples
25AC_ARG_ENABLE([examples],
26 [AC_HELP_STRING([--enable-examples],
27 [Build example programs])],
28 [ENABLE_EXAMPLES=$enableval],
29 [ENABLE_EXAMPLES="no"])
30
ee872606 31# We need popt to compile the examples
dabf4152 32if test x$ENABLE_EXAMPLES = xyes; then
ee872606
RRS
33AC_MSG_CHECKING(whether libpopt is available)
34ac_save_CFLAGS="$CFLAGS"
35ac_save_LIBS="$LIBS"
36CFLAGS="$CFLAGS $GLIB_CFLAGS"
37LIBS="$GLIB_LIBS $LIBS -lpopt"
38AC_TRY_RUN([
39/*
40 * Just see if we can compile/link with popt
41 */
42#include <popt.h>
43
44int main(int argc, const char *argv[])
45{
46 struct poptOption popt_options[] = {
47 POPT_TABLEEND
48 };
49 poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
50
51 return 0;
52}
53], ac_cv_have_popt=yes, ac_cv_have_popt=no,
54 [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
55 ac_cv_have_popt=yes])
56CFLAGS="$ac_save_CFLAGS"
57LIBS="$ac_save_LIBS"
58if test "$ac_cv_have_popt" = yes ; then
59 AC_MSG_RESULT(yes)
dabf4152 60 MAYBE_EXAMPLES="examples"
ee872606
RRS
61else
62 AC_MSG_RESULT(no)
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.)
dabf4152 65fi
ee872606
RRS
66fi
67
dabf4152
AM
68AC_SUBST(MAYBE_EXAMPLES)
69
3be27335 70
dabf4152 71case $host in
dabf4152
AM
72 *solaris*)
73 AC_CHECK_HEADERS([sys/filio.h])
5670ec6e 74 AC_CHECK_HEADERS([sys/sockio.h])
dabf4152
AM
75 if test x$ENABLE_EXAMPLES = xyes; then
76 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
77 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
78 fi
79 ;;
80 *)
81 ;;
82esac
83
ee872606
RRS
84# check for poll.h
85dnl Check for poll.h
86AC_CHECK_HEADERS([poll.h])
87
88# check for unistd.h
89dnl Check for unistd.h
90AC_CHECK_HEADERS([unistd.h])
91
92# check for netdb.h
93dnl Check for netdb.h
94AC_CHECK_HEADERS([netdb.h])
95
96# check for utime.h
97dnl Check for utime.h
98AC_CHECK_HEADERS([utime.h])
99
100# check for net/if.h
101dnl Check for net/if.h
102AC_CHECK_HEADERS([net/if.h])
103
104# check for sys/time.h
105dnl Check for sys/time.h
106AC_CHECK_HEADERS([sys/time.h])
107
108# check for sys/ioctl.h
109dnl Check for sys/ioctl.h
110AC_CHECK_HEADERS([sys/ioctl.h])
111
112# check for sys/vfs.h
113dnl Check for sys/vfs.h
114AC_CHECK_HEADERS([sys/vfs.h])
115
116# check for sys/statvfs.h
117dnl Check for sys/statvfs.h
118AC_CHECK_HEADERS([sys/statvfs.h])
119
120# check for sys/socket.h
121dnl Check for sys/socket.h
122AC_CHECK_HEADERS([sys/socket.h])
123
124# check for netinet/tcp.h
125dnl Check for netinet/tcp.h
126AC_CHECK_HEADERS([netinet/tcp.h])
127
128# check for netinet/in.h
129dnl Check for netinet/in.h
130AC_CHECK_HEADERS([netinet/in.h])
131
132# check for arpa/inet.h
133dnl Check for arpa/inet.h
134AC_CHECK_HEADERS([arpa/inet.h])
dabf4152
AM
135
136# check for SA_LEN
137dnl Check if sockaddr data structure includes a "sa_len"
138AC_CHECK_MEMBER([struct sockaddr.sa_len],
139 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
140 [],
141 [
142#include <sys/types.h>
143#include <sys/socket.h>
144])
145
ee872606
RRS
146# check for sockaddr_storage
147dnl Check if sockaddr structure includes a "ss_family"
148AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
149 [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ],
150 [],
151 [
152#include <sys/types.h>
153#include <sys/socket.h>
154])
5670ec6e 155
dabf4152
AM
156#output
157AC_CONFIG_FILES([Makefile]
158 [include/Makefile]
159 [lib/Makefile]
160 [mount/Makefile]
161 [nfs/Makefile]
ee872606
RRS
162 [nlm/Makefile]
163 [nsm/Makefile]
dabf4152
AM
164 [portmap/Makefile]
165 [rquota/Makefile]
166 [examples/Makefile]
167 )
168
5670ec6e 169AC_OUTPUT([libnfs.pc])