Fix debug mode compilation on 64-bit boxes.
[usmb.git] / configure.ac
blob163b97aa51eef5b20b008de73ecb0a1534f5b4eb
1 m4_include([version.m4])
3 AC_PREREQ([2.63])
4 AC_INIT([usmb], VERSION_)
5 AC_CONFIG_SRCDIR([usmb.c])
6 AC_CONFIG_HEADERS([config.h])
8 AC_DEFINE([USMB_VERSION],[0x]VERSION_,[usmb version])
9 AC_DEFINE([USMB_VERSION_STATUS],'[VERSION_STATUS_]',[Version status])
11 AC_ARG_ENABLE([debug],
12               [AS_HELP_STRING([--enable-debug],
13                               [Build in debug mode (default no)])],
14               [AC_DEFINE([DEBUG], [], [Define to build in debug mode])])
16 AC_ARG_WITH([samba],
17             [AS_HELP_STRING([--with-samba=prefix],
18                               [Location of Samba (i.e. libsmbclient)])],
19             [if test no = $withval ; then
20                AC_MSG_ERROR(Samba is required for building AC_PACKAGE_NAME)
21              else
22                CFLAGS="$CFLAGS -I$withval/include"
23                LDFLAGS="$LDFLAGS -L$withval/lib"
24              fi])
26 # Checks for programs.
27 AC_PROG_CC_C99([gcc])
28 AC_PROG_INSTALL
29 AC_PROG_MKDIR_P
30 AC_PROG_SED
32 AC_DEFINE([_BSD_SOURCE], [], [Define to use BSD APIs (mandatory)])
33 AC_DEFINE([FUSE_USE_VERSION], [26], [Required FUSE API version])
35 m4_define([UNUSED_],[])
36 m4_define([MUSTCHECK_],[])
38 if test "$GCC" = yes ; then
39   m4_define([UNUSED_], [__attribute__ ((unused))])
40   m4_define([MUSTCHECK_], [__attribute__ ((warn_unused_result))])
41   CFLAGS="$CFLAGS -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations"
44 AC_DEFINE([UNUSED], [UNUSED_], [Marks unused parameters])
45 AC_DEFINE([MUSTCHECK], [MUSTCHECK_],
46           [Marks functions whose result values must not be ignored])
48 # Checks for libraries.
49 AC_CHECK_LIB([smbclient], [smbc_init], [],
50              [AC_MSG_ERROR(Cannot find libsmbclient.)])
52 AC_CHECK_LIB([smbclient], [smbc_getFunctionStatVFS],
53              [AC_DEFINE([HAVE_SAMBA33], [],
54               [Whether we have Samba 3.3 or later])
55               SAMBA_VERSION=33])
57 AC_CHECK_LIB([smbclient], [smbc_getFunctionOpen],
58              [AC_DEFINE([HAVE_SAMBA32], [],
59               [Whether we have Samba 3.2 or later])
60               if test "$SAMBA_VERSION" = "" ; then
61                 SAMBA_VERSION=32
62               fi])
64 if test "$SAMBA_VERSION" = '' ; then
65   SAMBA_VERSION=30
68 AC_SUBST(SAMBA_VERSION,[$SAMBA_VERSION])
70 PKG_PROG_PKG_CONFIG
71 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
72 PKG_CHECK_MODULES([GLIB], [glib-2.0])
73 PKG_CHECK_MODULES([FUSE], [fuse])
76 # Checks for header files.
77 AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h sys/time.h termios.h unistd.h utime.h])
79 # Checks for typedefs, structures, and compiler characteristics.
80 AC_HEADER_STDBOOL
81 AC_C_INLINE
82 AC_TYPE_MODE_T
83 AC_TYPE_OFF_T
84 AC_TYPE_SIZE_T
85 AC_TYPE_UID_T
86 AC_TYPE_UINT64_T
87 AC_CHECK_TYPES([ptrdiff_t])
89 # Checks for library functions.
90 AC_FUNC_MALLOC
91 AC_FUNC_REALLOC
92 AC_CHECK_FUNCS([memset strchr strerror])
94 AC_CONFIG_FILES([Makefile])
95 AC_OUTPUT