summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac344
1 files changed, 226 insertions, 118 deletions
diff --git a/configure.ac b/configure.ac
index fea617708c..518d105a12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_CANONICAL_HOST
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE(openbsd-malloc,
- AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD. Linux only]))
+ AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD. Linux only. Deprecated: see --with-malloc]))
AC_ARG_ENABLE(static-openssl,
AS_HELP_STRING(--enable-static-openssl, [link against a static openssl library. Requires --with-openssl-dir]))
AC_ARG_ENABLE(static-libevent,
@@ -82,8 +82,6 @@ if test "$enable_memory_sentinels" = "no"; then
[Defined if we're turning off memory safety code to look for bugs])
fi
-AM_CONDITIONAL(USE_OPENBSD_MALLOC, test "x$enable_openbsd_malloc" = "xyes")
-
AC_ARG_ENABLE(asciidoc,
AS_HELP_STRING(--disable-asciidoc, [don't use asciidoc (disables building of manpages)]),
[case "${enableval}" in
@@ -558,71 +556,101 @@ if test "$LIBS" != "$saved_LIBS"; then
have_rt=yes
fi
-AC_SEARCH_LIBS(pthread_create, [pthread])
-AC_SEARCH_LIBS(pthread_detach, [pthread])
+if test "$bwin32" = "false"; then
+ AC_SEARCH_LIBS(pthread_create, [pthread])
+ AC_SEARCH_LIBS(pthread_detach, [pthread])
+fi
AM_CONDITIONAL(THREADS_WIN32, test "$bwin32" = "true")
AM_CONDITIONAL(THREADS_PTHREADS, test "$bwin32" = "false")
AC_CHECK_FUNCS(
- _NSGetEnviron \
+ _NSGetEnviron \
RtlSecureZeroMemory \
SecureZeroMemory \
- accept4 \
- backtrace \
- backtrace_symbols_fd \
+ accept4 \
+ backtrace \
+ backtrace_symbols_fd \
eventfd \
explicit_bzero \
timingsafe_memcmp \
- flock \
- ftime \
- get_current_dir_name \
- getaddrinfo \
- getifaddrs \
- getpass \
- getrlimit \
- gettimeofday \
- gmtime_r \
+ flock \
+ ftime \
+ get_current_dir_name \
+ getaddrinfo \
+ getdelim \
+ getifaddrs \
+ getline \
+ getpass \
+ getrlimit \
+ gettimeofday \
+ gmtime_r \
gnu_get_libc_version \
htonll \
- inet_aton \
- ioctl \
- issetugid \
- llround \
- localtime_r \
- lround \
- mach_approximate_time \
- memmem \
- memset_s \
- mmap \
+ inet_aton \
+ ioctl \
+ issetugid \
+ llround \
+ localtime_r \
+ lround \
+ memmem \
+ memset_s \
+ mmap \
pipe \
pipe2 \
- prctl \
+ prctl \
readpassphrase \
- rint \
- sigaction \
- socketpair \
+ rint \
+ sigaction \
+ socketpair \
statvfs \
- strncasecmp \
- strcasecmp \
- strlcat \
- strlcpy \
+ strncasecmp \
+ strcasecmp \
+ strlcat \
+ strlcpy \
strnlen \
- strptime \
- strtok_r \
- strtoull \
- sysconf \
+ strptime \
+ strtok_r \
+ strtoull \
+ sysconf \
sysctl \
truncate \
- uname \
+ uname \
usleep \
- vasprintf \
+ vasprintf \
_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
+# 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([[
@@ -893,6 +921,7 @@ AC_CHECK_MEMBERS([struct ssl_method_st.get_cipher_by_char], , ,
])
AC_CHECK_FUNCS([ \
+ ERR_load_KDF_strings \
SSL_SESSION_get_master_key \
SSL_get_server_random \
SSL_get_client_ciphers \
@@ -1358,57 +1387,57 @@ dnl Make sure to enable support for large off_t if available.
AC_SYS_LARGEFILE
AC_CHECK_HEADERS([errno.h \
- fcntl.h \
- signal.h \
- string.h \
- sys/capability.h \
- sys/fcntl.h \
- sys/stat.h \
- sys/time.h \
- sys/types.h \
- time.h \
- unistd.h \
- arpa/inet.h \
- crt_externs.h \
- execinfo.h \
- gnu/libc-version.h \
- grp.h \
- ifaddrs.h \
- inttypes.h \
- limits.h \
- linux/types.h \
- machine/limits.h \
- malloc.h \
- malloc/malloc.h \
- malloc_np.h \
- netdb.h \
- netinet/in.h \
- netinet/in6.h \
- pwd.h \
- readpassphrase.h \
- stdatomic.h \
- sys/eventfd.h \
- sys/file.h \
- sys/ioctl.h \
- sys/limits.h \
- sys/mman.h \
- sys/param.h \
- sys/prctl.h \
+ fcntl.h \
+ signal.h \
+ string.h \
+ sys/capability.h \
+ sys/fcntl.h \
+ sys/stat.h \
+ sys/time.h \
+ sys/types.h \
+ time.h \
+ unistd.h \
+ arpa/inet.h \
+ crt_externs.h \
+ execinfo.h \
+ gnu/libc-version.h \
+ grp.h \
+ ifaddrs.h \
+ inttypes.h \
+ limits.h \
+ linux/types.h \
+ machine/limits.h \
+ malloc.h \
+ malloc/malloc.h \
+ malloc_np.h \
+ netdb.h \
+ netinet/in.h \
+ netinet/in6.h \
+ pwd.h \
+ readpassphrase.h \
+ stdatomic.h \
+ sys/eventfd.h \
+ sys/file.h \
+ sys/ioctl.h \
+ sys/limits.h \
+ sys/mman.h \
+ sys/param.h \
+ sys/prctl.h \
sys/random.h \
- sys/resource.h \
- sys/select.h \
- sys/socket.h \
- sys/statvfs.h \
- sys/syscall.h \
- sys/sysctl.h \
- sys/syslimits.h \
- sys/time.h \
- sys/types.h \
- sys/un.h \
- sys/utime.h \
- sys/wait.h \
- syslog.h \
- utime.h])
+ sys/resource.h \
+ sys/select.h \
+ sys/socket.h \
+ sys/statvfs.h \
+ sys/syscall.h \
+ sys/sysctl.h \
+ sys/syslimits.h \
+ sys/time.h \
+ sys/types.h \
+ sys/un.h \
+ sys/utime.h \
+ sys/wait.h \
+ syslog.h \
+ utime.h])
AC_CHECK_HEADERS(sys/param.h)
@@ -1624,6 +1653,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(
@@ -1754,22 +1803,78 @@ if test "$tor_cv_uint8_uchar" = "no"; then
fi
AC_ARG_WITH(tcmalloc,
-AS_HELP_STRING(--with-tcmalloc, [use tcmalloc memory allocation library]),
+AS_HELP_STRING(--with-tcmalloc, [use tcmalloc memory allocation library. Deprecated; see --with-malloc]),
[ tcmalloc=yes ], [ tcmalloc=no ])
-if test "x$tcmalloc" = "xyes"; then
- LDFLAGS="-ltcmalloc $LDFLAGS"
-fi
+default_malloc=system
-using_custom_malloc=no
-if test "x$enable_openbsd_malloc" = "xyes"; then
- using_custom_malloc=yes
+if test "x$enable_openbsd_malloc" = "xyes" ; then
+ AC_MSG_NOTICE([The --enable-openbsd-malloc argument is deprecated; use --with-malloc=openbsd instead.])
+ default_malloc=openbsd
fi
+
if test "x$tcmalloc" = "xyes"; then
- using_custom_malloc=yes
+ AC_MSG_NOTICE([The --with-tcmalloc argument is deprecated; use --with-malloc=tcmalloc instead.])
+ default_malloc=tcmalloc
fi
-if test "$using_custom_malloc" = "no"; then
- AC_CHECK_FUNCS(mallinfo)
+
+AC_ARG_WITH(malloc,
+ AS_HELP_STRING([--with-malloc=[system,jemalloc,tcmalloc,openbsd]],
+ [select special malloc implementation [system]]),
+ [ malloc="$with_malloc" ], [ malloc="$default_malloc" ])
+
+AS_CASE([$malloc],
+ [tcmalloc], [
+ PKG_CHECK_MODULES([TCMALLOC],
+ [libtcmalloc],
+ have_tcmalloc=yes,
+ have_tcmalloc=no)
+
+ if test "x$have_tcmalloc" = "xno" ; then
+ AC_MSG_ERROR([Unable to find tcmalloc requested by --with-malloc.])
+ fi
+
+ CFLAGS="$CFLAGS $TCMALLOC_CFLAGS"
+ LIBS="$TCMALLOC_LIBS $LIBS"
+ ],
+
+ [jemalloc], [
+ PKG_CHECK_MODULES([JEMALLOC],
+ [jemalloc],
+ have_jemalloc=yes,
+ have_jemalloc=no)
+
+ if test "x$have_tcmalloc" = "xno" ; then
+ AC_MSG_ERROR([Unable to find jemalloc requested by --with-malloc.])
+ fi
+
+ CFLAGS="$CFLAGS $JEMALLOC_CFLAGS"
+ LIBS="$JEMALLOC_LIBS $LIBS"
+ using_custom_malloc=yes
+ ],
+
+ [openbsd], [
+ AC_MSG_WARN([The openbsd malloc port is deprecated in Tor 0.3.5 and will be removed in a future version.])
+ enable_openbsd_malloc=yes
+ ],
+
+ [system], [
+ # handle this later, including the jemalloc fallback
+ AC_CHECK_FUNCS(mallinfo)
+ ],
+
+ [AC_MSG_ERROR([--with-malloc=`$with_malloc' not supported, see --help])
+])
+
+AM_CONDITIONAL(USE_OPENBSD_MALLOC, test "x$enable_openbsd_malloc" = "xyes")
+
+if test "$malloc" != "system"; then
+ # Tell the C compiler not to use the system allocator functions.
+ TOR_CHECK_CFLAGS([-fno-builtin-malloc -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-free])
+fi
+if test "$using_custom_malloc" = "yes"; then
+ # Tell the C compiler not to use the system allocator functions.
+ TOR_CHECK_CFLAGS([-fno-builtin-malloc -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-free])
fi
# By default, we're going to assume we don't have mlockall()
@@ -2243,6 +2348,9 @@ dnl -Wthread-safety-precise
if test "$tor_cv_cflags__Woverlength_strings" = "yes"; then
AC_DEFINE([HAVE_CFLAG_WOVERLENGTH_STRINGS], 1, [True if we have -Woverlength-strings])
fi
+ if test "$tor_cv_cflags__warn_unused_const_variable_2" = "yes"; then
+ AC_DEFINE([HAVE_CFLAG_WUNUSED_CONST_VARIABLE], 1, [True if we have -Wunused-const-variable])
+ fi
if test "x$enable_fatal_warnings" = "xyes"; then
# I'd like to use TOR_CHECK_CFLAGS here, but I can't, since the
@@ -2262,20 +2370,20 @@ fi
CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
AC_CONFIG_FILES([
- Doxyfile
- Makefile
- config.rust
- link_rust.sh
- contrib/dist/suse/tor.sh
- contrib/operator-tools/tor.logrotate
- contrib/dist/tor.sh
- contrib/dist/torctl
- contrib/dist/tor.service
- src/config/torrc.sample
- src/config/torrc.minimal
- src/rust/.cargo/config
- scripts/maint/checkOptionDocs.pl
- scripts/maint/updateVersions.pl
+ Doxyfile
+ Makefile
+ config.rust
+ link_rust.sh
+ contrib/dist/suse/tor.sh
+ contrib/operator-tools/tor.logrotate
+ contrib/dist/tor.sh
+ contrib/dist/torctl
+ contrib/dist/tor.service
+ src/config/torrc.sample
+ src/config/torrc.minimal
+ src/rust/.cargo/config
+ scripts/maint/checkOptionDocs.pl
+ scripts/maint/updateVersions.pl
])
if test "x$asciidoc" = "xtrue" && test "$ASCIIDOC" = "none"; then