specify a default for UseGuardFraction in the man page
[tor.git] / configure.ac
blobe411e9ae13797a779dca1e3f0a60b23ae0a828e6
1 dnl Copyright (c) 2001-2004, Roger Dingledine
2 dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
3 dnl Copyright (c) 2007-2015, The Tor Project, Inc.
4 dnl See LICENSE for licensing information
6 AC_INIT([tor],[0.2.6.2-alpha-dev])
7 AC_CONFIG_SRCDIR([src/or/main.c])
8 AC_CONFIG_MACRO_DIR([m4])
9 AM_INIT_AUTOMAKE
10 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11 AC_CONFIG_HEADERS([orconfig.h])
13 AC_CANONICAL_HOST
15 PKG_PROG_PKG_CONFIG
17 if test -f /etc/redhat-release ; then
18   if test -f /usr/kerberos/include ; then
19     CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
20   fi
23 # Not a no-op; we want to make sure that CPPFLAGS is set before we use
24 # the += operator on it in src/or/Makefile.am
25 CPPFLAGS="$CPPFLAGS -I\${top_srcdir}/src/common"
27 #XXXX020 We should make these enabled or not, before 0.2.0.x-final
28 AC_ARG_ENABLE(openbsd-malloc,
29    AS_HELP_STRING(--enable-openbsd-malloc, Use malloc code from openbsd.  Linux only))
30 AC_ARG_ENABLE(instrument-downloads,
31    AS_HELP_STRING(--enable-instrument-downloads, Instrument downloads of directory resources etc.))
32 AC_ARG_ENABLE(static-openssl,
33    AS_HELP_STRING(--enable-static-openssl, Link against a static openssl library. Requires --with-openssl-dir))
34 AC_ARG_ENABLE(static-libevent,
35    AS_HELP_STRING(--enable-static-libevent, Link against a static libevent library. Requires --with-libevent-dir))
36 AC_ARG_ENABLE(static-zlib,
37    AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir))
38 AC_ARG_ENABLE(static-tor,
39    AS_HELP_STRING(--enable-static-tor, Create an entirely static Tor binary. Requires --with-openssl-dir and --with-libevent-dir and --with-zlib-dir))
40 AC_ARG_ENABLE(unittests,
41    AS_HELP_STRING(--disable-unittests, [Don't build unit tests for Tor. Risky!]))
42 AC_ARG_ENABLE(coverage,
43    AS_HELP_STRING(--enable-coverage, [Enable coverage support in the unit-test build]))
44 AC_ARG_ENABLE(system-torrc,
45    AS_HELP_STRING(--disable-system-torrc, [Don't look for a system-wide torrc file]))
47 AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno)
48 AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes)
50 if test "$enable_static_tor" = "yes"; then
51   enable_static_libevent="yes";
52   enable_static_openssl="yes";
53   enable_static_zlib="yes";
54   CFLAGS="$CFLAGS -static"
57 if test "$enable_system_torrc" = "no"; then
58   AC_DEFINE(DISABLE_SYSTEM_TORRC, 1,
59             [Defined if we're not going to look for a torrc in SYSCONF])
62 if test x$enable_buf_freelists = xyes; then
63   AC_DEFINE(ENABLE_BUF_FREELISTS, 1,
64             [Defined if we try to use freelists for buffer RAM chunks])
67 AM_CONDITIONAL(USE_MEMPOOLS, test x$enable_mempools = xyes)
68 if test x$enable_mempools = xyes; then
69   AC_DEFINE(ENABLE_MEMPOOLS, 1,
70             [Defined if we try to use mempools for cells being relayed])
73 AM_CONDITIONAL(USE_OPENBSD_MALLOC, test x$enable_openbsd_malloc = xyes)
74 if test x$enable_instrument_downloads = xyes; then
75   AC_DEFINE(INSTRUMENT_DOWNLOADS, 1,
76             [Defined if we want to keep track of how much of each kind of resource we download.])
79 AC_ARG_ENABLE(transparent,
80      AS_HELP_STRING(--disable-transparent, disable transparent proxy support),
81      [case "${enableval}" in
82         yes) transparent=true ;;
83         no)  transparent=false ;;
84         *) AC_MSG_ERROR(bad value for --enable-transparent) ;;
85       esac], [transparent=true])
87 AC_ARG_ENABLE(asciidoc,
88      AS_HELP_STRING(--disable-asciidoc, don't use asciidoc (disables building of manpages)),
89      [case "${enableval}" in
90         yes) asciidoc=true ;;
91         no)  asciidoc=false ;;
92         *) AC_MSG_ERROR(bad value for --disable-asciidoc) ;;
93       esac], [asciidoc=true])
95 # By default, we're not ready to ship a NAT-PMP aware Tor
96 AC_ARG_ENABLE(nat-pmp,
97      AS_HELP_STRING(--enable-nat-pmp, enable NAT-PMP support),
98      [case "${enableval}" in
99         yes) natpmp=true ;;
100         no)  natpmp=false ;;
101         * ) AC_MSG_ERROR(bad value for --enable-nat-pmp) ;;
102       esac], [natpmp=false])
104 # By default, we're not ready to ship a UPnP aware Tor
105 AC_ARG_ENABLE(upnp,
106      AS_HELP_STRING(--enable-upnp, enable UPnP support),
107      [case "${enableval}" in
108         yes) upnp=true ;;
109         no)  upnp=false ;;
110         * ) AC_MSG_ERROR(bad value for --enable-upnp) ;;
111       esac], [upnp=false])
113 # systemd notify support
114 AC_ARG_ENABLE(systemd,
115       AS_HELP_STRING(--enable-systemd, enable systemd notification support),
116       [case "${enableval}" in
117         yes) systemd=true ;;
118         no)  systemd=false ;;
119         * ) AC_MSG_ERROR(bad value for --enable-systemd) ;;
120       esac], [systemd=auto])
124 # systemd support
125 if test x$enable_systemd = xno ; then
126     have_systemd=no;
127 else
128     PKG_CHECK_MODULES(SYSTEMD,
129         [libsystemd-daemon],
130         have_systemd=yes,
131         have_systemd=no)
132     if test x$have_systemd=xno; then
133         AC_MSG_NOTICE([Okay, checking for systemd a different way...])
134         PKG_CHECK_MODULES(SYSTEMD,
135             [libsystemd],
136             have_systemd=yes,
137             have_systemd=no)
138     fi
141 if test x$have_systemd = xyes; then
142     AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd])
143     TOR_SYSTEMD_CFLAGS="${SYSTEMD_CFLAGS}"
144     TOR_SYSTEMD_LIBS="${SYSTEMD_LIBS}"
145     PKG_CHECK_MODULES(SYSTEMD209, [systemd >= 209],
146          [AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], [])
148 AC_SUBST(TOR_SYSTEMD_CFLAGS)
149 AC_SUBST(TOR_SYSTEMD_LIBS)
151 if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then
152     AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found])
155 case $host in
156    *-*-solaris* )
157      AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
158      ;;
159 esac
161 AC_ARG_ENABLE(gcc-warnings,
162      AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
163 AC_ARG_ENABLE(gcc-warnings-advisory,
164      AS_HELP_STRING(--enable-gcc-warnings-advisory, [enable verbose warnings, excluding -Werror]))
166 dnl Others suggest '/gs /safeseh /nxcompat /dynamicbase' for non-gcc on Windows
167 AC_ARG_ENABLE(gcc-hardening,
168     AS_HELP_STRING(--disable-gcc-hardening, disable compiler security checks))
170 AC_ARG_ENABLE(expensive-hardening,
171     AS_HELP_STRING(--enable-expensive-hardening, enable more expensive compiler hardening; makes Tor slower))
173 dnl Linker hardening options
174 dnl Currently these options are ELF specific - you can't use this with MacOSX
175 AC_ARG_ENABLE(linker-hardening,
176     AS_HELP_STRING(--disable-linker-hardening, disable linker security fixups))
178 AC_ARG_ENABLE(local-appdata,
179    AS_HELP_STRING(--enable-local-appdata, default to host local application data paths on Windows))
180 if test "$enable_local_appdata" = "yes"; then
181   AC_DEFINE(ENABLE_LOCAL_APPDATA, 1,
182             [Defined if we default to host local appdata paths on Windows])
185 # Tor2web mode flag
186 AC_ARG_ENABLE(tor2web-mode,
187      AS_HELP_STRING(--enable-tor2web-mode, support tor2web non-anonymous mode),
188 [if test x$enableval = xyes; then
189     CFLAGS="$CFLAGS -D ENABLE_TOR2WEB_MODE=1"
190 fi])
192 AC_ARG_ENABLE(bufferevents,
193      AS_HELP_STRING(--enable-bufferevents, use Libevent's buffered IO.))
195 AC_ARG_ENABLE(tool-name-check,
196      AS_HELP_STRING(--disable-tool-name-check, check for sanely named toolchain when cross-compiling))
198 AC_ARG_ENABLE(seccomp,
199      AS_HELP_STRING(--disable-seccomp, do not attempt to use libseccomp))
201 AC_ARG_ENABLE(libscrypt,
202      AS_HELP_STRING(--disable-libscrypt, do not attempt to use libscrypt))
204 dnl check for the correct "ar" when cross-compiling
205 AN_MAKEVAR([AR], [AC_PROG_AR])
206 AN_PROGRAM([ar], [AC_PROG_AR])
207 AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL([AR], [ar], [ar])])
208 AC_PROG_AR
210 dnl Check whether the above macro has settled for a simply named tool even
211 dnl though we're cross compiling. We must do this before running AC_PROG_CC,
212 dnl because that will find any cc on the system, not only the cross-compiler,
213 dnl and then verify that a binary built with this compiler runs on the
214 dnl build system. It will then come to the false conclusion that we're not
215 dnl cross-compiling.
216 if test x$enable_tool_name_check != xno; then
217     if test x$ac_tool_warned = xyes; then
218         AC_MSG_ERROR([We are cross compiling but could not find a properly named toolchain. Do you have your cross-compiling toolchain in PATH? (You can --disable-tool-name-check to ignore this.)])
219         elif test "x$ac_ct_AR" != x -a x$cross_compiling = xmaybe; then
220                 AC_MSG_ERROR([We think we are cross compiling but could not find a properly named toolchain. Do you have your cross-compiling toolchain in PATH? (You can --disable-tool-name-check to ignore this.)])
221         fi
224 AC_PROG_CC
225 AC_PROG_CPP
226 AC_PROG_MAKE_SET
227 AC_PROG_RANLIB
229 dnl autoconf 2.59 appears not to support AC_PROG_SED
230 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
232 dnl check for asciidoc and a2x
233 AC_PATH_PROG([ASCIIDOC], [asciidoc], none)
234 AC_PATH_PROGS([A2X], [a2x a2x.py], none)
236 AM_CONDITIONAL(USE_ASCIIDOC, test x$asciidoc = xtrue)
238 AM_CONDITIONAL(USE_FW_HELPER, test x$natpmp = xtrue || test x$upnp = xtrue)
239 AM_CONDITIONAL(NAT_PMP, test x$natpmp = xtrue)
240 AM_CONDITIONAL(MINIUPNPC, test x$upnp = xtrue)
241 AM_PROG_CC_C_O
242 AC_PROG_CC_C99
244 AC_ARG_VAR([PYTHON], [path to Python binary])
245 AC_CHECK_PROGS(PYTHON, [python python2 python2.7 python3 python3.3])
246 if test "x$PYTHON" = "x"; then
247   AC_MSG_WARN([Python unavailable; some tests will not be run.])
249 AM_CONDITIONAL(USEPYTHON, [test "x$PYTHON" != "x"])
251 ifdef([AC_C_FLEXIBLE_ARRAY_MEMBER], [
252 AC_C_FLEXIBLE_ARRAY_MEMBER
253 ], [
254  dnl Maybe we've got an old autoconf...
255  AC_CACHE_CHECK([for flexible array members],
256      tor_cv_c_flexarray,
257      [AC_COMPILE_IFELSE(
258        AC_LANG_PROGRAM([
259  struct abc { int a; char b[]; };
260 ], [
261  struct abc *def = malloc(sizeof(struct abc)+sizeof(char));
262  def->b[0] = 33;
264   [tor_cv_c_flexarray=yes],
265   [tor_cv_c_flexarray=no])])
266  if test $tor_cv_flexarray = yes ; then
267    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
268  else
269    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
270  fi
273 AC_CACHE_CHECK([for working C99 mid-block declaration syntax],
274       tor_cv_c_c99_decl,
275       [AC_COMPILE_IFELSE(
276          [AC_LANG_PROGRAM([], [int x; x = 3; int y; y = 4 + x;])],
277          [tor_cv_c_c99_decl=yes],
278          [tor_cv_c_c99_decl=no] )])
279 if test "$tor_cv_c_c99_decl" != "yes"; then
280   AC_MSG_ERROR([Your compiler doesn't support c99 mid-block declarations. This is required as of Tor 0.2.6.x])
283 AC_CACHE_CHECK([for working C99 designated initializers],
284       tor_cv_c_c99_designated_init,
285       [AC_COMPILE_IFELSE(
286          [AC_LANG_PROGRAM([struct s { int a; int b; };],
287                [[ struct s ss = { .b = 5, .a = 6 }; ]])],
288          [tor_cv_c_c99_designated_init=yes],
289          [tor_cv_c_c99_designated_init=no] )])
291 if test "$tor_cv_c_c99_designated_init" != "yes"; then
292   AC_MSG_ERROR([Your compiler doesn't support c99 designated initializers. This is required as of Tor 0.2.6.x])
295 AC_PATH_PROG([SHA1SUM], [sha1sum], none)
296 AC_PATH_PROG([OPENSSL], [openssl], none)
298 TORUSER=_tor
299 AC_ARG_WITH(tor-user,
300         [  --with-tor-user=NAME    Specify username for tor daemon ],
301         [
302            TORUSER=$withval
303         ]
305 AC_SUBST(TORUSER)
307 TORGROUP=_tor
308 AC_ARG_WITH(tor-group,
309         [  --with-tor-group=NAME   Specify group name for tor daemon ],
310         [
311            TORGROUP=$withval
312         ]
314 AC_SUBST(TORGROUP)
317 dnl If _WIN32 is defined and non-zero, we are building for win32
318 AC_MSG_CHECKING([for win32])
319 AC_RUN_IFELSE([AC_LANG_SOURCE([
320 int main(int c, char **v) {
321 #ifdef _WIN32
322 #if _WIN32
323   return 0;
324 #else
325   return 1;
326 #endif
327 #else
328   return 2;
329 #endif
330 }])],
331 bwin32=true; AC_MSG_RESULT([yes]),
332 bwin32=false; AC_MSG_RESULT([no]),
333 bwin32=cross; AC_MSG_RESULT([cross])
336 if test "$bwin32" = cross; then
337 AC_MSG_CHECKING([for win32 (cross)])
338 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
339 #ifdef _WIN32
340 int main(int c, char **v) {return 0;}
341 #else
342 #error
343 int main(int c, char **v) {return x(y);}
344 #endif
345 ])],
346 bwin32=true; AC_MSG_RESULT([yes]),
347 bwin32=false; AC_MSG_RESULT([no]))
350 AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
352 dnl Enable C99 when compiling with MIPSpro
353 AC_MSG_CHECKING([for MIPSpro compiler])
354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [
355 #if (defined(__sgi) && defined(_COMPILER_VERSION))
356 #error
357   return x(y);
358 #endif
359 ])],
360 bmipspro=false; AC_MSG_RESULT(no),
361 bmipspro=true; AC_MSG_RESULT(yes))
363 if test "$bmipspro" = true; then
364   CFLAGS="$CFLAGS -c99"
367 AC_C_BIGENDIAN
369 AC_SEARCH_LIBS(socket, [socket network])
370 AC_SEARCH_LIBS(gethostbyname, [nsl])
371 AC_SEARCH_LIBS(dlopen, [dl])
372 AC_SEARCH_LIBS(inet_aton, [resolv])
373 saved_LIBS="$LIBS"
374 AC_SEARCH_LIBS([clock_gettime], [rt])
375 if test "$LIBS" != "$saved_LIBS"; then
376    # Looks like we need -lrt for clock_gettime().
377    have_rt=yes
380 AC_SEARCH_LIBS(pthread_create, [pthread])
381 AC_SEARCH_LIBS(pthread_detach, [pthread])
383 AM_CONDITIONAL(THREADS_WIN32, test "$bwin32" = "true")
384 AM_CONDITIONAL(THREADS_PTHREADS, test "$bwin32" = "false")
386 dnl -------------------------------------------------------------------
387 dnl Check for functions before libevent, since libevent-1.2 apparently
388 dnl exports strlcpy without defining it in a header.
390 AC_CHECK_FUNCS(
391         _NSGetEnviron \
392         accept4 \
393         backtrace \
394         backtrace_symbols_fd \
395         clock_gettime \
396         eventfd \
397         flock \
398         ftime \
399         getaddrinfo \
400         getifaddrs \
401         getrlimit \
402         gettimeofday \
403         gmtime_r \
404         inet_aton \
405         ioctl \
406         issetugid \
407         llround \
408         localtime_r \
409         lround \
410         memmem \
411         pipe \
412         pipe2 \
413         prctl \
414         rint \
415         sigaction \
416         socketpair \
417         strlcat \
418         strlcpy \
419         strnlen \
420         strptime \
421         strtok_r \
422         strtoull \
423         sysconf \
424         sysctl \
425         uname \
426         usleep \
427         vasprintf \
428         _vscprintf
431 if test "$bwin32" != true; then
432   AC_CHECK_HEADERS(pthread.h)
433   AC_CHECK_FUNCS(pthread_create)
436 dnl ------------------------------------------------------
437 dnl Where do you live, libevent?  And how do we call you?
439 if test "$bwin32" = true; then
440   TOR_LIB_WS32=-lws2_32
441   TOR_LIB_IPHLPAPI=-liphlpapi
442   # Some of the cargo-cults recommend -lwsock32 as well, but I don't
443   # think it's actually necessary.
444   TOR_LIB_GDI=-lgdi32
445 else
446   TOR_LIB_WS32=
447   TOR_LIB_GDI=
449 AC_SUBST(TOR_LIB_WS32)
450 AC_SUBST(TOR_LIB_GDI)
451 AC_SUBST(TOR_LIB_IPHLPAPI)
453 dnl We need to do this before we try our disgusting hack below.
454 AC_CHECK_HEADERS([sys/types.h])
456 dnl This is a disgusting hack so we safely include older libevent headers.
457 AC_CHECK_TYPE(u_int64_t, unsigned long long)
458 AC_CHECK_TYPE(u_int32_t, unsigned long)
459 AC_CHECK_TYPE(u_int16_t, unsigned short)
460 AC_CHECK_TYPE(u_int8_t, unsigned char)
462 tor_libevent_pkg_redhat="libevent"
463 tor_libevent_pkg_debian="libevent-dev"
464 tor_libevent_devpkg_redhat="libevent-devel"
465 tor_libevent_devpkg_debian="libevent-dev"
467 dnl On Gnu/Linux or any place we require it, we'll add librt to the Libevent
468 dnl linking for static builds.
469 STATIC_LIBEVENT_FLAGS=""
470 if test "$enable_static_libevent" = "yes"; then
471     if test "$have_rt" = yes; then
472       STATIC_LIBEVENT_FLAGS=" -lrt "
473     fi
476 TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32], [
477 #ifdef _WIN32
478 #include <winsock2.h>
479 #endif
480 #include <stdlib.h>
481 #include <sys/time.h>
482 #include <sys/types.h>
483 #include <event.h>], [
484 #ifdef _WIN32
485 #include <winsock2.h>
486 #endif
487 void exit(int); void *event_init(void);],
488     [
489 #ifdef _WIN32
490 {WSADATA d; WSAStartup(0x101,&d); }
491 #endif
492 event_init(); exit(0);
493 ], [--with-libevent-dir], [/opt/libevent])
495 dnl Now check for particular libevent functions.
496 save_LIBS="$LIBS"
497 save_LDFLAGS="$LDFLAGS"
498 save_CPPFLAGS="$CPPFLAGS"
499 LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS"
500 LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS"
501 CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS"
502 AC_CHECK_FUNCS([event_get_version \
503                 event_get_version_number \
504                 event_get_method \
505                 event_set_log_callback \
506                 evutil_secure_rng_set_urandom_device_file \
507                 evutil_secure_rng_init \
508                 event_base_loopexit])
509 AC_CHECK_MEMBERS([struct event.min_heap_idx], , ,
510 [#include <event.h>
513 AC_CHECK_HEADERS(event2/event.h event2/dns.h event2/bufferevent_ssl.h)
515 LIBS="$save_LIBS"
516 LDFLAGS="$save_LDFLAGS"
517 CPPFLAGS="$save_CPPFLAGS"
520 AM_CONDITIONAL(USE_EXTERNAL_EVDNS, test x$ac_cv_header_event2_dns_h = xyes)
522 if test "$enable_static_libevent" = "yes"; then
523    if test "$tor_cv_library_libevent_dir" = "(system)"; then
524      AC_MSG_ERROR("You must specify an explicit --with-libevent-dir=x option when using --enable-static-libevent")
525    else
526      TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a $STATIC_LIBEVENT_FLAGS"
527    fi
528 else
529      TOR_LIBEVENT_LIBS="-levent"
532 dnl This isn't the best test for Libevent 2.0.3-alpha.  Once it's released,
533 dnl we can do much better.
534 if test "$enable_bufferevents" = "yes" ; then
535   if test "$ac_cv_header_event2_bufferevent_ssl_h" != "yes" ; then
536     AC_MSG_ERROR([You've asked for bufferevent support, but you're using a version of Libevent without SSL support.  This won't work.  We need Libevent 2.0.8-rc or later, and you don't seem to even have Libevent 2.0.3-alpha.])
537   else
539     CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent"
541     # Check for the right version.  First see if version detection works.
542     AC_MSG_CHECKING([whether we can detect the Libevent version])
543     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
544 #include <event2/event.h>
545 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 10
546 #error
547 int x = y(zz);
548 #else
549 int x = 1;
550 #endif
551   ])], [event_version_number_works=yes; AC_MSG_RESULT([yes]) ],
552      [event_version_number_works=no;  AC_MSG_RESULT([no])])
553     if test "$event_version_number_works" != 'yes'; then
554       AC_MSG_WARN([Version detection on Libevent seems broken.  Your Libevent installation is probably screwed up or very old.])
555     else
556       AC_MSG_CHECKING([whether Libevent is new enough for bufferevents])
557       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
558 #include <event2/event.h>
559 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000d00
560 #error
561 int x = y(zz);
562 #else
563 int x = 1;
564 #endif
565    ])], [ AC_MSG_RESULT([yes]) ],
566       [ AC_MSG_RESULT([no])
567         AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents.  We require 2.0.13-stable or later]) ] )
568     fi
569   fi
572 LIBS="$save_LIBS"
573 LDFLAGS="$save_LDFLAGS"
574 CPPFLAGS="$save_CPPFLAGS"
576 AM_CONDITIONAL(USE_BUFFEREVENTS, test "$enable_bufferevents" = "yes")
577 if test "$enable_bufferevents" = "yes"; then
578   AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
579   if test "$enable_static_libevent" = "yes"; then
580     TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent_openssl.a $TOR_LIBEVENT_LIBS"
581   else
582     TOR_LIBEVENT_LIBS="-levent_openssl $TOR_LIBEVENT_LIBS"
583   fi
585 AC_SUBST(TOR_LIBEVENT_LIBS)
587 dnl ------------------------------------------------------
588 dnl Where do you live, libm?
590 dnl On some platforms (Haiku/BeOS) the math library is
591 dnl part of libroot. In which case don't link against lm
592 TOR_LIB_MATH=""
593 save_LIBS="$LIBS"
594 AC_SEARCH_LIBS(pow, [m], , AC_MSG_ERROR([Could not find pow in libm or libc.]))
595 if test "$ac_cv_search_pow" != "none required"; then
596     TOR_LIB_MATH="$ac_cv_search_pow"
598 LIBS="$save_LIBS"
599 AC_SUBST(TOR_LIB_MATH)
601 dnl ------------------------------------------------------
602 dnl Where do you live, openssl?  And how do we call you?
604 tor_openssl_pkg_redhat="openssl"
605 tor_openssl_pkg_debian="libssl-dev"
606 tor_openssl_devpkg_redhat="openssl-devel"
607 tor_openssl_devpkg_debian="libssl-dev"
609 ALT_openssl_WITHVAL=""
610 AC_ARG_WITH(ssl-dir,
611   [  --with-ssl-dir=PATH    Obsolete alias for --with-openssl-dir ],
612   [
613       if test "x$withval" != xno && test "x$withval" != "x" ; then
614          ALT_openssl_WITHVAL="$withval"
615       fi
616   ])
618 TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
619     [#include <openssl/rand.h>],
620     [void RAND_add(const void *buf, int num, double entropy);],
621     [RAND_add((void*)0,0,0); exit(0);], [],
622     [/usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])
624 dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
626 if test "$enable_static_openssl" = "yes"; then
627    if test "$tor_cv_library_openssl_dir" = "(system)"; then
628      AC_MSG_ERROR("You must specify an explicit --with-openssl-dir=x option when using --enable-static-openssl")
629    else
630      TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libssl.a $TOR_LIBDIR_openssl/libcrypto.a"
631    fi
632 else
633      TOR_OPENSSL_LIBS="-lssl -lcrypto"
635 AC_SUBST(TOR_OPENSSL_LIBS)
637 AC_CHECK_MEMBERS([struct ssl_method_st.get_cipher_by_char], , ,
638 [#include <openssl/ssl.h>
641 dnl ------------------------------------------------------
642 dnl Where do you live, zlib?  And how do we call you?
644 tor_zlib_pkg_redhat="zlib"
645 tor_zlib_pkg_debian="zlib1g"
646 tor_zlib_devpkg_redhat="zlib-devel"
647 tor_zlib_devpkg_debian="zlib1g-dev"
649 TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
650     [#include <zlib.h>],
651     [const char * zlibVersion(void);],
652     [zlibVersion(); exit(0);], [--with-zlib-dir],
653     [/opt/zlib])
655 if test "$enable_static_zlib" = "yes"; then
656    if test "$tor_cv_library_zlib_dir" = "(system)"; then
657      AC_MSG_ERROR("You must specify an explicit --with-zlib-dir=x option when
658  using --enable-static-zlib")
659    else
660      TOR_ZLIB_LIBS="$TOR_LIBDIR_zlib/libz.a"
661    fi
662 else
663      TOR_ZLIB_LIBS="-lz"
665 AC_SUBST(TOR_ZLIB_LIBS)
667 dnl ---------------------------------------------------------------------
668 dnl Now that we know about our major libraries, we can check for compiler
669 dnl and linker hardening options.  We need to do this with the libraries known,
670 dnl since sometimes the linker will like an option but not be willing to
671 dnl use it with a build of a library.
673 all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent"
674 all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_SYSTEMD_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI"
676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
677 #if !defined(__clang__)
678 #error
679 #endif])], have_clang=yes, have_clang=no)
681 if test x$enable_gcc_hardening != xno; then
682     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
683     if test x$have_clang = xyes; then
684         TOR_CHECK_CFLAGS(-Qunused-arguments)
685     fi
686     TOR_CHECK_CFLAGS(-fstack-protector-all, also_link)
687     AS_VAR_PUSHDEF([can_compile], [tor_cv_cflags_-fstack-protector-all])
688     AS_VAR_PUSHDEF([can_link], [tor_can_link_-fstack-protector-all])
689 m4_ifdef([AS_VAR_IF],[
690     AS_VAR_IF(can_compile, [yes],
691         AS_VAR_IF(can_link, [yes],
692                   [],
693                   AC_MSG_ERROR([We tried to build with stack protection; it looks like your compiler supports it but your libc does not provide it. Are you missing libssp? (You can --disable-gcc-hardening to ignore this error.)]))
694         )])
695     AS_VAR_POPDEF([can_link])
696     AS_VAR_POPDEF([can_compile])
697     TOR_CHECK_CFLAGS(-Wstack-protector)
698     TOR_CHECK_CFLAGS(-fwrapv)
699     TOR_CHECK_CFLAGS(--param ssp-buffer-size=1)
700     if test "$bwin32" = "false"; then
701        TOR_CHECK_CFLAGS(-fPIE)
702        TOR_CHECK_LDFLAGS(-pie, "$all_ldflags_for_check", "$all_libs_for_check")
703     fi
706 if test x$enable_expensive_hardening = xyes ; then
707    TOR_CHECK_CFLAGS([-fsanitize=address])
708    TOR_CHECK_CFLAGS([-fsanitize=undefined])
709    TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
712 if test x$enable_linker_hardening != xno; then
713     TOR_CHECK_LDFLAGS(-z relro -z now, "$all_ldflags_for_check", "$all_libs_for_check")
716 # For backtrace support
717 TOR_CHECK_LDFLAGS(-rdynamic)
719 dnl ------------------------------------------------------
720 dnl Now see if we have a -fomit-frame-pointer compiler option.
722 saved_CFLAGS="$CFLAGS"
723 TOR_CHECK_CFLAGS(-fomit-frame-pointer)
724 F_OMIT_FRAME_POINTER=''
725 if test "$saved_CFLAGS" != "$CFLAGS"; then
726   if test x$enable_expensive_hardening != xyes ; then
727     F_OMIT_FRAME_POINTER='-fomit-frame-pointer'
728   fi
730 CFLAGS="$saved_CFLAGS"
731 AC_SUBST(F_OMIT_FRAME_POINTER)
733 dnl ------------------------------------------------------
734 dnl If we are adding -fomit-frame-pointer (or if the compiler's doing it
735 dnl for us, as GCC 4.6 and later do at many optimization levels), then
736 dnl we should try to add -fasynchronous-unwind-tables so that our backtrace
737 dnl code will work.
738 TOR_CHECK_CFLAGS(-fasynchronous-unwind-tables)
740 dnl ------------------------------------------------------
741 dnl Where do you live, libnatpmp?  And how do we call you?
742 dnl There are no packages for Debian or Redhat as of this patch
744 if test "$natpmp" = "true"; then
745     AC_DEFINE(NAT_PMP, 1, [Define to 1 if we are building with nat-pmp.])
746     TOR_SEARCH_LIBRARY(libnatpmp, $trylibnatpmpdir, [-lnatpmp $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
747         [#include <natpmp.h>],
748         [#ifdef _WIN32
749          #define STATICLIB
750          #endif
751          #include <natpmp.h>],
752         [   int r;
753             natpmp_t natpmp;
754             natpmpresp_t response;
755             r = initnatpmp(&natpmp, 0, 0);],
756             [printf("initnatpmp() returned %d (%s)\n", r, r?"FAILED":"SUCCESS");
757             exit(0);],
758         [--with-libnatpmp-dir],
759         [/usr/lib/])
763 dnl ------------------------------------------------------
764 dnl Where do you live, libminiupnpc?  And how do we call you?
765 dnl There are no packages for Debian or Redhat as of this patch
767 if test "$upnp" = "true"; then
768     AC_DEFINE(MINIUPNPC, 1, [Define to 1 if we are building with UPnP.])
770     dnl Before we call TOR_SEARCH_LIBRARY we'll do a quick compile test
771     dnl to see if we have miniupnpc-1.5 or -1.6
772     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
773         [upnpDiscover(1, 0, 0, 0);exit(0);])],[miniupnpc15="true"],[miniupnpc15="false"])
775     if test "$miniupnpc15" = "true" ; then
776         AC_DEFINE([MINIUPNPC15],[1],[libminiupnpc version 1.5 found])
777         TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
778             [#include <miniupnpc/miniwget.h>
779              #include <miniupnpc/miniupnpc.h>
780              #include <miniupnpc/upnpcommands.h>],
781             [void upnpDiscover(int delay, const char * multicastif,
782              const char * minissdpdsock, int sameport);],
783             [upnpDiscover(1, 0, 0, 0); exit(0);],
784             [--with-libminiupnpc-dir],
785             [/usr/lib/])
786     else
787         TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
788             [#include <miniupnpc/miniwget.h>
789              #include <miniupnpc/miniupnpc.h>
790              #include <miniupnpc/upnpcommands.h>],
791             [void upnpDiscover(int delay, const char * multicastif,
792              const char * minissdpdsock, int sameport, int ipv6, int * error);],
793             [upnpDiscover(1, 0, 0, 0, 0, 0); exit(0);],
794             [--with-libminiupnpc-dir],
795             [/usr/lib/])
796     fi
799 dnl ============================================================
800 dnl Check for libseccomp
802 if test "x$enable_seccomp" != "xno"; then
803   AC_CHECK_HEADERS([seccomp.h])
804   AC_SEARCH_LIBS(seccomp_init, [seccomp])
807 dnl ============================================================
808 dnl Check for libscrypt
810 if test "x$enable_libscrypt" != "xno"; then
811   AC_CHECK_HEADERS([libscrypt.h])
812   AC_SEARCH_LIBS(libscrypt_scrypt, [scrypt])
815 dnl ============================================================
816 dnl We need an implementation of curve25519.
818 dnl set these defaults.
819 build_curve25519_donna=no
820 build_curve25519_donna_c64=no
821 use_curve25519_donna=no
822 use_curve25519_nacl=no
823 CURVE25519_LIBS=
825 dnl The best choice is using curve25519-donna-c64, but that requires
826 dnl that we
827 AC_CACHE_CHECK([whether we can use curve25519-donna-c64],
828   tor_cv_can_use_curve25519_donna_c64,
829   [AC_RUN_IFELSE(
830     [AC_LANG_PROGRAM([dnl
831       #include <stdint.h>
832       typedef unsigned uint128_t __attribute__((mode(TI)));
833   int func(uint64_t a, uint64_t b) {
834            uint128_t c = ((uint128_t)a) * b;
835            int ok = ((uint64_t)(c>>96)) == 522859 &&
836              (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
837                  (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
838                  (((uint64_t)(c))&0xffffffffL) == 0;
839            return ok;
840       }
841   ], [dnl
842     int ok = func( ((uint64_t)2000000000) * 1000000000,
843                    ((uint64_t)1234567890) << 24);
844         return !ok;
845       ])],
846   [tor_cv_can_use_curve25519_donna_c64=yes],
847       [tor_cv_can_use_curve25519_donna_c64=no],
848   [AC_LINK_IFELSE(
849         [AC_LANG_PROGRAM([dnl
850       #include <stdint.h>
851       typedef unsigned uint128_t __attribute__((mode(TI)));
852   int func(uint64_t a, uint64_t b) {
853            uint128_t c = ((uint128_t)a) * b;
854            int ok = ((uint64_t)(c>>96)) == 522859 &&
855              (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
856                  (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
857                  (((uint64_t)(c))&0xffffffffL) == 0;
858            return ok;
859       }
860   ], [dnl
861     int ok = func( ((uint64_t)2000000000) * 1000000000,
862                  ((uint64_t)1234567890) << 24);
863         return !ok;
864       ])],
865           [tor_cv_can_use_curve25519_donna_c64=cross],
866       [tor_cv_can_use_curve25519_donna_c64=no])])])
868 AC_CHECK_HEADERS([crypto_scalarmult_curve25519.h \
869                   nacl/crypto_scalarmult_curve25519.h])
871 AC_CACHE_CHECK([for nacl compiled with a fast curve25519 implementation],
872   tor_cv_can_use_curve25519_nacl,
873   [tor_saved_LIBS="$LIBS"
874    LIBS="$LIBS -lnacl"
875    AC_LINK_IFELSE(
876      [AC_LANG_PROGRAM([dnl
877        #ifdef HAVE_CRYPTO_SCALARMULT_CURVE25519_H
878        #include <crypto_scalarmult_curve25519.h>
879    #elif defined(HAVE_NACL_CRYPTO_SCALARMULT_CURVE25519_H)
880    #include <nacl/crypto_scalarmult_curve25519.h>
881    #endif
882        #ifdef crypto_scalarmult_curve25519_ref_BYTES
883    #error Hey, this is the reference implementation! That's not fast.
884    #endif
885      ], [
886    unsigned char *a, *b, *c; crypto_scalarmult_curve25519(a,b,c);
887      ])], [tor_cv_can_use_curve25519_nacl=yes],
888      [tor_cv_can_use_curve25519_nacl=no])
889    LIBS="$tor_saved_LIBS" ])
891  dnl Okay, now we need to figure out which one to actually use. Fall back
892  dnl to curve25519-donna.c
894  if test x$tor_cv_can_use_curve25519_donna_c64 != xno; then
895    build_curve25519_donna_c64=yes
896    use_curve25519_donna=yes
897  elif test x$tor_cv_can_use_curve25519_nacl = xyes; then
898    use_curve25519_nacl=yes
899    CURVE25519_LIBS=-lnacl
900  else
901    build_curve25519_donna=yes
902    use_curve25519_donna=yes
903  fi
905 if test x$use_curve25519_donna = xyes; then
906   AC_DEFINE(USE_CURVE25519_DONNA, 1,
907             [Defined if we should use an internal curve25519_donna{,_c64} implementation])
909 if test x$use_curve25519_nacl = xyes; then
910   AC_DEFINE(USE_CURVE25519_NACL, 1,
911             [Defined if we should use a curve25519 from nacl])
913 AM_CONDITIONAL(BUILD_CURVE25519_DONNA, test x$build_curve25519_donna = xyes)
914 AM_CONDITIONAL(BUILD_CURVE25519_DONNA_C64, test x$build_curve25519_donna_c64 = xyes)
915 AC_SUBST(CURVE25519_LIBS)
917 dnl Make sure to enable support for large off_t if available.
918 AC_SYS_LARGEFILE
920 AC_CHECK_HEADERS(
921         assert.h \
922         errno.h \
923         fcntl.h \
924         signal.h \
925         string.h \
926         sys/fcntl.h \
927         sys/stat.h \
928         sys/time.h \
929         sys/types.h \
930         time.h \
931         unistd.h
932  , , AC_MSG_WARN(Some headers were not found, compilation may fail.  If compilation succeeds, please send your orconfig.h to the developers so we can fix this warning.))
934 dnl These headers are not essential
936 AC_CHECK_HEADERS(
937         arpa/inet.h \
938         crt_externs.h \
939         execinfo.h \
940         grp.h \
941         ifaddrs.h \
942         inttypes.h \
943         limits.h \
944         linux/types.h \
945         machine/limits.h \
946         malloc.h \
947         malloc/malloc.h \
948         malloc_np.h \
949         netdb.h \
950         netinet/in.h \
951         netinet/in6.h \
952         pwd.h \
953         stdint.h \
954         sys/eventfd.h \
955         sys/file.h \
956         sys/ioctl.h \
957         sys/limits.h \
958         sys/mman.h \
959         sys/param.h \
960         sys/prctl.h \
961         sys/resource.h \
962         sys/select.h \
963         sys/socket.h \
964         sys/sysctl.h \
965         sys/syslimits.h \
966         sys/time.h \
967         sys/types.h \
968         sys/un.h \
969         sys/utime.h \
970         sys/wait.h \
971         syslog.h \
972         utime.h
975 AC_CHECK_HEADERS(sys/param.h)
977 AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
978 [#ifdef HAVE_SYS_TYPES_H
979 #include <sys/types.h>
980 #endif
981 #ifdef HAVE_SYS_SOCKET_H
982 #include <sys/socket.h>
983 #endif])
984 AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0,
985 [#ifdef HAVE_SYS_TYPES_H
986 #include <sys/types.h>
987 #endif
988 #ifdef HAVE_SYS_SOCKET_H
989 #include <sys/socket.h>
990 #endif
991 #ifdef HAVE_NET_IF_H
992 #include <net/if.h>
993 #endif])
995 AC_CHECK_HEADERS(linux/if.h,[],[],
997 #ifdef HAVE_SYS_SOCKET_H
998 #include <sys/socket.h>
999 #endif
1002 AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
1003         linux_netfilter_ipv4=1, linux_netfilter_ipv4=0,
1004 [#ifdef HAVE_SYS_TYPES_H
1005 #include <sys/types.h>
1006 #endif
1007 #ifdef HAVE_SYS_SOCKET_H
1008 #include <sys/socket.h>
1009 #endif
1010 #ifdef HAVE_LIMITS_H
1011 #include <limits.h>
1012 #endif
1013 #ifdef HAVE_LINUX_TYPES_H
1014 #include <linux/types.h>
1015 #endif
1016 #ifdef HAVE_NETINET_IN6_H
1017 #include <netinet/in6.h>
1018 #endif
1019 #ifdef HAVE_NETINET_IN_H
1020 #include <netinet/in.h>
1021 #endif])
1023 AC_CHECK_HEADERS(linux/netfilter_ipv6/ip6_tables.h,
1024         linux_netfilter_ipv6_ip6_tables=1, linux_netfilter_ipv6_ip6_tables=0,
1025 [#ifdef HAVE_SYS_TYPES_H
1026 #include <sys/types.h>
1027 #endif
1028 #ifdef HAVE_SYS_SOCKET_H
1029 #include <sys/socket.h>
1030 #endif
1031 #ifdef HAVE_LIMITS_H
1032 #include <limits.h>
1033 #endif
1034 #ifdef HAVE_LINUX_TYPES_H
1035 #include <linux/types.h>
1036 #endif
1037 #ifdef HAVE_NETINET_IN6_H
1038 #include <netinet/in6.h>
1039 #endif
1040 #ifdef HAVE_NETINET_IN_H
1041 #include <netinet/in.h>
1042 #endif
1043 #ifdef HAVE_LINUX_IF_H
1044 #include <linux/if.h>
1045 #endif])
1047 if test x$transparent = xtrue ; then
1048    transparent_ok=0
1049    if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then
1050      transparent_ok=1
1051    fi
1052    if test x$linux_netfilter_ipv4 = x1 ; then
1053      transparent_ok=1
1054    fi
1055    if test x$linux_netfilter_ipv6_ip6_tables = x1 ; then
1056      transparent_ok=1
1057    fi
1058    if test x$transparent_ok = x1 ; then
1059      AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
1060      case $host in
1061        *-*-openbsd* | *-*-bitrig*)
1062          AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
1063      esac
1064    else
1065      AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
1066    fi
1069 AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
1070 [#ifdef HAVE_SYS_TYPES_H
1071 #include <sys/types.h>
1072 #endif
1073 #ifdef HAVE_SYS_TIME_H
1074 #include <sys/time.h>
1075 #endif])
1077 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
1078 dnl Watch out.
1080 AC_CHECK_SIZEOF(int8_t)
1081 AC_CHECK_SIZEOF(int16_t)
1082 AC_CHECK_SIZEOF(int32_t)
1083 AC_CHECK_SIZEOF(int64_t)
1084 AC_CHECK_SIZEOF(uint8_t)
1085 AC_CHECK_SIZEOF(uint16_t)
1086 AC_CHECK_SIZEOF(uint32_t)
1087 AC_CHECK_SIZEOF(uint64_t)
1088 AC_CHECK_SIZEOF(intptr_t)
1089 AC_CHECK_SIZEOF(uintptr_t)
1091 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
1093 AC_CHECK_SIZEOF(char)
1094 AC_CHECK_SIZEOF(short)
1095 AC_CHECK_SIZEOF(int)
1096 AC_CHECK_SIZEOF(long)
1097 AC_CHECK_SIZEOF(long long)
1098 AC_CHECK_SIZEOF(__int64)
1099 AC_CHECK_SIZEOF(void *)
1100 AC_CHECK_SIZEOF(time_t)
1101 AC_CHECK_SIZEOF(size_t)
1102 AC_CHECK_SIZEOF(pid_t)
1104 AC_CHECK_TYPES([uint, u_char, ssize_t])
1106 AC_PC_FROM_UCONTEXT([/bin/true])
1108 dnl used to include sockaddr_storage, but everybody has that.
1109 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
1110 [#ifdef HAVE_SYS_TYPES_H
1111 #include <sys/types.h>
1112 #endif
1113 #ifdef HAVE_NETINET_IN_H
1114 #include <netinet/in.h>
1115 #endif
1116 #ifdef HAVE_NETINET_IN6_H
1117 #include <netinet/in6.h>
1118 #endif
1119 #ifdef HAVE_SYS_SOCKET_H
1120 #include <sys/socket.h>
1121 #endif
1122 #ifdef _WIN32
1123 #define _WIN32_WINNT 0x0501
1124 #define WIN32_LEAN_AND_MEAN
1125 #if defined(_MSC_VER) && (_MSC_VER < 1300)
1126 #include <winsock.h>
1127 #else
1128 #include <winsock2.h>
1129 #include <ws2tcpip.h>
1130 #endif
1131 #endif
1133 AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
1134 [#ifdef HAVE_SYS_TYPES_H
1135 #include <sys/types.h>
1136 #endif
1137 #ifdef HAVE_NETINET_IN_H
1138 #include <netinet/in.h>
1139 #endif
1140 #ifdef HAVE_NETINET_IN6_H
1141 #include <netinet/in6.h>
1142 #endif
1143 #ifdef HAVE_SYS_SOCKET_H
1144 #include <sys/socket.h>
1145 #endif
1146 #ifdef _WIN32
1147 #define _WIN32_WINNT 0x0501
1148 #define WIN32_LEAN_AND_MEAN
1149 #if defined(_MSC_VER) && (_MSC_VER < 1300)
1150 #include <winsock.h>
1151 #else
1152 #include <winsock2.h>
1153 #include <ws2tcpip.h>
1154 #endif
1155 #endif
1158 AC_CHECK_TYPES([rlim_t], , ,
1159 [#ifdef HAVE_SYS_TYPES_H
1160 #include <sys/types.h>
1161 #endif
1162 #ifdef HAVE_SYS_TIME_H
1163 #include <sys/time.h>
1164 #endif
1165 #ifdef HAVE_SYS_RESOURCE_H
1166 #include <sys/resource.h>
1167 #endif
1170 AX_CHECK_SIGN([time_t],
1171        [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
1172        [ : ], [
1173 #ifdef HAVE_SYS_TYPES_H
1174 #include <sys/types.h>
1175 #endif
1176 #ifdef HAVE_SYS_TIME_H
1177 #include <sys/time.h>
1178 #endif
1179 #ifdef HAVE_TIME_H
1180 #include <time.h>
1181 #endif
1184 if test "$ax_cv_decl_time_t_signed" = no; then
1185   AC_MSG_WARN([You have an unsigned time_t; some things will probably break. Please tell the Tor developers about your interesting platform.])
1188 AX_CHECK_SIGN([size_t],
1189        [ tor_cv_size_t_signed=yes ],
1190        [ tor_cv_size_t_signed=no ], [
1191 #ifdef HAVE_SYS_TYPES_H
1192 #include <sys/types.h>
1193 #endif
1196 if test "$ax_cv_decl_size_t_signed" = yes; then
1197   AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
1200 AX_CHECK_SIGN([enum always],
1201        [ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
1202        [ : ], [
1203  enum always { AAA, BBB, CCC };
1206 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
1207 #ifdef HAVE_SYS_SOCKET_H
1208 #include <sys/socket.h>
1209 #endif
1212 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
1214 AC_CHECK_SIZEOF(cell_t)
1216 # Now make sure that NULL can be represented as zero bytes.
1217 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
1218 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1219 [[#include <stdlib.h>
1220 #include <string.h>
1221 #include <stdio.h>
1222 #ifdef HAVE_STDDEF_H
1223 #include <stddef.h>
1224 #endif
1225 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
1226 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
1227        [tor_cv_null_is_zero=yes],
1228        [tor_cv_null_is_zero=no],
1229        [tor_cv_null_is_zero=cross])])
1231 if test "$tor_cv_null_is_zero" = cross ; then
1232   # Cross-compiling; let's hope that the target isn't raving mad.
1233   AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
1236 if test "$tor_cv_null_is_zero" != no; then
1237   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
1238             [Define to 1 iff memset(0) sets pointers to NULL])
1241 AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
1242 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1243 [[#include <stdlib.h>
1244 #include <string.h>
1245 #include <stdio.h>
1246 #ifdef HAVE_STDDEF_H
1247 #include <stddef.h>
1248 #endif
1249 int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
1250 return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
1251        [tor_cv_dbl0_is_zero=yes],
1252        [tor_cv_dbl0_is_zero=no],
1253        [tor_cv_dbl0_is_zero=cross])])
1255 if test "$tor_cv_dbl0_is_zero" = cross ; then
1256   # Cross-compiling; let's hope that the target isn't raving mad.
1257   AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
1260 if test "$tor_cv_dbl0_is_zero" != no; then
1261   AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
1262             [Define to 1 iff memset(0) sets doubles to 0.0])
1265 # And what happens when we malloc zero?
1266 AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
1267 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1268 [[#include <stdlib.h>
1269 #include <string.h>
1270 #include <stdio.h>
1271 #ifdef HAVE_STDDEF_H
1272 #include <stddef.h>
1273 #endif
1274 int main () { return malloc(0)?0:1; }]])],
1275        [tor_cv_malloc_zero_works=yes],
1276        [tor_cv_malloc_zero_works=no],
1277        [tor_cv_malloc_zero_works=cross])])
1279 if test "$tor_cv_malloc_zero_works" = cross; then
1280   # Cross-compiling; let's hope that the target isn't raving mad.
1281   AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
1284 if test "$tor_cv_malloc_zero_works" = yes; then
1285   AC_DEFINE([MALLOC_ZERO_WORKS], 1,
1286             [Define to 1 iff malloc(0) returns a pointer])
1289 # whether we seem to be in a 2s-complement world.
1290 AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
1291 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1292 [[int main () { int problem = ((-99) != (~99)+1);
1293 return problem ? 1 : 0; }]])],
1294        [tor_cv_twos_complement=yes],
1295        [tor_cv_twos_complement=no],
1296        [tor_cv_twos_complement=cross])])
1298 if test "$tor_cv_twos_complement" = cross ; then
1299   # Cross-compiling; let's hope that the target isn't raving mad.
1300   AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
1303 if test "$tor_cv_twos_complement" != no ; then
1304   AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
1305             [Define to 1 iff we represent negative integers with two's complement])
1308 # What does shifting a negative value do?
1309 AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
1310 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1311 [[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
1312        [tor_cv_sign_extend=yes],
1313        [tor_cv_sign_extend=no],
1314        [tor_cv_sign_extend=cross])])
1316 if test "$tor_cv_sign_extend" = cross ; then
1317   # Cross-compiling; let's hope that the target isn't raving mad.
1318   AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
1321 if test "$tor_cv_sign_extend" != no ; then
1322   AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
1323             [Define to 1 iff right-shifting a negative value performs sign-extension])
1326 # Whether we should use the dmalloc memory allocation debugging library.
1327 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
1328 AC_ARG_WITH(dmalloc,
1329 [  --with-dmalloc          Use debug memory allocation library. ],
1330 [if [[ "$withval" = "yes" ]]; then
1331   dmalloc=1
1332   AC_MSG_RESULT(yes)
1333 else
1334   dmalloc=1
1335   AC_MSG_RESULT(no)
1336 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
1339 if [[ $dmalloc -eq 1 ]]; then
1340   AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
1341   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
1342   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
1343   AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
1346 AC_ARG_WITH(tcmalloc,
1347 [  --with-tcmalloc         Use tcmalloc memory allocation library. ],
1348 [ tcmalloc=yes ], [ tcmalloc=no ])
1350 if test x$tcmalloc = xyes ; then
1351    LDFLAGS="-ltcmalloc $LDFLAGS"
1354 using_custom_malloc=no
1355 if test x$enable_openbsd_malloc = xyes ; then
1356    using_custom_malloc=yes
1358 if test x$tcmalloc = xyes ; then
1359    using_custom_malloc=yes
1361 if test $using_custom_malloc = no ; then
1362    AC_CHECK_FUNCS(mallinfo)
1365 # By default, we're going to assume we don't have mlockall()
1366 # bionic and other platforms have various broken mlockall subsystems.
1367 # Some systems don't have a working mlockall, some aren't linkable,
1368 # and some have it but don't declare it.
1369 AC_CHECK_FUNCS(mlockall)
1370 AC_CHECK_DECLS([mlockall], , , [
1371 #ifdef HAVE_SYS_MMAN_H
1372 #include <sys/mman.h>
1373 #endif])
1375 # Allow user to specify an alternate syslog facility
1376 AC_ARG_WITH(syslog-facility,
1377 [  --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
1378 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
1379 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
1380 AC_SUBST(LOGFACILITY)
1382 # Check if we have getresuid and getresgid
1383 AC_CHECK_FUNCS(getresuid getresgid)
1385 # Check for gethostbyname_r in all its glorious incompatible versions.
1386 #   (This logic is based on that in Python's configure.in)
1387 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1388   [Define this if you have any gethostbyname_r()])
1390 AC_CHECK_FUNC(gethostbyname_r, [
1391   AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
1392   OLD_CFLAGS=$CFLAGS
1393   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1394   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1395 #include <netdb.h>
1396   ], [[
1397     char *cp1, *cp2;
1398     struct hostent *h1, *h2;
1399     int i1, i2;
1400     (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
1401   ]])],[
1402     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1403     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1404      [Define this if gethostbyname_r takes 6 arguments])
1405     AC_MSG_RESULT(6)
1406   ], [
1407     AC_TRY_COMPILE([
1408 #include <netdb.h>
1409     ], [
1410       char *cp1, *cp2;
1411       struct hostent *h1;
1412       int i1, i2;
1413       (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
1414     ], [
1415       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1416       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1417         [Define this if gethostbyname_r takes 5 arguments])
1418       AC_MSG_RESULT(5)
1419    ], [
1420       AC_TRY_COMPILE([
1421 #include <netdb.h>
1422      ], [
1423        char *cp1;
1424        struct hostent *h1;
1425        struct hostent_data hd;
1426        (void) gethostbyname_r(cp1,h1,&hd);
1427      ], [
1428        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1429        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1430          [Define this if gethostbyname_r takes 3 arguments])
1431        AC_MSG_RESULT(3)
1432      ], [
1433        AC_MSG_RESULT(0)
1434      ])
1435   ])
1436  ])
1437  CFLAGS=$OLD_CFLAGS
1440 AC_CACHE_CHECK([whether the C compiler supports __func__],
1441   tor_cv_have_func_macro,
1442   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1443 #include <stdio.h>
1444 int main(int c, char **v) { puts(__func__); }])],
1445   tor_cv_have_func_macro=yes,
1446   tor_cv_have_func_macro=no))
1448 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
1449   tor_cv_have_FUNC_macro,
1450   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1451 #include <stdio.h>
1452 int main(int c, char **v) { puts(__FUNC__); }])],
1453   tor_cv_have_FUNC_macro=yes,
1454   tor_cv_have_FUNC_macro=no))
1456 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
1457   tor_cv_have_FUNCTION_macro,
1458   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1459 #include <stdio.h>
1460 int main(int c, char **v) { puts(__FUNCTION__); }])],
1461   tor_cv_have_FUNCTION_macro=yes,
1462   tor_cv_have_FUNCTION_macro=no))
1464 AC_CACHE_CHECK([whether we have extern char **environ already declared],
1465   tor_cv_have_environ_declared,
1466   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1467 /* We define _GNU_SOURCE here because it is also defined in compat.c.
1468  * Without it environ doesn't get declared. */
1469 #define _GNU_SOURCE
1470 #ifdef HAVE_UNISTD_H
1471 #include <unistd.h>
1472 #endif
1473 #include <stdlib.h>
1474 int main(int c, char **v) { char **t = environ; }])],
1475   tor_cv_have_environ_declared=yes,
1476   tor_cv_have_environ_declared=no))
1478 if test "$tor_cv_have_func_macro" = 'yes'; then
1479   AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
1482 if test "$tor_cv_have_FUNC_macro" = 'yes'; then
1483   AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
1486 if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
1487   AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
1488            [Defined if the compiler supports __FUNCTION__])
1491 if test "$tor_cv_have_environ_declared" = 'yes'; then
1492   AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
1493            [Defined if we have extern char **environ already declared])
1496 # $prefix stores the value of the --prefix command line option, or
1497 # NONE if the option wasn't set.  In the case that it wasn't set, make
1498 # it be the default, so that we can use it to expand directories now.
1499 if test "x$prefix" = "xNONE"; then
1500   prefix=$ac_default_prefix
1503 # and similarly for $exec_prefix
1504 if test "x$exec_prefix" = "xNONE"; then
1505   exec_prefix=$prefix
1508 if test "x$BUILDDIR" = "x"; then
1509   BUILDDIR=`pwd`
1511 AC_SUBST(BUILDDIR)
1512 AH_TEMPLATE([BUILDDIR],[tor's build directory])
1513 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
1515 if test "x$CONFDIR" = "x"; then
1516   CONFDIR=`eval echo $sysconfdir/tor`
1518 AC_SUBST(CONFDIR)
1519 AH_TEMPLATE([CONFDIR],[tor's configuration directory])
1520 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
1522 BINDIR=`eval echo $bindir`
1523 AC_SUBST(BINDIR)
1524 LOCALSTATEDIR=`eval echo $localstatedir`
1525 AC_SUBST(LOCALSTATEDIR)
1527 if test "$bwin32" = true; then
1528   # Test if the linker supports the --nxcompat and --dynamicbase options
1529   # for Windows
1530   save_LDFLAGS="$LDFLAGS"
1531   LDFLAGS="-Wl,--nxcompat -Wl,--dynamicbase"
1532   AC_MSG_CHECKING([whether the linker supports DllCharacteristics])
1533   AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1534     [AC_MSG_RESULT([yes])]
1535     [save_LDFLAGS="$save_LDFLAGS $LDFLAGS"],
1536     [AC_MSG_RESULT([no])]
1537   )
1538   LDFLAGS="$save_LDFLAGS"
1541 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
1542 # than autoconf's macros like.
1543 if test "$GCC" = yes; then
1544   # Disable GCC's strict aliasing checks.  They are an hours-to-debug
1545   # accident waiting to happen.
1546   CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
1547 else
1548   # Override optimization level for non-gcc compilers
1549   CFLAGS="$CFLAGS -O"
1550   enable_gcc_warnings=no
1551   enable_gcc_warnings_advisory=no
1554 # OS X Lion started deprecating the system openssl. Let's just disable
1555 # all deprecation warnings on OS X. Also, to potentially make the binary
1556 # a little smaller, let's enable dead_strip.
1557 case "$host_os" in
1559  darwin*)
1560     CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1561     LDFLAGS="$LDFLAGS -dead_strip" ;;
1562 esac
1564 # Add some more warnings which we use in development but not in the
1565 # released versions.  (Some relevant gcc versions can't handle these.)
1566 if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xyes; then
1568   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1569 #if !defined(__GNUC__) || (__GNUC__ < 4)
1570 #error
1571 #endif])], have_gcc4=yes, have_gcc4=no)
1573   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1574 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
1575 #error
1576 #endif])], have_gcc42=yes, have_gcc42=no)
1578   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1579 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
1580 #error
1581 #endif])], have_gcc43=yes, have_gcc43=no)
1583   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1584 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
1585 #error
1586 #endif])], have_gcc46=yes, have_gcc46=no)
1589   save_CFLAGS="$CFLAGS"
1590   CFLAGS="$CFLAGS -Wshorten-64-to-32"
1591   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
1592                     have_shorten64_flag=no)
1593   CFLAGS="$save_CFLAGS"
1595   case $host in
1596     *-*-openbsd* | *-*-bitrig*)
1597       # Some OpenBSD versions (like 4.8) have -Wsystem-headers by default.
1598       # That's fine, except that the headers don't pass -Wredundant-decls.
1599       # Therefore, let's disable -Wsystem-headers when we're building
1600       # with maximal warnings on OpenBSD.
1601       CFLAGS="$CFLAGS -Wno-system-headers" ;;
1602   esac
1604   CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith"
1605   CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
1606   CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
1607   CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
1608   CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
1610   if test x$enable_gcc_warnings = xyes; then
1611     CFLAGS="$CFLAGS -Werror"
1612   fi
1614   # Disabled, so we can use mallinfo(): -Waggregate-return
1616   if test x$have_gcc4 = xyes ; then
1617     # These warnings break gcc 3.3.5 and work on gcc 4.0.2
1618     CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wold-style-definition"
1619   fi
1621   if test x$have_gcc42 = xyes ; then
1622     # These warnings break gcc 4.0.2 and work on gcc 4.2
1623     # XXXX020 See if any of these work with earlier versions.
1624     CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
1626     # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
1627   fi
1629   if test x$have_gcc42 = xyes && test x$have_clang = xno; then
1630     # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
1631     CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
1632   fi
1634   if test x$have_gcc43 = xyes ; then
1635     # These warnings break gcc 4.2 and work on gcc 4.3
1636     # XXXX020 See if any of these work with earlier versions.
1637     CFLAGS="$CFLAGS -Wextra -Warray-bounds"
1638   fi
1640   if test x$have_gcc46 = xyes ; then
1641     # This warning was added in gcc 4.3, but it appears to generate
1642     # spurious warnings in gcc 4.4.  I don't know if it works in 4.5.
1643     CFLAGS="$CFLAGS -Wlogical-op"
1644   fi
1646   if test x$have_shorten64_flag = xyes ; then
1647     CFLAGS="$CFLAGS -Wshorten-64-to-32"
1648   fi
1652 ##This will break the world on some 64-bit architectures
1653 # CFLAGS="$CFLAGS -Winline"
1656 if test "$enable_coverage" = yes && test "$have_clang" = "no"; then
1657    case "$host_os" in
1658     darwin*)
1659       AC_MSG_WARN([Tried to enable coverage on OSX without using the clang compiler. This might not work! If coverage fails, use CC=clang when configuring with --enable-profiling.])
1660    esac
1663 CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
1665 AC_CONFIG_FILES([
1666         Doxyfile
1667         Makefile
1668         contrib/dist/suse/tor.sh
1669         contrib/operator-tools/tor.logrotate
1670         contrib/dist/tor.sh
1671         contrib/dist/torctl
1672         contrib/dist/tor.service
1673         src/config/torrc.sample
1674         src/config/torrc.minimal
1677 if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
1678   regular_mans="doc/tor doc/tor-gencert doc/tor-resolve doc/torify"
1679   for file in $regular_mans ; do
1680     if ! [[ -f "$srcdir/$file.1.in" ]] || ! [[ -f "$srcdir/$file.html.in" ]] ; then
1681       echo "==================================";
1682       echo;
1683       echo "Building Tor has failed since manpages cannot be built.";
1684       echo;
1685       echo "You need asciidoc installed to be able to build the manpages.";
1686       echo "To build without manpages, use the --disable-asciidoc argument";
1687       echo "when calling configure.";
1688       echo;
1689       echo "==================================";
1690       exit 1;
1691     fi
1692   done
1695 AC_OUTPUT
1697 if test -x /usr/bin/perl && test -x ./scripts/maint/updateVersions.pl ; then
1698   ./scripts/maint/updateVersions.pl