Version 20090411.
[usmb.git] / configure.ac
blob16ba52a6f1538d065fcec1d7974a383baa975912
1 AC_PREREQ([2.63])
2 AC_INIT([usmb], [20090411])
3 AC_CONFIG_SRCDIR([usmb.c])
4 AC_CONFIG_HEADERS([config.h])
6 AC_ARG_ENABLE([debug],
7               [AS_HELP_STRING([--enable-debug],
8                               [Build in debug mode (default no)])],
9               [AC_DEFINE([DEBUG], [], [Define to build in debug mode])])
11 AC_ARG_WITH([samba],
12             [AS_HELP_STRING([--with-samba=prefix],
13                               [Location of Samba (i.e. libsmbclient)])],
14             [if test no = $withval ; then
15                AC_MSG_ERROR(Samba is required for building AC_PACKAGE_NAME)
16              else
17                CFLAGS="$CFLAGS -I$withval/include"
18                LDFLAGS="$LDFLAGS -L$withval/lib"
19              fi])
21 # Checks for programs.
22 AC_PROG_CC_C99([gcc])
23 AC_PROG_INSTALL
24 AC_PROG_MKDIR_P
25 AC_PROG_SED
27 AC_DEFINE([_BSD_SOURCE], [], [Define to use BSD APIs (mandatory)])
28 AC_DEFINE([FUSE_USE_VERSION], [26], [Required FUSE API version])
30 m4_define([UNUSED_],[])
31 m4_define([MUSTCHECK_],[])
33 if test "$GCC" = yes ; then
34   m4_define([UNUSED_], [__attribute__ ((unused))])
35   m4_define([MUSTCHECK_], [__attribute__ ((warn_unused_result))])
36   CFLAGS="$CFLAGS -Wall -Wextra -Werror -pedantic"
39 AC_DEFINE([UNUSED], [UNUSED_], [Marks unused parameters])
40 AC_DEFINE([MUSTCHECK], [MUSTCHECK_],
41           [Marks functions whose result values must not be ignored])
43 # Checks for libraries.
44 AC_CHECK_LIB([smbclient], [smbc_init], [],
45              [AC_MSG_ERROR(Cannot find libsmbclient.)])
47 AC_CHECK_LIB([smbclient], [smbc_getFunctionStatVFS],
48              [AC_DEFINE([HAVE_SAMBA33], [],
49                                                   [Whether we have Samba 3.3 or later])
50                                                   SAMBA_VERSION=33])
52 AC_CHECK_LIB([smbclient], [smbc_getFunctionOpen],
53              [AC_DEFINE([HAVE_SAMBA32], [],
54                                                   [Whether we have Samba 3.2 or later])
55                                                   if test "$SAMBA_VERSION" = "" ; then
56                                                                 SAMBA_VERSION=32
57                                                         fi])
59 if test "$SAMBA_VERSION" = '' ; then
60         SAMBA_VERSION=30
63 AC_SUBST(SAMBA_VERSION,[$SAMBA_VERSION])
65 PKG_PROG_PKG_CONFIG
66 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
67 PKG_CHECK_MODULES([GLIB], [glib-2.0])
68 PKG_CHECK_MODULES([FUSE], [fuse])
71 # Checks for header files.
72 AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h sys/time.h termios.h unistd.h utime.h])
74 # Checks for typedefs, structures, and compiler characteristics.
75 AC_HEADER_STDBOOL
76 AC_C_INLINE
77 AC_TYPE_MODE_T
78 AC_TYPE_OFF_T
79 AC_TYPE_SIZE_T
80 AC_TYPE_UID_T
81 AC_TYPE_UINT64_T
82 AC_CHECK_TYPES([ptrdiff_t])
84 # Checks for library functions.
85 AC_FUNC_MALLOC
86 AC_FUNC_REALLOC
87 AC_CHECK_FUNCS([memset strchr strerror])
89 AC_CONFIG_FILES([Makefile])
90 AC_OUTPUT