-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
124 lines (109 loc) · 4.42 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
#
# s3backer - FUSE-based single file backing store via Amazon S3
#
# Copyright 2008-2011 Archie L. Cobbs <archie@dellroad.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# $Id$
#
AC_INIT([s3backer FUSE filesystem backed by Amazon S3], [1.4.0], [http://s3backer.googlecode.com/], [s3backer])
AC_CONFIG_AUX_DIR(scripts)
AM_INIT_AUTOMAKE
dnl AM_MAINTAINER_MODE
AC_PREREQ(2.59)
AC_REVISION($Id$)
AC_PREFIX_DEFAULT(/usr)
AC_PROG_MAKE_SET
[CFLAGS="-g -O3 -pipe -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual $CFLAGS"]
AC_SUBST(CFLAGS)
# Compile flags for Linux
AC_DEFINE(_GNU_SOURCE, 1, GNU functions)
AC_DEFINE(_BSD_SOURCE, 1, BSD functions)
# Compile flags for Mac OS
AC_DEFINE(_DARWIN_C_SOURCE, 1, MacOS functions)
# Compile flags for FUSE
AC_DEFINE(FUSE_USE_VERSION, 26, FUSE API version)
AC_DEFINE(FUSE_FALLOCATE, 0, FUSE fallocate() support)
# Check for required programs
AC_PROG_INSTALL
AC_PROG_CC
# Check for required pkg-config'd stuff
PKG_PROG_PKG_CONFIG(0.19)
PKG_CHECK_MODULES(FUSE, fuse,
[CFLAGS="${CFLAGS} ${FUSE_CFLAGS}"
LDFLAGS="${LDFLAGS} ${FUSE_LIBS}"],
[AC_MSG_ERROR(["fuse" not found in pkg-config])])
# Check for required libraries
AC_CHECK_LIB(curl, curl_version,,
[AC_MSG_ERROR([required library libcurl missing])])
AC_CHECK_LIB(crypto, BIO_new,,
[AC_MSG_ERROR([required library libcrypto missing])])
AC_CHECK_LIB(expat, XML_ParserCreate,,
[AC_MSG_ERROR([required library expat missing])])
AC_CHECK_LIB(fuse, fuse_version,,
[AC_MSG_ERROR([required library libfuse missing])])
AC_CHECK_LIB(z, compressBound,,
[AC_MSG_ERROR([required library zlib missing])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <curl/curl.h>
long x = CURLOPT_HTTP_CONTENT_DECODING;
]])],, [AC_MSG_ERROR([unable to compile with curl, or curl version is < 7.16.2])])
# See if FUSE version is 2.9.2 or later
AC_MSG_CHECKING([for fallocate() support in fuse])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <fuse/fuse.h>
struct fuse_operations x = { fallocate: (void*)1 };
]])],[AC_MSG_RESULT([yes]); AC_DEFINE(FUSE_FALLOCATE)],AC_MSG_RESULT([no]))
# Set some O/S specific stuff
case `uname -s` in
Darwin|FreeBSD)
AC_CHECK_LIB(pthread, pthread_create,,
[AC_MSG_ERROR([required library libpthread missing])])
;;
Linux)
LDFLAGS="${LDFLAGS} -pthread"
;;
*)
;;
esac
# Check for some O/S specific functions
AC_CHECK_DECLS(fdatasync)
# Check for required header files
AC_HEADER_STDC
AC_CHECK_HEADERS(assert.h ctype.h curl/curl.h err.h errno.h expat.h pthread.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h syslog.h time.h unistd.h sys/queue.h openssl/bio.h openssl/buffer.h openssl/evp.h openssl/hmac.h openssl/md5.h zlib.h, [],
[AC_MSG_ERROR([required header file '$ac_header' missing])])
# Optional features
AC_ARG_ENABLE(assertions,
AC_HELP_STRING([--enable-assertions],
[enable debugging sanity checks (default NO)]),
[test x"$enableval" = "xyes" || AC_DEFINE(NDEBUG, 1, [disable assertions])],
[AC_DEFINE(NDEBUG, 1, [disable assertions])])
AC_ARG_ENABLE(gprof,
AC_HELP_STRING([--enable-gprof],
[Compile and link with gprof(1) support (default NO)]),
[test x"$enableval" = "xyes" && CFLAGS="${CFLAGS} -pg"])
AC_ARG_ENABLE(Werror,
AC_HELP_STRING([--enable-Werror],
[enable compilation with -Werror flag (default NO)]),
[test x"$enableval" = "xyes" && CFLAGS="${CFLAGS} -Werror"])
# Generated files
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(debian/Makefile)
AC_CONFIG_FILES(s3backer.spec)
AM_CONFIG_HEADER(config.h)
# Go
AC_OUTPUT