configure.ac 47 KB

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