Commit | Line | Data |
---|---|---|
84004dbf | 1 | AC_PREREQ(2.50) |
8afcdc95 | 2 | AC_INIT([libnfs], [1.5.0], [ronniesahlberg@gmail.com]) |
6c437065 TN |
3 | AC_CONFIG_HEADERS([config.h]) |
4 | AM_INIT_AUTOMAKE([foreign]) | |
5 | AC_CANONICAL_HOST | |
84004dbf | 6 | |
6c437065 TN |
7 | # Work around stupid autoconf default cflags. pt 1 |
8 | SAVE_CFLAGS="x${CFLAGS}" | |
84004dbf | 9 | |
6c437065 TN |
10 | AC_PROG_CC |
11 | AC_PROG_LIBTOOL | |
84004dbf | 12 | |
6c437065 | 13 | AM_PROG_CC_C_O |
6a14f02f | 14 | PKG_PROG_PKG_CONFIG |
84004dbf | 15 | |
6c437065 TN |
16 | # Work around stupid autoconf default cflags. pt 2 |
17 | if test "$SAVE_CFLAGS" = "x"; then | |
18 | CFLAGS="" | |
84004dbf | 19 | fi |
e644e700 | 20 | |
71f48059 RS |
21 | # We always want 64 bit file offsets |
22 | CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64" | |
23 | ||
6c437065 TN |
24 | #option: examples |
25 | AC_ARG_ENABLE([examples], | |
26 | [AC_HELP_STRING([--enable-examples], | |
27 | [Build example programs])], | |
28 | [ENABLE_EXAMPLES=$enableval], | |
29 | [ENABLE_EXAMPLES="no"]) | |
13283beb | 30 | |
d70bb152 | 31 | # We need popt to compile the examples |
13283beb | 32 | if test x$ENABLE_EXAMPLES = xyes; then |
d70bb152 RS |
33 | AC_MSG_CHECKING(whether libpopt is available) |
34 | ac_save_CFLAGS="$CFLAGS" | |
35 | ac_save_LIBS="$LIBS" | |
36 | CFLAGS="$CFLAGS $GLIB_CFLAGS" | |
37 | LIBS="$GLIB_LIBS $LIBS -lpopt" | |
38 | AC_TRY_RUN([ | |
39 | /* | |
40 | * Just see if we can compile/link with popt | |
41 | */ | |
42 | #include <popt.h> | |
43 | ||
44 | int 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]) | |
56 | CFLAGS="$ac_save_CFLAGS" | |
57 | LIBS="$ac_save_LIBS" | |
58 | if test "$ac_cv_have_popt" = yes ; then | |
59 | AC_MSG_RESULT(yes) | |
13283beb | 60 | MAYBE_EXAMPLES="examples" |
d70bb152 RS |
61 | else |
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.) | |
65 | fi | |
13283beb | 66 | fi |
d70bb152 | 67 | |
6c437065 TN |
68 | AC_SUBST(MAYBE_EXAMPLES) |
69 | ||
d70bb152 | 70 | |
fc01d2a9 | 71 | case $host in |
fc01d2a9 TN |
72 | *solaris*) |
73 | AC_CHECK_HEADERS([sys/filio.h]) | |
647d2ea1 | 74 | AC_CHECK_HEADERS([sys/sockio.h]) |
4a75cfa2 TN |
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 | |
fc01d2a9 TN |
79 | ;; |
80 | *) | |
81 | ;; | |
82 | esac | |
83 | ||
d7c6e9aa RS |
84 | # check for poll.h |
85 | dnl Check for poll.h | |
86 | AC_CHECK_HEADERS([poll.h]) | |
87 | ||
f7f931c7 RS |
88 | # check for SA_LEN |
89 | dnl Check if sockaddr data structure includes a "sa_len" | |
90 | AC_CHECK_MEMBER([struct sockaddr.sa_len], | |
91 | [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ], | |
92 | [], | |
93 | [ | |
94 | #include <sys/types.h> | |
95 | #include <sys/socket.h> | |
96 | ]) | |
97 | ||
d7c6e9aa RS |
98 | # check for sockaddr_storage |
99 | dnl Check if sockaddr structure includes a "ss_family" | |
100 | AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], | |
101 | [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ], | |
102 | [], | |
103 | [ | |
104 | #include <sys/types.h> | |
105 | #include <sys/socket.h> | |
106 | ]) | |
107 | ||
6c437065 TN |
108 | #output |
109 | AC_CONFIG_FILES([Makefile] | |
110 | [include/Makefile] | |
111 | [lib/Makefile] | |
112 | [mount/Makefile] | |
113 | [nfs/Makefile] | |
6916a665 | 114 | [nlm/Makefile] |
6c437065 TN |
115 | [portmap/Makefile] |
116 | [rquota/Makefile] | |
117 | [examples/Makefile] | |
118 | ) | |
119 | ||
ea545df9 | 120 | AC_OUTPUT([libnfs.pc]) |