configure.ac 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505
  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 We need an implementation of curve25519.
  578. dnl set these defaults.
  579. have_a_curve25519=no
  580. build_curve25519_donna=no
  581. build_curve25519_donna_c64=no
  582. use_curve25519_donna=no
  583. use_curve25519_nacl=no
  584. CURVE25519_LIBS=
  585. if test x$enable_curve25519 != xno; then
  586. dnl The best choice is using curve25519-donna-c64, but that requires
  587. dnl that we
  588. AC_CACHE_CHECK([whether we can use curve25519-donna-c64],
  589. tor_cv_can_use_curve25519_donna_c64,
  590. [AC_RUN_IFELSE(
  591. [AC_LANG_PROGRAM([dnl
  592. #include <stdint.h>
  593. typedef unsigned uint128_t __attribute__((mode(TI)));
  594. int func(uint64_t a, uint64_t b) {
  595. uint128_t c = ((uint128_t)a) * b;
  596. int ok = ((uint64_t)(c>>96)) == 522859 &&
  597. (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
  598. (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
  599. (((uint64_t)(c))&0xffffffffL) == 0;
  600. return ok;
  601. }
  602. ], [dnl
  603. int ok = func( ((uint64_t)2000000000) * 1000000000,
  604. ((uint64_t)1234567890) << 24);
  605. return !ok;
  606. ])],
  607. [tor_cv_can_use_curve25519_donna_c64=yes],
  608. [tor_cv_can_use_curve25519_donna_c64=no],
  609. [AC_COMPILE_IFELSE(
  610. [AC_LANG_PROGRAM([dnl
  611. #include <stdint.h>
  612. typedef unsigned uint128_t __attribute__((mode(TI)));
  613. int func(uint64_t a, uint64_t b) {
  614. uint128_t c = ((uint128_t)a) * b;
  615. int ok = ((uint64_t)(c>>96)) == 522859 &&
  616. (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
  617. (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
  618. (((uint64_t)(c))&0xffffffffL) == 0;
  619. return ok;
  620. }
  621. ], [dnl
  622. int ok = func( ((uint64_t)2000000000) * 1000000000,
  623. ((uint64_t)1234567890) << 24);
  624. return !ok;
  625. ])],
  626. [tor_cv_can_use_curve25519_donna_c64=cross],
  627. [tor_cv_can_use_curve25519_donna_c64=no])])])
  628. AC_CHECK_HEADERS([crypto_scalarmult_curve25519.h \
  629. nacl/crypto_scalarmult_curve25519.h])
  630. AC_CACHE_CHECK([for nacl compiled with a fast curve25519 implementation],
  631. tor_cv_can_use_curve25519_nacl,
  632. [tor_saved_LIBS="$LIBS"
  633. LIBS="$LIBS -lnacl"
  634. AC_LINK_IFELSE(
  635. [AC_LANG_PROGRAM([dnl
  636. #ifdef HAVE_CRYPTO_SCALARMULT_CURVE25519_H
  637. #include <crypto_scalarmult_curve25519.h>
  638. #elif defined(HAVE_NACL_CRYPTO_SCALARMULT_CURVE25519_H)
  639. #include <nacl/crypto_scalarmult_curve25519.h>
  640. #endif
  641. #ifdef crypto_scalarmult_curve25519_ref_BYTES
  642. #error Hey, this is the reference implementation! That's not fast.
  643. #endif
  644. ], [
  645. unsigned char *a, *b, *c; crypto_scalarmult_curve25519(a,b,c);
  646. ])], [tor_cv_can_use_curve25519_nacl=yes],
  647. [tor_cv_can_use_curve25519_nacl=no])
  648. LIBS="$tor_saved_LIBS" ])
  649. dnl Okay, now we need to figure out which one to actually use. Fall back
  650. dnl to curve25519-donna.c
  651. if test x$tor_cv_can_use_curve25519_donna_c64 != xno; then
  652. build_curve25519_donna_c64=yes
  653. use_curve25519_donna=yes
  654. elif test x$tor_cv_can_use_curve25519_nacl = xyes; then
  655. use_curve25519_nacl=yes
  656. CURVE25519_LIBS=-lnacl
  657. else
  658. build_curve25519_donna=yes
  659. use_curve25519_donna=yes
  660. fi
  661. have_a_curve25519=yes
  662. fi
  663. if test x$have_a_curve25519 = xyes; then
  664. AC_DEFINE(CURVE25519_ENABLED, 1,
  665. [Defined if we have a curve25519 implementation])
  666. fi
  667. if test x$use_curve25519_donna = xyes; then
  668. AC_DEFINE(USE_CURVE25519_DONNA, 1,
  669. [Defined if we should use an internal curve25519_donna{,_c64} implementation])
  670. fi
  671. if test x$use_curve25519_nacl = xyes; then
  672. AC_DEFINE(USE_CURVE25519_NACL, 1,
  673. [Defined if we should use a curve25519 from nacl])
  674. fi
  675. AM_CONDITIONAL(BUILD_CURVE25519_DONNA, test x$build_curve25519_donna = xyes)
  676. AM_CONDITIONAL(BUILD_CURVE25519_DONNA_C64, test x$build_curve25519_donna_c64 = xyes)
  677. AM_CONDITIONAL(CURVE25519_ENABLED, test x$have_a_curve25519 = xyes)
  678. AC_SUBST(CURVE25519_LIBS)
  679. dnl Make sure to enable support for large off_t if available.
  680. AC_SYS_LARGEFILE
  681. AC_CHECK_HEADERS(
  682. assert.h \
  683. errno.h \
  684. fcntl.h \
  685. signal.h \
  686. string.h \
  687. sys/fcntl.h \
  688. sys/stat.h \
  689. sys/time.h \
  690. sys/types.h \
  691. time.h \
  692. unistd.h
  693. , , 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.))
  694. dnl These headers are not essential
  695. AC_CHECK_HEADERS(
  696. arpa/inet.h \
  697. crt_externs.h \
  698. grp.h \
  699. ifaddrs.h \
  700. inttypes.h \
  701. limits.h \
  702. linux/types.h \
  703. machine/limits.h \
  704. malloc.h \
  705. malloc/malloc.h \
  706. malloc_np.h \
  707. netdb.h \
  708. netinet/in.h \
  709. netinet/in6.h \
  710. pwd.h \
  711. stdint.h \
  712. sys/file.h \
  713. sys/ioctl.h \
  714. sys/limits.h \
  715. sys/mman.h \
  716. sys/param.h \
  717. sys/prctl.h \
  718. sys/resource.h \
  719. sys/socket.h \
  720. sys/syslimits.h \
  721. sys/time.h \
  722. sys/types.h \
  723. sys/un.h \
  724. sys/utime.h \
  725. sys/wait.h \
  726. syslog.h \
  727. utime.h
  728. )
  729. AC_CHECK_HEADERS(sys/param.h)
  730. AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
  731. [#ifdef HAVE_SYS_TYPES_H
  732. #include <sys/types.h>
  733. #endif
  734. #ifdef HAVE_SYS_SOCKET_H
  735. #include <sys/socket.h>
  736. #endif])
  737. AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0,
  738. [#ifdef HAVE_SYS_TYPES_H
  739. #include <sys/types.h>
  740. #endif
  741. #ifdef HAVE_SYS_SOCKET_H
  742. #include <sys/socket.h>
  743. #endif
  744. #ifdef HAVE_NET_IF_H
  745. #include <net/if.h>
  746. #endif])
  747. AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
  748. linux_netfilter_ipv4=1, linux_netfilter_ipv4=0,
  749. [#ifdef HAVE_SYS_TYPES_H
  750. #include <sys/types.h>
  751. #endif
  752. #ifdef HAVE_SYS_SOCKET_H
  753. #include <sys/socket.h>
  754. #endif
  755. #ifdef HAVE_LIMITS_H
  756. #include <limits.h>
  757. #endif
  758. #ifdef HAVE_LINUX_TYPES_H
  759. #include <linux/types.h>
  760. #endif
  761. #ifdef HAVE_NETINET_IN6_H
  762. #include <netinet/in6.h>
  763. #endif
  764. #ifdef HAVE_NETINET_IN_H
  765. #include <netinet/in.h>
  766. #endif])
  767. if test x$transparent = xtrue ; then
  768. transparent_ok=0
  769. if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then
  770. transparent_ok=1
  771. fi
  772. if test x$linux_netfilter_ipv4 = x1 ; then
  773. transparent_ok=1
  774. fi
  775. if test x$transparent_ok = x1 ; then
  776. AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
  777. case $host in
  778. *-*-openbsd* | *-*-bitrig*)
  779. AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
  780. esac
  781. else
  782. AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
  783. fi
  784. fi
  785. AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
  786. [#ifdef HAVE_SYS_TYPES_H
  787. #include <sys/types.h>
  788. #endif
  789. #ifdef HAVE_SYS_TIME_H
  790. #include <sys/time.h>
  791. #endif])
  792. dnl In case we aren't given a working stdint.h, we'll need to grow our own.
  793. dnl Watch out.
  794. AC_CHECK_SIZEOF(int8_t)
  795. AC_CHECK_SIZEOF(int16_t)
  796. AC_CHECK_SIZEOF(int32_t)
  797. AC_CHECK_SIZEOF(int64_t)
  798. AC_CHECK_SIZEOF(uint8_t)
  799. AC_CHECK_SIZEOF(uint16_t)
  800. AC_CHECK_SIZEOF(uint32_t)
  801. AC_CHECK_SIZEOF(uint64_t)
  802. AC_CHECK_SIZEOF(intptr_t)
  803. AC_CHECK_SIZEOF(uintptr_t)
  804. dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
  805. AC_CHECK_SIZEOF(char)
  806. AC_CHECK_SIZEOF(short)
  807. AC_CHECK_SIZEOF(int)
  808. AC_CHECK_SIZEOF(long)
  809. AC_CHECK_SIZEOF(long long)
  810. AC_CHECK_SIZEOF(__int64)
  811. AC_CHECK_SIZEOF(void *)
  812. AC_CHECK_SIZEOF(time_t)
  813. AC_CHECK_SIZEOF(size_t)
  814. AC_CHECK_SIZEOF(pid_t)
  815. AC_CHECK_TYPES([uint, u_char, ssize_t])
  816. dnl used to include sockaddr_storage, but everybody has that.
  817. AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t], , ,
  818. [#ifdef HAVE_SYS_TYPES_H
  819. #include <sys/types.h>
  820. #endif
  821. #ifdef HAVE_NETINET_IN_H
  822. #include <netinet/in.h>
  823. #endif
  824. #ifdef HAVE_NETINET_IN6_H
  825. #include <netinet/in6.h>
  826. #endif
  827. #ifdef HAVE_SYS_SOCKET_H
  828. #include <sys/socket.h>
  829. #endif
  830. #ifdef _WIN32
  831. #define _WIN32_WINNT 0x0501
  832. #define WIN32_LEAN_AND_MEAN
  833. #if defined(_MSC_VER) && (_MSC_VER < 1300)
  834. #include <winsock.h>
  835. #else
  836. #include <winsock2.h>
  837. #include <ws2tcpip.h>
  838. #endif
  839. #endif
  840. ])
  841. AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len], , ,
  842. [#ifdef HAVE_SYS_TYPES_H
  843. #include <sys/types.h>
  844. #endif
  845. #ifdef HAVE_NETINET_IN_H
  846. #include <netinet/in.h>
  847. #endif
  848. #ifdef HAVE_NETINET_IN6_H
  849. #include <netinet/in6.h>
  850. #endif
  851. #ifdef HAVE_SYS_SOCKET_H
  852. #include <sys/socket.h>
  853. #endif
  854. #ifdef _WIN32
  855. #define _WIN32_WINNT 0x0501
  856. #define WIN32_LEAN_AND_MEAN
  857. #if defined(_MSC_VER) && (_MSC_VER < 1300)
  858. #include <winsock.h>
  859. #else
  860. #include <winsock2.h>
  861. #include <ws2tcpip.h>
  862. #endif
  863. #endif
  864. ])
  865. AC_CHECK_TYPES([rlim_t], , ,
  866. [#ifdef HAVE_SYS_TYPES_H
  867. #include <sys/types.h>
  868. #endif
  869. #ifdef HAVE_SYS_TIME_H
  870. #include <sys/time.h>
  871. #endif
  872. #ifdef HAVE_SYS_RESOURCE_H
  873. #include <sys/resource.h>
  874. #endif
  875. ])
  876. AX_CHECK_SIGN([time_t],
  877. [ AC_DEFINE(TIME_T_IS_SIGNED, 1, [Define if time_t is signed]) ],
  878. [ : ], [
  879. #ifdef HAVE_SYS_TYPES_H
  880. #include <sys/types.h>
  881. #endif
  882. #ifdef HAVE_SYS_TIME_H
  883. #include <sys/time.h>
  884. #endif
  885. #ifdef HAVE_TIME_H
  886. #include <time.h>
  887. #endif
  888. ])
  889. if test "$ax_cv_decl_time_t_signed" = no; then
  890. AC_MSG_WARN([You have an unsigned time_t; some things will probably break. Please tell the Tor developers about your interesting platform.])
  891. fi
  892. AX_CHECK_SIGN([size_t],
  893. [ tor_cv_size_t_signed=yes ],
  894. [ tor_cv_size_t_signed=no ], [
  895. #ifdef HAVE_SYS_TYPES_H
  896. #include <sys/types.h>
  897. #endif
  898. ])
  899. if test "$ax_cv_decl_size_t_signed" = yes; then
  900. AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
  901. fi
  902. AX_CHECK_SIGN([enum always],
  903. [ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
  904. [ : ], [
  905. enum always { AAA, BBB, CCC };
  906. ])
  907. AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
  908. #ifdef HAVE_SYS_SOCKET_H
  909. #include <sys/socket.h>
  910. #endif
  911. ])
  912. # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
  913. AC_CHECK_SIZEOF(cell_t)
  914. # Now make sure that NULL can be represented as zero bytes.
  915. AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
  916. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  917. [[#include <stdlib.h>
  918. #include <string.h>
  919. #include <stdio.h>
  920. #ifdef HAVE_STDDEF_H
  921. #include <stddef.h>
  922. #endif
  923. int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
  924. return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
  925. [tor_cv_null_is_zero=yes],
  926. [tor_cv_null_is_zero=no],
  927. [tor_cv_null_is_zero=cross])])
  928. if test "$tor_cv_null_is_zero" = cross ; then
  929. # Cross-compiling; let's hope that the target isn't raving mad.
  930. AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
  931. fi
  932. if test "$tor_cv_null_is_zero" != no; then
  933. AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
  934. [Define to 1 iff memset(0) sets pointers to NULL])
  935. fi
  936. AC_CACHE_CHECK([whether memset(0) sets doubles to 0.0], tor_cv_dbl0_is_zero,
  937. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  938. [[#include <stdlib.h>
  939. #include <string.h>
  940. #include <stdio.h>
  941. #ifdef HAVE_STDDEF_H
  942. #include <stddef.h>
  943. #endif
  944. int main () { double d1,d2; d1=0; memset(&d2,0,sizeof(d2));
  945. return memcmp(&d1,&d2,sizeof(d1))?1:0; }]])],
  946. [tor_cv_dbl0_is_zero=yes],
  947. [tor_cv_dbl0_is_zero=no],
  948. [tor_cv_dbl0_is_zero=cross])])
  949. if test "$tor_cv_dbl0_is_zero" = cross ; then
  950. # Cross-compiling; let's hope that the target isn't raving mad.
  951. AC_MSG_NOTICE([Cross-compiling: we'll assume that 0.0 can be represented as a sequence of 0-valued bytes.])
  952. fi
  953. if test "$tor_cv_dbl0_is_zero" != no; then
  954. AC_DEFINE([DOUBLE_0_REP_IS_ZERO_BYTES], 1,
  955. [Define to 1 iff memset(0) sets doubles to 0.0])
  956. fi
  957. # And what happens when we malloc zero?
  958. AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
  959. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  960. [[#include <stdlib.h>
  961. #include <string.h>
  962. #include <stdio.h>
  963. #ifdef HAVE_STDDEF_H
  964. #include <stddef.h>
  965. #endif
  966. int main () { return malloc(0)?0:1; }]])],
  967. [tor_cv_malloc_zero_works=yes],
  968. [tor_cv_malloc_zero_works=no],
  969. [tor_cv_malloc_zero_works=cross])])
  970. if test "$tor_cv_malloc_zero_works" = cross; then
  971. # Cross-compiling; let's hope that the target isn't raving mad.
  972. AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
  973. fi
  974. if test "$tor_cv_malloc_zero_works" = yes; then
  975. AC_DEFINE([MALLOC_ZERO_WORKS], 1,
  976. [Define to 1 iff malloc(0) returns a pointer])
  977. fi
  978. # whether we seem to be in a 2s-complement world.
  979. AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
  980. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  981. [[int main () { int problem = ((-99) != (~99)+1);
  982. return problem ? 1 : 0; }]])],
  983. [tor_cv_twos_complement=yes],
  984. [tor_cv_twos_complement=no],
  985. [tor_cv_twos_complement=cross])])
  986. if test "$tor_cv_twos_complement" = cross ; then
  987. # Cross-compiling; let's hope that the target isn't raving mad.
  988. AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
  989. fi
  990. if test "$tor_cv_twos_complement" != no ; then
  991. AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
  992. [Define to 1 iff we represent negative integers with two's complement])
  993. fi
  994. # What does shifting a negative value do?
  995. AC_CACHE_CHECK([whether right-shift on negative values does sign-extension], tor_cv_sign_extend,
  996. [AC_RUN_IFELSE([AC_LANG_SOURCE(
  997. [[int main () { int okay = (-60 >> 8) == -1; return okay ? 0 : 1; }]])],
  998. [tor_cv_sign_extend=yes],
  999. [tor_cv_sign_extend=no],
  1000. [tor_cv_sign_extend=cross])])
  1001. if test "$tor_cv_sign_extend" = cross ; then
  1002. # Cross-compiling; let's hope that the target isn't raving mad.
  1003. AC_MSG_NOTICE([Cross-compiling: we'll assume that right-shifting negative integers causes sign-extension])
  1004. fi
  1005. if test "$tor_cv_sign_extend" != no ; then
  1006. AC_DEFINE([RSHIFT_DOES_SIGN_EXTEND], 1,
  1007. [Define to 1 iff right-shifting a negative value performs sign-extension])
  1008. fi
  1009. # Whether we should use the dmalloc memory allocation debugging library.
  1010. AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
  1011. AC_ARG_WITH(dmalloc,
  1012. [ --with-dmalloc Use debug memory allocation library. ],
  1013. [if [[ "$withval" = "yes" ]]; then
  1014. dmalloc=1
  1015. AC_MSG_RESULT(yes)
  1016. else
  1017. dmalloc=1
  1018. AC_MSG_RESULT(no)
  1019. fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
  1020. )
  1021. if [[ $dmalloc -eq 1 ]]; then
  1022. AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
  1023. AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
  1024. AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
  1025. AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
  1026. AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
  1027. fi
  1028. AC_ARG_WITH(tcmalloc,
  1029. [ --with-tcmalloc Use tcmalloc memory allocation library. ],
  1030. [ tcmalloc=yes ], [ tcmalloc=no ])
  1031. if test x$tcmalloc = xyes ; then
  1032. LDFLAGS="-ltcmalloc $LDFLAGS"
  1033. fi
  1034. using_custom_malloc=no
  1035. if test x$enable_openbsd_malloc = xyes ; then
  1036. using_custom_malloc=yes
  1037. fi
  1038. if test x$tcmalloc = xyes ; then
  1039. using_custom_malloc=yes
  1040. fi
  1041. if test $using_custom_malloc = no ; then
  1042. AC_CHECK_FUNCS(mallinfo)
  1043. fi
  1044. # By default, we're going to assume we don't have mlockall()
  1045. # bionic and other platforms have various broken mlockall subsystems.
  1046. # Some systems don't have a working mlockall, some aren't linkable,
  1047. # and some have it but don't declare it.
  1048. AC_CHECK_FUNCS(mlockall)
  1049. AC_CHECK_DECLS([mlockall], , , [
  1050. #ifdef HAVE_SYS_MMAN_H
  1051. #include <sys/mman.h>
  1052. #endif])
  1053. # Allow user to specify an alternate syslog facility
  1054. AC_ARG_WITH(syslog-facility,
  1055. [ --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
  1056. syslog_facility="$withval", syslog_facility="LOG_DAEMON")
  1057. AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
  1058. AC_SUBST(LOGFACILITY)
  1059. # Check if we have getresuid and getresgid
  1060. AC_CHECK_FUNCS(getresuid getresgid)
  1061. # Check for gethostbyname_r in all its glorious incompatible versions.
  1062. # (This logic is based on that in Python's configure.in)
  1063. AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
  1064. [Define this if you have any gethostbyname_r()])
  1065. AC_CHECK_FUNC(gethostbyname_r, [
  1066. AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
  1067. OLD_CFLAGS=$CFLAGS
  1068. CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
  1069. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
  1070. #include <netdb.h>
  1071. ], [[
  1072. char *cp1, *cp2;
  1073. struct hostent *h1, *h2;
  1074. int i1, i2;
  1075. (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
  1076. ]])],[
  1077. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1078. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
  1079. [Define this if gethostbyname_r takes 6 arguments])
  1080. AC_MSG_RESULT(6)
  1081. ], [
  1082. AC_TRY_COMPILE([
  1083. #include <netdb.h>
  1084. ], [
  1085. char *cp1, *cp2;
  1086. struct hostent *h1;
  1087. int i1, i2;
  1088. (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
  1089. ], [
  1090. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1091. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
  1092. [Define this if gethostbyname_r takes 5 arguments])
  1093. AC_MSG_RESULT(5)
  1094. ], [
  1095. AC_TRY_COMPILE([
  1096. #include <netdb.h>
  1097. ], [
  1098. char *cp1;
  1099. struct hostent *h1;
  1100. struct hostent_data hd;
  1101. (void) gethostbyname_r(cp1,h1,&hd);
  1102. ], [
  1103. AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1104. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
  1105. [Define this if gethostbyname_r takes 3 arguments])
  1106. AC_MSG_RESULT(3)
  1107. ], [
  1108. AC_MSG_RESULT(0)
  1109. ])
  1110. ])
  1111. ])
  1112. CFLAGS=$OLD_CFLAGS
  1113. ])
  1114. AC_CACHE_CHECK([whether the C compiler supports __func__],
  1115. tor_cv_have_func_macro,
  1116. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1117. #include <stdio.h>
  1118. int main(int c, char **v) { puts(__func__); }])],
  1119. tor_cv_have_func_macro=yes,
  1120. tor_cv_have_func_macro=no))
  1121. AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
  1122. tor_cv_have_FUNC_macro,
  1123. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1124. #include <stdio.h>
  1125. int main(int c, char **v) { puts(__FUNC__); }])],
  1126. tor_cv_have_FUNC_macro=yes,
  1127. tor_cv_have_FUNC_macro=no))
  1128. AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
  1129. tor_cv_have_FUNCTION_macro,
  1130. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1131. #include <stdio.h>
  1132. int main(int c, char **v) { puts(__FUNCTION__); }])],
  1133. tor_cv_have_FUNCTION_macro=yes,
  1134. tor_cv_have_FUNCTION_macro=no))
  1135. AC_CACHE_CHECK([whether we have extern char **environ already declared],
  1136. tor_cv_have_environ_declared,
  1137. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1138. /* We define _GNU_SOURCE here because it is also defined in compat.c.
  1139. * Without it environ doesn't get declared. */
  1140. #define _GNU_SOURCE
  1141. #ifdef HAVE_UNISTD_H
  1142. #include <unistd.h>
  1143. #endif
  1144. #include <stdlib.h>
  1145. int main(int c, char **v) { char **t = environ; }])],
  1146. tor_cv_have_environ_declared=yes,
  1147. tor_cv_have_environ_declared=no))
  1148. if test "$tor_cv_have_func_macro" = 'yes'; then
  1149. AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
  1150. fi
  1151. if test "$tor_cv_have_FUNC_macro" = 'yes'; then
  1152. AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
  1153. fi
  1154. if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
  1155. AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
  1156. [Defined if the compiler supports __FUNCTION__])
  1157. fi
  1158. if test "$tor_cv_have_environ_declared" = 'yes'; then
  1159. AC_DEFINE(HAVE_EXTERN_ENVIRON_DECLARED, 1,
  1160. [Defined if we have extern char **environ already declared])
  1161. fi
  1162. # $prefix stores the value of the --prefix command line option, or
  1163. # NONE if the option wasn't set. In the case that it wasn't set, make
  1164. # it be the default, so that we can use it to expand directories now.
  1165. if test "x$prefix" = "xNONE"; then
  1166. prefix=$ac_default_prefix
  1167. fi
  1168. # and similarly for $exec_prefix
  1169. if test "x$exec_prefix" = "xNONE"; then
  1170. exec_prefix=$prefix
  1171. fi
  1172. if test "x$BUILDDIR" = "x"; then
  1173. BUILDDIR=`pwd`
  1174. fi
  1175. AC_SUBST(BUILDDIR)
  1176. AH_TEMPLATE([BUILDDIR],[tor's build directory])
  1177. AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
  1178. if test "x$CONFDIR" = "x"; then
  1179. CONFDIR=`eval echo $sysconfdir/tor`
  1180. fi
  1181. AC_SUBST(CONFDIR)
  1182. AH_TEMPLATE([CONFDIR],[tor's configuration directory])
  1183. AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
  1184. BINDIR=`eval echo $bindir`
  1185. AC_SUBST(BINDIR)
  1186. LOCALSTATEDIR=`eval echo $localstatedir`
  1187. AC_SUBST(LOCALSTATEDIR)
  1188. if test "$bwin32" = true; then
  1189. # Test if the linker supports the --nxcompat and --dynamicbase options
  1190. # for Windows
  1191. save_LDFLAGS="$LDFLAGS"
  1192. LDFLAGS="-Wl,--nxcompat -Wl,--dynamicbase"
  1193. AC_MSG_CHECKING([whether the linker supports DllCharacteristics])
  1194. AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
  1195. [AC_MSG_RESULT([yes])]
  1196. [save_LDFLAGS="$save_LDFLAGS $LDFLAGS"],
  1197. [AC_MSG_RESULT([no])]
  1198. )
  1199. LDFLAGS="$save_LDFLAGS"
  1200. fi
  1201. # Set CFLAGS _after_ all the above checks, since our warnings are stricter
  1202. # than autoconf's macros like.
  1203. if test "$GCC" = yes; then
  1204. # Disable GCC's strict aliasing checks. They are an hours-to-debug
  1205. # accident waiting to happen.
  1206. CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
  1207. else
  1208. # Autoconf sets -g -O2 by default. Override optimization level
  1209. # for non-gcc compilers
  1210. CFLAGS="$CFLAGS -O"
  1211. enable_gcc_warnings=no
  1212. enable_gcc_warnings_advisory=no
  1213. fi
  1214. # OS X Lion started deprecating the system openssl. Let's just disable
  1215. # all deprecation warnings on OS X. Also, to potentially make the binary
  1216. # a little smaller, let's enable dead_strip.
  1217. case "$host_os" in
  1218. darwin*)
  1219. CFLAGS="$CFLAGS -Wno-deprecated-declarations"
  1220. LDFLAGS="$LDFLAGS -dead_strip" ;;
  1221. esac
  1222. # Add some more warnings which we use in development but not in the
  1223. # released versions. (Some relevant gcc versions can't handle these.)
  1224. if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xyes; then
  1225. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1226. #if !defined(__GNUC__) || (__GNUC__ < 4)
  1227. #error
  1228. #endif])], have_gcc4=yes, have_gcc4=no)
  1229. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1230. #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
  1231. #error
  1232. #endif])], have_gcc42=yes, have_gcc42=no)
  1233. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1234. #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
  1235. #error
  1236. #endif])], have_gcc43=yes, have_gcc43=no)
  1237. save_CFLAGS="$CFLAGS"
  1238. CFLAGS="$CFLAGS -Wshorten-64-to-32"
  1239. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], have_shorten64_flag=yes,
  1240. have_shorten64_flag=no)
  1241. CFLAGS="$save_CFLAGS"
  1242. case $host in
  1243. *-*-openbsd* | *-*-bitrig*)
  1244. # Some OpenBSD versions (like 4.8) have -Wsystem-headers by default.
  1245. # That's fine, except that the headers don't pass -Wredundant-decls.
  1246. # Therefore, let's disable -Wsystem-headers when we're building
  1247. # with maximal warnings on OpenBSD.
  1248. CFLAGS="$CFLAGS -Wno-system-headers" ;;
  1249. esac
  1250. CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith"
  1251. CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
  1252. CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
  1253. CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
  1254. CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
  1255. if test x$enable_gcc_warnings = xyes; then
  1256. CFLAGS="$CFLAGS -Werror"
  1257. fi
  1258. # Disabled, so we can use mallinfo(): -Waggregate-return
  1259. if test x$have_gcc4 = xyes ; then
  1260. # These warnings break gcc 3.3.5 and work on gcc 4.0.2
  1261. CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Wold-style-definition"
  1262. fi
  1263. if test x$have_gcc42 = xyes ; then
  1264. # These warnings break gcc 4.0.2 and work on gcc 4.2
  1265. # XXXX020 See if any of these work with earlier versions.
  1266. CFLAGS="$CFLAGS -Waddress -Wmissing-noreturn -Wstrict-overflow=1"
  1267. # We used to use -Wstrict-overflow=5, but that breaks us heavily under 4.3.
  1268. fi
  1269. if test x$have_gcc42 = xyes && test x$have_clang = xno; then
  1270. # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
  1271. CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
  1272. fi
  1273. if test x$have_gcc43 = xyes ; then
  1274. # These warnings break gcc 4.2 and work on gcc 4.3
  1275. # XXXX020 See if any of these work with earlier versions.
  1276. CFLAGS="$CFLAGS -Wextra -Warray-bounds"
  1277. fi
  1278. if test x$have_shorten64_flag = xyes ; then
  1279. CFLAGS="$CFLAGS -Wshorten-64-to-32"
  1280. fi
  1281. ##This will break the world on some 64-bit architectures
  1282. # CFLAGS="$CFLAGS -Winline"
  1283. fi
  1284. if test "$enable_coverage" = yes && test "$have_clang" = "no"; then
  1285. case "$host_os" in
  1286. darwin*)
  1287. 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.])
  1288. esac
  1289. fi
  1290. CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
  1291. AC_CONFIG_FILES([
  1292. Doxyfile
  1293. Makefile
  1294. contrib/suse/tor.sh
  1295. contrib/tor.logrotate
  1296. contrib/tor.sh
  1297. contrib/torctl
  1298. contrib/torify
  1299. src/config/torrc.sample
  1300. ])
  1301. if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
  1302. regular_mans="doc/tor doc/tor-gencert doc/tor-resolve doc/torify"
  1303. for file in $regular_mans ; do
  1304. if ! [[ -f "$srcdir/$file.1.in" ]] || ! [[ -f "$srcdir/$file.html.in" ]] ; then
  1305. echo "==================================";
  1306. echo;
  1307. echo "You need asciidoc installed to be able to build the manpage.";
  1308. echo "To build without manpages, use the --disable-asciidoc argument";
  1309. echo "when calling configure.";
  1310. echo;
  1311. echo "==================================";
  1312. exit 1;
  1313. fi
  1314. done
  1315. fi
  1316. AC_OUTPUT
  1317. if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then
  1318. ./contrib/updateVersions.pl
  1319. fi