more header include cleanups
[deb_libnfs.git] / configure.ac
... / ...
CommitLineData
1AC_PREREQ(2.50)
2AC_INIT([libnfs], [1.5.0], [ronniesahlberg@gmail.com])
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
14PKG_PROG_PKG_CONFIG
15
16# Work around stupid autoconf default cflags. pt 2
17if test "$SAVE_CFLAGS" = "x"; then
18 CFLAGS=""
19fi
20
21# We always want 64 bit file offsets
22CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
23
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
31# We need popt to compile the examples
32if test x$ENABLE_EXAMPLES = xyes; then
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)
60 MAYBE_EXAMPLES="examples"
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.)
65fi
66fi
67
68AC_SUBST(MAYBE_EXAMPLES)
69
70
71case $host in
72 *solaris*)
73 AC_CHECK_HEADERS([sys/filio.h])
74 AC_CHECK_HEADERS([sys/sockio.h])
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
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 sys/ioctl.h
93dnl Check for sys/ioctl.h
94AC_CHECK_HEADERS([sys/ioctl.h])
95
96# check for SA_LEN
97dnl Check if sockaddr data structure includes a "sa_len"
98AC_CHECK_MEMBER([struct sockaddr.sa_len],
99 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
100 [],
101 [
102#include <sys/types.h>
103#include <sys/socket.h>
104])
105
106# check for sockaddr_storage
107dnl Check if sockaddr structure includes a "ss_family"
108AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
109 [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ],
110 [],
111 [
112#include <sys/types.h>
113#include <sys/socket.h>
114])
115
116#output
117AC_CONFIG_FILES([Makefile]
118 [include/Makefile]
119 [lib/Makefile]
120 [mount/Makefile]
121 [nfs/Makefile]
122 [nlm/Makefile]
123 [portmap/Makefile]
124 [rquota/Makefile]
125 [examples/Makefile]
126 )
127
128AC_OUTPUT([libnfs.pc])