2 AC_INIT([libsmb2], [3.0.0], [ronniesahlberg@gmail.com])
3 AC_CONFIG_HEADERS([config.h])
4 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
6 AC_CONFIG_MACRO_DIR([m4])
7 m4_pattern_allow([AM_PROG_AR])
10 # Work around stupid autoconf default cflags. pt 1
11 SAVE_CFLAGS="x${CFLAGS}"
19 # Work around stupid autoconf default cflags. pt 2
20 if test "$SAVE_CFLAGS" = "x"; then
24 # We always want 64 bit file offsets
25 CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
28 AC_ARG_ENABLE([examples],
29 [AC_HELP_STRING([--enable-examples],
30 [Build example programs])],
31 [ENABLE_EXAMPLES=$enableval],
32 [ENABLE_EXAMPLES="no"])
34 # We need popt to compile the examples
35 if test x$ENABLE_EXAMPLES = xyes; then
36 AC_MSG_CHECKING(whether libpopt is available)
37 ac_save_CFLAGS="$CFLAGS"
39 CFLAGS="$CFLAGS $GLIB_CFLAGS"
40 LIBS="$GLIB_LIBS $LIBS -lpopt"
43 * Just see if we can compile/link with popt
47 int main(int argc, const char *argv[])
49 struct poptOption popt_options[] = {
52 poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
56 ], ac_cv_have_popt=yes, ac_cv_have_popt=no,
57 [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
59 CFLAGS="$ac_save_CFLAGS"
61 if test "$ac_cv_have_popt" = yes ; then
63 MAYBE_EXAMPLES="examples"
66 AC_MSG_NOTICE(You need libpopt to compile the sample libsmb2 clients.)
67 AC_MSG_NOTICE(Only the library will be compiled and installed.)
71 AC_SUBST(MAYBE_EXAMPLES)
73 AC_ARG_WITH([libkrb5],
74 AS_HELP_STRING([--without-libkrb5], [Do not link with libkrb5 and use builtin NTLMSSP module for authentication instead.]))
76 AS_IF([test "x$with_libkrb5" != "xno"],
77 [MAYBE_LIBKRB5="-lgssapi_krb5"
78 AC_DEFINE(HAVE_LIBKRB5,1,[Whether we use gssapi_krb5 or not])
79 AC_MSG_NOTICE(Build with gssapi_krb5 support)
80 # check for gssapi/gssapi.h
81 dnl Check for gssapi/gssapi.h
82 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [
83 AC_MSG_ERROR(You need gssapi development files to compile libsmb2.)
87 AC_MSG_NOTICE(Build WITHOUT gssapi_krb5 support)])
89 AC_SUBST(MAYBE_LIBKRB5)
91 AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror],
92 [Disables building with -Werror by default])])
94 if test "$ac_cv_prog_gcc" = yes; then
95 WARN_CFLAGS="-Wall -Wshadow -Wno-write-strings -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing"
96 if test "x$enable_werror" != "xno"; then
97 WARN_CFLAGS="$WARN_CFLAGS -Werror"
100 AC_SUBST(WARN_CFLAGS)
107 AC_CHECK_HEADERS([sys/filio.h])
108 AC_CHECK_HEADERS([sys/sockio.h])
109 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
110 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
112 *mingw32* | *cygwin* | *wince* | *mingwce*)
119 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
120 AC_SUBST([LIBSOCKET])
124 AC_CHECK_HEADERS([poll.h])
127 dnl Check for unistd.h
128 AC_CHECK_HEADERS([unistd.h])
131 dnl Check for netdb.h
132 AC_CHECK_HEADERS([netdb.h])
135 dnl Check for utime.h
136 AC_CHECK_HEADERS([utime.h])
139 dnl Check for net/if.h
140 AC_CHECK_HEADERS([net/if.h])
142 # check for sys/time.h
143 dnl Check for sys/time.h
144 AC_CHECK_HEADERS([sys/time.h])
146 # check for sys/ioctl.h
147 dnl Check for sys/ioctl.h
148 AC_CHECK_HEADERS([sys/ioctl.h])
150 # check for sys/vfs.h
151 dnl Check for sys/vfs.h
152 AC_CHECK_HEADERS([sys/vfs.h])
154 # check for sys/statvfs.h
155 dnl Check for sys/statvfs.h
156 AC_CHECK_HEADERS([sys/statvfs.h])
158 # check for sys/socket.h
159 dnl Check for sys/socket.h
160 AC_CHECK_HEADERS([sys/socket.h])
162 # check for sys/uio.h
163 dnl Check for sys/uio.h
164 AC_CHECK_HEADERS([sys/uio.h])
166 # check for netinet/tcp.h
167 dnl Check for netinet/tcp.h
168 AC_CHECK_HEADERS([netinet/tcp.h])
170 # check for netinet/in.h
171 dnl Check for netinet/in.h
172 AC_CHECK_HEADERS([netinet/in.h])
174 # check for arpa/inet.h
175 dnl Check for arpa/inet.h
176 AC_CHECK_HEADERS([arpa/inet.h])
179 dnl Check if sockaddr data structure includes a "sa_len"
180 AC_CHECK_MEMBER([struct sockaddr.sa_len],
181 [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ],
184 #include <sys/types.h>
185 #include <sys/socket.h>
188 # check for sockaddr_storage
189 dnl Check if sockaddr structure includes a "ss_family"
190 AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
191 [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ],
194 #include <sys/types.h>
195 #include <sys/socket.h>
198 # check where makedev is defined
202 AC_CONFIG_FILES([Makefile]
208 AC_OUTPUT([libsmb2.pc])