-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathconfigure.ac_server
238 lines (201 loc) · 8.25 KB
/
configure.ac_server
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([urbackup-server], [2.5.17.0], [martin@urbackup.org])
AC_CONFIG_SRCDIR([AcceptThread.cpp])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([subdir-objects tar-ustar])
AC_ARG_WITH([mail],
AS_HELP_STRING([--without-mail], [Disables server mailing features. Use this to remove the dependency on libcurl.]))
AC_ARG_WITH([crypto],
AS_HELP_STRING([--without-crypto], [Disables cryptography functions. Internet mode will not be available. Use this to remove the dependency on libcrypto++.]))
AC_ARG_ENABLE([install_initd],
AS_HELP_STRING([--enable-install_initd], [Enables installing of supplied init.d file into /etc/init.d]))
AC_ARG_ENABLE([packaging],
AS_HELP_STRING([--enable-packaging], [Will be installed for packaging.]))
AC_ARG_WITH([mountvhd],
AS_HELP_STRING([--with-mountvhd], [Enable mounting of VHD files via fuse.]))
AC_ARG_ENABLE([assertions],
AS_HELP_STRING([--enable-assertions], [Enable assertions (bug finding).]))
AM_CONDITIONAL(WITH_ASSERTIONS, test "x$enable_assertions" = xyes)
AC_ARG_WITH([embedded-sqlite3],
AS_HELP_STRING([--without-embedded-sqlite3], [Disables the embedded sqlite3 and uses the system one. Not recommended.]))
AC_ARG_WITH([embedded-lua],
AS_HELP_STRING([--without-embedded-lua], [Disables the embedded lua and uses the system one. Not recommended.]))
AC_ARG_WITH([embedded-lmdb],
AS_HELP_STRING([--without-embedded-lmdb], [Disables the embedded lmdb and uses the system one. Not recommended.]))
AC_ARG_ENABLE([fortify],
AS_HELP_STRING([--disable-fortify], [Disable GCC/runtime fortification]))
AM_CONDITIONAL(WITH_FORTIFY, test "x$enable_fortify" != xno)
AC_ARG_ENABLE([embedded-cryptopp],
AS_HELP_STRING([--enable-embedded-cryptopp], [Compile and use Crypto++ included with the source distribution.]))
AM_CONDITIONAL(EMBEDDED_CRYPTOPP, test "x$enable_embedded_cryptopp" = xyes)
AM_CONDITIONAL(TARGET_CPU_IS_X86, test "x$TARGET_CPU" = xx86)
AC_ARG_ENABLE([embedded-zstd],
AS_HELP_STRING([--enable-embedded-zstd], [Compile and use ZSTD included with the source distribution.]))
AM_CONDITIONAL(EMBEDDED_ZSTD, test "x$enable_embedded_zstd" = xyes)
AC_ARG_WITH([embedded-aws-cpp-sdk],
AS_HELP_STRING([--without-embedded-aws-cpp-sdk], [Disables the embedded AWS c++ sdk (for S3) and uses the system one. Not recommended.]))
AM_CONDITIONAL(WITH_EMBEDDED_AWS_CPP_SDK, test "x$with_embedded_aws_cpp_sdk" != "xno")
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_CXX_HAVE_SSTREAM
AC_CXX_HAVE_STRSTREAM
AC_CXX_HAVE_LONG_LONG
AX_PTHREAD
if !($HAVE_PTHREAD)
then
echo "Sorry, your system needs the pthread library."
echo "Either install it or give up."
exit 1
fi
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX([17])
# Checks for libraries.
AX_CHECK_OPENSSL([with_openssl=true], [with_openssl=false])
AM_CONDITIONAL([WITH_OPENSSL], [test x$with_openssl = xtrue])
if test "x$with_openssl" != "xtrue"
then
AC_MSG_ERROR([OpenSSL library not present or not recent enough.])
fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([pthread.h arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h sys/socket.h sys/time.h unistd.h linux/fiemap.h sys/random.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AX_CHECK_COMPILE_FLAG(-fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIE,
[], [AM_CONDITIONAL(WITH_FORTIFY, test xyes = xno)])
AX_CHECK_COMPILE_FLAG(-Wno-subobject-linkage,
[AM_CONDITIONAL(DISABLE_CERTAIN_WARNINGS, test xyes = xyes)],
[AM_CONDITIONAL(DISABLE_CERTAIN_WARNINGS, test xyes = xno)])
AX_CHECK_LINK_FLAG([-Wl,-z,relro],
[], [AM_CONDITIONAL(WITH_FORTIFY, test xyes = xno)])
AX_LIB_SOCKET_NSL
AX_CHECK_ZLIB
AC_MSG_CHECKING([for operating system])
case "$host_os" in
freebsd*)
opsys="freebsd"
;;
linux*)
opsys="linux"
;;
*)
opsys=""
;;
esac
AM_CONDITIONAL([FREEBSD], test x"$opsys" = x"freebsd")
AM_CONDITIONAL([LINUX], test x"$opsys" = x"linux")
# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gettimeofday memset select socket strstr syncfs fallocate64 utimensat accept4 getrandom])
AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS="-ldl"])
AC_SUBST([DLOPEN_LIBS])
if test "x$enable_embedded_zstd" != "xyes"
then
AC_CHECK_LIB(zstd, ZSTD_CCtx_setParameter, [HAS_ZSTD_LIB=1])
AC_CHECK_HEADER(zstd.h, [HAS_ZSTD_HEADER=1])
if test "x$HAS_ZSTD_LIB" != "x1" || test "x$HAS_ZSTD_HEADER" != "x1"
then
AC_MSG_WARN([ZSTD compression library not present or not recent enough. Compiling without ZSTD support. Install libzstd-dev(el) or use --enable-embedded-zstd])
fi
AM_CONDITIONAL(WITH_ZSTD, test "x$HAS_ZSTD_LIB" == "x1" && test "x$HAS_ZSTD_HEADER" == "x1")
else
AM_CONDITIONAL(WITH_ZSTD, true)
fi
P_SUBDIRS="snapshot_helper fsimageplugin httpserver urbackupserver"
AM_CONDITIONAL(WITH_URLPLUGIN, test "x$with_mail" != "xno")
AM_CONDITIONAL(WITH_CRYPTOPLUGIN, test "x$with_crypto" != "xno")
AM_CONDITIONAL(WITH_FUSEPLUGIN, test "x$with_mountvhd" = "xyes")
AM_CONDITIONAL(PACKAGING, test "x$enable_packaging" = xyes)
AM_CONDITIONAL(INSTALL_INITD, test "x$enable_install_initd" = xyes)
AM_CONDITIONAL(WITH_EMBEDDED_SQLITE3, test "x$with_embedded_sqlite3" != "xno")
AM_CONDITIONAL(WITH_EMBEDDED_LUA, test "x$with_embedded_lua" != "xno")
AM_CONDITIONAL(WITH_EMBEDDED_LMDB, test "x$with_embedded_lmdb" != "xno")
if test "x$with_mail" != "xno"
then
LIBCURL_CHECK_CONFIG(,[7.20.0],,[
AC_MSG_ERROR([Your system lacks of libcurl >= 7.20.0])
])
fi
if test "x$with_embedded_sqlite3" == "xno"
then
AX_LIB_SQLITE3([3.8.7.0])
AS_IF([test "x$HAVE_SQLITE3" = "x"],
[
AC_MSG_ERROR([
Specified to not use embedded sqlite3, but no system sqlite3 found.
Need sqlite3 to compile.
])
])
fi
if test "x$with_embedded_lua" == "xno"
then
AX_PROG_LUA([5.3], [], [], [echo "Specified to not use embedded lua, but no system lua found. Need lua to compile."; exit 45;])
AX_LUA_HEADERS([], [echo "Lua headers not found"; exit 45;])
AX_LUA_LIBS([], [echo "Lua libs not found"; exit 45;])
fi
if test "x$with_embedded_lmdb" == "xno"
then
AC_SEARCH_LIBS([mdb_env_set_mapsize], [lmdb],
[test "$ac_cv_search_mdb_env_set_mapsize" = "none required" || LIBS="$LIBS $ac_cv_search_mdb_env_set_mapsize"],
[AC_MSG_FAILURE([No library for mdb_env_set_mapsize (LMDB) found. Please install liblmdb-dev(el).])] )
AC_CHECK_HEADERS([lmdb.h], [], [echo "lmdb.h not found. Please install liblmdb-dev(el)." exit 46;])
fi
if test "x$with_crypto" != "xno" && test "x$enable_embedded_cryptopp" != "xyes"
then
MULE_CHECK_CRYPTOPP([5.1], [], [echo "Crypto++ not found. Please install (cryptopp-devel/libcrypto++-dev) or run configure with --enable-embedded-cryptopp."; exit 44;])
SAVED_LDFLAGS="$LDFLAGS"
SAVED_LIBS="$LIBS"
SAVED_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS $CRYPTOPP_LDFLAGS"
CPPFLAGS="$CPPFLAGS $CRYPTOPP_CPPFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $CRYPTOPP_LIBS $PTHREAD_LIBS"
CRYPTOPP_INC="<$CRYPTOPP_INCLUDE_PREFIX/misc.h>"
AC_MSG_CHECKING([whether Crypto++ contains CryptoPP::AlignedAllocate function])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include $CRYPTOPP_INC],
[CryptoPP::AlignedAllocate(5);])],
[AC_MSG_RESULT([yes])],
[
CRYPTOPP_INC="<$CRYPTOPP_INCLUDE_PREFIX/allocate.h>"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include $CRYPTOPP_INC],
[CryptoPP::AlignedAllocate(5);])],
[AC_MSG_RESULT([yes])],
[
CRYPTOPP_CPPFLAGS="$CRYPTOPP_CPPFLAGS -DCRYPTOPP_DISABLE_ASM"
AC_MSG_RESULT([no])
])
])
LDFLAGS="$SAVED_LDFLAGS"
CPPFLAGS="$SAVED_CPPFLAGS"
LIBS="$SAVED_LIBS"
else
AC_CONFIG_SUBDIRS([cryptoplugin/src])
fi
WITH_FUSEPLUGIN_CXXFLAGS=""
if test "x$with_mountvhd" = "xyes"
then
PKG_CHECK_MODULES([FUSE], [fuse >= 2.8.0], [
AC_SUBST([FUSE_CFLAGS])
AC_SUBST([FUSE_LIBS])
])
WITH_FUSEPLUGIN_CXXFLAGS="-DWITH_FUSEPLUGIN"
fi
AC_SUBST([WITH_FUSEPLUGIN_CXXFLAGS])
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
[test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$LIBS $ac_cv_search_clock_gettime"],
[AC_MSG_FAILURE([No library for clock_gettime found])] )
AC_CONFIG_FILES([Makefile])
AC_OUTPUT