Spell occurred right
[tor.git] / configure.ac
blob1496b0544be432187c1691279663067b4a9584ed
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.9])
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 # By default, we're not ready to ship a NAT-PMP aware Tor
85 AC_ARG_ENABLE(nat-pmp,
86      AS_HELP_STRING(--enable-nat-pmp, enable NAT-PMP support),
87      [case "${enableval}" in
88         yes) natpmp=true ;;
89         no)  natpmp=false ;;
90         * ) AC_MSG_ERROR(bad value for --enable-nat-pmp) ;;
91       esac], [natpmp=false])
93 # By default, we're not ready to ship a UPnP aware Tor
94 AC_ARG_ENABLE(upnp,
95      AS_HELP_STRING(--enable-upnp, enable UPnP support),
96      [case "${enableval}" in
97         yes) upnp=true ;;
98         no)  upnp=false ;;
99         * ) AC_MSG_ERROR(bad value for --enable-upnp) ;;
100       esac], [upnp=false])
102 # systemd notify support
103 AC_ARG_ENABLE(systemd,
104       AS_HELP_STRING(--enable-systemd, enable systemd notification support),
105       [case "${enableval}" in
106         yes) systemd=true ;;
107         no)  systemd=false ;;
108         * ) AC_MSG_ERROR(bad value for --enable-systemd) ;;
109       esac], [systemd=auto])
113 # systemd support
114 if test x$enable_systemd = xno ; then
115     have_systemd=no;
116 else
117     PKG_CHECK_MODULES(SYSTEMD,
118         [libsystemd-daemon],
119         have_systemd=yes,
120         have_systemd=no)
121     if test x$have_systemd=xno; then
122         AC_MSG_NOTICE([Okay, checking for systemd a different way...])
123         PKG_CHECK_MODULES(SYSTEMD,
124             [libsystemd],
125             have_systemd=yes,
126             have_systemd=no)
127     fi
130 if test x$have_systemd = xyes; then
131     AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd])
132     TOR_SYSTEMD_CFLAGS="${SYSTEMD_CFLAGS}"
133     TOR_SYSTEMD_LIBS="${SYSTEMD_LIBS}"
134     PKG_CHECK_MODULES(LIBSYSTEMD209, [libsystemd >= 209],
135          [AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], [])
137 AC_SUBST(TOR_SYSTEMD_CFLAGS)
138 AC_SUBST(TOR_SYSTEMD_LIBS)
140 if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then
141     AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found])
144 case $host in
145    *-*-solaris* )
146      AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
147      ;;
148 esac
150 AC_ARG_ENABLE(gcc-warnings,
151      AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
152 AC_ARG_ENABLE(gcc-warnings-advisory,
153      AS_HELP_STRING(--enable-gcc-warnings-advisory, [enable verbose warnings, excluding -Werror]))
155 dnl Others suggest '/gs /safeseh /nxcompat /dynamicbase' for non-gcc on Windows
156 AC_ARG_ENABLE(gcc-hardening,
157     AS_HELP_STRING(--disable-gcc-hardening, disable compiler security checks))
159 AC_ARG_ENABLE(expensive-hardening,
160     AS_HELP_STRING(--enable-expensive-hardening, enable more expensive compiler hardening; makes Tor slower))
162 dnl Linker hardening options
163 dnl Currently these options are ELF specific - you can't use this with MacOSX
164 AC_ARG_ENABLE(linker-hardening,
165     AS_HELP_STRING(--disable-linker-hardening, disable linker security fixups))
167 AC_ARG_ENABLE(local-appdata,
168    AS_HELP_STRING(--enable-local-appdata, default to host local application data paths on Windows))
169 if test "$enable_local_appdata" = "yes"; then
170   AC_DEFINE(ENABLE_LOCAL_APPDATA, 1,
171             [Defined if we default to host local appdata paths on Windows])
174 # Tor2web mode flag
175 AC_ARG_ENABLE(tor2web-mode,
176      AS_HELP_STRING(--enable-tor2web-mode, support tor2web non-anonymous mode),
177 [if test x$enableval = xyes; then
178     CFLAGS="$CFLAGS -D ENABLE_TOR2WEB_MODE=1"
179 fi])
181 AC_ARG_ENABLE(bufferevents,
182      AS_HELP_STRING(--enable-bufferevents, use Libevent's buffered IO.))
184 AC_ARG_ENABLE(tool-name-check,
185      AS_HELP_STRING(--disable-tool-name-check, check for sanely named toolchain when cross-compiling))
187 AC_ARG_ENABLE(seccomp,
188      AS_HELP_STRING(--disable-seccomp, do not attempt to use libseccomp))
190 AC_ARG_ENABLE(libscrypt,
191      AS_HELP_STRING(--disable-libscrypt, do not attempt to use libscrypt))
193 dnl check for the correct "ar" when cross-compiling
194 AN_MAKEVAR([AR], [AC_PROG_AR])
195 AN_PROGRAM([ar], [AC_PROG_AR])
196 AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL([AR], [ar], [ar])])
197 AC_PROG_AR
199 dnl Check whether the above macro has settled for a simply named tool even
200 dnl though we're cross compiling. We must do this before running AC_PROG_CC,
201 dnl because that will find any cc on the system, not only the cross-compiler,
202 dnl and then verify that a binary built with this compiler runs on the
203 dnl build system. It will then come to the false conclusion that we're not
204 dnl cross-compiling.
205 if test x$enable_tool_name_check != xno; then
206     if test x$ac_tool_warned = xyes; then
207         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.)])
208         elif test "x$ac_ct_AR" != x -a x$cross_compiling = xmaybe; then
209                 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.)])
210         fi
213 AC_PROG_CC
214 AC_PROG_CPP
215 AC_PROG_MAKE_SET
216 AC_PROG_RANLIB
218 dnl autoconf 2.59 appears not to support AC_PROG_SED
219 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
221 dnl check for asciidoc and a2x
222 AC_PATH_PROG([ASCIIDOC], [asciidoc], none)
223 AC_PATH_PROGS([A2X], [a2x a2x.py], none)
225 AM_CONDITIONAL(USE_ASCIIDOC, test x$asciidoc = xtrue)
227 AM_CONDITIONAL(USE_FW_HELPER, test x$natpmp = xtrue || test x$upnp = xtrue)
228 AM_CONDITIONAL(NAT_PMP, test x$natpmp = xtrue)
229 AM_CONDITIONAL(MINIUPNPC, test x$upnp = xtrue)
230 AM_PROG_CC_C_O
231 AC_PROG_CC_C99
233 AC_ARG_VAR([PYTHON], [path to Python binary])
234 AC_CHECK_PROGS(PYTHON, [python python2 python2.7 python3 python3.3])
235 if test "x$PYTHON" = "x"; then
236   AC_MSG_WARN([Python unavailable; some tests will not be run.])
238 AM_CONDITIONAL(USEPYTHON, [test "x$PYTHON" != "x"])
240 ifdef([AC_C_FLEXIBLE_ARRAY_MEMBER], [
241 AC_C_FLEXIBLE_ARRAY_MEMBER
242 ], [
243  dnl Maybe we've got an old autoconf...
244  AC_CACHE_CHECK([for flexible array members],
245      tor_cv_c_flexarray,
246      [AC_COMPILE_IFELSE(
247        AC_LANG_PROGRAM([
248  struct abc { int a; char b[]; };
249 ], [
250  struct abc *def = malloc(sizeof(struct abc)+sizeof(char));
251  def->b[0] = 33;
253   [tor_cv_c_flexarray=yes],
254   [tor_cv_c_flexarray=no])])
255  if test $tor_cv_flexarray = yes ; then
256    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
257  else
258    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
259  fi
262 AC_CACHE_CHECK([for working C99 mid-block declaration syntax],
263       tor_cv_c_c99_decl,
264       [AC_COMPILE_IFELSE(
265          [AC_LANG_PROGRAM([], [int x; x = 3; int y; y = 4 + x;])],
266          [tor_cv_c_c99_decl=yes],
267          [tor_cv_c_c99_decl=no] )])
268 if test "$tor_cv_c_c99_decl" != "yes"; then
269   AC_MSG_ERROR([Your compiler doesn't support c99 mid-block declarations. This is required as of Tor 0.2.6.x])
272 AC_CACHE_CHECK([for working C99 designated initializers],
273       tor_cv_c_c99_designated_init,
274       [AC_COMPILE_IFELSE(
275          [AC_LANG_PROGRAM([struct s { int a; int b; };],
276                [[ struct s ss = { .b = 5, .a = 6 }; ]])],
277          [tor_cv_c_c99_designated_init=yes],
278          [tor_cv_c_c99_designated_init=no] )])
280 if test "$tor_cv_c_c99_designated_init" != "yes"; then
281   AC_MSG_ERROR([Your compiler doesn't support c99 designated initializers. This is required as of Tor 0.2.6.x])
284 AC_PATH_PROG([SHA1SUM], [sha1sum], none)
285 AC_PATH_PROG([OPENSSL], [openssl], none)
287 TORUSER=_tor
288 AC_ARG_WITH(tor-user,
289         [  --with-tor-user=NAME    Specify username for tor daemon ],
290         [
291            TORUSER=$withval
292         ]
294 AC_SUBST(TORUSER)
296 TORGROUP=_tor
297 AC_ARG_WITH(tor-group,
298         [  --with-tor-group=NAME   Specify group name for tor daemon ],
299         [
300            TORGROUP=$withval
301         ]
303 AC_SUBST(TORGROUP)
306 dnl If _WIN32 is defined and non-zero, we are building for win32
307 AC_MSG_CHECKING([for win32])
308 AC_RUN_IFELSE([AC_LANG_SOURCE([
309 int main(int c, char **v) {
310 #ifdef _WIN32
311 #if _WIN32
312   return 0;
313 #else
314   return 1;
315 #endif
316 #else
317   return 2;
318 #endif
319 }])],
320 bwin32=true; AC_MSG_RESULT([yes]),
321 bwin32=false; AC_MSG_RESULT([no]),
322 bwin32=cross; AC_MSG_RESULT([cross])
325 if test "$bwin32" = cross; then
326 AC_MSG_CHECKING([for win32 (cross)])
327 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
328 #ifdef _WIN32
329 int main(int c, char **v) {return 0;}
330 #else
331 #error
332 int main(int c, char **v) {return x(y);}
333 #endif
334 ])],
335 bwin32=true; AC_MSG_RESULT([yes]),
336 bwin32=false; AC_MSG_RESULT([no]))
339 AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
341 dnl Enable C99 when compiling with MIPSpro
342 AC_MSG_CHECKING([for MIPSpro compiler])
343 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [
344 #if (defined(__sgi) && defined(_COMPILER_VERSION))
345 #error
346   return x(y);
347 #endif
348 ])],
349 bmipspro=false; AC_MSG_RESULT(no),
350 bmipspro=true; AC_MSG_RESULT(yes))
352 if test "$bmipspro" = true; then
353   CFLAGS="$CFLAGS -c99"
356 AC_C_BIGENDIAN
358 AC_SEARCH_LIBS(socket, [socket network])
359 AC_SEARCH_LIBS(gethostbyname, [nsl])
360 AC_SEARCH_LIBS(dlopen, [dl])
361 AC_SEARCH_LIBS(inet_aton, [resolv])
362 saved_LIBS="$LIBS"
363 AC_SEARCH_LIBS([clock_gettime], [rt])
364 if test "$LIBS" != "$saved_LIBS"; then
365    # Looks like we need -lrt for clock_gettime().
366    have_rt=yes
369 AC_SEARCH_LIBS(pthread_create, [pthread])
370 AC_SEARCH_LIBS(pthread_detach, [pthread])
372 AM_CONDITIONAL(THREADS_WIN32, test "$bwin32" = "true")
373 AM_CONDITIONAL(THREADS_PTHREADS, test "$bwin32" = "false")
375 dnl -------------------------------------------------------------------
376 dnl Check for functions before libevent, since libevent-1.2 apparently
377 dnl exports strlcpy without defining it in a header.
379 AC_CHECK_FUNCS(
380         _NSGetEnviron \
381         accept4 \
382         backtrace \
383         backtrace_symbols_fd \
384         clock_gettime \
385         eventfd \
386         flock \
387         ftime \
388         getaddrinfo \
389         getifaddrs \
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         rint \
404         sigaction \
405         socketpair \
406         strlcat \
407         strlcpy \
408         strnlen \
409         strptime \
410         strtok_r \
411         strtoull \
412         sysconf \
413         sysctl \
414         uname \
415         usleep \
416         vasprintf \
417         _vscprintf
420 if test "$bwin32" != true; then
421   AC_CHECK_HEADERS(pthread.h)
422   AC_CHECK_FUNCS(pthread_create)
425 dnl ------------------------------------------------------
426 dnl Where do you live, libevent?  And how do we call you?
428 if test "$bwin32" = true; then
429   TOR_LIB_WS32=-lws2_32
430   TOR_LIB_IPHLPAPI=-liphlpapi
431   # Some of the cargo-cults recommend -lwsock32 as well, but I don't
432   # think it's actually necessary.
433   TOR_LIB_GDI=-lgdi32
434 else
435   TOR_LIB_WS32=
436   TOR_LIB_GDI=
438 AC_SUBST(TOR_LIB_WS32)
439 AC_SUBST(TOR_LIB_GDI)
440 AC_SUBST(TOR_LIB_IPHLPAPI)
442 dnl We need to do this before we try our disgusting hack below.
443 AC_CHECK_HEADERS([sys/types.h])
445 dnl This is a disgusting hack so we safely include older libevent headers.
446 AC_CHECK_TYPE(u_int64_t, unsigned long long)
447 AC_CHECK_TYPE(u_int32_t, unsigned long)
448 AC_CHECK_TYPE(u_int16_t, unsigned short)
449 AC_CHECK_TYPE(u_int8_t, unsigned char)
451 tor_libevent_pkg_redhat="libevent"
452 tor_libevent_pkg_debian="libevent-dev"
453 tor_libevent_devpkg_redhat="libevent-devel"
454 tor_libevent_devpkg_debian="libevent-dev"
456 dnl On Gnu/Linux or any place we require it, we'll add librt to the Libevent
457 dnl linking for static builds.
458 STATIC_LIBEVENT_FLAGS=""
459 if test "$enable_static_libevent" = "yes"; then
460     if test "$have_rt" = yes; then
461       STATIC_LIBEVENT_FLAGS=" -lrt "
462     fi
465 TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32], [
466 #ifdef _WIN32
467 #include <winsock2.h>
468 #endif
469 #include <stdlib.h>
470 #include <sys/time.h>
471 #include <sys/types.h>
472 #include <event.h>], [
473 #ifdef _WIN32
474 #include <winsock2.h>
475 #endif
476 void exit(int); void *event_init(void);],
477     [
478 #ifdef _WIN32
479 {WSADATA d; WSAStartup(0x101,&d); }
480 #endif
481 event_init(); exit(0);
482 ], [--with-libevent-dir], [/opt/libevent])
484 dnl Now check for particular libevent functions.
485 save_LIBS="$LIBS"
486 save_LDFLAGS="$LDFLAGS"
487 save_CPPFLAGS="$CPPFLAGS"
488 LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS"
489 LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS"
490 CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS"
491 AC_CHECK_FUNCS([event_get_version \
492                 event_get_version_number \
493                 event_get_method \
494                 event_set_log_callback \
495                 evutil_secure_rng_set_urandom_device_file \
496                 evutil_secure_rng_init \
497                 event_base_loopexit])
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="$save_LIBS"
505 LDFLAGS="$save_LDFLAGS"
506 CPPFLAGS="$save_CPPFLAGS"
509 AM_CONDITIONAL(USE_EXTERNAL_EVDNS, test x$ac_cv_header_event2_dns_h = xyes)
511 if test "$enable_static_libevent" = "yes"; then
512    if test "$tor_cv_library_libevent_dir" = "(system)"; then
513      AC_MSG_ERROR("You must specify an explicit --with-libevent-dir=x option when using --enable-static-libevent")
514    else
515      TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a $STATIC_LIBEVENT_FLAGS"
516    fi
517 else
518      TOR_LIBEVENT_LIBS="-levent"
521 dnl This isn't the best test for Libevent 2.0.3-alpha.  Once it's released,
522 dnl we can do much better.
523 if test "$enable_bufferevents" = "yes" ; then
524   if test "$ac_cv_header_event2_bufferevent_ssl_h" != "yes" ; then
525     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.])
526   else
528     CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent"
530     # Check for the right version.  First see if version detection works.
531     AC_MSG_CHECKING([whether we can detect the Libevent version])
532     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
533 #include <event2/event.h>
534 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 10
535 #error
536 int x = y(zz);
537 #else
538 int x = 1;
539 #endif
540   ])], [event_version_number_works=yes; AC_MSG_RESULT([yes]) ],
541      [event_version_number_works=no;  AC_MSG_RESULT([no])])
542     if test "$event_version_number_works" != 'yes'; then
543       AC_MSG_WARN([Version detection on Libevent seems broken.  Your Libevent installation is probably screwed up or very old.])
544     else
545       AC_MSG_CHECKING([whether Libevent is new enough for bufferevents])
546       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
547 #include <event2/event.h>
548 #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000d00
549 #error
550 int x = y(zz);
551 #else
552 int x = 1;
553 #endif
554    ])], [ AC_MSG_RESULT([yes]) ],
555       [ AC_MSG_RESULT([no])
556         AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents.  We require 2.0.13-stable or later]) ] )
557     fi
558   fi
561 LIBS="$save_LIBS"
562 LDFLAGS="$save_LDFLAGS"
563 CPPFLAGS="$save_CPPFLAGS"
565 AM_CONDITIONAL(USE_BUFFEREVENTS, test "$enable_bufferevents" = "yes")
566 if test "$enable_bufferevents" = "yes"; then
567   AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
568   if test "$enable_static_libevent" = "yes"; then
569     TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent_openssl.a $TOR_LIBEVENT_LIBS"
570   else
571     TOR_LIBEVENT_LIBS="-levent_openssl $TOR_LIBEVENT_LIBS"
572   fi
574 AC_SUBST(TOR_LIBEVENT_LIBS)
576 dnl ------------------------------------------------------
577 dnl Where do you live, libm?
579 dnl On some platforms (Haiku/BeOS) the math library is
580 dnl part of libroot. In which case don't link against lm
581 TOR_LIB_MATH=""
582 save_LIBS="$LIBS"
583 AC_SEARCH_LIBS(pow, [m], , AC_MSG_ERROR([Could not find pow in libm or libc.]))
584 if test "$ac_cv_search_pow" != "none required"; then
585     TOR_LIB_MATH="$ac_cv_search_pow"
587 LIBS="$save_LIBS"
588 AC_SUBST(TOR_LIB_MATH)
590 dnl ------------------------------------------------------
591 dnl Where do you live, openssl?  And how do we call you?
593 tor_openssl_pkg_redhat="openssl"
594 tor_openssl_pkg_debian="libssl-dev"
595 tor_openssl_devpkg_redhat="openssl-devel"
596 tor_openssl_devpkg_debian="libssl-dev"
598 ALT_openssl_WITHVAL=""
599 AC_ARG_WITH(ssl-dir,
600   [  --with-ssl-dir=PATH    Obsolete alias for --with-openssl-dir ],
601   [
602       if test "x$withval" != xno && test "x$withval" != "x" ; then
603          ALT_openssl_WITHVAL="$withval"
604       fi
605   ])
607 TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
608     [#include <openssl/rand.h>],
609     [void RAND_add(const void *buf, int num, double entropy);],
610     [RAND_add((void*)0,0,0); exit(0);], [],
611     [/usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])
613 dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
615 if test "$enable_static_openssl" = "yes"; then
616    if test "$tor_cv_library_openssl_dir" = "(system)"; then
617      AC_MSG_ERROR("You must specify an explicit --with-openssl-dir=x option when using --enable-static-openssl")
618    else
619      TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libssl.a $TOR_LIBDIR_openssl/libcrypto.a"
620    fi
621 else
622      TOR_OPENSSL_LIBS="-lssl -lcrypto"
624 AC_SUBST(TOR_OPENSSL_LIBS)
626 AC_CHECK_MEMBERS([struct ssl_method_st.get_cipher_by_char], , ,
627 [#include <openssl/ssl.h>
630 dnl ------------------------------------------------------
631 dnl Where do you live, zlib?  And how do we call you?
633 tor_zlib_pkg_redhat="zlib"
634 tor_zlib_pkg_debian="zlib1g"
635 tor_zlib_devpkg_redhat="zlib-devel"
636 tor_zlib_devpkg_debian="zlib1g-dev"
638 TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
639     [#include <zlib.h>],
640     [const char * zlibVersion(void);],
641     [zlibVersion(); exit(0);], [--with-zlib-dir],
642     [/opt/zlib])
644 if test "$enable_static_zlib" = "yes"; then
645    if test "$tor_cv_library_zlib_dir" = "(system)"; then
646      AC_MSG_ERROR("You must specify an explicit --with-zlib-dir=x option when
647  using --enable-static-zlib")
648    else
649      TOR_ZLIB_LIBS="$TOR_LIBDIR_zlib/libz.a"
650    fi
651 else
652      TOR_ZLIB_LIBS="-lz"
654 AC_SUBST(TOR_ZLIB_LIBS)
656 dnl ---------------------------------------------------------------------
657 dnl Now that we know about our major libraries, we can check for compiler
658 dnl and linker hardening options.  We need to do this with the libraries known,
659 dnl since sometimes the linker will like an option but not be willing to
660 dnl use it with a build of a library.
662 all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent"
663 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"
665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
666 #if !defined(__clang__)
667 #error
668 #endif])], have_clang=yes, have_clang=no)
670 if test x$enable_gcc_hardening != xno; then
671     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
672     if test x$have_clang = xyes; then
673         TOR_CHECK_CFLAGS(-Qunused-arguments)
674     fi
675     TOR_CHECK_CFLAGS(-fstack-protector-all, also_link)
676     AS_VAR_PUSHDEF([can_compile], [tor_cv_cflags_-fstack-protector-all])
677     AS_VAR_PUSHDEF([can_link], [tor_can_link_-fstack-protector-all])
678 m4_ifdef([AS_VAR_IF],[
679     AS_VAR_IF(can_compile, [yes],
680         AS_VAR_IF(can_link, [yes],
681                   [],
682                   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.)]))
683         )])
684     AS_VAR_POPDEF([can_link])
685     AS_VAR_POPDEF([can_compile])
686     TOR_CHECK_CFLAGS(-Wstack-protector)
687     TOR_CHECK_CFLAGS(-fwrapv)
688     TOR_CHECK_CFLAGS(--param ssp-buffer-size=1)
689     if test "$bwin32" = "false"; then
690        TOR_CHECK_CFLAGS(-fPIE)
691        TOR_CHECK_LDFLAGS(-pie, "$all_ldflags_for_check", "$all_libs_for_check")
692     fi
695 if test x$enable_expensive_hardening = xyes ; then
696    TOR_CHECK_CFLAGS([-fsanitize=address])
697    TOR_CHECK_CFLAGS([-fsanitize=undefined])
698    TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
701 if test x$enable_linker_hardening != xno; then
702     TOR_CHECK_LDFLAGS(-z relro -z now, "$all_ldflags_for_check", "$all_libs_for_check")
705 # For backtrace support
706 TOR_CHECK_LDFLAGS(-rdynamic)
708 dnl ------------------------------------------------------
709 dnl Now see if we have a -fomit-frame-pointer compiler option.
711 saved_CFLAGS="$CFLAGS"
712 TOR_CHECK_CFLAGS(-fomit-frame-pointer)
713 F_OMIT_FRAME_POINTER=''
714 if test "$saved_CFLAGS" != "$CFLAGS"; then
715   if test x$enable_expensive_hardening != xyes ; then
716     F_OMIT_FRAME_POINTER='-fomit-frame-pointer'
717   fi
719 CFLAGS="$saved_CFLAGS"
720 AC_SUBST(F_OMIT_FRAME_POINTER)
722 dnl ------------------------------------------------------
723 dnl If we are adding -fomit-frame-pointer (or if the compiler's doing it
724 dnl for us, as GCC 4.6 and later do at many optimization levels), then
725 dnl we should try to add -fasynchronous-unwind-tables so that our backtrace
726 dnl code will work.
727 TOR_CHECK_CFLAGS(-fasynchronous-unwind-tables)
729 dnl ------------------------------------------------------
730 dnl Where do you live, libnatpmp?  And how do we call you?
731 dnl There are no packages for Debian or Redhat as of this patch
733 if test "$natpmp" = "true"; then
734     AC_DEFINE(NAT_PMP, 1, [Define to 1 if we are building with nat-pmp.])
735     TOR_SEARCH_LIBRARY(libnatpmp, $trylibnatpmpdir, [-lnatpmp $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
736         [#include <natpmp.h>],
737         [#ifdef _WIN32
738          #define STATICLIB
739          #endif
740          #include <natpmp.h>],
741         [   int r;
742             natpmp_t natpmp;
743             natpmpresp_t response;
744             r = initnatpmp(&natpmp, 0, 0);],
745             [printf("initnatpmp() returned %d (%s)\n", r, r?"FAILED":"SUCCESS");
746             exit(0);],
747         [--with-libnatpmp-dir],
748         [/usr/lib/])
752 dnl ------------------------------------------------------
753 dnl Where do you live, libminiupnpc?  And how do we call you?
754 dnl There are no packages for Debian or Redhat as of this patch
756 if test "$upnp" = "true"; then
757     AC_DEFINE(MINIUPNPC, 1, [Define to 1 if we are building with UPnP.])
759     dnl Before we call TOR_SEARCH_LIBRARY we'll do a quick compile test
760     dnl to see if we have miniupnpc-1.5 or -1.6
761     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
762         [upnpDiscover(1, 0, 0, 0);exit(0);])],[miniupnpc15="true"],[miniupnpc15="false"])
764     if test "$miniupnpc15" = "true" ; then
765         AC_DEFINE([MINIUPNPC15],[1],[libminiupnpc version 1.5 found])
766         TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
767             [#include <miniupnpc/miniwget.h>
768              #include <miniupnpc/miniupnpc.h>
769              #include <miniupnpc/upnpcommands.h>],
770             [void upnpDiscover(int delay, const char * multicastif,
771              const char * minissdpdsock, int sameport);],
772             [upnpDiscover(1, 0, 0, 0); exit(0);],
773             [--with-libminiupnpc-dir],
774             [/usr/lib/])
775     else
776         TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
777             [#include <miniupnpc/miniwget.h>
778              #include <miniupnpc/miniupnpc.h>
779              #include <miniupnpc/upnpcommands.h>],
780             [void upnpDiscover(int delay, const char * multicastif,
781              const char * minissdpdsock, int sameport, int ipv6, int * error);],
782             [upnpDiscover(1, 0, 0, 0, 0, 0); exit(0);],
783             [--with-libminiupnpc-dir],
784             [/usr/lib/])
785     fi
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         stdint.h \
943         sys/eventfd.h \
944         sys/file.h \
945         sys/ioctl.h \
946         sys/limits.h \
947         sys/mman.h \
948         sys/param.h \
949         sys/prctl.h \
950         sys/resource.h \
951         sys/select.h \
952         sys/socket.h \
953         sys/sysctl.h \
954         sys/syslimits.h \
955         sys/time.h \
956         sys/types.h \
957         sys/un.h \
958         sys/utime.h \
959         sys/wait.h \
960         syslog.h \
961         utime.h
964 AC_CHECK_HEADERS(sys/param.h)
966 AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
967 [#ifdef HAVE_SYS_TYPES_H
968 #include <sys/types.h>
969 #endif
970 #ifdef HAVE_SYS_SOCKET_H
971 #include <sys/socket.h>
972 #endif])
973 AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0,
974 [#ifdef HAVE_SYS_TYPES_H
975 #include <sys/types.h>
976 #endif
977 #ifdef HAVE_SYS_SOCKET_H
978 #include <sys/socket.h>
979 #endif
980 #ifdef HAVE_NET_IF_H
981 #include <net/if.h>
982 #endif])
984 AC_CHECK_HEADERS(linux/if.h,[],[],
986 #ifdef HAVE_SYS_SOCKET_H
987 #include <sys/socket.h>
988 #endif
991 AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
992         linux_netfilter_ipv4=1, linux_netfilter_ipv4=0,
993 [#ifdef HAVE_SYS_TYPES_H
994 #include <sys/types.h>
995 #endif
996 #ifdef HAVE_SYS_SOCKET_H
997 #include <sys/socket.h>
998 #endif
999 #ifdef HAVE_LIMITS_H
1000 #include <limits.h>
1001 #endif
1002 #ifdef HAVE_LINUX_TYPES_H
1003 #include <linux/types.h>
1004 #endif
1005 #ifdef HAVE_NETINET_IN6_H
1006 #include <netinet/in6.h>
1007 #endif
1008 #ifdef HAVE_NETINET_IN_H
1009 #include <netinet/in.h>
1010 #endif])
1012 AC_CHECK_HEADERS(linux/netfilter_ipv6/ip6_tables.h,
1013         linux_netfilter_ipv6_ip6_tables=1, linux_netfilter_ipv6_ip6_tables=0,
1014 [#ifdef HAVE_SYS_TYPES_H
1015 #include <sys/types.h>
1016 #endif
1017 #ifdef HAVE_SYS_SOCKET_H
1018 #include <sys/socket.h>
1019 #endif
1020 #ifdef HAVE_LIMITS_H
1021 #include <limits.h>
1022 #endif
1023 #ifdef HAVE_LINUX_TYPES_H
1024 #include <linux/types.h>
1025 #endif
1026 #ifdef HAVE_NETINET_IN6_H
1027 #include <netinet/in6.h>
1028 #endif
1029 #ifdef HAVE_NETINET_IN_H
1030 #include <netinet/in.h>
1031 #endif
1032 #ifdef HAVE_LINUX_IF_H
1033 #include <linux/if.h>
1034 #endif])
1036 if test x$transparent = xtrue ; then
1037    transparent_ok=0
1038    if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then
1039      transparent_ok=1
1040    fi
1041    if test x$linux_netfilter_ipv4 = x1 ; then
1042      transparent_ok=1
1043    fi
1044    if test x$linux_netfilter_ipv6_ip6_tables = x1 ; then
1045      transparent_ok=1
1046    fi
1047    if test x$transparent_ok = x1 ; then
1048      AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
1049      case $host in
1050        *-*-openbsd* | *-*-bitrig*)
1051          AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
1052      esac
1053    else
1054      AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
1055    fi
1058 AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
1059 [#ifdef HAVE_SYS_TYPES_H
1060 #include <sys/types.h>
1061 #endif
1062 #ifdef HAVE_SYS_TIME_H
1063 #include <sys/time.h>
1064 #endif])
1066 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
1067 dnl Watch out.
1069 AC_CHECK_SIZEOF(int8_t)
1070 AC_CHECK_SIZEOF(int16_t)
1071 AC_CHECK_SIZEOF(int32_t)
1072 AC_CHECK_SIZEOF(int64_t)
1073 AC_CHECK_SIZEOF(uint8_t)
1074 AC_CHECK_SIZEOF(uint16_t)
1075 AC_CHECK_SIZEOF(uint32_t)
1076 AC_CHECK_SIZEOF(uint64_t)
1077 AC_CHECK_SIZEOF(intptr_t)
1078 AC_CHECK_SIZEOF(uintptr_t)
1080 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
1082 AC_CHECK_SIZEOF(char)
1083 AC_CHECK_SIZEOF(short)
1084 AC_CHECK_SIZEOF(int)
1085 AC_CHECK_SIZEOF(long)
1086 AC_CHECK_SIZEOF(long long)
1087 AC_CHECK_SIZEOF(__int64)
1088 AC_CHECK_SIZEOF(void *)
1089 AC_CHECK_SIZEOF(time_t)
1090 AC_CHECK_SIZEOF(size_t)
1091 AC_CHECK_SIZEOF(pid_t)
1093 AC_CHECK_TYPES([uint, u_char, ssize_t])
1095 AC_PC_FROM_UCONTEXT([/bin/true])
1097 dnl used to include sockaddr_storage, but everybody has that.
1098 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
1099 [#ifdef HAVE_SYS_TYPES_H
1100 #include <sys/types.h>
1101 #endif
1102 #ifdef HAVE_NETINET_IN_H
1103 #include <netinet/in.h>
1104 #endif
1105 #ifdef HAVE_NETINET_IN6_H
1106 #include <netinet/in6.h>
1107 #endif
1108 #ifdef HAVE_SYS_SOCKET_H
1109 #include <sys/socket.h>
1110 #endif
1111 #ifdef _WIN32
1112 #define _WIN32_WINNT 0x0501
1113 #define WIN32_LEAN_AND_MEAN
1114 #if defined(_MSC_VER) && (_MSC_VER < 1300)
1115 #include <winsock.h>
1116 #else
1117 #include <winsock2.h>
1118 #include <ws2tcpip.h>
1119 #endif
1120 #endif
1122 AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
1123 [#ifdef HAVE_SYS_TYPES_H
1124 #include <sys/types.h>
1125 #endif
1126 #ifdef HAVE_NETINET_IN_H
1127 #include <netinet/in.h>
1128 #endif
1129 #ifdef HAVE_NETINET_IN6_H
1130 #include <netinet/in6.h>
1131 #endif
1132 #ifdef HAVE_SYS_SOCKET_H
1133 #include <sys/socket.h>
1134 #endif
1135 #ifdef _WIN32
1136 #define _WIN32_WINNT 0x0501
1137 #define WIN32_LEAN_AND_MEAN
1138 #if defined(_MSC_VER) && (_MSC_VER < 1300)
1139 #include <winsock.h>
1140 #else
1141 #include <winsock2.h>
1142 #include <ws2tcpip.h>
1143 #endif
1144 #endif
1147 AC_CHECK_TYPES([rlim_t], , ,
1148 [#ifdef HAVE_SYS_TYPES_H
1149 #include <sys/types.h>
1150 #endif
1151 #ifdef HAVE_SYS_TIME_H
1152 #include <sys/time.h>
1153 #endif
1154 #ifdef HAVE_SYS_RESOURCE_H
1155 #include <sys/resource.h>
1156 #endif
1159 AX_CHECK_SIGN([time_t],
1160        [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
1161        [ : ], [
1162 #ifdef HAVE_SYS_TYPES_H
1163 #include <sys/types.h>
1164 #endif
1165 #ifdef HAVE_SYS_TIME_H
1166 #include <sys/time.h>
1167 #endif
1168 #ifdef HAVE_TIME_H
1169 #include <time.h>
1170 #endif
1173 if test "$ax_cv_decl_time_t_signed" = no; then
1174   AC_MSG_WARN([You have an unsigned time_t; some things will probably break. Please tell the Tor developers about your interesting platform.])
1177 AX_CHECK_SIGN([size_t],
1178        [ tor_cv_size_t_signed=yes ],
1179        [ tor_cv_size_t_signed=no ], [
1180 #ifdef HAVE_SYS_TYPES_H
1181 #include <sys/types.h>
1182 #endif
1185 if test "$ax_cv_decl_size_t_signed" = yes; then
1186   AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
1189 AX_CHECK_SIGN([enum always],
1190        [ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
1191        [ : ], [
1192  enum always { AAA, BBB, CCC };
1195 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
1196 #ifdef HAVE_SYS_SOCKET_H
1197 #include <sys/socket.h>
1198 #endif
1201 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
1203 AC_CHECK_SIZEOF(cell_t)
1205 # Now make sure that NULL can be represented as zero bytes.
1206 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
1207 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1208 [[#include <stdlib.h>
1209 #include <string.h>
1210 #include <stdio.h>
1211 #ifdef HAVE_STDDEF_H
1212 #include <stddef.h>
1213 #endif
1214 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
1215 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
1216        [tor_cv_null_is_zero=yes],
1217        [tor_cv_null_is_zero=no],
1218        [tor_cv_null_is_zero=cross])])
1220 if test "$tor_cv_null_is_zero" = cross ; then
1221   # Cross-compiling; let's hope that the target isn't raving mad.
1222   AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
1225 if test "$tor_cv_null_is_zero" != no; then
1226   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
1227             [Define to 1 iff memset(0) sets pointers to NULL])
1230 AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
1231 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1232 [[#include <stdlib.h>
1233 #include <string.h>
1234 #include <stdio.h>
1235 #ifdef HAVE_STDDEF_H
1236 #include <stddef.h>
1237 #endif
1238 int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
1239 return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
1240        [tor_cv_dbl0_is_zero=yes],
1241        [tor_cv_dbl0_is_zero=no],
1242        [tor_cv_dbl0_is_zero=cross])])
1244 if test "$tor_cv_dbl0_is_zero" = cross ; then
1245   # Cross-compiling; let's hope that the target isn't raving mad.
1246   AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
1249 if test "$tor_cv_dbl0_is_zero" != no; then
1250   AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
1251             [Define to 1 iff memset(0) sets doubles to 0.0])
1254 # And what happens when we malloc zero?
1255 AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
1256 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1257 [[#include <stdlib.h>
1258 #include <string.h>
1259 #include <stdio.h>
1260 #ifdef HAVE_STDDEF_H
1261 #include <stddef.h>
1262 #endif
1263 int main () { return malloc(0)?0:1; }]])],
1264        [tor_cv_malloc_zero_works=yes],
1265        [tor_cv_malloc_zero_works=no],
1266        [tor_cv_malloc_zero_works=cross])])
1268 if test "$tor_cv_malloc_zero_works" = cross; then
1269   # Cross-compiling; let's hope that the target isn't raving mad.
1270   AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
1273 if test "$tor_cv_malloc_zero_works" = yes; then
1274   AC_DEFINE([MALLOC_ZERO_WORKS], 1,
1275             [Define to 1 iff malloc(0) returns a pointer])
1278 # whether we seem to be in a 2s-complement world.
1279 AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
1280 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1281 [[int main () { int problem = ((-99) != (~99)+1);
1282 return problem ? 1 : 0; }]])],
1283        [tor_cv_twos_complement=yes],
1284        [tor_cv_twos_complement=no],
1285        [tor_cv_twos_complement=cross])])
1287 if test "$tor_cv_twos_complement" = cross ; then
1288   # Cross-compiling; let's hope that the target isn't raving mad.
1289   AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
1292 if test "$tor_cv_twos_complement" != no ; then
1293   AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
1294             [Define to 1 iff we represent negative integers with two's complement])
1297 # What does shifting a negative value do?
1298 AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
1299 [AC_RUN_IFELSE([AC_LANG_SOURCE(
1300 [[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
1301        [tor_cv_sign_extend=yes],
1302        [tor_cv_sign_extend=no],
1303        [tor_cv_sign_extend=cross])])
1305 if test "$tor_cv_sign_extend" = cross ; then
1306   # Cross-compiling; let's hope that the target isn't raving mad.
1307   AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
1310 if test "$tor_cv_sign_extend" != no ; then
1311   AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
1312             [Define to 1 iff right-shifting a negative value performs sign-extension])
1315 # Whether we should use the dmalloc memory allocation debugging library.
1316 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
1317 AC_ARG_WITH(dmalloc,
1318 [  --with-dmalloc          Use debug memory allocation library. ],
1319 [if [[ "$withval" = "yes" ]]; then
1320   dmalloc=1
1321   AC_MSG_RESULT(yes)
1322 else
1323   dmalloc=1
1324   AC_MSG_RESULT(no)
1325 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
1328 if [[ $dmalloc -eq 1 ]]; then
1329   AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
1330   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
1331   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
1332   AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
1335 AC_ARG_WITH(tcmalloc,
1336 [  --with-tcmalloc         Use tcmalloc memory allocation library. ],
1337 [ tcmalloc=yes ], [ tcmalloc=no ])
1339 if test x$tcmalloc = xyes ; then
1340    LDFLAGS="-ltcmalloc $LDFLAGS"
1343 using_custom_malloc=no
1344 if test x$enable_openbsd_malloc = xyes ; then
1345    using_custom_malloc=yes
1347 if test x$tcmalloc = xyes ; then
1348    using_custom_malloc=yes
1350 if test $using_custom_malloc = no ; then
1351    AC_CHECK_FUNCS(mallinfo)
1354 # By default, we're going to assume we don't have mlockall()
1355 # bionic and other platforms have various broken mlockall subsystems.
1356 # Some systems don't have a working mlockall, some aren't linkable,
1357 # and some have it but don't declare it.
1358 AC_CHECK_FUNCS(mlockall)
1359 AC_CHECK_DECLS([mlockall], , , [
1360 #ifdef HAVE_SYS_MMAN_H
1361 #include <sys/mman.h>
1362 #endif])
1364 # Allow user to specify an alternate syslog facility
1365 AC_ARG_WITH(syslog-facility,
1366 [  --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
1367 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
1368 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
1369 AC_SUBST(LOGFACILITY)
1371 # Check if we have getresuid and getresgid
1372 AC_CHECK_FUNCS(getresuid getresgid)
1374 # Check for gethostbyname_r in all its glorious incompatible versions.
1375 #   (This logic is based on that in Python's configure.in)
1376 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1377   [Define this if you have any gethostbyname_r()])
1379 AC_CHECK_FUNC(gethostbyname_r, [
1380   AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
1381   OLD_CFLAGS=$CFLAGS
1382   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1383   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1384 #include <netdb.h>
1385   ], [[
1386     char *cp1, *cp2;
1387     struct hostent *h1, *h2;
1388     int i1, i2;
1389     (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
1390   ]])],[
1391     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1392     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1393      [Define this if gethostbyname_r takes 6 arguments])
1394     AC_MSG_RESULT(6)
1395   ], [
1396     AC_TRY_COMPILE([
1397 #include <netdb.h>
1398     ], [
1399       char *cp1, *cp2;
1400       struct hostent *h1;
1401       int i1, i2;
1402       (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
1403     ], [
1404       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1405       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1406         [Define this if gethostbyname_r takes 5 arguments])
1407       AC_MSG_RESULT(5)
1408    ], [
1409       AC_TRY_COMPILE([
1410 #include <netdb.h>
1411      ], [
1412        char *cp1;
1413        struct hostent *h1;
1414        struct hostent_data hd;
1415        (void) gethostbyname_r(cp1,h1,&hd);
1416      ], [
1417        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1418        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1419          [Define this if gethostbyname_r takes 3 arguments])
1420        AC_MSG_RESULT(3)
1421      ], [
1422        AC_MSG_RESULT(0)
1423      ])
1424   ])
1425  ])
1426  CFLAGS=$OLD_CFLAGS
1429 AC_CACHE_CHECK([whether the C compiler supports __func__],
1430   tor_cv_have_func_macro,
1431   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1432 #include <stdio.h>
1433 int main(int c, char **v) { puts(__func__); }])],
1434   tor_cv_have_func_macro=yes,
1435   tor_cv_have_func_macro=no))
1437 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
1438   tor_cv_have_FUNC_macro,
1439   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1440 #include <stdio.h>
1441 int main(int c, char **v) { puts(__FUNC__); }])],
1442   tor_cv_have_FUNC_macro=yes,
1443   tor_cv_have_FUNC_macro=no))
1445 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
1446   tor_cv_have_FUNCTION_macro,
1447   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1448 #include <stdio.h>
1449 int main(int c, char **v) { puts(__FUNCTION__); }])],
1450   tor_cv_have_FUNCTION_macro=yes,
1451   tor_cv_have_FUNCTION_macro=no))
1453 AC_CACHE_CHECK([whether we have extern char **environ already declared],
1454   tor_cv_have_environ_declared,
1455   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1456 /* We define _GNU_SOURCE here because it is also defined in compat.c.
1457  * Without it environ doesn't get declared. */
1458 #define _GNU_SOURCE
1459 #ifdef HAVE_UNISTD_H
1460 #include <unistd.h>
1461 #endif
1462 #include <stdlib.h>
1463 int main(int c, char **v) { char **t = environ; }])],
1464   tor_cv_have_environ_declared=yes,
1465   tor_cv_have_environ_declared=no))
1467 if test "$tor_cv_have_func_macro" = 'yes'; then
1468   AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
1471 if test "$tor_cv_have_FUNC_macro" = 'yes'; then
1472   AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
1475 if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
1476   AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
1477            [Defined if the compiler supports __FUNCTION__])
1480 if test "$tor_cv_have_environ_declared" = 'yes'; then
1481   AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
1482            [Defined if we have extern char **environ already declared])
1485 # $prefix stores the value of the --prefix command line option, or
1486 # NONE if the option wasn't set.  In the case that it wasn't set, make
1487 # it be the default, so that we can use it to expand directories now.
1488 if test "x$prefix" = "xNONE"; then
1489   prefix=$ac_default_prefix
1492 # and similarly for $exec_prefix
1493 if test "x$exec_prefix" = "xNONE"; then
1494   exec_prefix=$prefix
1497 if test "x$BUILDDIR" = "x"; then
1498   BUILDDIR=`pwd`
1500 AC_SUBST(BUILDDIR)
1501 AH_TEMPLATE([BUILDDIR],[tor's build directory])
1502 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
1504 if test "x$CONFDIR" = "x"; then
1505   CONFDIR=`eval echo $sysconfdir/tor`
1507 AC_SUBST(CONFDIR)
1508 AH_TEMPLATE([CONFDIR],[tor's configuration directory])
1509 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
1511 BINDIR=`eval echo $bindir`
1512 AC_SUBST(BINDIR)
1513 LOCALSTATEDIR=`eval echo $localstatedir`
1514 AC_SUBST(LOCALSTATEDIR)
1516 if test "$bwin32" = true; then
1517   # Test if the linker supports the --nxcompat and --dynamicbase options
1518   # for Windows
1519   save_LDFLAGS="$LDFLAGS"
1520   LDFLAGS="-Wl,--nxcompat -Wl,--dynamicbase"
1521   AC_MSG_CHECKING([whether the linker supports DllCharacteristics])
1522   AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
1523     [AC_MSG_RESULT([yes])]
1524     [save_LDFLAGS="$save_LDFLAGS $LDFLAGS"],
1525     [AC_MSG_RESULT([no])]
1526   )
1527   LDFLAGS="$save_LDFLAGS"
1530 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
1531 # than autoconf's macros like.
1532 if test "$GCC" = yes; then
1533   # Disable GCC's strict aliasing checks.  They are an hours-to-debug
1534   # accident waiting to happen.
1535   CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
1536 else
1537   # Override optimization level for non-gcc compilers
1538   CFLAGS="$CFLAGS -O"
1539   enable_gcc_warnings=no
1540   enable_gcc_warnings_advisory=no
1543 # OS X Lion started deprecating the system openssl. Let's just disable
1544 # all deprecation warnings on OS X. Also, to potentially make the binary
1545 # a little smaller, let's enable dead_strip.
1546 case "$host_os" in
1548  darwin*)
1549     CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1550     LDFLAGS="$LDFLAGS -dead_strip" ;;
1551 esac
1553 # Add some more warnings which we use in development but not in the
1554 # released versions.  (Some relevant gcc versions can't handle these.)
1555 if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xyes; then
1557   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1558 #if !defined(__GNUC__) || (__GNUC__ < 4)
1559 #error
1560 #endif])], have_gcc4=yes, have_gcc4=no)
1562   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1563 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
1564 #error
1565 #endif])], have_gcc42=yes, have_gcc42=no)
1567   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1568 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
1569 #error
1570 #endif])], have_gcc43=yes, have_gcc43=no)
1572   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1573 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
1574 #error
1575 #endif])], have_gcc46=yes, have_gcc46=no)
1578   save_CFLAGS="$CFLAGS"
1579   CFLAGS="$CFLAGS -Wshorten-64-to-32"
1580   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
1581                     have_shorten64_flag=no)
1582   CFLAGS="$save_CFLAGS"
1584   case $host in
1585     *-*-openbsd* | *-*-bitrig*)
1586       # Some OpenBSD versions (like 4.8) have -Wsystem-headers by default.
1587       # That's fine, except that the headers don't pass -Wredundant-decls.
1588       # Therefore, let's disable -Wsystem-headers when we're building
1589       # with maximal warnings on OpenBSD.
1590       CFLAGS="$CFLAGS -Wno-system-headers" ;;
1591   esac
1593   CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith"
1594   CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
1595   CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
1596   CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
1597   CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
1599   if test x$enable_gcc_warnings = xyes; then
1600     CFLAGS="$CFLAGS -Werror"
1601   fi
1603   # Disabled, so we can use mallinfo(): -Waggregate-return
1605   if test x$have_gcc4 = xyes ; then
1606     # These warnings break gcc 3.3.5 and work on gcc 4.0.2
1607     CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wold-style-definition"
1608   fi
1610   if test x$have_gcc42 = xyes ; then
1611     # These warnings break gcc 4.0.2 and work on gcc 4.2
1612     # XXXX020 See if any of these work with earlier versions.
1613     CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
1615     # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
1616   fi
1618   if test x$have_gcc42 = xyes && test x$have_clang = xno; then
1619     # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
1620     CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
1621   fi
1623   if test x$have_gcc43 = xyes ; then
1624     # These warnings break gcc 4.2 and work on gcc 4.3
1625     # XXXX020 See if any of these work with earlier versions.
1626     CFLAGS="$CFLAGS -Wextra -Warray-bounds"
1627   fi
1629   if test x$have_gcc46 = xyes ; then
1630     # This warning was added in gcc 4.3, but it appears to generate
1631     # spurious warnings in gcc 4.4.  I don't know if it works in 4.5.
1632     CFLAGS="$CFLAGS -Wlogical-op"
1633   fi
1635   if test x$have_shorten64_flag = xyes ; then
1636     CFLAGS="$CFLAGS -Wshorten-64-to-32"
1637   fi
1641 ##This will break the world on some 64-bit architectures
1642 # CFLAGS="$CFLAGS -Winline"
1645 if test "$enable_coverage" = yes && test "$have_clang" = "no"; then
1646    case "$host_os" in
1647     darwin*)
1648       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.])
1649    esac
1652 CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
1654 AC_CONFIG_FILES([
1655         Doxyfile
1656         Makefile
1657         contrib/dist/suse/tor.sh
1658         contrib/operator-tools/tor.logrotate
1659         contrib/dist/tor.sh
1660         contrib/dist/torctl
1661         contrib/dist/tor.service
1662         src/config/torrc.sample
1663         src/config/torrc.minimal
1666 if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
1667   regular_mans="doc/tor doc/tor-gencert doc/tor-resolve doc/torify"
1668   for file in $regular_mans ; do
1669     if ! [[ -f "$srcdir/$file.1.in" ]] || ! [[ -f "$srcdir/$file.html.in" ]] ; then
1670       echo "==================================";
1671       echo;
1672       echo "Building Tor has failed since manpages cannot be built.";
1673       echo;
1674       echo "You need asciidoc installed to be able to build the manpages.";
1675       echo "To build without manpages, use the --disable-asciidoc argument";
1676       echo "when calling configure.";
1677       echo;
1678       echo "==================================";
1679       exit 1;
1680     fi
1681   done
1684 AC_OUTPUT
1686 if test -x /usr/bin/perl && test -x ./scripts/maint/updateVersions.pl ; then
1687   ./scripts/maint/updateVersions.pl