forked from tex/fusecompress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
180 lines (159 loc) · 5.19 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(FuseCompress, 2.0, [email protected])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([.])
AC_LANG_CPLUSPLUS
AC_PREFIX_DEFAULT([/usr/local])
# Checks for programs.
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
# Need to include any user specified flags in the tests below, as they might
# specify required include directories..
FUSEFLAGS="-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
CPPFLAGS="$CPPFLAGS $USER_INCLUDES $FUSEFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $USER_INCLUDES"
LDFLAGS="$LDFLAGS $PTHREAD_LIBS $USER_LDFLAGS"
AX_BOOST_BASE([1.33.1])
AX_BOOST_SYSTEM
AX_BOOST_SERIALIZATION
AX_BOOST_IOSTREAMS
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_FILESYSTEM
# Test the boost library whether it was compiled for 64bit system / 32bit
# system with long file support or not.
#
# If not, there is a little help with intructions to get boost library compiled:
# ./bjam "define=_FILE_OFFSET_BITS=64" release --toolset=gcc --build-type=minimal --layout=system --libdir=/usr/lib/ --prefix=/usr
# sudo ./bjam "define=_FILE_OFFSET_BITS=64" release --toolset=gcc --build-type=minimal --layout=system --libdir=/usr/lib/ --includedir=/usr/include/boost --prefix=/usr install
#
AC_ARG_ENABLE(crippled_boost,
AC_HELP_STRING([--enable-crippled_boost],
[enables use of boost without long file support. don't report bugs or ask for help if working with files bigger than 1.5GiB]),
USE_CRIPPLED_BOOST="yes",USE_CRIPPLED_BOOST="no")
if test "x$USE_CRIPPLED_BOOST" = "xno"; then
old_LIBS=$LIBS
LIBS="$LIBS $BOOST_IOSTREAMS_LIB"
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "src/boost/iostreams/device/nonclosable_file_descriptor.hpp"
int main(int argc, char **argv) {
int fd = open("bigfs.tmp", O_RDWR|O_CREAT, 0666);
boost::iostreams::nonclosable_file_descriptor file(fd);
long long ret = file.seek(3*1024*1024*1024LL, std::ios_base::beg);
return ret == 3*1024*1024*1024LL ? 0 : 1;
}],
[],
[AC_MSG_ERROR([Boost library compiled for 32bit architecture without long file support!])])
AC_LANG_POP([C++])
LIBS=$old_LIBS
fi
# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_mutex_lock],,
[AC_MSG_ERROR([Can't find pthread.a])],)
AC_CHECK_LIB([magic], [magic_open],,
[AC_MSG_ERROR([FuseCompress depends on libmagic.])],)
# This function helps with configuring optional libraries.
AC_DEFUN([AX_CHECK_OPTIONAL_LIB],
[
AC_ARG_WITH([$1],
AS_HELP_STRING([--with-$1@<:@=DIR@:>@],
[use the $1 library - it is possible to specify a path for the library]),
[
if test "$withval" = "no"; then
want_lib="no"
elif test "$withval" = "yes"; then
want_lib="yes"
ax_user_lib_path=""
else
want_lib="yes"
ax_user_lib_path="$withval"
fi
],
[want_lib="yes"]
)
if test "x$want_lib" = "xyes"; then
if test "$ax_user_lib_path" != ""; then
LDFLAGS="$LDFLAGS -L$ax_user_lib_path"
export LDFLAGS
fi
AC_CHECK_LIB([$1], [$2],,,)
fi
]
)
# Check optional compression libraries.
AX_CHECK_OPTIONAL_LIB([lzma], [lzma_code])
AX_CHECK_OPTIONAL_LIB([z], [uncompress])
AX_CHECK_OPTIONAL_LIB([bz2], [BZ2_bzBuffToBuffCompress])
AX_CHECK_OPTIONAL_LIB([lzo2], [lzo1x_1_compress])
AC_CHECK_HEADER(attr/xattr.h,
[AC_DEFINE([HAVE_ATTR_XATTR_H], [], ["Have xattr.h header in attr/"])],
[AC_CHECK_HEADER(sys/xattr.h,
[AC_DEFINE([HAVE_SYS_XATTR_H], [], ["Have xattr.h header in sys/"])],
[AC_MSG_ERROR([Can't find xattr.h in attr/ or /sys])])])
PKG_CHECK_MODULES([FUSE], [fuse])
# Check for a supported FUSE_MAJOR_VERSION.
AC_MSG_CHECKING([For supported FUSE API version])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[#include <fuse.h>]],
[[
if(FUSE_MAJOR_VERSION == 2 && FUSE_MINOR_VERSION >= 6)
return 0;
else
return -1;
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_FAILURE([FuseCompress requires FUSE 2.6 or newer.])
]
)
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[collects profile for gprof]),
CPPFLAGS="$CPPFLAGS -pg" LDFLAGS="$LDFLAGS -pg",)
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[creates debug build]),
CPPFLAGS="$CPPFLAGS -D_GLIBCXX_DEBUG", CPPFLAGS="$CPPFLAGS -DNDEBUG")
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h unistd.h utime.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS([fchdir fdatasync ftruncate lchown memmove memset mkdir rmdir strchr strerror utime])
# Tell Makefile.am to process following subdirectories
subdirs="src src/tests"
AC_SUBST(subdirs)
AC_CONFIG_FILES([Makefile] [src/Makefile] [src/tests/Makefile])
AC_OUTPUT