summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac123
1 files changed, 99 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 91abe7e1e4..5b717d38f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Copyright (c) 2007-2017, The Tor Project, Inc.
dnl See LICENSE for licensing information
AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.2.10-dev])
+AC_INIT([tor],[0.3.3.8-dev])
AC_CONFIG_SRCDIR([src/or/main.c])
AC_CONFIG_MACRO_DIR([m4])
@@ -59,6 +59,8 @@ AC_ARG_ENABLE(rust,
AS_HELP_STRING(--enable-rust, [enable rust integration]))
AC_ARG_ENABLE(cargo-online-mode,
AS_HELP_STRING(--enable-cargo-online-mode, [Allow cargo to make network requests to fetch crates. For builds with rust only.]))
+AC_ARG_ENABLE(restart-debugging,
+ AS_HELP_STRING(--enable-restart-debugging, [Build Tor with support for debugging in-process restart. Developers only.]))
if test "x$enable_coverage" != "xyes" -a "x$enable_asserts_in_tests" = "xno" ; then
AC_MSG_ERROR([Can't disable assertions outside of coverage build])
@@ -107,6 +109,10 @@ AC_ARG_ENABLE(systemd,
* ) AC_MSG_ERROR(bad value for --enable-systemd) ;;
esac], [systemd=auto])
+if test "$enable_restart_debugging" = "yes"; then
+ AC_DEFINE(ENABLE_RESTART_DEBUGGING, 1,
+ [Defined if we're building with support for in-process restart debugging.])
+fi
# systemd support
@@ -204,6 +210,20 @@ if test x$enable_event_tracing_debug = xyes; then
AC_DEFINE([TOR_EVENT_TRACING_ENABLED], [1], [Compile the event tracing instrumentation])
fi
+dnl Enable Android only features.
+AC_ARG_ENABLE(android,
+ AS_HELP_STRING(--enable-android, [build with Android features enabled]))
+AM_CONDITIONAL([USE_ANDROID], [test "x$enable_android" = "xyes"])
+
+if test "x$enable_android" = "xyes"; then
+ AC_DEFINE([USE_ANDROID], [1], [Compile with Android specific features enabled])
+
+ dnl Check if the Android log library is available.
+ AC_CHECK_HEADERS([android/log.h])
+ AC_SEARCH_LIBS(__android_log_write, [log])
+
+fi
+
dnl check for the correct "ar" when cross-compiling.
dnl (AM_PROG_AR was new in automake 1.11.2, which we do not yet require,
dnl so kludge up a replacement for the case where it isn't there yet.)
@@ -259,7 +279,7 @@ fi
AM_CONDITIONAL(USEPYTHON, [test "x$PYTHON" != "x"])
dnl List all external rust crates we depend on here. Include the version
-rust_crates="libc-0.2.22"
+rust_crates="libc-0.2.39"
AC_SUBST(rust_crates)
ifdef([AC_C_FLEXIBLE_ARRAY_MEMBER], [
@@ -379,6 +399,7 @@ AH_BOTTOM([
AM_CONDITIONAL(BUILD_NT_SERVICES, test "x$bwin32" = "xtrue")
+AM_CONDITIONAL(BUILD_LIBTORRUNNER, test "x$bwin32" != "xtrue")
dnl Enable C99 when compiling with MIPSpro
AC_MSG_CHECKING([for MIPSpro compiler])
@@ -421,22 +442,27 @@ if test "x$enable_rust" = "xyes"; then
dnl When we're not allowed to touch the network, we need crate dependencies
dnl locally available.
AC_MSG_CHECKING([rust crate dependencies])
- AC_ARG_VAR([RUST_DEPENDENCIES], [path to directory with local crate mirror])
- if test "x$RUST_DEPENDENCIES" = "x"; then
- RUST_DEPENDENCIES="$srcdir/src/ext/rust/"
- NEED_MOD=1
+ AC_ARG_VAR([TOR_RUST_DEPENDENCIES], [path to directory with local crate mirror])
+ if test "x$TOR_RUST_DEPENDENCIES" = "x"; then
+ TOR_RUST_DEPENDENCIES="${srcdir}/src/ext/rust/crates"
fi
- if test ! -d "$RUST_DEPENDENCIES"; then
- AC_MSG_ERROR([Rust dependency directory $RUST_DEPENDENCIES does not exist. Specify a dependency directory using the RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.])
+ dnl Check whether the path exists before we try to cd into it.
+ if test ! -d "$TOR_RUST_DEPENDENCIES"; then
+ AC_MSG_ERROR([Rust dependency directory $TOR_RUST_DEPENDENCIES does not exist. Specify a dependency directory using the TOR_RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.])
+ ERRORED=1
fi
+ dnl Make the path absolute, since we'll be using it from within a
+ dnl subdirectory.
+ TOR_RUST_DEPENDENCIES=$(cd "$TOR_RUST_DEPENDENCIES" ; pwd)
+
for dep in $rust_crates; do
- if test ! -d "$RUST_DEPENDENCIES"/"$dep"; then
- AC_MSG_ERROR([Failure to find rust dependency $RUST_DEPENDENCIES/$dep. Specify a dependency directory using the RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.])
+ if test ! -d "$TOR_RUST_DEPENDENCIES"/"$dep"; then
+ AC_MSG_ERROR([Failure to find rust dependency $TOR_RUST_DEPENDENCIES/$dep. Specify a dependency directory using the TOR_RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.])
+ ERRORED=1
fi
done
- if test "x$NEED_MOD" = "x1"; then
- dnl When looking for dependencies from cargo, pick right directory
- RUST_DEPENDENCIES="../../src/ext/rust"
+ if test "x$ERRORED" = "x"; then
+ AC_MSG_RESULT([yes])
fi
fi
@@ -452,17 +478,18 @@ if test "x$enable_rust" = "xyes"; then
dnl For now both MSVC and MinGW rust libraries will output static libs with
dnl the MSVC naming convention.
if test "$bwin32" = "true"; then
- TOR_RUST_UTIL_STATIC_NAME=tor_util.lib
+ TOR_RUST_STATIC_NAME=tor_rust.lib
else
- TOR_RUST_UTIL_STATIC_NAME=libtor_util.a
+ TOR_RUST_STATIC_NAME=libtor_rust.a
fi
- AC_SUBST(TOR_RUST_UTIL_STATIC_NAME)
+ AC_SUBST(TOR_RUST_STATIC_NAME)
AC_SUBST(CARGO_ONLINE)
AC_SUBST(RUST_DL)
dnl Let's check the rustc version, too
AC_MSG_CHECKING([rust version])
+ RUSTC_VERSION=`$RUSTC --version`
RUSTC_VERSION_MAJOR=`$RUSTC --version | cut -d ' ' -f 2 | cut -d '.' -f 1`
RUSTC_VERSION_MINOR=`$RUSTC --version | cut -d ' ' -f 2 | cut -d '.' -f 2`
if test "x$RUSTC_VERSION_MAJOR" = "x" -o "x$RUSTC_VERSION_MINOR" = "x"; then
@@ -471,6 +498,7 @@ if test "x$enable_rust" = "xyes"; then
if test "$RUSTC_VERSION_MAJOR" -lt 2 -a "$RUSTC_VERSION_MINOR" -lt 14; then
AC_MSG_ERROR([rustc must be at least version 1.14])
fi
+ AC_MSG_RESULT([$RUSTC_VERSION])
fi
AC_SUBST(TOR_RUST_EXTRA_LIBS)
@@ -547,10 +575,37 @@ AC_CHECK_FUNCS(
_vscprintf
)
-# Apple messed up when they added two functions functions in Sierra: they
+# Apple messed up when they added some functions: they
# forgot to decorate them with appropriate AVAILABLE_MAC_OS_VERSION
-# checks. So we should only probe for those functions if we are sure that we
-# are not targetting OSX 10.11 or earlier.
+# checks.
+
+# We should only probe for these functions if we are sure that we
+# are not targeting OS X 10.9 or earlier.
+AC_MSG_CHECKING([for a pre-Yosemite OS X build target])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __APPLE__
+# include <AvailabilityMacros.h>
+# ifndef MAC_OS_X_VERSION_10_10
+# define MAC_OS_X_VERSION_10_10 101000
+# endif
+# if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
+# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
+# error "Running on Mac OS X 10.9 or earlier"
+# endif
+# endif
+#endif
+]], [[]])],
+ [on_macos_pre_10_10=no ; AC_MSG_RESULT([no])],
+ [on_macos_pre_10_10=yes; AC_MSG_RESULT([yes])])
+
+if test "$on_macos_pre_10_10" = "no"; then
+ AC_CHECK_FUNCS(
+ mach_approximate_time \
+ )
+fi
+
+# We should only probe for these functions if we are sure that we
+# are not targeting OSX 10.11 or earlier.
AC_MSG_CHECKING([for a pre-Sierra OSX build target])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef __APPLE__
@@ -746,7 +801,7 @@ TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI $TOR_LIB_WS
[#include <openssl/ssl.h>],
[struct ssl_method_st; const struct ssl_method_st *TLSv1_1_method(void);],
[TLSv1_1_method();], [],
- [/usr/local/opt/openssl /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])
+ [/usr/local/opt/openssl /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /opt/openssl])
dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
@@ -1004,12 +1059,12 @@ if test "$fragile_hardening" = "yes"; then
TOR_TRY_COMPILE_WITH_CFLAGS([-fsanitize=address], also_link, CFLAGS_ASAN="-fsanitize=address", true)
if test "$tor_cv_cflags__fsanitize_address" = "yes" && test "$tor_can_link__fsanitize_address" != "yes"; then
- AC_MSG_ERROR([The compiler supports -fsanitize=address, but for some reason I was not able to link when using it. Are you missing run-time support? With GCC you need libubsan.so, and with Clang you need libclang_rt.ubsan*])
+ AC_MSG_ERROR([The compiler supports -fsanitize=address, but for some reason I was not able to link when using it. Are you missing run-time support? With GCC you need libubsan.*, and with Clang you need libclang_rt.ubsan*])
fi
TOR_TRY_COMPILE_WITH_CFLAGS([-fsanitize=undefined], also_link, CFLAGS_UBSAN="-fsanitize=undefined", true)
if test "$tor_cv_cflags__fsanitize_address" = "yes" && test "$tor_can_link__fsanitize_address" != "yes"; then
- AC_MSG_ERROR([The compiler supports -fsanitize=undefined, but for some reason I was not able to link when using it. Are you missing run-time support? With GCC you need libasan.so, and with Clang you need libclang_rt.ubsan*])
+ AC_MSG_ERROR([The compiler supports -fsanitize=undefined, but for some reason I was not able to link when using it. Are you missing run-time support? With GCC you need libasan.*, and with Clang you need libclang_rt.ubsan*])
fi
TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
@@ -1250,6 +1305,7 @@ AC_CHECK_HEADERS([assert.h \
pwd.h \
readpassphrase.h \
stdint.h \
+ stdatomic.h \
sys/eventfd.h \
sys/file.h \
sys/ioctl.h \
@@ -1503,6 +1559,26 @@ AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
AC_CHECK_SIZEOF(cell_t)
+# Let's see if stdatomic works. (There are some debian clangs that screw it
+# up; see Tor bug #26779 and debian bug 903709.)
+AC_CACHE_CHECK([whether C11 stdatomic.h actually works],
+ tor_cv_stdatomic_works,
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <stdatomic.h>
+struct x { atomic_size_t y; };
+void try_atomic_init(struct x *xx)
+{
+ atomic_init(&xx->y, 99);
+ atomic_fetch_add(&xx->y, 1);
+}
+]])], [tor_cv_stdatomic_works=yes], [tor_cv_stdatomic_works=no])])
+
+if test "$tor_cv_stdatomic_works" = "yes"; then
+ AC_DEFINE(STDATOMIC_WORKS, 1, [Set to 1 if we can compile a simple stdatomic example.])
+elif test "$ac_cv_header_stdatomic_h" = "yes"; then
+ AC_MSG_WARN([Your compiler provides the stdatomic.h header, but it doesn't seem to work. I'll pretend it isn't there. If you are using Clang on Debian, maybe this is because of https://bugs.debian.org/903709 ])
+fi
+
# Now make sure that NULL can be represented as zero bytes.
AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
[AC_RUN_IFELSE([AC_LANG_SOURCE(
@@ -2011,7 +2087,6 @@ if test "x$enable_gcc_warnings_advisory" != "xno"; then
-Winvalid-source-encoding
-Winvalid-token-paste
-Wknr-promoted-parameter
- -Wlanguage-extension-token
-Wlarge-by-value-copy
-Wliteral-conversion
-Wliteral-range
@@ -2037,7 +2112,7 @@ if test "x$enable_gcc_warnings_advisory" != "xno"; then
-Wnon-literal-null-conversion
-Wnon-pod-varargs
-Wnonportable-cfstrings
- -Wnormalized=id
+ -Wnormalized=nfkc
-Wnull-arithmetic
-Wnull-character
-Wnull-conversion