configure.ac 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511
  1. dnl Copyright (c) 2001-2004, Roger Dingledine
  2. dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
  3. dnl Copyright (c) 2007-2013, The Tor Project, Inc.
  4. dnl See LICENSE for licensing information
  5. AC_INIT([tor],[0.2.5.0-alpha-dev])
  6. AC_CONFIG_SRCDIR([src/or/main.c])
  7. AC_CONFIG_MACRO_DIR([m4])
  8. AM_INIT_AUTOMAKE
  9. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  10. AC_CONFIG_HEADERS([orconfig.h])
  11. AC_CANONICAL_HOST
  12. if test -f /etc/redhat-release ; then
  13. if test -f /usr/kerberos/include ; then
  14. CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
  15. fi
  16. fi
  17. # Not a no-op; we want to make sure that CPPFLAGS is set before we use
  18. # the += operator on it in src/or/Makefile.am
  19. CPPFLAGS="$CPPFLAGS -I\${top_srcdir}/src/common"
  20. #XXXX020 We should make these enabled or not, before 0.2.0.x-final
  21. AC_ARG_ENABLE(buf-freelists,
  22. AS_HELP_STRING(--disable-buf-freelists, disable freelists for buffer RAM))
  23. AC_ARG_ENABLE(openbsd-malloc,
  24. AS_HELP_STRING(--enable-openbsd-malloc, Use malloc code from openbsd. Linux only))
  25. AC_ARG_ENABLE(instrument-downloads,
  26. AS_HELP_STRING(--enable-instrument-downloads, Instrument downloads of directory resources etc.))
  27. AC_ARG_ENABLE(static-openssl,
  28. AS_HELP_STRING(--enable-static-openssl, Link against a static openssl library. Requires --with-openssl-dir))
  29. AC_ARG_ENABLE(static-libevent,
  30. AS_HELP_STRING(--enable-static-libevent, Link against a static libevent library. Requires --with-libevent-dir))
  31. AC_ARG_ENABLE(static-zlib,
  32. AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir))
  33. AC_ARG_ENABLE(static-tor,
  34. AS_HELP_STRING(--enable-static-tor, Create an entirely static Tor binary. Requires --with-openssl-dir and --with-libevent-dir and --with-zlib-dir))
  35. AC_ARG_ENABLE(curve25519,
  36. AS_HELP_STRING(--disable-curve25519, Build Tor with no curve25519 elliptic-curve crypto support))
  37. AC_ARG_ENABLE(unittests,
  38. AS_HELP_STRING(--disable-unittests, [Don't build unit tests for Tor. Risky!]))
  39. AC_ARG_ENABLE(coverage,
  40. AS_HELP_STRING(--enable-coverage, [Enable coverage support in the unit-test build]))
  41. AM_CONDITIONAL(UNITTESTS_ENABLED, test x$enable_unittests != xno)
  42. AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes)
  43. echo "COVERAGE: $enable_coverage"
  44. if test "$enable_static_tor" = "yes"; then
  45. enable_static_libevent="yes";
  46. enable_static_openssl="yes";
  47. enable_static_zlib="yes";
  48. CFLAGS="$CFLAGS -static"
  49. fi
  50. if test x$enable_buf_freelists != xno; then
  51. AC_DEFINE(ENABLE_BUF_FREELISTS, 1,
  52. [Defined if we try to use freelists for buffer RAM chunks])
  53. fi
  54. AM_CONDITIONAL(USE_OPENBSD_MALLOC, test x$enable_openbsd_malloc = xyes)
  55. if test x$enable_instrument_downloads = xyes; then
  56. AC_DEFINE(INSTRUMENT_DOWNLOADS, 1,
  57. [Defined if we want to keep track of how much of each kind of resource we download.])
  58. fi
  59. AC_ARG_ENABLE(transparent,
  60. AS_HELP_STRING(--disable-transparent, disable transparent proxy support),
  61. [case "${enableval}" in
  62. yes) transparent=true ;;
  63. no) transparent=false ;;
  64. *) AC_MSG_ERROR(bad value for --enable-transparent) ;;
  65. esac], [transparent=true])
  66. AC_ARG_ENABLE(asciidoc,
  67. AS_HELP_STRING(--disable-asciidoc, don't use asciidoc (disables building of manpages)),
  68. [case "${enableval}" in
  69. yes) asciidoc=true ;;
  70. no) asciidoc=false ;;
  71. *) AC_MSG_ERROR(bad value for --disable-asciidoc) ;;
  72. esac], [asciidoc=true])
  73. # By default, we're not ready to ship a NAT-PMP aware Tor
  74. AC_ARG_ENABLE(nat-pmp,
  75. AS_HELP_STRING(--enable-nat-pmp, enable NAT-PMP support),
  76. [case "${enableval}" in
  77. yes) natpmp=true ;;
  78. no) natpmp=false ;;
  79. * ) AC_MSG_ERROR(bad value for --enable-nat-pmp) ;;
  80. esac], [natpmp=false])
  81. # By default, we're not ready to ship a UPnP aware Tor
  82. AC_ARG_ENABLE(upnp,
  83. AS_HELP_STRING(--enable-upnp, enable UPnP support),
  84. [case "${enableval}" in
  85. yes) upnp=true ;;
  86. no) upnp=false ;;
  87. * ) AC_MSG_ERROR(bad value for --enable-upnp) ;;
  88. esac], [upnp=false])
  89. AC_ARG_ENABLE(threads,
  90. AS_HELP_STRING(--disable-threads, disable multi-threading support))
  91. if test x$enable_threads = x; then
  92. case $host in
  93. *-*-solaris* )
  94. # Don't try multithreading on solaris -- cpuworkers seem to lock.
  95. AC_MSG_NOTICE([You are running Solaris; Sometimes threading makes
  96. cpu workers lock up here, so I will disable threads.])
  97. enable_threads="no";;
  98. *)
  99. enable_threads="yes";;
  100. esac
  101. fi
  102. if test "$enable_threads" = "yes"; then
  103. AC_DEFINE(ENABLE_THREADS, 1, [Defined if we will try to use multithreading])
  104. fi
  105. case $host in
  106. *-*-solaris* )
  107. AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
  108. ;;
  109. esac
  110. AC_ARG_ENABLE(gcc-warnings,
  111. AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
  112. AC_ARG_ENABLE(gcc-warnings-advisory,
  113. AS_HELP_STRING(--enable-gcc-warnings-advisory, [enable verbose warnings, excluding -Werror]))
  114. dnl Adam shostack suggests the following for Windows:
  115. dnl -D_FORTIFY_SOURCE=2 -fstack-protector-all
  116. dnl Others suggest '/gs /safeseh /nxcompat /dynamicbase' for non-gcc on Windows
  117. dnl This requires that we use gcc and that we add -O2 to the CFLAGS.
  118. AC_ARG_ENABLE(gcc-hardening,
  119. AS_HELP_STRING(--disable-gcc-hardening, disable compiler security checks))
  120. dnl Linker hardening options
  121. dnl Currently these options are ELF specific - you can't use this with MacOSX
  122. AC_ARG_ENABLE(linker-hardening,
  123. AS_HELP_STRING(--disable-linker-hardening, disable linker security fixups))
  124. AC_ARG_ENABLE(local-appdata,
  125. AS_HELP_STRING(--enable-local-appdata, default to host local application data paths on Windows))
  126. if test "$enable_local_appdata" = "yes"; then
  127. AC_DEFINE(ENABLE_LOCAL_APPDATA, 1,
  128. [Defined if we default to host local appdata paths on Windows])
  129. fi
  130. # Tor2web mode flag
  131. AC_ARG_ENABLE(tor2web-mode,
  132. AS_HELP_STRING(--enable-tor2web-mode, support tor2web non-anonymous mode),
  133. [if test x$enableval = xyes; then
  134. CFLAGS="$CFLAGS -D ENABLE_TOR2WEB_MODE=1"
  135. fi])
  136. AC_ARG_ENABLE(bufferevents,
  137. AS_HELP_STRING(--enable-bufferevents, use Libevent's buffered IO.))
  138. dnl check for the correct "ar" when cross-compiling
  139. AN_MAKEVAR([AR], [AC_PROG_AR])
  140. AN_PROGRAM([ar], [AC_PROG_AR])
  141. AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL([AR], [ar], [ar])])
  142. AC_PROG_AR
  143. AC_PROG_CC
  144. AC_PROG_CPP
  145. AC_PROG_MAKE_SET
  146. AC_PROG_RANLIB
  147. dnl autoconf 2.59 appears not to support AC_PROG_SED
  148. AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
  149. dnl check for asciidoc and a2x
  150. AC_PATH_PROG([ASCIIDOC], [asciidoc], none)
  151. AC_PATH_PROG([A2X], [a2x], none)
  152. AM_CONDITIONAL(USE_ASCIIDOC, test x$asciidoc = xtrue)
  153. AM_CONDITIONAL(USE_FW_HELPER, test x$natpmp = xtrue || test x$upnp = xtrue)
  154. AM_CONDITIONAL(NAT_PMP, test x$natpmp = xtrue)
  155. AM_CONDITIONAL(MINIUPNPC, test x$upnp = xtrue)
  156. AM_PROG_CC_C_O
  157. ifdef([AC_C_FLEXIBLE_ARRAY_MEMBER], [
  158. AC_C_FLEXIBLE_ARRAY_MEMBER
  159. ], [
  160. dnl Maybe we've got an old autoconf...
  161. AC_CACHE_CHECK([for flexible array members],
  162. tor_cv_c_flexarray,
  163. [AC_COMPILE_IFELSE(
  164. AC_LANG_PROGRAM([
  165. struct abc { int a; char b[]; };
  166. ], [
  167. struct abc *def = malloc(sizeof(struct abc)+sizeof(char));
  168. def->b[0] = 33;
  169. ]),
  170. [tor_cv_c_flexarray=yes],
  171. [tor_cv_c_flexarray=no])])
  172. if test $tor_cv_flexarray = yes ; then
  173. AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
  174. else
  175. AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1], [Define to nothing if C supports flexible array members, and to 1 if it does not.])
  176. fi
  177. ])
  178. AC_PATH_PROG([SHA1SUM], [sha1sum], none)
  179. AC_PATH_PROG([OPENSSL], [openssl], none)
  180. TORUSER=_tor
  181. AC_ARG_WITH(tor-user,
  182. [ --with-tor-user=NAME Specify username for tor daemon ],
  183. [
  184. TORUSER=$withval
  185. ]
  186. )
  187. AC_SUBST(TORUSER)
  188. TORGROUP=_tor
  189. AC_ARG_WITH(tor-group,
  190. [ --with-tor-group=NAME Specify group name for tor daemon ],
  191. [
  192. TORGROUP=$withval
  193. ]
  194. )
  195. AC_SUBST(TORGROUP)
  196. dnl If _WIN32 is defined and non-zero, we are building for win32
  197. AC_MSG_CHECKING([for win32])
  198. AC_RUN_IFELSE([AC_LANG_SOURCE([
  199. int main(int c, char **v) {
  200. #ifdef _WIN32
  201. #if _WIN32
  202. return 0;
  203. #else
  204. return 1;
  205. #endif
  206. #else
  207. return 2;
  208. #endif
  209. }])],
  210. bwin32=true; AC_MSG_RESULT([yes]),
  211. bwin32=false; AC_MSG_RESULT([no]),
  212. bwin32=cross; AC_MSG_RESULT([cross])
  213. )
  214. if test "$bwin32" = cross; then
  215. AC_MSG_CHECKING([for win32 (cross)])
  216. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  217. #ifdef _WIN32
  218. int main(int c, char **v) {return 0;}
  219. #else
  220. #error
  221. int main(int c, char **v) {return x(y);}
  222. #endif
  223. ])],
  224. bwin32=true; AC_MSG_RESULT([yes]),
  225. bwin32=false; AC_MSG_RESULT([no]))
  226. fi
  227. AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
  228. dnl Enable C99 when compiling with MIPSpro
  229. AC_MSG_CHECKING([for MIPSpro compiler])
  230. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [
  231. #if (defined(__sgi) && defined(_COMPILER_VERSION))
  232. #error
  233. return x(y);
  234. #endif
  235. ])],
  236. bmipspro=false; AC_MSG_RESULT(no),
  237. bmipspro=true; AC_MSG_RESULT(yes))
  238. if test "$bmipspro" = true; then
  239. CFLAGS="$CFLAGS -c99"
  240. fi
  241. AC_C_BIGENDIAN
  242. AC_SEARCH_LIBS(socket, [socket network])
  243. AC_SEARCH_LIBS(gethostbyname, [nsl])
  244. AC_SEARCH_LIBS(dlopen, [dl])
  245. AC_SEARCH_LIBS(inet_aton, [resolv])
  246. saved_LIBS="$LIBS"
  247. AC_SEARCH_LIBS([clock_gettime], [rt])
  248. if test "$LIBS" != "$saved_LIBS"; then
  249. # Looks like we need -lrt for clock_gettime().
  250. have_rt=yes
  251. fi
  252. if test "$enable_threads" = "yes"; then
  253. AC_SEARCH_LIBS(pthread_create, [pthread])
  254. AC_SEARCH_LIBS(pthread_detach, [pthread])
  255. fi
  256. dnl -------------------------------------------------------------------
  257. dnl Check for functions before libevent, since libevent-1.2 apparently
  258. dnl exports strlcpy without defining it in a header.
  259. AC_CHECK_FUNCS(
  260. _NSGetEnviron \
  261. accept4 \
  262. clock_gettime \
  263. flock \
  264. ftime \
  265. getaddrinfo \
  266. getifaddrs \
  267. getrlimit \
  268. gettimeofday \
  269. gmtime_r \
  270. inet_aton \
  271. ioctl \
  272. issetugid \
  273. llround \
  274. localtime_r \
  275. lround \
  276. memmem \
  277. prctl \
  278. rint \
  279. socketpair \
  280. strlcat \
  281. strlcpy \
  282. strptime \
  283. strtok_r \
  284. strtoull \
  285. sysconf \
  286. uname \
  287. vasprintf \
  288. _vscprintf
  289. )
  290. if test "$enable_threads" = "yes"; then
  291. AC_CHECK_HEADERS(pthread.h)
  292. AC_CHECK_FUNCS(pthread_create)
  293. fi
  294. dnl ------------------------------------------------------
  295. dnl Where do you live, libevent? And how do we call you?
  296. if test "$bwin32" = true; then
  297. TOR_LIB_WS32=-lws2_32
  298. TOR_LIB_IPHLPAPI=-liphlpapi
  299. # Some of the cargo-cults recommend -lwsock32 as well, but I don't
  300. # think it's actually necessary.
  301. TOR_LIB_GDI=-lgdi32
  302. else
  303. TOR_LIB_WS32=
  304. TOR_LIB_GDI=
  305. fi
  306. AC_SUBST(TOR_LIB_WS32)
  307. AC_SUBST(TOR_LIB_GDI)
  308. AC_SUBST(TOR_LIB_IPHLPAPI)
  309. dnl We need to do this before we try our disgusting hack below.
  310. AC_CHECK_HEADERS([sys/types.h])
  311. dnl This is a disgusting hack so we safely include older libevent headers.
  312. AC_CHECK_TYPE(u_int64_t, unsigned long long)
  313. AC_CHECK_TYPE(u_int32_t, unsigned long)
  314. AC_CHECK_TYPE(u_int16_t, unsigned short)
  315. AC_CHECK_TYPE(u_int8_t, unsigned char)
  316. tor_libevent_pkg_redhat="libevent"
  317. tor_libevent_pkg_debian="libevent-dev"
  318. tor_libevent_devpkg_redhat="libevent-devel"
  319. tor_libevent_devpkg_debian="libevent-dev"
  320. dnl On Gnu/Linux or any place we require it, we'll add librt to the Libevent
  321. dnl linking for static builds.
  322. STATIC_LIBEVENT_FLAGS=""
  323. if test "$enable_static_libevent" = "yes"; then
  324. if test "$have_rt" = yes; then
  325. STATIC_LIBEVENT_FLAGS=" -lrt "
  326. fi
  327. fi
  328. TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32], [
  329. #ifdef _WIN32
  330. #include <winsock2.h>
  331. #endif
  332. #include <stdlib.h>
  333. #include <sys/time.h>
  334. #include <sys/types.h>
  335. #include <event.h>], [
  336. #ifdef _WIN32
  337. #include <winsock2.h>
  338. #endif
  339. void exit(int); void *event_init(void);],
  340. [
  341. #ifdef _WIN32
  342. {WSADATA d; WSAStartup(0x101,&d); }
  343. #endif
  344. event_init(); exit(0);
  345. ], [--with-libevent-dir], [/opt/libevent])
  346. dnl Now check for particular libevent functions.
  347. save_LIBS="$LIBS"
  348. save_LDFLAGS="$LDFLAGS"
  349. save_CPPFLAGS="$CPPFLAGS"
  350. LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS"
  351. LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS"
  352. CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS"
  353. AC_CHECK_FUNCS(event_get_version event_get_version_number event_get_method event_set_log_callback evdns_set_outgoing_bind_address event_base_loopexit)
  354. AC_CHECK_MEMBERS([struct event.min_heap_idx], , ,
  355. [#include <event.h>
  356. ])
  357. AC_CHECK_HEADERS(event2/event.h event2/dns.h event2/bufferevent_ssl.h)
  358. LIBS="$save_LIBS"
  359. LDFLAGS="$save_LDFLAGS"
  360. CPPFLAGS="$save_CPPFLAGS"
  361. AM_CONDITIONAL(USE_EXTERNAL_EVDNS, test x$ac_cv_header_event2_dns_h = xyes)
  362. if test "$enable_static_libevent" = "yes"; then
  363. if test "$tor_cv_library_libevent_dir" = "(system)"; then
  364. AC_MSG_ERROR("You must specify an explicit --with-libevent-dir=x option when using --enable-static-libevent")
  365. else
  366. TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent.a $STATIC_LIBEVENT_FLAGS"
  367. fi
  368. else
  369. TOR_LIBEVENT_LIBS="-levent"
  370. fi
  371. dnl This isn't the best test for Libevent 2.0.3-alpha. Once it's released,
  372. dnl we can do much better.
  373. if test "$enable_bufferevents" = "yes" ; then
  374. if test "$ac_cv_header_event2_bufferevent_ssl_h" != "yes" ; then
  375. 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.])
  376. else
  377. CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent"
  378. # Check for the right version. First see if version detection works.
  379. AC_MSG_CHECKING([whether we can detect the Libevent version])
  380. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  381. #include <event2/event.h>
  382. #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 10
  383. #error
  384. int x = y(zz);
  385. #else
  386. int x = 1;
  387. #endif
  388. ])], [event_version_number_works=yes; AC_MSG_RESULT([yes]) ],
  389. [event_version_number_works=no; AC_MSG_RESULT([no])])
  390. if test "$event_version_number_works" != 'yes'; then
  391. AC_MSG_WARN([Version detection on Libevent seems broken. Your Libevent installation is probably screwed up or very old.])
  392. else
  393. AC_MSG_CHECKING([whether Libevent is new enough for bufferevents])
  394. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  395. #include <event2/event.h>
  396. #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000d00
  397. #error
  398. int x = y(zz);
  399. #else
  400. int x = 1;
  401. #endif
  402. ])], [ AC_MSG_RESULT([yes]) ],
  403. [ AC_MSG_RESULT([no])
  404. AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents. We require 2.0.13-stable or later]) ] )
  405. fi
  406. fi
  407. fi
  408. LIBS="$save_LIBS"
  409. LDFLAGS="$save_LDFLAGS"
  410. CPPFLAGS="$save_CPPFLAGS"
  411. AM_CONDITIONAL(USE_BUFFEREVENTS, test "$enable_bufferevents" = "yes")
  412. if test "$enable_bufferevents" = "yes"; then
  413. AC_DEFINE(USE_BUFFEREVENTS, 1, [Defined if we're going to use Libevent's buffered IO API])
  414. if test "$enable_static_libevent" = "yes"; then
  415. TOR_LIBEVENT_LIBS="$TOR_LIBDIR_libevent/libevent_openssl.a $TOR_LIBEVENT_LIBS"
  416. else
  417. TOR_LIBEVENT_LIBS="-levent_openssl $TOR_LIBEVENT_LIBS"
  418. fi
  419. fi
  420. AC_SUBST(TOR_LIBEVENT_LIBS)
  421. dnl ------------------------------------------------------
  422. dnl Where do you live, libm?
  423. dnl On some platforms (Haiku/BeOS) the math library is
  424. dnl part of libroot. In which case don't link against lm
  425. TOR_LIB_MATH=""
  426. save_LIBS="$LIBS"
  427. AC_SEARCH_LIBS(pow, [m], , AC_MSG_ERROR([Could not find pow in libm or libc.]))
  428. if test "$ac_cv_search_pow" != "none required"; then
  429. TOR_LIB_MATH="$ac_cv_search_pow"
  430. fi
  431. LIBS="$save_LIBS"
  432. AC_SUBST(TOR_LIB_MATH)
  433. dnl ------------------------------------------------------
  434. dnl Where do you live, openssl? And how do we call you?
  435. tor_openssl_pkg_redhat="openssl"
  436. tor_openssl_pkg_debian="libssl"
  437. tor_openssl_devpkg_redhat="openssl-devel"
  438. tor_openssl_devpkg_debian="libssl-dev"
  439. ALT_openssl_WITHVAL=""
  440. AC_ARG_WITH(ssl-dir,
  441. [ --with-ssl-dir=PATH Obsolete alias for --with-openssl-dir ],
  442. [
  443. if test "x$withval" != xno && test "x$withval" != "x" ; then
  444. ALT_openssl_WITHVAL="$withval"
  445. fi
  446. ])
  447. TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
  448. [#include <openssl/rand.h>],
  449. [void RAND_add(const void *buf, int num, double entropy);],
  450. [RAND_add((void*)0,0,0); exit(0);], [],
  451. [/usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])
  452. dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
  453. if test "$enable_static_openssl" = "yes"; then
  454. if test "$tor_cv_library_openssl_dir" = "(system)"; then
  455. AC_MSG_ERROR("You must specify an explicit --with-openssl-dir=x option when using --enable-static-openssl")
  456. else
  457. TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libssl.a $TOR_LIBDIR_openssl/libcrypto.a"
  458. fi
  459. else
  460. TOR_OPENSSL_LIBS="-lssl -lcrypto"
  461. fi
  462. AC_SUBST(TOR_OPENSSL_LIBS)
  463. dnl ------------------------------------------------------
  464. dnl Where do you live, zlib? And how do we call you?
  465. tor_zlib_pkg_redhat="zlib"
  466. tor_zlib_pkg_debian="zlib1g"
  467. tor_zlib_devpkg_redhat="zlib-devel"
  468. tor_zlib_devpkg_debian="zlib1g-dev"
  469. TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
  470. [#include <zlib.h>],
  471. [const char * zlibVersion(void);],
  472. [zlibVersion(); exit(0);], [--with-zlib-dir],
  473. [/opt/zlib])
  474. if test "$enable_static_zlib" = "yes"; then
  475. if test "$tor_cv_library_zlib_dir" = "(system)"; then
  476. AC_MSG_ERROR("You must specify an explicit --with-zlib-dir=x option when
  477. using --enable-static-zlib")
  478. else
  479. TOR_ZLIB_LIBS="$TOR_LIBDIR_zlib/libz.a"
  480. fi
  481. else
  482. TOR_ZLIB_LIBS="-lz"
  483. fi
  484. AC_SUBST(TOR_ZLIB_LIBS)
  485. dnl ---------------------------------------------------------------------
  486. dnl Now that we know about our major libraries, we can check for compiler
  487. dnl and linker hardening options. We need to do this with the libraries known,
  488. dnl since sometimes the linker will like an option but not be willing to
  489. dnl use it with a build of a library.
  490. all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent"
  491. all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI"
  492. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  493. #if !defined(__clang__)
  494. #error
  495. #endif])], have_clang=yes, have_clang=no)
  496. if test x$enable_gcc_hardening != xno; then
  497. CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
  498. if test x$have_clang = xyes; then
  499. TOR_CHECK_CFLAGS(-Qunused-arguments)
  500. fi
  501. TOR_CHECK_CFLAGS(-fstack-protector-all)
  502. TOR_CHECK_CFLAGS(-Wstack-protector)
  503. TOR_CHECK_CFLAGS(-fwrapv)
  504. TOR_CHECK_CFLAGS(--param ssp-buffer-size=1)
  505. if test "$bwin32" = "false"; then
  506. TOR_CHECK_CFLAGS(-fPIE)
  507. TOR_CHECK_LDFLAGS(-pie, "$all_ldflags_for_check", "$all_libs_for_check")
  508. fi
  509. fi
  510. if test x$enable_linker_hardening != xno; then
  511. TOR_CHECK_LDFLAGS(-z relro -z now, "$all_ldflags_for_check", "$all_libs_for_check")
  512. fi
  513. dnl ------------------------------------------------------
  514. dnl Now see if we have a -fomit-frame-pointer compiler option.
  515. saved_CFLAGS="$CFLAGS"
  516. TOR_CHECK_CFLAGS(-fomit-frame-pointer)
  517. if test "$saved_CFLAGS" != "$CFLAGS"; then
  518. F_OMIT_FRAME_POINTER='-fomit-frame-pointer'
  519. else
  520. F_OMIT_FRAME_POINTER=''
  521. fi
  522. CFLAGS="$saved_CFLAGS"
  523. AC_SUBST(F_OMIT_FRAME_POINTER)
  524. dnl ------------------------------------------------------
  525. dnl Where do you live, libnatpmp? And how do we call you?
  526. dnl There are no packages for Debian or Redhat as of this patch
  527. if test "$natpmp" = "true"; then
  528. AC_DEFINE(NAT_PMP, 1, [Define to 1 if we are building with nat-pmp.])
  529. TOR_SEARCH_LIBRARY(libnatpmp, $trylibnatpmpdir, [-lnatpmp $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
  530. [#include <natpmp.h>],
  531. [#ifdef _WIN32
  532. #define STATICLIB
  533. #endif
  534. #include <natpmp.h>],
  535. [ int r;
  536. natpmp_t natpmp;
  537. natpmpresp_t response;
  538. r = initnatpmp(&natpmp, 0, 0);],
  539. [printf("initnatpmp() returned %d (%s)\n", r, r?"FAILED":"SUCCESS");
  540. exit(0);],
  541. [--with-libnatpmp-dir],
  542. [/usr/lib/])
  543. fi
  544. dnl ------------------------------------------------------
  545. dnl Where do you live, libminiupnpc? And how do we call you?
  546. dnl There are no packages for Debian or Redhat as of this patch
  547. if test "$upnp" = "true"; then
  548. AC_DEFINE(MINIUPNPC, 1, [Define to 1 if we are building with UPnP.])
  549. dnl Before we call TOR_SEARCH_LIBRARY we'll do a quick compile test
  550. dnl to see if we have miniupnpc-1.5 or -1.6
  551. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
  552. [upnpDiscover(1, 0, 0, 0);exit(0);])],[miniupnpc15="true"],[miniupnpc15="false"])
  553. if test "$miniupnpc15" = "true" ; then
  554. AC_DEFINE([MINIUPNPC15],[1],[libminiupnpc version 1.5 found])
  555. TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
  556. [#include <miniupnpc/miniwget.h>
  557. #include <miniupnpc/miniupnpc.h>
  558. #include <miniupnpc/upnpcommands.h>],
  559. [void upnpDiscover(int delay, const char * multicastif,
  560. const char * minissdpdsock, int sameport);],
  561. [upnpDiscover(1, 0, 0, 0); exit(0);],
  562. [--with-libminiupnpc-dir],
  563. [/usr/lib/])
  564. else
  565. TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
  566. [#include <miniupnpc/miniwget.h>
  567. #include <miniupnpc/miniupnpc.h>
  568. #include <miniupnpc/upnpcommands.h>],
  569. [void upnpDiscover(int delay, const char * multicastif,
  570. const char * minissdpdsock, int sameport, int ipv6, int * error);],
  571. [upnpDiscover(1, 0, 0, 0, 0, 0); exit(0);],
  572. [--with-libminiupnpc-dir],
  573. [/usr/lib/])
  574. fi
  575. fi
  576. dnl ============================================================
  577. dnl Check for libseccomp
  578. AC_CHECK_HEADERS([seccomp.h])
  579. AC_SEARCH_LIBS(seccomp_init, [seccomp])
  580. dnl ============================================================
  581. dnl We need an implementation of curve25519.
  582. dnl set these defaults.
  583. have_a_curve25519=no
  584. build_curve25519_donna=no
  585. build_curve25519_donna_c64=no
  586. use_curve25519_donna=no
  587. use_curve25519_nacl=no
  588. CURVE25519_LIBS=
  589. if test x$enable_curve25519 != xno; then
  590. dnl The best choice is using curve25519-donna-c64, but that requires
  591. dnl that we
  592. AC_CACHE_CHECK([whether we can use curve25519-donna-c64],
  593. tor_cv_can_use_curve25519_donna_c64,
  594. [AC_RUN_IFELSE(
  595. [AC_LANG_PROGRAM([dnl
  596. #include <stdint.h>
  597. typedef unsigned uint128_t __attribute__((mode(TI)));
  598. int func(uint64_t a, uint64_t b) {
  599. uint128_t c = ((uint128_t)a) * b;
  600. int ok = ((uint64_t)(c>>96)) == 522859 &&
  601. (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
  602. (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
  603. (((uint64_t)(c))&0xffffffffL) == 0;
  604. return ok;
  605. }
  606. ], [dnl
  607. int ok = func( ((uint64_t)2000000000) * 1000000000,
  608. ((uint64_t)1234567890) << 24);
  609. return !ok;
  610. ])],
  611. [tor_cv_can_use_curve25519_donna_c64=yes],
  612. [tor_cv_can_use_curve25519_donna_c64=no],
  613. [AC_COMPILE_IFELSE(
  614. [AC_LANG_PROGRAM([dnl
  615. #include <stdint.h>
  616. typedef unsigned uint128_t __attribute__((mode(TI)));
  617. int func(uint64_t a, uint64_t b) {
  618. uint128_t c = ((uint128_t)a) * b;
  619. int ok = ((uint64_t)(c>>96)) == 522859 &&
  620. (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
  621. (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
  622. (((uint64_t)(c))&0xffffffffL) == 0;
  623. return ok;
  624. }
  625. ], [dnl
  626. int ok = func( ((uint64_t)2000000000) * 1000000000,
  627. ((uint64_t)1234567890) << 24);
  628. return !ok;
  629. ])],
  630. [tor_cv_can_use_curve25519_donna_c64=cross],
  631. [tor_cv_can_use_curve25519_donna_c64=no])])])
  632. AC_CHECK_HEADERS([crypto_scalarmult_curve25519.h \
  633. nacl/crypto_scalarmult_curve25519.h])
  634. AC_CACHE_CHECK([for nacl compiled with a fast curve25519 implementation],
  635. tor_cv_can_use_curve25519_nacl,
  636. [tor_saved_LIBS="$LIBS"
  637. LIBS="$LIBS -lnacl"
  638. AC_LINK_IFELSE(
  639. [AC_LANG_PROGRAM([dnl
  640. #ifdef HAVE_CRYPTO_SCALARMULT_CURVE25519_H
  641. #include <crypto_scalarmult_curve25519.h>
  642. #elif defined(HAVE_NACL_CRYPTO_SCALARMULT_CURVE25519_H)
  643. #include <nacl/crypto_scalarmult_curve25519.h>
  644. #endif
  645. #ifdef crypto_scalarmult_curve25519_ref_BYTES
  646. #error Hey, this is the reference implementation! That's not fast.
  647. #endif
  648. ], [
  649. unsigned char *a, *b, *c; crypto_scalarmult_curve25519(a,b,c);
  650. ])], [tor_cv_can_use_curve25519_nacl=yes],
  651. [tor_cv_can_use_curve25519_nacl=no])
  652. LIBS="$tor_saved_LIBS" ])
  653. dnl Okay, now we need to figure out which one to actually use. Fall back
  654. dnl to curve25519-donna.c
  655. if test x$tor_cv_can_use_curve25519_donna_c64 != xno; then
  656. build_curve25519_donna_c64=yes
  657. use_curve25519_donna=yes
  658. elif test x$tor_cv_can_use_curve25519_nacl = xyes; then
  659. use_curve25519_nacl=yes
  660. CURVE25519_LIBS=-lnacl
  661. else
  662. build_curve25519_donna=yes
  663. use_curve25519_donna=yes
  664. fi
  665. have_a_curve25519=yes
  666. fi
  667. if test x$have_a_curve25519 = xyes; then
  668. AC_DEFINE(CURVE25519_ENABLED, 1,
  669. [Defined if we have a curve25519 implementation])
  670. fi
  671. if test x$use_curve25519_donna = xyes; then
  672. AC_DEFINE(USE_CURVE25519_DONNA, 1,
  673. [Defined if we should use an internal curve25519_donna{,_c64} implementation])
  674. fi
  675. if test x$use_curve25519_nacl = xyes; then
  676. AC_DEFINE(USE_CURVE25519_NACL, 1,
  677. [Defined if we should use a curve25519 from nacl])
  678. fi
  679. AM_CONDITIONAL(BUILD_CURVE25519_DONNA, test x$build_curve25519_donna = xyes)
  680. AM_CONDITIONAL(BUILD_CURVE25519_DONNA_C64, test x$build_curve25519_donna_c64 = xyes)
  681. AM_CONDITIONAL(CURVE25519_ENABLED, test x$have_a_curve25519 = xyes)
  682. AC_SUBST(CURVE25519_LIBS)
  683. dnl Make sure to enable support for large off_t if available.
  684. AC_SYS_LARGEFILE
  685. AC_CHECK_HEADERS(
  686. assert.h \
  687. errno.h \
  688. fcntl.h \
  689. signal.h \
  690. string.h \
  691. sys/fcntl.h \
  692. sys/stat.h \
  693. sys/time.h \
  694. sys/types.h \
  695. time.h \
  696. unistd.h
  697. , , 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.))
  698. dnl These headers are not essential
  699. AC_CHECK_HEADERS(
  700. arpa/inet.h \
  701. crt_externs.h \
  702. grp.h \
  703. ifaddrs.h \
  704. inttypes.h \
  705. limits.h \
  706. linux/types.h \
  707. machine/limits.h \
  708. malloc.h \
  709. malloc/malloc.h \
  710. malloc_np.h \
  711. netdb.h \
  712. netinet/in.h \
  713. netinet/in6.h \
  714. pwd.h \
  715. stdint.h \
  716. sys/file.h \
  717. sys/ioctl.h \
  718. sys/limits.h \
  719. sys/mman.h \
  720. sys/param.h \
  721. sys/prctl.h \
  722. sys/resource.h \
  723. sys/socket.h \
  724. sys/syslimits.h \
  725. sys/time.h \
  726. sys/types.h \
  727. sys/un.h \
  728. sys/utime.h \
  729. sys/wait.h \
  730. syslog.h \
  731. utime.h
  732. )
  733. AC_CHECK_HEADERS(sys/param.h)
  734. AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
  735. [#ifdef HAVE_SYS_TYPES_H
  736. #include <sys/types.h>
  737. #endif
  738. #ifdef HAVE_SYS_SOCKET_H
  739. #include <sys/socket.h>
  740. #endif])
  741. AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0,
  742. [#ifdef HAVE_SYS_TYPES_H
  743. #include <sys/types.h>
  744. #endif
  745. #ifdef HAVE_SYS_SOCKET_H
  746. #include <sys/socket.h>
  747. #endif
  748. #ifdef HAVE_NET_IF_H
  749. #include <net/if.h>
  750. #endif])
  751. AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
  752. linux_netfilter_ipv4=1, linux_netfilter_ipv4=0,
  753. [#ifdef HAVE_SYS_TYPES_H
  754. #include <sys/types.h>
  755. #endif
  756. #ifdef HAVE_SYS_SOCKET_H
  757. #include <sys/socket.h>
  758. #endif
  759. #ifdef HAVE_LIMITS_H
  760. #include <limits.h>
  761. #endif
  762. #ifdef HAVE_LINUX_TYPES_H
  763. #include <linux/types.h>
  764. #endif
  765. #ifdef HAVE_NETINET_IN6_H
  766. #include <netinet/in6.h>
  767. #endif
  768. #ifdef HAVE_NETINET_IN_H
  769. #include <netinet/in.h>
  770. #endif])
  771. if test x$transparent = xtrue ; then
  772. transparent_ok=0
  773. if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then
  774. transparent_ok=1
  775. fi
  776. if test x$linux_netfilter_ipv4 = x1 ; then
  777. transparent_ok=1
  778. fi
  779. if test x$transparent_ok = x1 ; then
  780. AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
  781. case $host in
  782. *-*-openbsd* | *-*-bitrig*)
  783. AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
  784. esac
  785. else
  786. AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
  787. fi
  788. fi
  789. AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
  790. [#ifdef HAVE_SYS_TYPES_H
  791. #include <sys/types.h>
  792. #endif
  793. #ifdef HAVE_SYS_TIME_H
  794. #include <sys/time.h>
  795. #endif])
  796. dnl In case we aren't given a working stdint.h, we'll need to grow our own.
  797. dnl Watch out.
  798. AC_CHECK_SIZEOF(int8_t)
  799. AC_CHECK_SIZEOF(int16_t)
  800. AC_CHECK_SIZEOF(int32_t)
  801. AC_CHECK_SIZEOF(int64_t)
  802. AC_CHECK_SIZEOF(uint8_t)
  803. AC_CHECK_SIZEOF(uint16_t)
  804. AC_CHECK_SIZEOF(uint32_t)
  805. AC_CHECK_SIZEOF(uint64_t)
  806. AC_CHECK_SIZEOF(intptr_t)
  807. AC_CHECK_SIZEOF(uintptr_t)
  808. dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
  809. AC_CHECK_SIZEOF(char)
  810. AC_CHECK_SIZEOF(short)
  811. AC_CHECK_SIZEOF(int)
  812. AC_CHECK_SIZEOF(long)
  813. AC_CHECK_SIZEOF(long long)
  814. AC_CHECK_SIZEOF(__int64)
  815. AC_CHECK_SIZEOF(void *)
  816. AC_CHECK_SIZEOF(time_t)
  817. AC_CHECK_SIZEOF(size_t)
  818. AC_CHECK_SIZEOF(pid_t)
  819. AC_CHECK_TYPES([uint, u_char, ssize_t])
  820. dnl used to include sockaddr_storage, but everybody has that.
  821. AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
  822. [#ifdef HAVE_SYS_TYPES_H
  823. #include <sys/types.h>
  824. #endif
  825. #ifdef HAVE_NETINET_IN_H
  826. #include <netinet/in.h>
  827. #endif
  828. #ifdef HAVE_NETINET_IN6_H
  829. #include <netinet/in6.h>
  830. #endif
  831. #ifdef HAVE_SYS_SOCKET_H
  832. #include <sys/socket.h>
  833. #endif
  834. #ifdef _WIN32
  835. #define _WIN32_WINNT 0x0501
  836. #define WIN32_LEAN_AND_MEAN
  837. #if defined(_MSC_VER) && (_MSC_VER < 1300)
  838. #include <winsock.h>
  839. #else
  840. #include <winsock2.h>
  841. #include <ws2tcpip.h>
  842. #endif
  843. #endif
  844. ])
  845. AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
  846. [#ifdef HAVE_SYS_TYPES_H
  847. #include <sys/types.h>
  848. #endif
  849. #ifdef HAVE_NETINET_IN_H
  850. #include <netinet/in.h>
  851. #endif
  852. #ifdef HAVE_NETINET_IN6_H
  853. #include <netinet/in6.h>
  854. #endif
  855. #ifdef HAVE_SYS_SOCKET_H
  856. #include <sys/socket.h>
  857. #endif
  858. #ifdef _WIN32
  859. #define _WIN32_WINNT 0x0501
  860. #define WIN32_LEAN_AND_MEAN
  861. #if defined(_MSC_VER) && (_MSC_VER < 1300)
  862. #include <winsock.h>
  863. #else
  864. #include <winsock2.h>
  865. #include <ws2tcpip.h>
  866. #endif
  867. #endif
  868. ])
  869. AC_CHECK_TYPES([rlim_t], , ,
  870. [#ifdef HAVE_SYS_TYPES_H
  871. #include <sys/types.h>
  872. #endif
  873. #ifdef HAVE_SYS_TIME_H
  874. #include <sys/time.h>
  875. #endif
  876. #ifdef HAVE_SYS_RESOURCE_H
  877. #include <sys/resource.h>
  878. #endif
  879. ])
  880. AX_CHECK_SIGN([time_t],
  881. [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
  882. [ : ], [
  883. #ifdef HAVE_SYS_TYPES_H
  884. #include <sys/types.h>
  885. #endif
  886. #ifdef HAVE_SYS_TIME_H
  887. #include <sys/time.h>
  888. #endif
  889. #ifdef HAVE_TIME_H
  890. #include <time.h>
  891. #endif
  892. ])
  893. if test "$ax_cv_decl_time_t_signed" = no; then
  894. AC_MSG_WARN([You have an unsigned time_t; some things will probably break. Please tell the Tor developers about your interesting platform.])
  895. fi
  896. AX_CHECK_SIGN([size_t],
  897. [ tor_cv_size_t_signed=yes ],
  898. [ tor_cv_size_t_signed=no ], [
  899. #ifdef HAVE_SYS_TYPES_H
  900. #include <sys/types.h>
  901. #endif
  902. ])
  903. if test "$ax_cv_decl_size_t_signed" = yes; then
  904. AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
  905. fi
  906. AX_CHECK_SIGN([enum always],
  907. [ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
  908. [ : ], [
  909. enum always { AAA, BBB, CCC };
  910. ])
  911. AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
  912. #ifdef HAVE_SYS_SOCKET_H
  913. #include <sys/socket.h>
  914. #endif
  915. ])
  916. # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
  917. AC_CHECK_SIZEOF(cell_t)
  918. # Now make sure that NULL can be represented as zero bytes.
  919. AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
  920. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  921. [[#include <stdlib.h>
  922. #include <string.h>
  923. #include <stdio.h>
  924. #ifdef HAVE_STDDEF_H
  925. #include <stddef.h>
  926. #endif
  927. int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
  928. return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
  929. [tor_cv_null_is_zero=yes],
  930. [tor_cv_null_is_zero=no],
  931. [tor_cv_null_is_zero=cross])])
  932. if test "$tor_cv_null_is_zero" = cross ; then
  933. # Cross-compiling; let's hope that the target isn't raving mad.
  934. AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
  935. fi
  936. if test "$tor_cv_null_is_zero" != no; then
  937. AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
  938. [Define to 1 iff memset(0) sets pointers to NULL])
  939. fi
  940. AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
  941. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  942. [[#include <stdlib.h>
  943. #include <string.h>
  944. #include <stdio.h>
  945. #ifdef HAVE_STDDEF_H
  946. #include <stddef.h>
  947. #endif
  948. int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
  949. return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
  950. [tor_cv_dbl0_is_zero=yes],
  951. [tor_cv_dbl0_is_zero=no],
  952. [tor_cv_dbl0_is_zero=cross])])
  953. if test "$tor_cv_dbl0_is_zero" = cross ; then
  954. # Cross-compiling; let's hope that the target isn't raving mad.
  955. AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
  956. fi
  957. if test "$tor_cv_dbl0_is_zero" != no; then
  958. AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
  959. [Define to 1 iff memset(0) sets doubles to 0.0])
  960. fi
  961. # And what happens when we malloc zero?
  962. AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
  963. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  964. [[#include <stdlib.h>
  965. #include <string.h>
  966. #include <stdio.h>
  967. #ifdef HAVE_STDDEF_H
  968. #include <stddef.h>
  969. #endif
  970. int main () { return malloc(0)?0:1; }]])],
  971. [tor_cv_malloc_zero_works=yes],
  972. [tor_cv_malloc_zero_works=no],
  973. [tor_cv_malloc_zero_works=cross])])
  974. if test "$tor_cv_malloc_zero_works" = cross; then
  975. # Cross-compiling; let's hope that the target isn't raving mad.
  976. AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
  977. fi
  978. if test "$tor_cv_malloc_zero_works" = yes; then
  979. AC_DEFINE([MALLOC_ZERO_WORKS], 1,
  980. [Define to 1 iff malloc(0) returns a pointer])
  981. fi
  982. # whether we seem to be in a 2s-complement world.
  983. AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
  984. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  985. [[int main () { int problem = ((-99) != (~99)+1);
  986. return problem ? 1 : 0; }]])],
  987. [tor_cv_twos_complement=yes],
  988. [tor_cv_twos_complement=no],
  989. [tor_cv_twos_complement=cross])])
  990. if test "$tor_cv_twos_complement" = cross ; then
  991. # Cross-compiling; let's hope that the target isn't raving mad.
  992. AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
  993. fi
  994. if test "$tor_cv_twos_complement" != no ; then
  995. AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
  996. [Define to 1 iff we represent negative integers with two's complement])
  997. fi
  998. # What does shifting a negative value do?
  999. AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
  1000. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  1001. [[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
  1002. [tor_cv_sign_extend=yes],
  1003. [tor_cv_sign_extend=no],
  1004. [tor_cv_sign_extend=cross])])
  1005. if test "$tor_cv_sign_extend" = cross ; then
  1006. # Cross-compiling; let's hope that the target isn't raving mad.
  1007. AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
  1008. fi
  1009. if test "$tor_cv_sign_extend" != no ; then
  1010. AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
  1011. [Define to 1 iff right-shifting a negative value performs sign-extension])
  1012. fi
  1013. # Whether we should use the dmalloc memory allocation debugging library.
  1014. AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
  1015. AC_ARG_WITH(dmalloc,
  1016. [ --with-dmalloc Use debug memory allocation library. ],
  1017. [if [[ "$withval" = "yes" ]]; then
  1018. dmalloc=1
  1019. AC_MSG_RESULT(yes)
  1020. else
  1021. dmalloc=1
  1022. AC_MSG_RESULT(no)
  1023. fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
  1024. )
  1025. if [[ $dmalloc -eq 1 ]]; then
  1026. AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
  1027. AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
  1028. AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
  1029. AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
  1030. AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
  1031. fi
  1032. AC_ARG_WITH(tcmalloc,
  1033. [ --with-tcmalloc Use tcmalloc memory allocation library. ],
  1034. [ tcmalloc=yes ], [ tcmalloc=no ])
  1035. if test x$tcmalloc = xyes ; then
  1036. LDFLAGS="-ltcmalloc $LDFLAGS"
  1037. fi
  1038. using_custom_malloc=no
  1039. if test x$enable_openbsd_malloc = xyes ; then
  1040. using_custom_malloc=yes
  1041. fi
  1042. if test x$tcmalloc = xyes ; then
  1043. using_custom_malloc=yes
  1044. fi
  1045. if test $using_custom_malloc = no ; then
  1046. AC_CHECK_FUNCS(mallinfo)
  1047. fi
  1048. # By default, we're going to assume we don't have mlockall()
  1049. # bionic and other platforms have various broken mlockall subsystems.
  1050. # Some systems don't have a working mlockall, some aren't linkable,
  1051. # and some have it but don't declare it.
  1052. AC_CHECK_FUNCS(mlockall)
  1053. AC_CHECK_DECLS([mlockall], , , [
  1054. #ifdef HAVE_SYS_MMAN_H
  1055. #include <sys/mman.h>
  1056. #endif])
  1057. # Allow user to specify an alternate syslog facility
  1058. AC_ARG_WITH(syslog-facility,
  1059. [ --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
  1060. syslog_facility="$withval", syslog_facility="LOG_DAEMON")
  1061. AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
  1062. AC_SUBST(LOGFACILITY)
  1063. # Check if we have getresuid and getresgid
  1064. AC_CHECK_FUNCS(getresuid getresgid)
  1065. # Check for gethostbyname_r in all its glorious incompatible versions.
  1066. # (This logic is based on that in Python's configure.in)
  1067. AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
  1068. [Define this if you have any gethostbyname_r()])
  1069. AC_CHECK_FUNC(gethostbyname_r, [
  1070. AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
  1071. OLD_CFLAGS=$CFLAGS
  1072. CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
  1073. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
  1074. #include <netdb.h>
  1075. ], [[
  1076. char *cp1, *cp2;
  1077. struct hostent *h1, *h2;
  1078. int i1, i2;
  1079. (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
  1080. ]])],[
  1081. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1082. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
  1083. [Define this if gethostbyname_r takes 6 arguments])
  1084. AC_MSG_RESULT(6)
  1085. ], [
  1086. AC_TRY_COMPILE([
  1087. #include <netdb.h>
  1088. ], [
  1089. char *cp1, *cp2;
  1090. struct hostent *h1;
  1091. int i1, i2;
  1092. (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
  1093. ], [
  1094. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1095. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
  1096. [Define this if gethostbyname_r takes 5 arguments])
  1097. AC_MSG_RESULT(5)
  1098. ], [
  1099. AC_TRY_COMPILE([
  1100. #include <netdb.h>
  1101. ], [
  1102. char *cp1;
  1103. struct hostent *h1;
  1104. struct hostent_data hd;
  1105. (void) gethostbyname_r(cp1,h1,&hd);
  1106. ], [
  1107. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1108. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
  1109. [Define this if gethostbyname_r takes 3 arguments])
  1110. AC_MSG_RESULT(3)
  1111. ], [
  1112. AC_MSG_RESULT(0)
  1113. ])
  1114. ])
  1115. ])
  1116. CFLAGS=$OLD_CFLAGS
  1117. ])
  1118. AC_CACHE_CHECK([whether the C compiler supports __func__],
  1119. tor_cv_have_func_macro,
  1120. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1121. #include <stdio.h>
  1122. int main(int c, char **v) { puts(__func__); }])],
  1123. tor_cv_have_func_macro=yes,
  1124. tor_cv_have_func_macro=no))
  1125. AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
  1126. tor_cv_have_FUNC_macro,
  1127. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1128. #include <stdio.h>
  1129. int main(int c, char **v) { puts(__FUNC__); }])],
  1130. tor_cv_have_FUNC_macro=yes,
  1131. tor_cv_have_FUNC_macro=no))
  1132. AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
  1133. tor_cv_have_FUNCTION_macro,
  1134. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1135. #include <stdio.h>
  1136. int main(int c, char **v) { puts(__FUNCTION__); }])],
  1137. tor_cv_have_FUNCTION_macro=yes,
  1138. tor_cv_have_FUNCTION_macro=no))
  1139. AC_CACHE_CHECK([whether we have extern char **environ already declared],
  1140. tor_cv_have_environ_declared,
  1141. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1142. /* We define _GNU_SOURCE here because it is also defined in compat.c.
  1143. * Without it environ doesn't get declared. */
  1144. #define _GNU_SOURCE
  1145. #ifdef HAVE_UNISTD_H
  1146. #include <unistd.h>
  1147. #endif
  1148. #include <stdlib.h>
  1149. int main(int c, char **v) { char **t = environ; }])],
  1150. tor_cv_have_environ_declared=yes,
  1151. tor_cv_have_environ_declared=no))
  1152. if test "$tor_cv_have_func_macro" = 'yes'; then
  1153. AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
  1154. fi
  1155. if test "$tor_cv_have_FUNC_macro" = 'yes'; then
  1156. AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
  1157. fi
  1158. if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
  1159. AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
  1160. [Defined if the compiler supports __FUNCTION__])
  1161. fi
  1162. if test "$tor_cv_have_environ_declared" = 'yes'; then
  1163. AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
  1164. [Defined if we have extern char **environ already declared])
  1165. fi
  1166. # $prefix stores the value of the --prefix command line option, or
  1167. # NONE if the option wasn't set. In the case that it wasn't set, make
  1168. # it be the default, so that we can use it to expand directories now.
  1169. if test "x$prefix" = "xNONE"; then
  1170. prefix=$ac_default_prefix
  1171. fi
  1172. # and similarly for $exec_prefix
  1173. if test "x$exec_prefix" = "xNONE"; then
  1174. exec_prefix=$prefix
  1175. fi
  1176. if test "x$BUILDDIR" = "x"; then
  1177. BUILDDIR=`pwd`
  1178. fi
  1179. AC_SUBST(BUILDDIR)
  1180. AH_TEMPLATE([BUILDDIR],[tor's build directory])
  1181. AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
  1182. if test "x$CONFDIR" = "x"; then
  1183. CONFDIR=`eval echo $sysconfdir/tor`
  1184. fi
  1185. AC_SUBST(CONFDIR)
  1186. AH_TEMPLATE([CONFDIR],[tor's configuration directory])
  1187. AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
  1188. BINDIR=`eval echo $bindir`
  1189. AC_SUBST(BINDIR)
  1190. LOCALSTATEDIR=`eval echo $localstatedir`
  1191. AC_SUBST(LOCALSTATEDIR)
  1192. if test "$bwin32" = true; then
  1193. # Test if the linker supports the --nxcompat and --dynamicbase options
  1194. # for Windows
  1195. save_LDFLAGS="$LDFLAGS"
  1196. LDFLAGS="-Wl,--nxcompat -Wl,--dynamicbase"
  1197. AC_MSG_CHECKING([whether the linker supports DllCharacteristics])
  1198. AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
  1199. [AC_MSG_RESULT([yes])]
  1200. [save_LDFLAGS="$save_LDFLAGS $LDFLAGS"],
  1201. [AC_MSG_RESULT([no])]
  1202. )
  1203. LDFLAGS="$save_LDFLAGS"
  1204. fi
  1205. # Set CFLAGS _after_ all the above checks, since our warnings are stricter
  1206. # than autoconf's macros like.
  1207. if test "$GCC" = yes; then
  1208. # Disable GCC's strict aliasing checks. They are an hours-to-debug
  1209. # accident waiting to happen.
  1210. CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
  1211. else
  1212. # Autoconf sets -g -O2 by default. Override optimization level
  1213. # for non-gcc compilers
  1214. CFLAGS="$CFLAGS -O"
  1215. enable_gcc_warnings=no
  1216. enable_gcc_warnings_advisory=no
  1217. fi
  1218. # OS X Lion started deprecating the system openssl. Let's just disable
  1219. # all deprecation warnings on OS X. Also, to potentially make the binary
  1220. # a little smaller, let's enable dead_strip.
  1221. case "$host_os" in
  1222. darwin*)
  1223. CFLAGS="$CFLAGS -Wno-deprecated-declarations"
  1224. LDFLAGS="$LDFLAGS -dead_strip" ;;
  1225. esac
  1226. # Add some more warnings which we use in development but not in the
  1227. # released versions. (Some relevant gcc versions can't handle these.)
  1228. if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xyes; then
  1229. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1230. #if !defined(__GNUC__) || (__GNUC__ < 4)
  1231. #error
  1232. #endif])], have_gcc4=yes, have_gcc4=no)
  1233. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1234. #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
  1235. #error
  1236. #endif])], have_gcc42=yes, have_gcc42=no)
  1237. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1238. #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
  1239. #error
  1240. #endif])], have_gcc43=yes, have_gcc43=no)
  1241. save_CFLAGS="$CFLAGS"
  1242. CFLAGS="$CFLAGS -Wshorten-64-to-32"
  1243. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
  1244. have_shorten64_flag=no)
  1245. CFLAGS="$save_CFLAGS"
  1246. case $host in
  1247. *-*-openbsd* | *-*-bitrig*)
  1248. # Some OpenBSD versions (like 4.8) have -Wsystem-headers by default.
  1249. # That's fine, except that the headers don't pass -Wredundant-decls.
  1250. # Therefore, let's disable -Wsystem-headers when we're building
  1251. # with maximal warnings on OpenBSD.
  1252. CFLAGS="$CFLAGS -Wno-system-headers" ;;
  1253. esac
  1254. CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith"
  1255. CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
  1256. CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
  1257. CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
  1258. CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
  1259. if test x$enable_gcc_warnings = xyes; then
  1260. CFLAGS="$CFLAGS -Werror"
  1261. fi
  1262. # Disabled, so we can use mallinfo(): -Waggregate-return
  1263. if test x$have_gcc4 = xyes ; then
  1264. # These warnings break gcc 3.3.5 and work on gcc 4.0.2
  1265. CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Wold-style-definition"
  1266. fi
  1267. if test x$have_gcc42 = xyes ; then
  1268. # These warnings break gcc 4.0.2 and work on gcc 4.2
  1269. # XXXX020 See if any of these work with earlier versions.
  1270. CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
  1271. # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
  1272. fi
  1273. if test x$have_gcc42 = xyes && test x$have_clang = xno; then
  1274. # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
  1275. CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
  1276. fi
  1277. if test x$have_gcc43 = xyes ; then
  1278. # These warnings break gcc 4.2 and work on gcc 4.3
  1279. # XXXX020 See if any of these work with earlier versions.
  1280. CFLAGS="$CFLAGS -Wextra -Warray-bounds"
  1281. fi
  1282. if test x$have_shorten64_flag = xyes ; then
  1283. CFLAGS="$CFLAGS -Wshorten-64-to-32"
  1284. fi
  1285. ##This will break the world on some 64-bit architectures
  1286. # CFLAGS="$CFLAGS -Winline"
  1287. fi
  1288. if test "$enable_coverage" = yes && test "$have_clang" = "no"; then
  1289. case "$host_os" in
  1290. darwin*)
  1291. 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.])
  1292. esac
  1293. fi
  1294. CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
  1295. AC_CONFIG_FILES([
  1296. Doxyfile
  1297. Makefile
  1298. contrib/suse/tor.sh
  1299. contrib/tor.logrotate
  1300. contrib/tor.sh
  1301. contrib/torctl
  1302. contrib/torify
  1303. src/config/torrc.sample
  1304. ])
  1305. if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
  1306. regular_mans="doc/tor doc/tor-gencert doc/tor-resolve doc/torify"
  1307. for file in $regular_mans ; do
  1308. if ! [[ -f "$srcdir/$file.1.in" ]] || ! [[ -f "$srcdir/$file.html.in" ]] ; then
  1309. echo "==================================";
  1310. echo;
  1311. echo "You need asciidoc installed to be able to build the manpage.";
  1312. echo "To build without manpages, use the --disable-asciidoc argument";
  1313. echo "when calling configure.";
  1314. echo;
  1315. echo "==================================";
  1316. exit 1;
  1317. fi
  1318. done
  1319. fi
  1320. AC_OUTPUT
  1321. if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then
  1322. ./contrib/updateVersions.pl
  1323. fi