1 AC_INIT([libsmb2], [3.0.0], [ronniesahlberg@gmail.com])
4 AC_CONFIG_HEADERS([config.h])
5 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects 1.11])
7 AC_CONFIG_MACRO_DIR([m4])
9 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
11 dnl Do not add default CFLAGS in AC_PROG_CC
18 dnl We always want 64 bit file offsets
19 CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
21 AC_ARG_ENABLE([examples],
22 [AS_HELP_STRING([--enable-examples],
23 [Build example programs])])
25 AM_CONDITIONAL([ENABLE_EXAMPLES],
26 [test "$enable_examples" = "yes"])
28 AC_ARG_WITH([libkrb5],
29 [AS_HELP_STRING([--without-libkrb5],
30 [Do not link with libkrb5 and use builtin
31 NTLMSSP module for authentication instead.])])
33 AS_IF([test "x$with_libkrb5" != "xno"], [
34 MAYBE_LIBKRB5="-lgssapi_krb5"
35 AC_DEFINE([HAVE_LIBKRB5], [1], [Whether we use gssapi_krb5 or not])
36 AC_MSG_NOTICE([Build with gssapi_krb5 support])
37 dnl Check for gssapi/gssapi.h
38 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [
39 AC_MSG_ERROR([You need gssapi development files to compile libsmb2.])
43 AC_MSG_NOTICE([Build WITHOUT gssapi_krb5 support])
46 AC_SUBST([MAYBE_LIBKRB5])
48 AC_ARG_ENABLE([werror],
49 [AS_HELP_STRING([--disable-werror],
50 [Disables building with -Werror by default])])
52 AS_IF([test "$GCC" = "yes"], [
53 WARN_CFLAGS="-Wall -Wshadow -Wno-write-strings -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing"
54 AS_IF([test "$enable_werror" != "no"], [
55 WARN_CFLAGS="${WARN_CFLAGS} -Werror"
58 AC_SUBST([WARN_CFLAGS])
65 AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
66 AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
68 *mingw32* | *cygwin* | *wince* | *mingwce*)
75 AM_CONDITIONAL([HAVE_WIN32], [test "${SYS}" = "mingw32"])
79 AC_CHECK_HEADERS([poll.h])
81 dnl Check for unistd.h
82 AC_CHECK_HEADERS([unistd.h])
85 AC_CHECK_HEADERS([netdb.h])
87 dnl Check for sys/ioctl.h
88 AC_CHECK_HEADERS([sys/ioctl.h])
90 dnl Check for sys/socket.h
91 AC_CHECK_HEADERS([sys/socket.h])
93 dnl Check for sys/uio.h
94 AC_CHECK_HEADERS([sys/uio.h])
96 dnl Check for netinet/tcp.h
97 AC_CHECK_HEADERS([netinet/tcp.h])
99 dnl Check for netinet/in.h
100 AC_CHECK_HEADERS([netinet/in.h])
102 dnl Check for arpa/inet.h
103 AC_CHECK_HEADERS([arpa/inet.h])
105 dnl Check if sockaddr data struct includes a "sa_len"
106 AC_CHECK_MEMBER([struct sockaddr.sa_len], [
107 AC_DEFINE([HAVE_SOCKADDR_LEN], [1], [Whether sockaddr struct has sa_len])
109 #include <sys/types.h>
110 #include <sys/socket.h>
113 dnl Check if sockaddr_storage struct includes a "ss_family"
114 AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], [
115 AC_DEFINE([HAVE_SOCKADDR_STORAGE], [1], [Whether we have sockaddr_Storage])
117 #include <sys/types.h>
118 #include <sys/socket.h>
129 AC_OUTPUT([libsmb2.pc])