Prop210: Add schedules for simultaneous client consensus downloads
[tor.git] / configure.ac
blob4dbb3c4fa4ccf00fec9a2db2bfcd97995dcb07a3
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.8.0-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 AM_CONDITIONAL(USE_OPENBSD_MALLOC, test x$enable_openbsd_malloc = xyes)
63 if test x$enable_instrument_downloads = xyes; then
64   AC_DEFINE(INSTRUMENT_DOWNLOADS, 1,
65             [Defined if we want to keep track of how much of each kind of resource we download.])
68 AC_ARG_ENABLE(transparent,
69      AS_HELP_STRING(--disable-transparent, [disable transparent proxy support]),
70      [case "${enableval}" in
71         yes) transparent=true ;;
72         no)  transparent=false ;;
73         *) AC_MSG_ERROR(bad value for --enable-transparent) ;;
74       esac], [transparent=true])
76 AC_ARG_ENABLE(asciidoc,
77      AS_HELP_STRING(--disable-asciidoc, [don't use asciidoc (disables building of manpages)]),
78      [case "${enableval}" in
79         yes) asciidoc=true ;;
80         no)  asciidoc=false ;;
81         *) AC_MSG_ERROR(bad value for --disable-asciidoc) ;;
82       esac], [asciidoc=true])
84 # systemd notify support
85 AC_ARG_ENABLE(systemd,
86       AS_HELP_STRING(--enable-systemd, [enable systemd notification support]),
87       [case "${enableval}" in
88         yes) systemd=true ;;
89         no)  systemd=false ;;
90         * ) AC_MSG_ERROR(bad value for --enable-systemd) ;;
91       esac], [systemd=auto])
95 # systemd support
96 if test x$enable_systemd = xno ; then
97     have_systemd=no;
98 else
99     PKG_CHECK_MODULES(SYSTEMD,
100         [libsystemd-daemon],
101         have_systemd=yes,
102         have_systemd=no)
103     if test x$have_systemd=xno; then
104         AC_MSG_NOTICE([Okay, checking for systemd a different way...])
105         PKG_CHECK_MODULES(SYSTEMD,
106             [libsystemd],
107             have_systemd=yes,
108             have_systemd=no)
109     fi
112 if test x$have_systemd = xyes; then
113     AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd])
114     TOR_SYSTEMD_CFLAGS="${SYSTEMD_CFLAGS}"
115     TOR_SYSTEMD_LIBS="${SYSTEMD_LIBS}"
116     PKG_CHECK_MODULES(LIBSYSTEMD209, [libsystemd >= 209],
117          [AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], [])
119 AC_SUBST(TOR_SYSTEMD_CFLAGS)
120 AC_SUBST(TOR_SYSTEMD_LIBS)
122 if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then
123     AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found])
126 case $host in
127    *-*-solaris* )
128      AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
129      ;;
130 esac
132 AC_ARG_ENABLE(gcc-warnings,
133      AS_HELP_STRING(--enable-gcc-warnings, [enable verbose warnings]))
134 AC_ARG_ENABLE(gcc-warnings-advisory,
135      AS_HELP_STRING(--enable-gcc-warnings-advisory, [enable verbose warnings, excluding -Werror]))
137 dnl Others suggest '/gs /safeseh /nxcompat /dynamicbase' for non-gcc on Windows
138 AC_ARG_ENABLE(gcc-hardening,
139     AS_HELP_STRING(--disable-gcc-hardening, [disable compiler security checks]))
141 AC_ARG_ENABLE(expensive-hardening,
142     AS_HELP_STRING(--enable-expensive-hardening, [enable more expensive compiler hardening; makes Tor slower]))
144 dnl Linker hardening options
145 dnl Currently these options are ELF specific - you can't use this with MacOSX
146 AC_ARG_ENABLE(linker-hardening,
147     AS_HELP_STRING(--disable-linker-hardening, [disable linker security fixups]))
149 AC_ARG_ENABLE(local-appdata,
150    AS_HELP_STRING(--enable-local-appdata, [default to host local application data paths on Windows]))
151 if test "$enable_local_appdata" = "yes"; then
152   AC_DEFINE(ENABLE_LOCAL_APPDATA, 1,
153             [Defined if we default to host local appdata paths on Windows])
156 # Tor2web mode flag
157 AC_ARG_ENABLE(tor2web-mode,
158      AS_HELP_STRING(--enable-tor2web-mode, [support tor2web non-anonymous mode]),
159 [if test x$enableval = xyes; then
160     CFLAGS="$CFLAGS -D ENABLE_TOR2WEB_MODE=1"
161 fi])
163 AC_ARG_ENABLE(bufferevents,
164      AS_HELP_STRING(--enable-bufferevents, [use Libevent's buffered IO]))
166 AC_ARG_ENABLE(tool-name-check,
167      AS_HELP_STRING(--disable-tool-name-check, [check for sanely named toolchain when cross-compiling]))
169 AC_ARG_ENABLE(seccomp,
170      AS_HELP_STRING(--disable-seccomp, [do not attempt to use libseccomp]))
172 AC_ARG_ENABLE(libscrypt,
173      AS_HELP_STRING(--disable-libscrypt, [do not attempt to use libscrypt]))
175 dnl check for the correct "ar" when cross-compiling
176 AN_MAKEVAR([AR], [AC_PROG_AR])
177 AN_PROGRAM([ar], [AC_PROG_AR])
178 AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL([AR], [ar], [ar])])
179 AC_PROG_AR
181 dnl Check whether the above macro has settled for a simply named tool even
182 dnl though we're cross compiling. We must do this before running AC_PROG_CC,
183 dnl because that will find any cc on the system, not only the cross-compiler,
184 dnl and then verify that a binary built with this compiler runs on the
185 dnl build system. It will then come to the false conclusion that we're not
186 dnl cross-compiling.
187 if test x$enable_tool_name_check != xno; then
188     if test x$ac_tool_warned = xyes; then
189         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.)])
190         elif test "x$ac_ct_AR" != x -a x$cross_compiling = xmaybe; then
191                 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.)])
192         fi
195 AC_PROG_CC
196 AC_PROG_CPP
197 AC_PROG_MAKE_SET
198 AC_PROG_RANLIB
200 AC_PATH_PROG([PERL], [perl])
202 dnl autoconf 2.59 appears not to support AC_PROG_SED
203 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
205 dnl check for asciidoc and a2x
206 AC_PATH_PROG([ASCIIDOC], [asciidoc], none)
207 AC_PATH_PROGS([A2X], [a2x a2x.py], none)
209 AM_CONDITIONAL(USE_ASCIIDOC, test x$asciidoc = xtrue)
211 AM_CONDITIONAL(USE_FW_HELPER, test x$natpmp = xtrue || test x$upnp = xtrue)
212 AM_CONDITIONAL(NAT_PMP, test x$natpmp = xtrue)
213 AM_CONDITIONAL(MINIUPNPC, test x$upnp = xtrue)
214 AM_PROG_CC_C_O
215 AC_PROG_CC_C99
217 AC_ARG_VAR([PYTHON], [path to Python binary])
218 AC_CHECK_PROGS(PYTHON, [python python2 python2.7 python3 python3.3])
219 if test "x$PYTHON" = "x"; then
220   AC_MSG_WARN([Python unavailable; some tests will not be run.])
222 AM_CONDITIONAL(USEPYTHON, [test "x$PYTHON" != "x"])
224 ifdef([AC_C_FLEXIBLE_ARRAY_MEMBER], [
225 AC_C_FLEXIBLE_ARRAY_MEMBER
226 ], [
227  dnl Maybe we've got an old autoconf...
228  AC_CACHE_CHECK([for flexible array members],
229      tor_cv_c_flexarray,
230      [AC_COMPILE_IFELSE(
231        AC_LANG_PROGRAM([
232  struct abc { int a; char b[]; };
233 ], [
234  struct abc *def = malloc(sizeof(struct abc)+sizeof(char));
235  def->b[0] = 33;
237   [tor_cv_c_flexarray=yes],
238   [tor_cv_c_flexarray=no])])
239  if test $tor_cv_flexarray = yes ; then
240    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
241  else
242    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
243  fi
246 AC_CACHE_CHECK([for working C99 mid-block declaration syntax],
247       tor_cv_c_c99_decl,
248       [AC_COMPILE_IFELSE(
249          [AC_LANG_PROGRAM([], [int x; x = 3; int y; y = 4 + x;])],
250          [tor_cv_c_c99_decl=yes],
251          [tor_cv_c_c99_decl=no] )])
252 if test "$tor_cv_c_c99_decl" != "yes"; then
253   AC_MSG_ERROR([Your compiler doesn't support c99 mid-block declarations. This is required as of Tor 0.2.6.x])
256 AC_CACHE_CHECK([for working C99 designated initializers],
257       tor_cv_c_c99_designated_init,
258       [AC_COMPILE_IFELSE(
259          [AC_LANG_PROGRAM([struct s { int a; int b; };],
260                [[ struct s ss = { .b = 5, .a = 6 }; ]])],
261          [tor_cv_c_c99_designated_init=yes],
262          [tor_cv_c_c99_designated_init=no] )])
264 if test "$tor_cv_c_c99_designated_init" != "yes"; then
265   AC_MSG_ERROR([Your compiler doesn't support c99 designated initializers. This is required as of Tor 0.2.6.x])
268 TORUSER=_tor
269 AC_ARG_WITH(tor-user,
270         AS_HELP_STRING(--with-tor-user=NAME, [specify username for tor daemon]),
271         [
272            TORUSER=$withval
273         ]
275 AC_SUBST(TORUSER)
277 TORGROUP=_tor
278 AC_ARG_WITH(tor-group,
279         AS_HELP_STRING(--with-tor-group=NAME, [specify group name for tor daemon]),
280         [
281            TORGROUP=$withval
282         ]
284 AC_SUBST(TORGROUP)
287 dnl If _WIN32 is defined and non-zero, we are building for win32
288 AC_MSG_CHECKING([for win32])
289 AC_RUN_IFELSE([AC_LANG_SOURCE([
290 int main(int c, char **v) {
291 #ifdef _WIN32
292 #if _WIN32
293   return 0;
294 #else
295   return 1;
296 #endif
297 #else
298   return 2;
299 #endif
300 }])],
301 bwin32=true; AC_MSG_RESULT([yes]),
302 bwin32=false; AC_MSG_RESULT([no]),
303 bwin32=cross; AC_MSG_RESULT([cross])
306 if test "$bwin32" = cross; then
307 AC_MSG_CHECKING([for win32 (cross)])
308 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
309 #ifdef _WIN32
310 int main(int c, char **v) {return 0;}
311 #else
312 #error
313 int main(int c, char **v) {return x(y);}
314 #endif
315 ])],
316 bwin32=true; AC_MSG_RESULT([yes]),
317 bwin32=false; AC_MSG_RESULT([no]))
320 AH_BOTTOM([
321 #ifdef _WIN32
322 /* Defined to access windows functions and definitions for >=WinXP */
323 # ifndef WINVER
324 #  define WINVER 0x0501
325 # endif
327 /* Defined to access _other_ windows functions and definitions for >=WinXP */
328 # ifndef _WIN32_WINNT
329 #  define _WIN32_WINNT 0x0501
330 # endif
332 /* Defined to avoid including some windows headers as part of Windows.h */
333 # ifndef WIN32_LEAN_AND_MEAN
334 #  define WIN32_LEAN_AND_MEAN 1
335 # endif
336 #endif
340 AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
342 dnl Enable C99 when compiling with MIPSpro
343 AC_MSG_CHECKING([for MIPSpro compiler])
344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [
345 #if (defined(__sgi) && defined(_COMPILER_VERSION))
346 #error
347   return x(y);
348 #endif
349 ])],
350 bmipspro=false; AC_MSG_RESULT(no),
351 bmipspro=true; AC_MSG_RESULT(yes))
353 if test "$bmipspro" = true; then
354   CFLAGS="$CFLAGS -c99"
357 AC_C_BIGENDIAN
359 AC_SEARCH_LIBS(socket, [socket network])
360 AC_SEARCH_LIBS(gethostbyname, [nsl])
361 AC_SEARCH_LIBS(dlopen, [dl])
362 AC_SEARCH_LIBS(inet_aton, [resolv])
363 AC_SEARCH_LIBS(backtrace, [execinfo])
364 saved_LIBS="$LIBS"
365 AC_SEARCH_LIBS([clock_gettime], [rt])
366 if test "$LIBS" != "$saved_LIBS"; then
367    # Looks like we need -lrt for clock_gettime().
368    have_rt=yes
371 AC_SEARCH_LIBS(pthread_create, [pthread])
372 AC_SEARCH_LIBS(pthread_detach, [pthread])
374 AM_CONDITIONAL(THREADS_WIN32, test "$bwin32" = "true")
375 AM_CONDITIONAL(THREADS_PTHREADS, test "$bwin32" = "false")
377 AC_CHECK_FUNCS(
378         _NSGetEnviron \
379         accept4 \
380         backtrace \
381         backtrace_symbols_fd \
382         clock_gettime \
383         eventfd \
384         flock \
385         ftime \
386         getaddrinfo \
387         getentropy \
388         getifaddrs \
389         getpass \
390         getrlimit \
391         gettimeofday \
392         gmtime_r \
393         inet_aton \
394         ioctl \
395         issetugid \
396         llround \
397         localtime_r \
398         lround \
399         memmem \
400         pipe \
401         pipe2 \
402         prctl \
403         readpassphrase \
404         rint \
405         sigaction \
406         socketpair \
407         statvfs \
408         strlcat \
409         strlcpy \
410         strnlen \
411         strptime \
412         strtok_r \
413         strtoull \
414         sysconf \
415         sysctl \
416         uname \
417         usleep \
418         vasprintf \
419         _vscprintf
422 if test "$bwin32" != true; then
423   AC_CHECK_HEADERS(pthread.h)
424   AC_CHECK_FUNCS(pthread_create)
427 if test "$bwin32" = true; then
428   AC_CHECK_DECLS([SecureZeroMemory, _getwch], , , [
429 #include <windows.h>
430 #include <conio.h>
431 #include <wchar.h>
432                  ])
435 AM_CONDITIONAL(BUILD_READPASSPHRASE_C, test x$ac_cv_func_readpassphrase = xno && test $bwin32 = false)
437 dnl ------------------------------------------------------
438 dnl Where do you live, libevent?  And how do we call you?
440 if test "$bwin32" = true; then
441   TOR_LIB_WS32=-lws2_32
442   TOR_LIB_IPHLPAPI=-liphlpapi
443   # Some of the cargo-cults recommend -lwsock32 as well, but I don't
444   # think it's actually necessary.
445   TOR_LIB_GDI=-lgdi32
446 else
447   TOR_LIB_WS32=
448   TOR_LIB_GDI=
450 AC_SUBST(TOR_LIB_WS32)
451 AC_SUBST(TOR_LIB_GDI)
452 AC_SUBST(TOR_LIB_IPHLPAPI)
454 tor_libevent_pkg_redhat="libevent"
455 tor_libevent_pkg_debian="libevent-dev"
456 tor_libevent_devpkg_redhat="libevent-devel"
457 tor_libevent_devpkg_debian="libevent-dev"
459 dnl On Gnu/Linux or any place we require it, we'll add librt to the Libevent
460 dnl linking for static builds.
461 STATIC_LIBEVENT_FLAGS=""
462 if test "$enable_static_libevent" = "yes"; then
463     if test "$have_rt" = yes; then
464       STATIC_LIBEVENT_FLAGS=" -lrt "
465     fi
468 TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32], [
469 #ifdef _WIN32
470 #include <winsock2.h>
471 #endif
472 #include <stdlib.h>
473 #include <sys/time.h>
474 #include <sys/types.h>
475 #include <event.h>], [
476 #ifdef _WIN32
477 #include <winsock2.h>
478 #endif
479 void exit(int); void *event_init(void);],
480     [
481 #ifdef _WIN32
482 {WSADATA d; WSAStartup(0x101,&d); }
483 #endif
484 event_init(); exit(0);
485 ], [--with-libevent-dir], [/opt/libevent])
487 dnl Now check for particular libevent functions.
488 save_LIBS="$LIBS"
489 save_LDFLAGS="$LDFLAGS"
490 save_CPPFLAGS="$CPPFLAGS"
491 LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS"
492 LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS"
493 CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS"
494 AC_CHECK_FUNCS([event_get_version_number \
495                 evutil_secure_rng_set_urandom_device_file \
496                 evutil_secure_rng_init \
497                ])
498 AC_CHECK_MEMBERS([struct event.min_heap_idx], , ,
499 [#include <event.h>
502 AC_CHECK_HEADERS(event2/event.h event2/dns.h event2/bufferevent_ssl.h)
504 LIBS="$STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $save_LIBS"
506 AM_CONDITIONAL(USE_EXTERNAL_EVDNS, test x$ac_cv_header_event2_dns_h = xyes)
508 if test "$enable_static_libevent" = "yes"; then
509    if test "$tor_cv_library_libevent_dir" = "(system)"; then
510      AC_MSG_ERROR("You must specify an explicit --with-libevent-dir=x option when using --enable-static-libevent")
511    else
512      TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a $STATIC_LIBEVENT_FLAGS"
513    fi
514 else
515      if test "x$ac_cv_header_event2_event_h" = "xyes"; then
516        AC_SEARCH_LIBS(event_new, [event event_core], , AC_MSG_ERROR("libevent2 is installed but linking it failed while searching for event_new"))
517        AC_SEARCH_LIBS(evdns_base_new, [event event_extra], , AC_MSG_ERROR("libevent2 is installed but linking it failed while searching for evdns_base_new"))
519        if test "$ac_cv_search_event_new" != "none required"; then
520          TOR_LIBEVENT_LIBS="$ac_cv_search_event_new"
521        fi
522        if test "$ac_cv_search_evdns_base_new" != "none required"; then
523          TOR_LIBEVENT_LIBS="$ac_cv_search_evdns_base_new $TOR_LIBEVENT_LIBS"
524        fi
525      else
526        TOR_LIBEVENT_LIBS="-levent"
527      fi
530 LIBS="$save_LIBS"
531 LDFLAGS="$save_LDFLAGS"
532 CPPFLAGS="$save_CPPFLAGS"
534 dnl This isn't the best test for Libevent 2.0.3-alpha.  Once it's released,
535 dnl we can do much better.
536 if test "$enable_bufferevents" = "yes" ; then
537   if test "$ac_cv_header_event2_bufferevent_ssl_h" != "yes" ; then
538     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.])
539   else
541     CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent"
543     # Check for the right version.  First see if version detection works.
544     AC_MSG_CHECKING([whether we can detect the Libevent version])
545     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
546 #include <event2/event.h>
547 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 10
548 #error
549 int x = y(zz);
550 #else
551 int x = 1;
552 #endif
553   ])], [event_version_number_works=yes; AC_MSG_RESULT([yes]) ],
554      [event_version_number_works=no;  AC_MSG_RESULT([no])])
555     if test "$event_version_number_works" != 'yes'; then
556       AC_MSG_WARN([Version detection on Libevent seems broken.  Your Libevent installation is probably screwed up or very old.])
557     else
558       AC_MSG_CHECKING([whether Libevent is new enough for bufferevents])
559       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
560 #include <event2/event.h>
561 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000d00
562 #error
563 int x = y(zz);
564 #else
565 int x = 1;
566 #endif
567    ])], [ AC_MSG_RESULT([yes]) ],
568       [ AC_MSG_RESULT([no])
569         AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents.  We require 2.0.13-stable or later]) ] )
570     fi
571   fi
574 LIBS="$save_LIBS"
575 LDFLAGS="$save_LDFLAGS"
576 CPPFLAGS="$save_CPPFLAGS"
578 AM_CONDITIONAL(USE_BUFFEREVENTS, test "$enable_bufferevents" = "yes")
579 if test "$enable_bufferevents" = "yes"; then
580   AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
581   if test "$enable_static_libevent" = "yes"; then
582     TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent_openssl.a $TOR_LIBEVENT_LIBS"
583   else
584     TOR_LIBEVENT_LIBS="-levent_openssl $TOR_LIBEVENT_LIBS"
585   fi
587 AC_SUBST(TOR_LIBEVENT_LIBS)
589 dnl ------------------------------------------------------
590 dnl Where do you live, libm?
592 dnl On some platforms (Haiku/BeOS) the math library is
593 dnl part of libroot. In which case don't link against lm
594 TOR_LIB_MATH=""
595 save_LIBS="$LIBS"
596 AC_SEARCH_LIBS(pow, [m], , AC_MSG_ERROR([Could not find pow in libm or libc.]))
597 if test "$ac_cv_search_pow" != "none required"; then
598     TOR_LIB_MATH="$ac_cv_search_pow"
600 LIBS="$save_LIBS"
601 AC_SUBST(TOR_LIB_MATH)
603 dnl ------------------------------------------------------
604 dnl Where do you live, openssl?  And how do we call you?
606 tor_openssl_pkg_redhat="openssl"
607 tor_openssl_pkg_debian="libssl-dev"
608 tor_openssl_devpkg_redhat="openssl-devel"
609 tor_openssl_devpkg_debian="libssl-dev"
611 ALT_openssl_WITHVAL=""
612 AC_ARG_WITH(ssl-dir,
613   AS_HELP_STRING(--with-ssl-dir=PATH, [obsolete alias for --with-openssl-dir]),
614   [
615       if test "x$withval" != xno && test "x$withval" != "x" ; then
616          ALT_openssl_WITHVAL="$withval"
617       fi
618   ])
620 TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
621     [#include <openssl/rand.h>],
622     [void RAND_add(const void *buf, int num, double entropy);],
623     [RAND_add((void*)0,0,0); exit(0);], [],
624     [/usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])
626 dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
628 if test "$enable_static_openssl" = "yes"; then
629    if test "$tor_cv_library_openssl_dir" = "(system)"; then
630      AC_MSG_ERROR("You must specify an explicit --with-openssl-dir=x option when using --enable-static-openssl")
631    else
632      TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libssl.a $TOR_LIBDIR_openssl/libcrypto.a"
633    fi
634 else
635      TOR_OPENSSL_LIBS="-lssl -lcrypto"
637 AC_SUBST(TOR_OPENSSL_LIBS)
639 dnl Now check for particular openssl functions.
640 save_LIBS="$LIBS"
641 save_LDFLAGS="$LDFLAGS"
642 save_CPPFLAGS="$CPPFLAGS"
643 LIBS="$TOR_OPENSSL_LIBS $LIBS"
644 LDFLAGS="$TOR_LDFLAGS_openssl $LDFLAGS"
645 CPPFLAGS="$TOR_CPPFLAGS_openssl $CPPFLAGS"
647 AC_TRY_COMPILE([
648 #include <openssl/opensslv.h>
649 #if OPENSSL_VERSION_NUMBER < 0x1000000fL
650 #error "too old"
651 #endif
652    ], [],
653    [ : ],
654    [ AC_ERROR([OpenSSL is too old. We require 1.0.0 or later. You can specify a path to a newer one with --with-openssl-dir.]) ])
656 AC_TRY_COMPILE([
657 #include <openssl/opensslv.h>
658 #include <openssl/evp.h>
659 #if defined(OPENSSL_NO_EC) || defined(OPENSSL_NO_ECDH) || defined(OPENSSL_NO_ECDSA)
660 #error "no ECC"
661 #endif
662 #if !defined(NID_X9_62_prime256v1) || !defined(NID_secp224r1)
663 #error "curves unavailable"
664 #endif
665    ], [],
666    [ : ],
667    [ AC_ERROR([OpenSSL is built without full ECC support, including curves P256 and P224. You can specify a path to one with ECC support with --with-openssl-dir.]) ])
669 AC_CHECK_MEMBERS([struct ssl_method_st.get_cipher_by_char], , ,
670 [#include <openssl/ssl.h>
673 AC_CHECK_FUNCS([ \
674                 SSL_SESSION_get_master_key \
675                 SSL_get_server_random \
676                 SSL_get_client_ciphers \
677                 SSL_get_client_random \
678                 SSL_CIPHER_find \
679                 TLS_method
680                ])
682 dnl Check if OpenSSL has scrypt implementation.
683 AC_CHECK_FUNCS([ EVP_PBE_scrypt ])
685 LIBS="$save_LIBS"
686 LDFLAGS="$save_LDFLAGS"
687 CPPFLAGS="$save_CPPFLAGS"
689 dnl ------------------------------------------------------
690 dnl Where do you live, zlib?  And how do we call you?
692 tor_zlib_pkg_redhat="zlib"
693 tor_zlib_pkg_debian="zlib1g"
694 tor_zlib_devpkg_redhat="zlib-devel"
695 tor_zlib_devpkg_debian="zlib1g-dev"
697 TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
698     [#include <zlib.h>],
699     [const char * zlibVersion(void);],
700     [zlibVersion(); exit(0);], [--with-zlib-dir],
701     [/opt/zlib])
703 if test "$enable_static_zlib" = "yes"; then
704    if test "$tor_cv_library_zlib_dir" = "(system)"; then
705      AC_MSG_ERROR("You must specify an explicit --with-zlib-dir=x option when
706  using --enable-static-zlib")
707    else
708      TOR_ZLIB_LIBS="$TOR_LIBDIR_zlib/libz.a"
709    fi
710 else
711      TOR_ZLIB_LIBS="-lz"
713 AC_SUBST(TOR_ZLIB_LIBS)
715 dnl ---------------------------------------------------------------------
716 dnl Now that we know about our major libraries, we can check for compiler
717 dnl and linker hardening options.  We need to do this with the libraries known,
718 dnl since sometimes the linker will like an option but not be willing to
719 dnl use it with a build of a library.
721 all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent"
722 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"
724 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
725 #if !defined(__clang__)
726 #error
727 #endif])], have_clang=yes, have_clang=no)
729 if test x$enable_gcc_hardening != xno; then
730     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
731     if test x$have_clang = xyes; then
732         TOR_CHECK_CFLAGS(-Qunused-arguments)
733     fi
734     TOR_CHECK_CFLAGS(-fstack-protector-all, also_link)
735     AS_VAR_PUSHDEF([can_compile], [tor_cv_cflags_-fstack-protector-all])
736     AS_VAR_PUSHDEF([can_link], [tor_can_link_-fstack-protector-all])
737 m4_ifdef([AS_VAR_IF],[
738     AS_VAR_IF(can_compile, [yes],
739         AS_VAR_IF(can_link, [yes],
740                   [],
741                   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.)]))
742         )])
743     AS_VAR_POPDEF([can_link])
744     AS_VAR_POPDEF([can_compile])
745     TOR_CHECK_CFLAGS(-Wstack-protector)
746     TOR_CHECK_CFLAGS(-fwrapv)
747     TOR_CHECK_CFLAGS(--param ssp-buffer-size=1)
748     if test "$bwin32" = "false"; then
749        TOR_CHECK_CFLAGS(-fPIE)
750        TOR_CHECK_LDFLAGS(-pie, "$all_ldflags_for_check", "$all_libs_for_check")
751     fi
754 if test x$enable_expensive_hardening = xyes ; then
755    TOR_CHECK_CFLAGS([-fsanitize=address])
756    TOR_CHECK_CFLAGS([-fsanitize=undefined])
757    TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
760 if test x$enable_linker_hardening != xno; then
761     TOR_CHECK_LDFLAGS(-z relro -z now, "$all_ldflags_for_check", "$all_libs_for_check")
764 # For backtrace support
765 TOR_CHECK_LDFLAGS(-rdynamic)
767 dnl ------------------------------------------------------
768 dnl Now see if we have a -fomit-frame-pointer compiler option.
770 saved_CFLAGS="$CFLAGS"
771 TOR_CHECK_CFLAGS(-fomit-frame-pointer)
772 F_OMIT_FRAME_POINTER=''
773 if test "$saved_CFLAGS" != "$CFLAGS"; then
774   if test x$enable_expensive_hardening != xyes ; then
775     F_OMIT_FRAME_POINTER='-fomit-frame-pointer'
776   fi
778 CFLAGS="$saved_CFLAGS"
779 AC_SUBST(F_OMIT_FRAME_POINTER)
781 dnl ------------------------------------------------------
782 dnl If we are adding -fomit-frame-pointer (or if the compiler's doing it
783 dnl for us, as GCC 4.6 and later do at many optimization levels), then
784 dnl we should try to add -fasynchronous-unwind-tables so that our backtrace
785 dnl code will work.
786 TOR_CHECK_CFLAGS(-fasynchronous-unwind-tables)
788 dnl ============================================================
789 dnl Check for libseccomp
791 if test "x$enable_seccomp" != "xno"; then
792   AC_CHECK_HEADERS([seccomp.h])
793   AC_SEARCH_LIBS(seccomp_init, [seccomp])
796 dnl ============================================================
797 dnl Check for libscrypt
799 if test "x$enable_libscrypt" != "xno"; then
800   AC_CHECK_HEADERS([libscrypt.h])
801   AC_SEARCH_LIBS(libscrypt_scrypt, [scrypt])
804 dnl ============================================================
805 dnl We need an implementation of curve25519.
807 dnl set these defaults.
808 build_curve25519_donna=no
809 build_curve25519_donna_c64=no
810 use_curve25519_donna=no
811 use_curve25519_nacl=no
812 CURVE25519_LIBS=
814 dnl The best choice is using curve25519-donna-c64, but that requires
815 dnl that we
816 AC_CACHE_CHECK([whether we can use curve25519-donna-c64],
817   tor_cv_can_use_curve25519_donna_c64,
818   [AC_RUN_IFELSE(
819     [AC_LANG_PROGRAM([dnl
820       #include <stdint.h>
821       typedef unsigned uint128_t __attribute__((mode(TI)));
822   int func(uint64_t a, uint64_t b) {
823            uint128_t c = ((uint128_t)a) * b;
824            int ok = ((uint64_t)(c>>96)) == 522859 &&
825              (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
826                  (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
827                  (((uint64_t)(c))&0xffffffffL) == 0;
828            return ok;
829       }
830   ], [dnl
831     int ok = func( ((uint64_t)2000000000) * 1000000000,
832                    ((uint64_t)1234567890) << 24);
833         return !ok;
834       ])],
835   [tor_cv_can_use_curve25519_donna_c64=yes],
836       [tor_cv_can_use_curve25519_donna_c64=no],
837   [AC_LINK_IFELSE(
838         [AC_LANG_PROGRAM([dnl
839       #include <stdint.h>
840       typedef unsigned uint128_t __attribute__((mode(TI)));
841   int func(uint64_t a, uint64_t b) {
842            uint128_t c = ((uint128_t)a) * b;
843            int ok = ((uint64_t)(c>>96)) == 522859 &&
844              (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
845                  (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
846                  (((uint64_t)(c))&0xffffffffL) == 0;
847            return ok;
848       }
849   ], [dnl
850     int ok = func( ((uint64_t)2000000000) * 1000000000,
851                  ((uint64_t)1234567890) << 24);
852         return !ok;
853       ])],
854           [tor_cv_can_use_curve25519_donna_c64=cross],
855       [tor_cv_can_use_curve25519_donna_c64=no])])])
857 AC_CHECK_HEADERS([crypto_scalarmult_curve25519.h \
858                   nacl/crypto_scalarmult_curve25519.h])
860 AC_CACHE_CHECK([for nacl compiled with a fast curve25519 implementation],
861   tor_cv_can_use_curve25519_nacl,
862   [tor_saved_LIBS="$LIBS"
863    LIBS="$LIBS -lnacl"
864    AC_LINK_IFELSE(
865      [AC_LANG_PROGRAM([dnl
866        #ifdef HAVE_CRYPTO_SCALARMULT_CURVE25519_H
867        #include <crypto_scalarmult_curve25519.h>
868    #elif defined(HAVE_NACL_CRYPTO_SCALARMULT_CURVE25519_H)
869    #include <nacl/crypto_scalarmult_curve25519.h>
870    #endif
871        #ifdef crypto_scalarmult_curve25519_ref_BYTES
872    #error Hey, this is the reference implementation! That's not fast.
873    #endif
874      ], [
875    unsigned char *a, *b, *c; crypto_scalarmult_curve25519(a,b,c);
876      ])], [tor_cv_can_use_curve25519_nacl=yes],
877      [tor_cv_can_use_curve25519_nacl=no])
878    LIBS="$tor_saved_LIBS" ])
880  dnl Okay, now we need to figure out which one to actually use. Fall back
881  dnl to curve25519-donna.c
883  if test x$tor_cv_can_use_curve25519_donna_c64 != xno; then
884    build_curve25519_donna_c64=yes
885    use_curve25519_donna=yes
886  elif test x$tor_cv_can_use_curve25519_nacl = xyes; then
887    use_curve25519_nacl=yes
888    CURVE25519_LIBS=-lnacl
889  else
890    build_curve25519_donna=yes
891    use_curve25519_donna=yes
892  fi
894 if test x$use_curve25519_donna = xyes; then
895   AC_DEFINE(USE_CURVE25519_DONNA, 1,
896             [Defined if we should use an internal curve25519_donna{,_c64} implementation])
898 if test x$use_curve25519_nacl = xyes; then
899   AC_DEFINE(USE_CURVE25519_NACL, 1,
900             [Defined if we should use a curve25519 from nacl])
902 AM_CONDITIONAL(BUILD_CURVE25519_DONNA, test x$build_curve25519_donna = xyes)
903 AM_CONDITIONAL(BUILD_CURVE25519_DONNA_C64, test x$build_curve25519_donna_c64 = xyes)
904 AC_SUBST(CURVE25519_LIBS)
906 dnl Make sure to enable support for large off_t if available.
907 AC_SYS_LARGEFILE
909 AC_CHECK_HEADERS(
910         assert.h \
911         errno.h \
912         fcntl.h \
913         signal.h \
914         string.h \
915         sys/fcntl.h \
916         sys/stat.h \
917         sys/time.h \
918         sys/types.h \
919         time.h \
920         unistd.h
921  , , 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.))
923 dnl These headers are not essential
925 AC_CHECK_HEADERS(
926         arpa/inet.h \
927         crt_externs.h \
928         execinfo.h \
929         grp.h \
930         ifaddrs.h \
931         inttypes.h \
932         limits.h \
933         linux/types.h \
934         machine/limits.h \
935         malloc.h \
936         malloc/malloc.h \
937         malloc_np.h \
938         netdb.h \
939         netinet/in.h \
940         netinet/in6.h \
941         pwd.h \
942         readpassphrase.h \
943         stdint.h \
944         sys/eventfd.h \
945         sys/file.h \
946         sys/ioctl.h \
947         sys/limits.h \
948         sys/mman.h \
949         sys/param.h \
950         sys/prctl.h \
951         sys/resource.h \
952         sys/select.h \
953         sys/socket.h \
954         sys/statvfs.h \
955         sys/syscall.h \
956         sys/sysctl.h \
957         sys/syslimits.h \
958         sys/time.h \
959         sys/types.h \
960         sys/un.h \
961         sys/utime.h \
962         sys/wait.h \
963         syslog.h \
964         utime.h
967 AC_CHECK_HEADERS(sys/param.h)
969 AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
970 [#ifdef HAVE_SYS_TYPES_H
971 #include <sys/types.h>
972 #endif
973 #ifdef HAVE_SYS_SOCKET_H
974 #include <sys/socket.h>
975 #endif])
976 AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0,
977 [#ifdef HAVE_SYS_TYPES_H
978 #include <sys/types.h>
979 #endif
980 #ifdef HAVE_SYS_SOCKET_H
981 #include <sys/socket.h>
982 #endif
983 #ifdef HAVE_NET_IF_H
984 #include <net/if.h>
985 #endif
986 #ifdef HAVE_NETINET_IN_H
987 #include <netinet/in.h>
988 #endif])
990 AC_CHECK_HEADERS(linux/if.h,[],[],
992 #ifdef HAVE_SYS_SOCKET_H
993 #include <sys/socket.h>
994 #endif
997 AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
998         linux_netfilter_ipv4=1, linux_netfilter_ipv4=0,
999 [#ifdef HAVE_SYS_TYPES_H
1000 #include <sys/types.h>
1001 #endif
1002 #ifdef HAVE_SYS_SOCKET_H
1003 #include <sys/socket.h>
1004 #endif
1005 #ifdef HAVE_LIMITS_H
1006 #include <limits.h>
1007 #endif
1008 #ifdef HAVE_LINUX_TYPES_H
1009 #include <linux/types.h>
1010 #endif
1011 #ifdef HAVE_NETINET_IN6_H
1012 #include <netinet/in6.h>
1013 #endif
1014 #ifdef HAVE_NETINET_IN_H
1015 #include <netinet/in.h>
1016 #endif])
1018 AC_CHECK_HEADERS(linux/netfilter_ipv6/ip6_tables.h,
1019         linux_netfilter_ipv6_ip6_tables=1, linux_netfilter_ipv6_ip6_tables=0,
1020 [#ifdef HAVE_SYS_TYPES_H
1021 #include <sys/types.h>
1022 #endif
1023 #ifdef HAVE_SYS_SOCKET_H
1024 #include <sys/socket.h>
1025 #endif
1026 #ifdef HAVE_LIMITS_H
1027 #include <limits.h>
1028 #endif
1029 #ifdef HAVE_LINUX_TYPES_H
1030 #include <linux/types.h>
1031 #endif
1032 #ifdef HAVE_NETINET_IN6_H
1033 #include <netinet/in6.h>
1034 #endif
1035 #ifdef HAVE_NETINET_IN_H
1036 #include <netinet/in.h>
1037 #endif
1038 #ifdef HAVE_LINUX_IF_H
1039 #include <linux/if.h>
1040 #endif])
1042 if test x$transparent = xtrue ; then
1043    transparent_ok=0
1044    if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then
1045      transparent_ok=1
1046    fi
1047    if test x$linux_netfilter_ipv4 = x1 ; then
1048      transparent_ok=1
1049    fi
1050    if test x$linux_netfilter_ipv6_ip6_tables = x1 ; then
1051      transparent_ok=1
1052    fi
1053    if test x$transparent_ok = x1 ; then
1054      AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
1055      case $host in
1056        *-*-openbsd* | *-*-bitrig*)
1057          AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
1058      esac
1059    else
1060      AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
1061    fi
1064 AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
1065 [#ifdef HAVE_SYS_TYPES_H
1066 #include <sys/types.h>
1067 #endif
1068 #ifdef HAVE_SYS_TIME_H
1069 #include <sys/time.h>
1070 #endif])
1072 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
1073 dnl Watch out.
1075 AC_CHECK_SIZEOF(int8_t)
1076 AC_CHECK_SIZEOF(int16_t)
1077 AC_CHECK_SIZEOF(int32_t)
1078 AC_CHECK_SIZEOF(int64_t)
1079 AC_CHECK_SIZEOF(uint8_t)
1080 AC_CHECK_SIZEOF(uint16_t)
1081 AC_CHECK_SIZEOF(uint32_t)
1082 AC_CHECK_SIZEOF(uint64_t)
1083 AC_CHECK_SIZEOF(intptr_t)
1084 AC_CHECK_SIZEOF(uintptr_t)
1086 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
1088 AC_CHECK_SIZEOF(char)
1089 AC_CHECK_SIZEOF(short)
1090 AC_CHECK_SIZEOF(int)
1091 AC_CHECK_SIZEOF(long)
1092 AC_CHECK_SIZEOF(long long)
1093 AC_CHECK_SIZEOF(__int64)
1094 AC_CHECK_SIZEOF(void *)
1095 AC_CHECK_SIZEOF(time_t)
1096 AC_CHECK_SIZEOF(size_t)
1097 AC_CHECK_SIZEOF(pid_t)
1099 AC_CHECK_TYPES([uint, u_char, ssize_t])
1101 AC_PC_FROM_UCONTEXT([:])
1103 dnl used to include sockaddr_storage, but everybody has that.
1104 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
1105 [#ifdef HAVE_SYS_TYPES_H
1106 #include <sys/types.h>
1107 #endif
1108 #ifdef HAVE_NETINET_IN_H
1109 #include <netinet/in.h>
1110 #endif
1111 #ifdef HAVE_NETINET_IN6_H
1112 #include <netinet/in6.h>
1113 #endif
1114 #ifdef HAVE_SYS_SOCKET_H
1115 #include <sys/socket.h>
1116 #endif
1117 #ifdef _WIN32
1118 #define _WIN32_WINNT 0x0501
1119 #define WIN32_LEAN_AND_MEAN
1120 #include <winsock2.h>
1121 #include <ws2tcpip.h>
1122 #endif
1124 AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
1125 [#ifdef HAVE_SYS_TYPES_H
1126 #include <sys/types.h>
1127 #endif
1128 #ifdef HAVE_NETINET_IN_H
1129 #include <netinet/in.h>
1130 #endif
1131 #ifdef HAVE_NETINET_IN6_H
1132 #include <netinet/in6.h>
1133 #endif
1134 #ifdef HAVE_SYS_SOCKET_H
1135 #include <sys/socket.h>
1136 #endif
1137 #ifdef _WIN32
1138 #define _WIN32_WINNT 0x0501
1139 #define WIN32_LEAN_AND_MEAN
1140 #include <winsock2.h>
1141 #include <ws2tcpip.h>
1142 #endif
1143 #endif
1146 AC_CHECK_TYPES([rlim_t], , ,
1147 [#ifdef HAVE_SYS_TYPES_H
1148 #include <sys/types.h>
1149 #endif
1150 #ifdef HAVE_SYS_TIME_H
1151 #include <sys/time.h>
1152 #endif
1153 #ifdef HAVE_SYS_RESOURCE_H
1154 #include <sys/resource.h>
1155 #endif
1158 AX_CHECK_SIGN([time_t],
1159        [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
1160        [ : ], [
1161 #ifdef HAVE_SYS_TYPES_H
1162 #include <sys/types.h>
1163 #endif
1164 #ifdef HAVE_SYS_TIME_H
1165 #include <sys/time.h>
1166 #endif
1167 #ifdef HAVE_TIME_H
1168 #include <time.h>
1169 #endif
1172 if test "$ax_cv_decl_time_t_signed" = no; then
1173   AC_MSG_WARN([You have an unsigned time_t; some things will probably break. Please tell the Tor developers about your interesting platform.])
1176 AX_CHECK_SIGN([size_t],
1177        [ tor_cv_size_t_signed=yes ],
1178        [ tor_cv_size_t_signed=no ], [
1179 #ifdef HAVE_SYS_TYPES_H
1180 #include <sys/types.h>
1181 #endif
1184 if test "$ax_cv_decl_size_t_signed" = yes; then
1185   AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
1188 AX_CHECK_SIGN([enum always],
1189        [ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
1190        [ : ], [
1191  enum always { AAA, BBB, CCC };
1194 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
1195 #ifdef HAVE_SYS_SOCKET_H
1196 #include <sys/socket.h>
1197 #endif
1200 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
1202 AC_CHECK_SIZEOF(cell_t)
1204 # Now make sure that NULL can be represented as zero bytes.
1205 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
1206 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1207 [[#include <stdlib.h>
1208 #include <string.h>
1209 #include <stdio.h>
1210 #ifdef HAVE_STDDEF_H
1211 #include <stddef.h>
1212 #endif
1213 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
1214 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
1215        [tor_cv_null_is_zero=yes],
1216        [tor_cv_null_is_zero=no],
1217        [tor_cv_null_is_zero=cross])])
1219 if test "$tor_cv_null_is_zero" = cross ; then
1220   # Cross-compiling; let's hope that the target isn't raving mad.
1221   AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
1224 if test "$tor_cv_null_is_zero" != no; then
1225   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
1226             [Define to 1 iff memset(0) sets pointers to NULL])
1229 AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
1230 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1231 [[#include <stdlib.h>
1232 #include <string.h>
1233 #include <stdio.h>
1234 #ifdef HAVE_STDDEF_H
1235 #include <stddef.h>
1236 #endif
1237 int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
1238 return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
1239        [tor_cv_dbl0_is_zero=yes],
1240        [tor_cv_dbl0_is_zero=no],
1241        [tor_cv_dbl0_is_zero=cross])])
1243 if test "$tor_cv_dbl0_is_zero" = cross ; then
1244   # Cross-compiling; let's hope that the target isn't raving mad.
1245   AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
1248 if test "$tor_cv_dbl0_is_zero" != no; then
1249   AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
1250             [Define to 1 iff memset(0) sets doubles to 0.0])
1253 # And what happens when we malloc zero?
1254 AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
1255 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1256 [[#include <stdlib.h>
1257 #include <string.h>
1258 #include <stdio.h>
1259 #ifdef HAVE_STDDEF_H
1260 #include <stddef.h>
1261 #endif
1262 int main () { return malloc(0)?0:1; }]])],
1263        [tor_cv_malloc_zero_works=yes],
1264        [tor_cv_malloc_zero_works=no],
1265        [tor_cv_malloc_zero_works=cross])])
1267 if test "$tor_cv_malloc_zero_works" = cross; then
1268   # Cross-compiling; let's hope that the target isn't raving mad.
1269   AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
1272 if test "$tor_cv_malloc_zero_works" = yes; then
1273   AC_DEFINE([MALLOC_ZERO_WORKS], 1,
1274             [Define to 1 iff malloc(0) returns a pointer])
1277 # whether we seem to be in a 2s-complement world.
1278 AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
1279 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1280 [[int main () { int problem = ((-99) != (~99)+1);
1281 return problem ? 1 : 0; }]])],
1282        [tor_cv_twos_complement=yes],
1283        [tor_cv_twos_complement=no],
1284        [tor_cv_twos_complement=cross])])
1286 if test "$tor_cv_twos_complement" = cross ; then
1287   # Cross-compiling; let's hope that the target isn't raving mad.
1288   AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
1291 if test "$tor_cv_twos_complement" != no ; then
1292   AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
1293             [Define to 1 iff we represent negative integers with two's complement])
1296 # What does shifting a negative value do?
1297 AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
1298 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1299 [[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
1300        [tor_cv_sign_extend=yes],
1301        [tor_cv_sign_extend=no],
1302        [tor_cv_sign_extend=cross])])
1304 if test "$tor_cv_sign_extend" = cross ; then
1305   # Cross-compiling; let's hope that the target isn't raving mad.
1306   AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
1309 if test "$tor_cv_sign_extend" != no ; then
1310   AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
1311             [Define to 1 iff right-shifting a negative value performs sign-extension])
1314 # Whether we should use the dmalloc memory allocation debugging library.
1315 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
1316 AC_ARG_WITH(dmalloc,
1317 AS_HELP_STRING(--with-dmalloc, [use debug memory allocation library]),
1318 [if [[ "$withval" = "yes" ]]; then
1319   dmalloc=1
1320   AC_MSG_RESULT(yes)
1321 else
1322   dmalloc=1
1323   AC_MSG_RESULT(no)
1324 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
1327 if [[ $dmalloc -eq 1 ]]; then
1328   AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
1329   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
1330   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
1331   AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
1334 AC_ARG_WITH(tcmalloc,
1335 AS_HELP_STRING(--with-tcmalloc, [use tcmalloc memory allocation library]),
1336 [ tcmalloc=yes ], [ tcmalloc=no ])
1338 if test x$tcmalloc = xyes ; then
1339    LDFLAGS="-ltcmalloc $LDFLAGS"
1342 using_custom_malloc=no
1343 if test x$enable_openbsd_malloc = xyes ; then
1344    using_custom_malloc=yes
1346 if test x$tcmalloc = xyes ; then
1347    using_custom_malloc=yes
1349 if test $using_custom_malloc = no ; then
1350    AC_CHECK_FUNCS(mallinfo)
1353 # By default, we're going to assume we don't have mlockall()
1354 # bionic and other platforms have various broken mlockall subsystems.
1355 # Some systems don't have a working mlockall, some aren't linkable,
1356 # and some have it but don't declare it.
1357 AC_CHECK_FUNCS(mlockall)
1358 AC_CHECK_DECLS([mlockall], , , [
1359 #ifdef HAVE_SYS_MMAN_H
1360 #include <sys/mman.h>
1361 #endif])
1363 # Allow user to specify an alternate syslog facility
1364 AC_ARG_WITH(syslog-facility,
1365 AS_HELP_STRING(--with-syslog-facility=LOG, [syslog facility to use (default=LOG_DAEMON)]),
1366 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
1367 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
1368 AC_SUBST(LOGFACILITY)
1370 # Check if we have getresuid and getresgid
1371 AC_CHECK_FUNCS(getresuid getresgid)
1373 # Check for gethostbyname_r in all its glorious incompatible versions.
1374 #   (This logic is based on that in Python's configure.in)
1375 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1376   [Define this if you have any gethostbyname_r()])
1378 AC_CHECK_FUNC(gethostbyname_r, [
1379   AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
1380   OLD_CFLAGS=$CFLAGS
1381   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1382   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1383 #include <netdb.h>
1384   ], [[
1385     char *cp1, *cp2;
1386     struct hostent *h1, *h2;
1387     int i1, i2;
1388     (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
1389   ]])],[
1390     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1391     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1392      [Define this if gethostbyname_r takes 6 arguments])
1393     AC_MSG_RESULT(6)
1394   ], [
1395     AC_TRY_COMPILE([
1396 #include <netdb.h>
1397     ], [
1398       char *cp1, *cp2;
1399       struct hostent *h1;
1400       int i1, i2;
1401       (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
1402     ], [
1403       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1404       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1405         [Define this if gethostbyname_r takes 5 arguments])
1406       AC_MSG_RESULT(5)
1407    ], [
1408       AC_TRY_COMPILE([
1409 #include <netdb.h>
1410      ], [
1411        char *cp1;
1412        struct hostent *h1;
1413        struct hostent_data hd;
1414        (void) gethostbyname_r(cp1,h1,&hd);
1415      ], [
1416        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1417        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1418          [Define this if gethostbyname_r takes 3 arguments])
1419        AC_MSG_RESULT(3)
1420      ], [
1421        AC_MSG_RESULT(0)
1422      ])
1423   ])
1424  ])
1425  CFLAGS=$OLD_CFLAGS
1428 AC_CACHE_CHECK([whether the C compiler supports __func__],
1429   tor_cv_have_func_macro,
1430   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1431 #include <stdio.h>
1432 int main(int c, char **v) { puts(__func__); }])],
1433   tor_cv_have_func_macro=yes,
1434   tor_cv_have_func_macro=no))
1436 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
1437   tor_cv_have_FUNC_macro,
1438   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1439 #include <stdio.h>
1440 int main(int c, char **v) { puts(__FUNC__); }])],
1441   tor_cv_have_FUNC_macro=yes,
1442   tor_cv_have_FUNC_macro=no))
1444 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
1445   tor_cv_have_FUNCTION_macro,
1446   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1447 #include <stdio.h>
1448 int main(int c, char **v) { puts(__FUNCTION__); }])],
1449   tor_cv_have_FUNCTION_macro=yes,
1450   tor_cv_have_FUNCTION_macro=no))
1452 AC_CACHE_CHECK([whether we have extern char **environ already declared],
1453   tor_cv_have_environ_declared,
1454   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1455 /* We define _GNU_SOURCE here because it is also defined in compat.c.
1456  * Without it environ doesn't get declared. */
1457 #define _GNU_SOURCE
1458 #ifdef HAVE_UNISTD_H
1459 #include <unistd.h>
1460 #endif
1461 #include <stdlib.h>
1462 int main(int c, char **v) { char **t = environ; }])],
1463   tor_cv_have_environ_declared=yes,
1464   tor_cv_have_environ_declared=no))
1466 if test "$tor_cv_have_func_macro" = 'yes'; then
1467   AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
1470 if test "$tor_cv_have_FUNC_macro" = 'yes'; then
1471   AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
1474 if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
1475   AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
1476            [Defined if the compiler supports __FUNCTION__])
1479 if test "$tor_cv_have_environ_declared" = 'yes'; then
1480   AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
1481            [Defined if we have extern char **environ already declared])
1484 # $prefix stores the value of the --prefix command line option, or
1485 # NONE if the option wasn't set.  In the case that it wasn't set, make
1486 # it be the default, so that we can use it to expand directories now.
1487 if test "x$prefix" = "xNONE"; then
1488   prefix=$ac_default_prefix
1491 # and similarly for $exec_prefix
1492 if test "x$exec_prefix" = "xNONE"; then
1493   exec_prefix=$prefix
1496 if test "x$BUILDDIR" = "x"; then
1497   BUILDDIR=`pwd`
1499 AC_SUBST(BUILDDIR)
1500 AH_TEMPLATE([BUILDDIR],[tor's build directory])
1501 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
1503 if test "x$CONFDIR" = "x"; then
1504   CONFDIR=`eval echo $sysconfdir/tor`
1506 AC_SUBST(CONFDIR)
1507 AH_TEMPLATE([CONFDIR],[tor's configuration directory])
1508 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
1510 BINDIR=`eval echo $bindir`
1511 AC_SUBST(BINDIR)
1512 LOCALSTATEDIR=`eval echo $localstatedir`
1513 AC_SUBST(LOCALSTATEDIR)
1515 if test "$bwin32" = true; then
1516   # Test if the linker supports the --nxcompat and --dynamicbase options
1517   # for Windows
1518   save_LDFLAGS="$LDFLAGS"
1519   LDFLAGS="-Wl,--nxcompat -Wl,--dynamicbase"
1520   AC_MSG_CHECKING([whether the linker supports DllCharacteristics])
1521   AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1522     [AC_MSG_RESULT([yes])]
1523     [save_LDFLAGS="$save_LDFLAGS $LDFLAGS"],
1524     [AC_MSG_RESULT([no])]
1525   )
1526   LDFLAGS="$save_LDFLAGS"
1529 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
1530 # than autoconf's macros like.
1531 if test "$GCC" = yes; then
1532   # Disable GCC's strict aliasing checks.  They are an hours-to-debug
1533   # accident waiting to happen.
1534   CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
1535 else
1536   # Override optimization level for non-gcc compilers
1537   CFLAGS="$CFLAGS -O"
1538   enable_gcc_warnings=no
1539   enable_gcc_warnings_advisory=no
1542 # OS X Lion started deprecating the system openssl. Let's just disable
1543 # all deprecation warnings on OS X. Also, to potentially make the binary
1544 # a little smaller, let's enable dead_strip.
1545 case "$host_os" in
1547  darwin*)
1548     CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1549     LDFLAGS="$LDFLAGS -dead_strip" ;;
1550 esac
1552 # Add some more warnings which we use in development but not in the
1553 # released versions.  (Some relevant gcc versions can't handle these.)
1554 if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xyes; then
1556   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1557 #if !defined(__GNUC__) || (__GNUC__ < 4)
1558 #error
1559 #endif])], have_gcc4=yes, have_gcc4=no)
1561   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1562 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
1563 #error
1564 #endif])], have_gcc42=yes, have_gcc42=no)
1566   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1567 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
1568 #error
1569 #endif])], have_gcc43=yes, have_gcc43=no)
1571   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1572 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
1573 #error
1574 #endif])], have_gcc46=yes, have_gcc46=no)
1577   save_CFLAGS="$CFLAGS"
1578   CFLAGS="$CFLAGS -Wshorten-64-to-32"
1579   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
1580                     have_shorten64_flag=no)
1581   CFLAGS="$save_CFLAGS"
1583   case $host in
1584     *-*-openbsd* | *-*-bitrig*)
1585       # Some OpenBSD versions (like 4.8) have -Wsystem-headers by default.
1586       # That's fine, except that the headers don't pass -Wredundant-decls.
1587       # Therefore, let's disable -Wsystem-headers when we're building
1588       # with maximal warnings on OpenBSD.
1589       CFLAGS="$CFLAGS -Wno-system-headers" ;;
1590   esac
1592   CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith"
1593   CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
1594   CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
1595   CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
1596   CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
1598   if test x$enable_gcc_warnings = xyes; then
1599     CFLAGS="$CFLAGS -Werror"
1600   fi
1602   # Disabled, so we can use mallinfo(): -Waggregate-return
1604   if test x$have_gcc4 = xyes ; then
1605     # These warnings break gcc 3.3.5 and work on gcc 4.0.2
1606     CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wold-style-definition"
1607   fi
1609   if test x$have_gcc42 = xyes ; then
1610     # These warnings break gcc 4.0.2 and work on gcc 4.2
1611     # XXXX020 See if any of these work with earlier versions.
1612     CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
1614     # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
1615   fi
1617   if test x$have_gcc42 = xyes && test x$have_clang = xno; then
1618     # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
1619     CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
1620   fi
1622   if test x$have_gcc43 = xyes ; then
1623     # These warnings break gcc 4.2 and work on gcc 4.3
1624     # XXXX020 See if any of these work with earlier versions.
1625     CFLAGS="$CFLAGS -Wextra -Warray-bounds"
1626   fi
1628   if test x$have_gcc46 = xyes ; then
1629     # This warning was added in gcc 4.3, but it appears to generate
1630     # spurious warnings in gcc 4.4.  I don't know if it works in 4.5.
1631     CFLAGS="$CFLAGS -Wlogical-op"
1632   fi
1634   if test x$have_shorten64_flag = xyes ; then
1635     CFLAGS="$CFLAGS -Wshorten-64-to-32"
1636   fi
1640 ##This will break the world on some 64-bit architectures
1641 # CFLAGS="$CFLAGS -Winline"
1644 if test "$enable_coverage" = yes && test "$have_clang" = "no"; then
1645    case "$host_os" in
1646     darwin*)
1647       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.])
1648    esac
1651 CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
1653 AC_CONFIG_FILES([
1654         Doxyfile
1655         Makefile
1656         contrib/dist/suse/tor.sh
1657         contrib/operator-tools/tor.logrotate
1658         contrib/dist/tor.sh
1659         contrib/dist/torctl
1660         contrib/dist/tor.service
1661         src/config/torrc.sample
1662         src/config/torrc.minimal
1663         scripts/maint/checkOptionDocs.pl
1664         scripts/maint/updateVersions.pl
1667 if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
1668   regular_mans="doc/tor doc/tor-gencert doc/tor-resolve doc/torify"
1669   for file in $regular_mans ; do
1670     if ! [[ -f "$srcdir/$file.1.in" ]] || ! [[ -f "$srcdir/$file.html.in" ]] ; then
1671       echo "==================================";
1672       echo;
1673       echo "Building Tor has failed since manpages cannot be built.";
1674       echo;
1675       echo "You need asciidoc installed to be able to build the manpages.";
1676       echo "To build without manpages, use the --disable-asciidoc argument";
1677       echo "when calling configure.";
1678       echo;
1679       echo "==================================";
1680       exit 1;
1681     fi
1682   done
1685 AC_OUTPUT