configure.ac 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193
  1. # This file is part of GNUnet.
  2. # (C) 2001--2019 GNUnet e.V.
  3. #
  4. # GNUnet is free software: you can redistribute it and/or modify it
  5. # under the terms of the GNU Affero General Public License as published
  6. # by the Free Software Foundation, either version 3 of the License,
  7. # or (at your option) any later version.
  8. #
  9. # GNUnet is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #
  17. # SPDX-License-Identifier: AGPL3.0-or-later
  18. #
  19. # Process this file with autoconf to produce a configure script.
  20. #
  21. #
  22. AC_PREREQ(2.61)
  23. # Checks for programs.
  24. AC_INIT([gnunet], [0.11.6], [bug-gnunet@gnu.org])
  25. AC_CONFIG_AUX_DIR([build-aux])
  26. # check for legacy option that is no longer supported (#5627) and fail hard
  27. AC_ARG_WITH(nssdir,
  28. [ --with-nssdir=DIR legacy switch, no longer supported, do not use],
  29. [AC_MSG_RESULT([$with_nssdir])
  30. AS_CASE([$with_nssdir],
  31. [no],[],
  32. [AC_MSG_ERROR([--with-nssdir is no longer supported])])
  33. ])
  34. AC_CANONICAL_TARGET
  35. AC_CANONICAL_HOST
  36. AC_CANONICAL_SYSTEM
  37. AM_INIT_AUTOMAKE
  38. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)])
  39. AC_CONFIG_HEADERS([gnunet_config.h])
  40. AH_TOP([#define _GNU_SOURCE 1])
  41. AC_CONFIG_MACRO_DIR([m4])
  42. AC_PROG_AWK
  43. AC_PROG_CC_C99
  44. AC_PROG_CPP
  45. AC_PROG_CXX
  46. AC_PROG_OBJC
  47. AC_PROG_INSTALL
  48. AC_PROG_LN_S
  49. AC_PROG_MAKE_SET
  50. AM_PROG_CC_C_O
  51. LT_INIT([disable-static dlopen win32-dll])
  52. AC_SUBST(MKDIR_P)
  53. # allow for different autotools
  54. AS_AUTOTOOLS_ALTERNATE
  55. # large file support
  56. AC_SYS_LARGEFILE
  57. AC_FUNC_FSEEKO
  58. CFLAGS="-Wall $CFLAGS"
  59. # use '-fno-strict-aliasing', but only if the compiler can take it
  60. AS_IF([gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1],
  61. [CFLAGS="-fno-strict-aliasing $CFLAGS"])
  62. # A helper which allows us to check cflags if compiler
  63. AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
  64. AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
  65. [ac_save_CFLAGS="$CFLAGS"
  66. CFLAGS="$CFLAGS $1"
  67. AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
  68. [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
  69. [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
  70. CFLAGS="$ac_save_CFLAGS"
  71. ])
  72. AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
  73. [$2], [$3])
  74. ])
  75. # We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable.
  76. CC_CHECK_CFLAGS_SILENT([-Wno-address-of-packed-member],
  77. [CFLAGS="-Wno-address-of-packed-member $CFLAGS"])
  78. # Use Linux interface name unless the OS has a different preference
  79. DEFAULT_INTERFACE="\"eth0\""
  80. funcstocheck="getnameinfo gethostname gethostbyname gethostbyaddr getaddrinfo getaddrinfo_a"
  81. # Srcdir in a form that native compiler understands (i.e. DOS path on W32)
  82. native_srcdir=$srcdir
  83. OLD_LDFLAGS="$LDFLAGS"
  84. LDFLAGS="$LDFLAGS -Wl,--unresolved-symbols=report-all"
  85. # Check system type
  86. AS_CASE(["$host_os"],
  87. [*darwin* | *rhapsody* | *macosx*],[
  88. AC_DEFINE_UNQUOTED(DARWIN,1,[This is an Apple Darwin system])
  89. CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS"
  90. CFLAGS="-fno-common $CFLAGS"
  91. LDFLAGS="$OLD_LDFLAGS"
  92. AC_MSG_WARN([WARNING: The VPN application cannot be compiled on your OS])
  93. AC_CHECK_LIB(intl, gettext)
  94. build_target="darwin"
  95. DEFAULT_INTERFACE="\"en0\""
  96. LIBPREFIX=
  97. DLLDIR=lib
  98. UNIXONLY="#"
  99. ],
  100. [linux*],[
  101. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
  102. build_target="linux"
  103. LIBPREFIX=
  104. DLLDIR=lib
  105. UNIXONLY="#"
  106. AC_PATH_XTRA
  107. ],
  108. [*freebsd*],[
  109. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  110. AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
  111. CFLAGS="-D_THREAD_SAFE $CFLAGS"
  112. build_target="freebsd"
  113. LIBPREFIX=
  114. DLLDIR=lib
  115. UNIXONLY="#"
  116. ],
  117. [*openbsd*],[
  118. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  119. AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
  120. LIBS=`echo $LIBS | sed -e "s/-ldl//"`
  121. build_target="openbsd"
  122. LIBPREFIX=
  123. DLLDIR=lib
  124. UNIXONLY="#"
  125. ],
  126. [*netbsd*],[
  127. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  128. AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
  129. LIBPREFIX=
  130. DLLDIR=lib
  131. UNIXONLY="#"
  132. ],
  133. [*solaris*],[
  134. AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
  135. AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
  136. AC_CHECK_LIB(resolv, res_init)
  137. AC_CHECK_LIB(rt, nanosleep)
  138. build_target="solaris"
  139. LIBPREFIX=
  140. DLLDIR=lib
  141. UNIXONLY="#"
  142. ],
  143. [*arm-linux*],[
  144. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
  145. CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
  146. build_target="linux"
  147. LIBPREFIX=
  148. DLLDIR=lib
  149. UNIXONLY="#"
  150. ],
  151. [*cygwin*],[
  152. AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
  153. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  154. AC_CHECK_LIB(intl, gettext)
  155. CFLAGS="-mms-bitfields $CFLAGS"
  156. build_target="cygwin"
  157. LIBPREFIX=lib
  158. DLLDIR=bin
  159. AC_PROG_CXX
  160. UNIXONLY=""
  161. ],
  162. [*mingw*],[
  163. AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
  164. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  165. AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
  166. AC_CHECK_LIB(intl, gettext)
  167. LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
  168. LIBS="$LIBS -lws2_32 -lplibc -lgnurx -lole32"
  169. CFLAGS="-mms-bitfields $CFLAGS"
  170. CPPFLAGS="-D_WIN32_WINNT=0x0501 -DHAVE_STAT64=1 -D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS"
  171. build_target="mingw"
  172. AC_PROG_CXX
  173. LIBPREFIX=lib
  174. DLLDIR=bin
  175. UNIXONLY=""
  176. funcstocheck=""
  177. native_srcdir=$(cd $srcdir; pwd -W)
  178. ],
  179. [gnu*],[
  180. AC_DEFINE_UNQUOTED(GNU,1,[This is a GNU system])
  181. build_target="gnu"
  182. UNIXONLY="#"
  183. ],
  184. [
  185. AC_MSG_RESULT(Unrecognised OS $host_os)
  186. AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
  187. UNIXONLY=""
  188. ])
  189. AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
  190. AC_SUBST(DEFAULT_INTERFACE)
  191. # Disable TCP-based IPC on systems that support UNIX domain
  192. # sockets in default configuratin:
  193. AC_SUBST(UNIXONLY)
  194. AC_MSG_CHECKING([for build target])
  195. AM_CONDITIONAL(DARWIN, test "$build_target" = "darwin")
  196. AM_CONDITIONAL(CYGWIN, test "$build_target" = "cygwin")
  197. AM_CONDITIONAL(MINGW, test "$build_target" = "mingw")
  198. AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
  199. AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
  200. AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
  201. AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
  202. AM_CONDITIONAL(GNU, test "$build_target" = "gnu")
  203. AC_MSG_RESULT([$build_target])
  204. AC_SUBST(build_target)
  205. AM_CONDITIONAL([am__fastdepOBJC], false)
  206. AC_UNALIGNED_64_ACCESS
  207. # some other checks for standard libs
  208. AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
  209. AC_SEARCH_LIBS([memrchr], [],
  210. AC_DEFINE(HAVE_MEMRCHR,1,[memrchr supported]), [])
  211. AC_SEARCH_LIBS([memset_s], [],
  212. AC_DEFINE(HAVE_MEMSET_S,1,[memset_s supported]), [])
  213. AC_SEARCH_LIBS([memset_s], [],
  214. AC_DEFINE(HAVE_EXPLICIT_BZERO,1,[explicit_bzero supported]), [])
  215. AC_CHECK_LIB(socket, socket)
  216. AC_CHECK_LIB(m, log)
  217. AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
  218. AC_CHECK_PROG(VAR_GETOPT_BINARY, getopt, true, false)
  219. AM_CONDITIONAL(HAVE_GETOPT_BINARY, $VAR_GETOPT_BINARY)
  220. AC_CHECK_PROG(VAR_SSH_BINARY, ssh, true, false)
  221. AM_CONDITIONAL(HAVE_SSH_BINARY, $VAR_SSH_BINARY)
  222. AM_CONDITIONAL(HAVE_SSH_KEY, ssh -D 12345 -o "BatchMode yes" -o "UserKnownHostsFile /tmp/gnunet_test_cosks_ssh_garbage" -o "StrictHostKeyChecking no" 127.0.0.1 echo -n)
  223. rm -f /tmp/gnunet_test_cosks_ssh_garbage
  224. # autotools' m4 for python has no maximum version!
  225. # python3.4 - python3.7 for tests
  226. m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python3.4 python3.5 python3.6 python3.7 python])
  227. AM_PATH_PYTHON([3.4],, [:])
  228. AC_SUBST([PYTHON])
  229. AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
  230. # perl
  231. AC_PATH_PROG( PERL, perl, ,
  232. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  233. AC_SUBST([PERL])
  234. # iptables is a soft requirement to run tests
  235. AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false)
  236. AS_IF([test x"$VAR_IPTABLES_BINARY" = x"false"],
  237. [AS_IF([test -x "/sbin/iptables"],
  238. [VAR_IPTABLES_BINARY="/sbin/iptables"],
  239. [AS_IF([test -x "/usr/sbin/iptables"],
  240. [VAR_IPTABLES_BINARY="/usr/sbin/iptables"])])])
  241. AS_IF([test x"$VAR_IPTABLES_BINARY" != x"false"],
  242. [AC_DEFINE_UNQUOTED([IPTABLES], "$VAR_IPTABLES_BINARY", [Path to iptables])],
  243. [AC_MSG_WARN([warning: 'iptables' not found.])])
  244. # ip6tables is a soft requirement for some features
  245. AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false)
  246. AS_IF([test x"$VAR_IP6TABLES_BINARY" = x"false"],
  247. [AS_IF([test -x "/sbin/ip6tables"],
  248. [VAR_IP6TABLES_BINARY="/sbin/ip6tables"],
  249. [AS_IF([test -x "/usr/sbin/ip6tables"],
  250. [VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"])])])
  251. AS_IF([test x"$VAR_IP6TABLES_BINARY" != x"false"],
  252. [AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])],
  253. [AC_MSG_WARN([warning: 'ip6tables' not found.])])
  254. # ip is a soft requirement for some features
  255. AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false)
  256. AS_IF([test x"$VAR_IP_BINARY" = x"false"],
  257. [AS_IF([test -x "/sbin/ip"],
  258. [VAR_IP_BINARY="/sbin/ip"],
  259. [AS_IF([test -x "/usr/sbin/ip"],
  260. [VAR_IP_BINARY="/usr/sbin/ip"])])])
  261. AS_IF([test x"$VAR_IP_BINARY" != x"false"],
  262. [AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])],
  263. [AC_MSG_WARN([warning: 'ip' not found.])])
  264. # locate 'ifconfig'
  265. AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false)
  266. AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false)
  267. AS_IF([test x"$VAR_IFCONFIG_BINARY" = x"false"],
  268. [AS_IF([test -x "/sbin/ifconfig"],
  269. [VAR_IFCONFIG_BINARY="/sbin/ifconfig"],
  270. [AS_IF([test -x "/usr/sbin/ifconfig"],
  271. [VAR_IFCONFIG_BINARY="/usr/sbin/ifconfig"])])])
  272. AS_IF([test x"$VAR_IFCONFIG_BINARY" != x"false"],
  273. [AC_DEFINE_UNQUOTED([IFCONFIG], "$VAR_IFCONFIG_BINARY", [Path to ifconfig])],
  274. [AC_MSG_WARN(['ifconfig' not found.])])
  275. AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false)
  276. AC_CHECK_PROG(VAR_SYSCTL_BINARY, sysctl, true, false)
  277. AS_IF([test x"$VAR_SYSCTL_BINARY" = x"false"],
  278. [AS_IF([test -x "/sbin/sysctl"],
  279. [VAR_SYSCTL_BINARY="/sbin/sysctl"],
  280. [AS_IF([test -x "/usr/sbin/sysctl"],
  281. [VAR_SYSCTL_BINARY="/usr/sbin/sysctl"])])])
  282. AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
  283. [AC_DEFINE_UNQUOTED([SYSCTL], "$VAR_SYSCTL_BINARY", [Path to sysctl])],
  284. [AC_MSG_WARN(['sysctl' not found.])])
  285. # miniupnpc / upnpc binary is a soft runtime requirement
  286. AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false)
  287. AS_IF([test x"$VAR_UPNPC_BINARY" != x"false"],
  288. [AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary])],
  289. [AC_MSG_WARN([warning: 'upnpc' binary not found.])])
  290. AC_CHECK_MEMBER(struct tm.tm_gmtoff,
  291. [AC_DEFINE(HAVE_TM_GMTOFF, 1,
  292. [Define if struct tm has the tm_gmtoff member.])],
  293. ,
  294. [#include <time.h>])
  295. AC_CHECK_DECLS([_stati64])
  296. # 'save' libs; only those libs found so far will be
  297. # linked against _everywhere_. For the others, we
  298. # will be more selective!
  299. SAVE_LIBS=$LIBS
  300. have_addrinfo_a=0
  301. AC_CHECK_LIB(anl,
  302. getaddrinfo_a,
  303. [have_addrinfo_a=1 AC_DEFINE(HAVE_GETADDRINFO_A,
  304. 1,
  305. [getaddrinfo_a supported])])
  306. AM_CONDITIONAL(HAVE_GETADDRINFO_A,
  307. [test "$have_addrinfo_a" = 1])
  308. # tests only run on Windows
  309. AS_IF([test "x$build_target" = "xmingw"],
  310. [AC_CHECK_LIB(plibc,
  311. plibc_init,
  312. [],
  313. [AC_MSG_ERROR([GNUnet requires PlibC on Windows])])
  314. AC_CHECK_LIB(gnurx,
  315. regexec,
  316. [],
  317. [AC_MSG_ERROR([GNUnet requires libgnurx on Windows])])])
  318. # libgcrypt
  319. gcrypt=0
  320. NEED_LIBGCRYPT_API=1
  321. NEED_LIBGCRYPT_VERSION=1.6.0
  322. AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
  323. AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
  324. AS_IF([test $gcrypt = 0],
  325. [
  326. AC_MSG_ERROR([[
  327. ***
  328. *** You need libgcrypt to build this program.
  329. ** This library is for example available at
  330. *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
  331. *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API)
  332. *** is required.)
  333. ***]])
  334. ])
  335. AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version])
  336. AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]])
  337. # should the build process be building the documentation?
  338. AC_MSG_CHECKING(whether to build documentation)
  339. AC_ARG_ENABLE([documentation],
  340. [AS_HELP_STRING([--disable-documentation],
  341. [do not build the documentation])],
  342. [documentation=${enableval}],
  343. [documentation=yes])
  344. AC_MSG_RESULT($documentation)
  345. AS_IF([test "x$documentation" = "xyes"],
  346. [AM_CONDITIONAL([DOCUMENTATION],
  347. true)
  348. AC_DEFINE([DOCUMENTATION],
  349. [1],
  350. [Building the documentation])],
  351. [AM_CONDITIONAL([DOCUMENTATION],
  352. false)
  353. AC_DEFINE([DOCUMENTATION],
  354. [0],
  355. [Not building the documentation])])
  356. # COMMENT: Check wether to transpile texinfo to mdoc.
  357. # COMMENT: This is TRUE when --enable-texi2mdoc-generation
  358. # COMMENT: but ERRORS when texi2mdoc binary is missing in your $PATH
  359. # COMMENT: and makes the configure fail if it is missing.
  360. # COMMENT: Consequential the DEFINE and CONDITIONAL are set to true.
  361. # COMMENT: This is FALSE when --disable-texi2mdoc-generation was set
  362. # COMMENT: or nothing was set (this is the default).
  363. # COMMENT: There are 2 nested AS_IFs because we need to catch the
  364. # COMMENT: potential non-existence of the texi2mdoc binary.
  365. # COMMENT: Default return value / setting: no
  366. AC_MSG_CHECKING(wether to include generated texi2mdoc output in installation)
  367. AC_ARG_ENABLE([texi2mdoc-generation],
  368. [AS_HELP_STRING([--enable-texi2mdoc-generation],
  369. [include generated texi2mdoc output in installation])],
  370. [texi2mdoc_generation=${enableval}],
  371. [texi2mdoc_generation=no])
  372. AC_MSG_RESULT($texi2mdoc_generation)
  373. AS_IF([test "x$texi2mdoc_generation" = "xyes"],
  374. [AS_IF([test "$texi2mdoc" = 0],
  375. [AC_MSG_WARN([ERROR: transpiled mdoc output requires texi2mdoc.])
  376. AC_MSG_WARN([ERROR: texi2mdoc can be obtained via your Operating System])
  377. AC_MSG_WARN([ERROR: package manager or from https://mandoc.bsd.lv/texi2mdoc/])],
  378. [AM_CONDITIONAL([TEXI2MDOC_GENERATION],true)
  379. AC_DEFINE([TEXI2MDOC_GENERATION],
  380. [1],
  381. [Building section 7 mdoc output])])],
  382. [AM_CONDITIONAL([TEXI2MDOC_GENERATION],
  383. false)
  384. AC_DEFINE([TEXI2MDOC_GENERATION],
  385. [0],
  386. [Not building section 7 mdoc output])])
  387. # should the build process be building only the documentation?
  388. AC_MSG_CHECKING(whether to build only documentation)
  389. AC_ARG_ENABLE([documentation-only],
  390. [AS_HELP_STRING([--enable-documentation-only], [build only the documentation])],
  391. [documentation_only=${enableval}],
  392. [documentation_only=no])
  393. AC_MSG_RESULT($documentation_only)
  394. AS_IF([test "x$documentation_only" = "xyes"],
  395. [
  396. AM_CONDITIONAL([DOCUMENTATION_ONLY],true)
  397. AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation])
  398. ],[
  399. AM_CONDITIONAL([DOCUMENTATION_ONLY],false)
  400. # TODO: Double negation might be a bit hard to parse for some
  401. # TODO: people reading the output.
  402. AC_DEFINE([DOCUMENTATION_ONLY],[0],[Not building only the documentation])
  403. ])
  404. # should the build process be including the manpages? (default: yes)
  405. AC_MSG_CHECKING(whether to include man pages)
  406. AC_ARG_ENABLE([include-manpages],
  407. [AS_HELP_STRING([--disable-include-manpages], [Do not include the man pages in build and installation])],
  408. [include_manpages=${enableval}],
  409. [include_manpages=yes])
  410. AC_MSG_RESULT($include_manpages)
  411. AS_IF([test "x$include_manpages" = "xyes"],
  412. [
  413. AM_CONDITIONAL([INCLUDE_MANPAGES],true)
  414. AC_DEFINE([INCLUDE_MANPAGES],[1],[Including the man pages in the build and installation])
  415. ],[
  416. AM_CONDITIONAL([INCLUDE_MANPAGES],false)
  417. AC_DEFINE([INCLUDE_MANPAGES],[0],[Not including the man pages in the build and installation])
  418. ])
  419. # Do we have texinfo4? If yes, it is used to set texinfo4 specific switches
  420. # (not syntax!) to the commandline tools which generate the html. If not,
  421. # texinfo5 switches are used. This comes with no version checks, is
  422. # enabled only at distributors action (ie defaults to "no").
  423. # Mantis #3914 for more details (https://bugs.gnunet.org/view.php?id=3914)
  424. AC_MSG_CHECKING(whether to enable texinfo4 switches)
  425. AC_ARG_ENABLE([texinfo4],
  426. [AS_HELP_STRING([--enable-texinfo4], [Use texinfo version 4 specific switches])],
  427. [activate_texinfo4=${enableval}],
  428. [activate_texinfo4=no])
  429. AC_MSG_RESULT($activate_texinfo4)
  430. AS_IF([test "x$activate_texinfo4" = "xyes"],
  431. [
  432. AM_CONDITIONAL([ACTIVATE_TEXINFO4],true)
  433. AC_DEFINE([ACTIVATE_TEXINFO4],[1],[Using texinfo version 4 specific switches])
  434. ],[
  435. AM_CONDITIONAL([ACTIVATE_TEXINFO4],false)
  436. AC_DEFINE([INCLUDE_MANPAGES],[0],[Using texinfo version 5 or later switches])
  437. ])
  438. # Adam shostack suggests the following for Windows:
  439. # -D_FORTIFY_SOURCE=2 -fstack-protector-all
  440. AC_ARG_ENABLE(gcc-hardening,
  441. AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
  442. [AS_IF([test x$enableval = xyes],[
  443. CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
  444. CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
  445. CFLAGS="$CFLAGS --param ssp-buffer-size=1"
  446. LDFLAGS="$LDFLAGS -pie"
  447. ])])
  448. # Linker hardening options
  449. # Currently these options are ELF specific - you can't use this with MacOSX
  450. AC_ARG_ENABLE(linker-hardening,
  451. AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
  452. [AS_IF([test x$enableval = xyes],
  453. [LDFLAGS="$LDFLAGS -z relro -z now"])])
  454. AC_ARG_ENABLE(sanitizer,
  455. AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer),
  456. [AS_IF([test x$enableval = xyes],[
  457. LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"
  458. ])])
  459. extra_logging=GNUNET_NO
  460. AC_ARG_ENABLE([logging],
  461. AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]),
  462. [AS_IF([test "x$enableval" = "xyes"], [],
  463. [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
  464. [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES]
  465. [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)])
  466. ], [])
  467. AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
  468. # should memory poisoning be enabled?
  469. AC_MSG_CHECKING(whether to poison freed memory)
  470. AC_ARG_ENABLE([poisoning],
  471. [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])],
  472. [enable_poisoning=${enableval}],
  473. [
  474. AS_IF([test "x$extra_logging" != "xGNUNET_NO"],
  475. [enable_poisoning="defaults to yes (extra logging is enabled)"],
  476. [enable_poisoning=no])
  477. ])
  478. AC_MSG_RESULT($enable_poisoning)
  479. AS_IF([test ! "x$enable_poisoning" = "xno"],
  480. [enable_poisoning=1],
  481. [enable_poisoning=0])
  482. AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise])
  483. AS_IF([test $build = $target],
  484. [
  485. AC_MSG_CHECKING([for working HMAC])
  486. AC_LANG_PUSH(C)
  487. LIBS="$LIBS $LIBGCRYPT_LIBS"
  488. CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
  489. AC_RUN_IFELSE(
  490. [AC_LANG_PROGRAM([#include <gcrypt.h>
  491. #include <stdio.h>], [[
  492. gcry_md_hd_t mac;
  493. unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
  494. 0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
  495. 0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde };
  496. unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
  497. unsigned char result[] = {0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
  498. 0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
  499. 0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
  500. 0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
  501. 0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
  502. 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3};
  503. if (!gcry_check_version (GCRYPT_VERSION))
  504. {
  505. fprintf (stderr, "Version mismatch %s <-> %s \n", gcry_check_version (NULL), GCRYPT_VERSION);
  506. return 1;
  507. }
  508. gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
  509. gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
  510. if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
  511. {
  512. fprintf (stderr, "gcry_md_open error\n");
  513. return 2;
  514. }
  515. gcry_md_setkey (mac, key, sizeof (key));
  516. gcry_md_write (mac, data, sizeof (data));
  517. if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
  518. {
  519. fprintf (stderr, "memcmp error\n");
  520. return 3;
  521. }
  522. gcry_md_close (mac);
  523. return 0;
  524. ]])],
  525. [AC_MSG_RESULT([yes])],
  526. [
  527. RESULT=$?
  528. if test $RESULT = 3
  529. then
  530. AC_MSG_FAILURE([HMAC test vector does not match. This is a known problem with libgcrypt 1.2.2 on Windows and fixed in 1.4.6.])
  531. fi
  532. if test $RESULT = 2
  533. then
  534. AC_MSG_FAILURE([HMAC test failed])
  535. fi
  536. if test $RESULT = 1
  537. then
  538. AC_MSG_FAILURE([libgcrypt header version does not match library version])
  539. fi
  540. ],
  541. [AC_MSG_RESULT([cross compiling, test skipped])])
  542. AC_LANG_POP(C)
  543. ]) # $build = $target
  544. # check for bluetooth library
  545. bluetooth=0
  546. CHECK_LIBHEADER(BLUETOOTH, bluetooth, ba2str, bluetooth/bluetooth.h,bluetooth=1,)
  547. AS_IF([test "$build_target" = "mingw"],
  548. [bluetooth=1])
  549. AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
  550. AS_IF([test "$bluetooth" = 1],
  551. [AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library])],
  552. [AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library])])
  553. # check for zbar library
  554. zbar=0
  555. AC_MSG_CHECKING(for libzbar)
  556. AC_ARG_WITH(zbar,
  557. [ --with-zbar=PREFIX (base of libzbar installation)],
  558. [AC_MSG_RESULT([$with_zbar])
  559. AS_CASE([$with_zbar],
  560. [no],[],
  561. [yes],[CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)],
  562. [
  563. LDFLAGS="-L$with_zbar/lib $LDFLAGS"
  564. CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
  565. AC_CHECK_HEADERS(zbar.h,
  566. AC_CHECK_LIB([zbar], [zbar_processor_create],
  567. EXT_LIB_PATH="-L$with_zbar/lib $EXT_LIB_PATH"
  568. zbar=1))
  569. ])
  570. ],
  571. [AC_MSG_RESULT([--with-zbar not specified])
  572. CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)])
  573. AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
  574. AS_IF([test "x$zbar" = x1],
  575. [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
  576. [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])])
  577. # check for jansson library
  578. jansson=0
  579. AC_MSG_CHECKING(for libjansson)
  580. AC_ARG_WITH(jansson,
  581. [ --with-jansson=PREFIX (base of libjansson installation)],
  582. [AC_MSG_RESULT([$with_jansson])
  583. AS_CASE([$with_jansson],
  584. [no],[],
  585. [yes],[
  586. CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)
  587. ],[
  588. LDFLAGS="-L$with_jansson/lib $LDFLAGS"
  589. CPPFLAGS="-I$with_jansson/include $CPPFLAGS"
  590. AC_CHECK_HEADERS(jansson.h,
  591. AC_CHECK_LIB([jansson], [json_loads],
  592. EXT_LIB_PATH="-L$with_jansson/lib $EXT_LIB_PATH"
  593. jansson=1))
  594. ])
  595. ],
  596. [AC_MSG_RESULT([--with-jansson not specified])
  597. CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)])
  598. AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
  599. AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
  600. AS_IF([test "x$jansson" = x1],
  601. [AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])],
  602. [AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])])
  603. # check for libpulse(audio) library
  604. pulse=0
  605. libpulse_msg="no"
  606. CHECK_LIBHEADER(LIBPULSE, pulse, pa_stream_peek, pulse/simple.h,pulse=1,)
  607. AS_IF([test "$build_target" = "mingw"],
  608. [pulse=0])
  609. AS_IF([test "$pulse" = 1],
  610. [AC_DEFINE([HAVE_PULSE],[1],[Have libpulse(audio) library])
  611. libpulse_msg="yes"])
  612. # check for libopus(audio) library
  613. opus=0
  614. libopus_msg="no"
  615. CHECK_LIBHEADER(LIBOPUS,
  616. opus,
  617. opus_decode_float,
  618. opus/opus.h,
  619. AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]))
  620. AS_IF([test "x$opus" = x1],
  621. [AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])
  622. libopus_msg="yes"])
  623. # libogg
  624. AC_CHECK_LIB(ogg, ogg_stream_flush_fill,
  625. [AC_CHECK_HEADERS([ogg/ogg.h],
  626. AM_CONDITIONAL(HAVE_OGG, true)
  627. ogg=1
  628. AC_DEFINE(HAVE_OGG,1,[Have ogg]),
  629. AM_CONDITIONAL(HAVE_OGG, false)
  630. ogg=0
  631. AC_DEFINE(HAVE_OGG,0,[lacking ogg]))],
  632. AM_CONDITIONAL(HAVE_OGG, false)
  633. ogg=0)
  634. PKG_CHECK_MODULES([GLIB],
  635. [glib-2.0],
  636. [# check for pbc library
  637. pbc=0
  638. AC_CHECK_HEADER([pbc/pbc.h],pbc=1)
  639. AC_CHECK_HEADER([gabe.h],abe=1)
  640. AM_CONDITIONAL(HAVE_PBC, [test "x$pbc" = x1])
  641. AM_CONDITIONAL(HAVE_ABE, [test "x$abe" = x1])
  642. AS_IF([test "x$pbc" = x1],
  643. [AC_DEFINE([HAVE_PBC],[1],[Have pbc library])],
  644. [AC_DEFINE([HAVE_PBC],[0],[Lacking pbc library])])
  645. AS_IF([test "x$abe" = x1],
  646. [AC_DEFINE([HAVE_ABE],[1],[Have ABE library])],
  647. [AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library])])],
  648. [# glib-2 not found
  649. AM_CONDITIONAL(HAVE_PBC, [false])
  650. AM_CONDITIONAL(HAVE_ABE, [false])
  651. AC_DEFINE([HAVE_PBC],[0],[Lacking glib library])])
  652. gst=0
  653. gstreamer_msg="no"
  654. PKG_CHECK_MODULES(
  655. [GST],
  656. [glib-2.0 gobject-2.0 gstreamer-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
  657. [gst=1
  658. gstreamer_msg="yes"],
  659. [gst=0])
  660. # Pulse Audio
  661. AS_IF([test "x$pulse" != "x1" -o "x$opus" != "x1" -o "x$ogg" != "x1"],[
  662. AS_IF([test "x$gst" != "x1"],[
  663. conversation_backend=none
  664. AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
  665. AM_CONDITIONAL(BUILD_GST_HELPERS, false)
  666. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  667. ],[
  668. conversation_backend=gst
  669. AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
  670. AM_CONDITIONAL(BUILD_GST_HELPERS, true)
  671. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  672. ])
  673. ],[
  674. conversation_backend=pulse
  675. AM_CONDITIONAL(BUILD_PULSE_HELPERS, true)
  676. AM_CONDITIONAL(BUILD_GST_HELPERS, false)
  677. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  678. ])
  679. # libgnurl
  680. LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
  681. SAVE_CPPFLAGS=$CPPFLAGS
  682. CPPFLAGS="$LIBGNURL_CPPFLAGS $LIBCURL_CPPFLAGS $CPPFLAGS"
  683. LIBS="$LIBGNURL $LIBCURL $LIBS"
  684. # libcurl-gnutls
  685. LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
  686. AS_IF([test "x$curl" = xtrue],[
  687. AC_CHECK_HEADER([curl/curl.h],
  688. AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include <curl/curl.h>]]),
  689. [curl=false])
  690. # need libcurl-gnutls.so, everything else is not acceptable
  691. AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=false])
  692. # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
  693. ])
  694. # libcurl and libgnurl should be mutually exclusive
  695. AS_IF([test "$gnurl" = 1],
  696. [AM_CONDITIONAL(HAVE_LIBGNURL, true)
  697. AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl])
  698. AM_CONDITIONAL(HAVE_LIBCURL, false)
  699. AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])],
  700. [AS_IF([test "$curl" = true],
  701. [AM_CONDITIONAL(HAVE_LIBGNURL, false)
  702. AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
  703. AM_CONDITIONAL(HAVE_LIBCURL, true)
  704. AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])],
  705. [AC_MSG_WARN([ERROR: GNUnet requires libcurl-gnutls or gnurl >= 7.34])
  706. AM_CONDITIONAL(HAVE_LIBGNURL, false)
  707. AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
  708. AM_CONDITIONAL(HAVE_LIBCURL, false)
  709. AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])])])
  710. AC_SEARCH_LIBS(__atomic_load_8, atomic, [have_libatomic=1 AC_DEFINE(HAVE_LIBATOMIC,1,[external libatomic])])
  711. AM_CONDITIONAL(HAVE_LIBATOMIC, [test "$have_libatomic" = 1])
  712. # restore LIBS & CPPFLAGS
  713. LIBS=$SAVE_LIBS
  714. CPPFLAGS=$SAVE_CPPFLAGS
  715. AC_CHECK_HEADERS([glpk.h],[glpk=true],[glpk=false])
  716. # GLPK must support glpk_init_env, version >= 4.43
  717. AC_CHECK_LIB([glpk],[glp_init_env],,[glpk=false])
  718. # GLPK must support atm MLP presolving, version >= 4.32
  719. AC_CHECK_MEMBERS(glp_iocp.presolve,,[glpk=false],[[#include <glpk.h>]])
  720. AS_IF([test "x$glpk" = xfalse],
  721. [
  722. AM_CONDITIONAL(HAVE_LIBGLPK, false)
  723. AC_MSG_WARN([ERROR: GNUnet requires GLPK >= 4.32])
  724. ],[
  725. AM_CONDITIONAL(HAVE_LIBGLPK, true)
  726. AC_DEFINE([HAVE_LIBGLPK],[1],[Have GLPK])
  727. ])
  728. AC_CHECK_HEADERS([nss.h],[nss=true],[nss=false])
  729. AS_IF([test x$nss = xfalse],
  730. [
  731. AM_CONDITIONAL(HAVE_GLIBCNSS, false)
  732. AC_MSG_WARN([No GNU libc nss header, will not build NSS plugin])
  733. ],[
  734. NSS_INCLUDES="
  735. #include <nss.h>
  736. "
  737. AC_CHECK_DECL([NSS_STATUS_UNAVAIL],
  738. [AM_CONDITIONAL(HAVE_GLIBCNSS, true)],
  739. [AM_CONDITIONAL(HAVE_GLIBCNSS, false)
  740. AC_MSG_WARN([No nss header fails to define NSS_STATUS_UNAVAIl, will not build NSS plugin])],
  741. [$NSS_INCLUDES])
  742. ])
  743. # test for kvm and kstat (for CPU stats under BSD/Solaris)
  744. AC_CHECK_LIB([kvm],[kvm_open])
  745. AC_CHECK_LIB([kstat],[kstat_open])
  746. # should the build process be restricted to the code required
  747. # for GNU Taler wallets?
  748. AC_MSG_CHECKING(whether to compile GNU Taler Wallet library ONLY)
  749. AC_ARG_ENABLE([taler-wallet],
  750. [AS_HELP_STRING([--enable-taler-wallet], [only compile for Taler wallet])],
  751. [taler_only=${enableval}],
  752. [taler_only=no])
  753. AC_MSG_RESULT($taler_only)
  754. AS_IF([test "x$taler_only" = "xyes"],
  755. [
  756. AM_CONDITIONAL([TALER_ONLY],true)
  757. AC_DEFINE([TALER_WALLET_ONLY],[1],[Compiling for Taler wallet])
  758. ],[
  759. AM_CONDITIONAL([TALER_ONLY],false)
  760. AC_DEFINE([TALER_WALLET_ONLY],[0],[Canonical compilation])
  761. ])
  762. # test for libextractor
  763. extractor=0
  764. AC_MSG_CHECKING(for libextractor)
  765. AC_ARG_WITH(extractor,
  766. [ --with-extractor=PREFIX (base of libextractor installation)],
  767. [AC_MSG_RESULT([$with_extractor])
  768. AS_CASE([$with_extractor],
  769. [no],[],
  770. [yes],[
  771. AC_CHECK_HEADERS([extractor.h],
  772. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  773. extractor=1))
  774. ],[
  775. LDFLAGS="-L$with_extractor/lib $LDFLAGS"
  776. CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
  777. AC_CHECK_HEADERS([extractor.h],
  778. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  779. EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
  780. extractor=1))
  781. ])
  782. ],
  783. [AC_MSG_RESULT([--with-extractor not specified])
  784. AC_CHECK_HEADERS([extractor.h],
  785. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  786. extractor=1))])
  787. # restore LIBS
  788. LIBS=$SAVE_LIBS
  789. AS_IF([test "$extractor" != 1],
  790. [
  791. AM_CONDITIONAL(HAVE_LIBEXTRACTOR, false)
  792. AC_DEFINE([HAVE_LIBEXTRACTOR],[0],[Lacking libextractor])
  793. ],[
  794. AM_CONDITIONAL(HAVE_LIBEXTRACTOR, true)
  795. AC_DEFINE([HAVE_LIBEXTRACTOR],[1],[Have libextractor])
  796. ])
  797. AS_IF([test "$taler_only" != yes],[
  798. # Check for libltdl header (#2999)
  799. ltdl=0
  800. AC_MSG_CHECKING(for libltdl)
  801. AC_ARG_WITH(ltdl,
  802. [AS_HELP_STRING([--with-ltdl=PREFIX],[base of libltdl installation])],
  803. [AC_MSG_RESULT([$with_ltdl])
  804. AS_CASE([$with_ltdl],
  805. [no],[],
  806. [yes],[
  807. AC_CHECK_HEADERS(ltdl.h,
  808. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  809. ltdl=1))
  810. ],[
  811. LDFLAGS="-L$with_ltdl/lib $LDFLAGS"
  812. CPPFLAGS="-I$with_ltdl/include $CPPFLAGS"
  813. AC_CHECK_HEADERS(ltdl.h,
  814. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  815. EXT_LIB_PATH="-L$with_ltdl/lib $EXT_LIB_PATH"
  816. ltdl=1))
  817. ])
  818. ],
  819. [AC_MSG_RESULT([--with-ltdl not specified])
  820. AC_CHECK_HEADERS(ltdl.h,
  821. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  822. ltdl=1))])
  823. AS_IF([test x$ltdl = x1],
  824. [
  825. AC_MSG_RESULT([libltdl found])
  826. ],[
  827. AC_MSG_ERROR([GNUnet requires libltdl (from GNU libtool), try installing libltdl-dev])
  828. ])
  829. # restore LIBS
  830. LIBS=$SAVE_LIBS
  831. # libidn and libidn2. The ideal goal is this:
  832. # check for libidn2, if it doesn't exist check for libidn
  833. # if both exist, prefer libidn2
  834. # if none exist, fail and message that libidn or libidn2
  835. # is required with a preference for libidn2.
  836. # TODO: What we have right here can probably be improved.
  837. my_with_libidn=1
  838. AC_ARG_WITH(libidn,
  839. AS_HELP_STRING([--with-libidn=pathname],
  840. [Support IDN (needs libidn)]),
  841. [],
  842. [withval="yes"])
  843. AS_IF([test x_$withval = x_yes],
  844. [AC_CHECK_HEADERS([idna.h],
  845. AC_MSG_NOTICE([Found idna.h]),
  846. AC_CHECK_HEADERS([idn/idna.h],
  847. AC_MSG_NOTICE([Found idn/idna.h]),
  848. my_with_libidn=0))],
  849. [AS_IF([test x_$withval != x_no],
  850. [CFLAGS="$CFLAGS -I$withval/include"
  851. LDFLAGS="$LDFLAGS -L$withval/lib"
  852. AC_CHECK_HEADERS([idna.h],
  853. AC_MSG_NOTICE([Found idna.h]),
  854. [AC_MSG_NOTICE([Failed to find idna.h])
  855. my_with_libidn=0])],
  856. [my_with_libidn=0])])
  857. my_with_libidn2=1
  858. AC_ARG_WITH(libidn2,
  859. AS_HELP_STRING([--with-libidn2=pathname],
  860. [Support IDN (needs libidn2)]),
  861. [],
  862. [withval="yes"])
  863. AS_IF([test x_$withval = x_yes],
  864. [AC_CHECK_HEADERS([idn2.h],
  865. AC_MSG_NOTICE([Found idn2.h]),
  866. AC_CHECK_HEADERS([idn2/idn2.h],
  867. AC_MSG_NOTICE([Found idn2/idn2.h]),
  868. [AC_MSG_NOTICE([Failed to find idn2.h])
  869. my_with_libidn2=0]))],
  870. [AS_IF([test x_$withval != x_no],
  871. [CFLAGS="$CFLAGS -I$withval/include"
  872. LDFLAGS="$LDFLAGS -L$withval/lib"],
  873. [my_with_libidn2=0])])
  874. AC_MSG_CHECKING([if libidn can be used])
  875. # Check for LIBIDNs
  876. there_can_only_be_one=1
  877. working_libidn1=0
  878. working_libidn2=0
  879. AS_IF([test x$my_with_libidn2 = x1],
  880. [AC_MSG_NOTICE([Checking for libidn2])
  881. AC_CHECK_LIB([idn2],
  882. [idn2_to_unicode_8z8z],
  883. [working_libidn2=1
  884. LIBS="-lidn2 $LIBS"
  885. AC_DEFINE_UNQUOTED([HAVE_LIBIDN2],
  886. [1],
  887. [Define to 1 if you have 'libidn2' (-lidn2).])],
  888. [MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2"
  889. MISSING_SEP=", "])])
  890. AM_CONDITIONAL(HAVE_LIBIDN2,
  891. test x$working_libidn2 = x1)
  892. AS_IF([test x$working_libidn2 = x0],
  893. [AS_IF([test x$my_with_libidn = x1],
  894. [AC_MSG_NOTICE([Checking for libidn])
  895. AC_CHECK_LIB([idn],
  896. [idna_to_ascii_8z],
  897. [working_libidn1=1
  898. LIBS="-lidn $LIBS"
  899. AC_DEFINE_UNQUOTED([HAVE_LIBIDN],
  900. [1],
  901. [Define to 1 if you have 'libidn' (-lidn).])],
  902. [there_can_only_be_one=0])],
  903. [AS_IF([test x$my_with_libidn2 = x1],
  904. [there_can_only_be_one=0
  905. AC_MSG_FAILURE([* There can only be one libidn.
  906. * Provide either libidn >= 1.13
  907. * or
  908. * libidn2 to the configure
  909. * script via
  910. * --with-libidn2
  911. * --with-libidn])])])])
  912. AM_CONDITIONAL(HAVE_LIBIDN, test x$working_libidn1 = x1)
  913. AS_IF([test "$working_libidn1" = 0 -a "$working_libidn2" = 0],
  914. [AC_MSG_ERROR([GNUnet requires libidn (or libidn2)])])
  915. AS_IF([test x$there_can_only_be_one = x0],
  916. [AC_MSG_FAILURE([Missing dependencies: $MISSING_DEPS])])
  917. # test for zlib
  918. SAVE_LDFLAGS=$LDFLAGS
  919. SAVE_CPPFLAGS=$CPPFLAGS
  920. AC_ARG_WITH(zlib,
  921. [ --with-zlib[[=DIR]] use libz in DIR],
  922. [AS_IF([test "$withval" = "no"],
  923. [AC_MSG_ERROR([GNUnet requires zlib])],
  924. [test "$withval" != "yes"],
  925. [Z_DIR=$withval
  926. CPPFLAGS="${CPPFLAGS} -I$withval/include"
  927. LDFLAGS="${LDFLAGS} -L$withval/lib"])])
  928. AC_CHECK_HEADER(zlib.h,
  929. [],
  930. [AC_MSG_ERROR([GNUnet requires zlib])])
  931. AC_CHECK_LIB(z,
  932. compress2,
  933. [AC_DEFINE([HAVE_ZLIB],
  934. [],
  935. [Have compression library])
  936. if test "x${Z_DIR}" != "x"; then
  937. Z_CFLAGS="-I${Z_DIR}/include"
  938. Z_LIBS="-L${Z_DIR}/lib -lz"
  939. else
  940. Z_LIBS="-lz"
  941. fi],
  942. [AC_MSG_ERROR([GNUnet requires zlib])])
  943. AC_SUBST(Z_CFLAGS)
  944. AC_SUBST(Z_LIBS)
  945. AS_IF([test "$enable_shared" = "no"],
  946. [AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])])
  947. # restore LIBS
  948. LIBS=$SAVE_LIBS
  949. # end of taler-only being false
  950. ])
  951. # check for iconv
  952. AM_ICONV
  953. # test for libunistring
  954. gl_LIBUNISTRING
  955. AS_IF([test $HAVE_LIBUNISTRING != yes],
  956. [AC_MSG_ERROR([GNUnet requires libunistring])])
  957. # under emscripten, $gl_libunistring_hexversion is undefined
  958. if test "$taler_only" != yes; then
  959. AS_IF([test "x$gl_libunistring_hexversion" = "x" || test "$gl_libunistring_hexversion" -le 2305],
  960. [AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1])])
  961. fi
  962. AC_CHECK_HEADERS([unistr.h],
  963. ,
  964. AC_MSG_ERROR([Compiling GNUnet requires unistr.h (from libunistring) to be installed]))
  965. # restore LIBS
  966. LIBS=$SAVE_LIBS
  967. # Checks for standard header files.
  968. AC_HEADER_DIRENT
  969. AC_HEADER_STDC
  970. # Check for headers that are ALWAYS required
  971. AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h],,AC_MSG_ERROR([Compiling GNUnet requires standard UNIX headers files: fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h]))
  972. # Checks for headers that are only required on some systems or
  973. # opional (and where we do NOT abort if they are not there)
  974. AC_CHECK_HEADERS([stdatomic.h malloc.h malloc/malloc.h malloc/malloc_np.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h ucred.h sys/ucred.h endian.h sys/endian.h execinfo.h byteswap.h])
  975. # FreeBSD requires this for netinet/in_systm.h and netinet/ip.h
  976. AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
  977. [#ifdef HAVE_SYS_TYPES_H
  978. #include <sys/types.h>
  979. #endif
  980. #ifdef HAVE_NETINET_IN_SYSTM_H
  981. #include <netinet/in_systm.h>
  982. #endif
  983. #ifdef HAVE_NETINET_IN_H
  984. #include <netinet/in.h>
  985. #endif
  986. ])
  987. SAVE_LDFLAGS=$LDFLAGS
  988. SAVE_CPPFLAGS=$CPPFLAGS
  989. # test for sqlite
  990. sqlite=false
  991. AC_MSG_CHECKING(for SQLite)
  992. AC_ARG_WITH(sqlite,
  993. [ --with-sqlite=PFX base of SQLite installation],
  994. [AC_MSG_RESULT("$with_sqlite")
  995. AS_CASE([$with_sqlite],
  996. [no],[],
  997. [yes],[
  998. AC_CHECK_HEADERS(sqlite3.h,
  999. sqlite=true)],
  1000. [
  1001. LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
  1002. CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
  1003. AC_CHECK_HEADERS(sqlite3.h,
  1004. EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
  1005. SQLITE_LDFLAGS="-L$with_sqlite/lib"
  1006. SQLITE_CPPFLAGS="-I$with_sqlite/include"
  1007. sqlite=true)
  1008. LDFLAGS=$SAVE_LDFLAGS
  1009. CPPFLAGS=$SAVE_CPPFLAGS
  1010. ])
  1011. ],
  1012. [AC_MSG_RESULT([--with-sqlite not specified])
  1013. AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
  1014. AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
  1015. AC_SUBST(SQLITE_CPPFLAGS)
  1016. AC_SUBST(SQLITE_LDFLAGS)
  1017. LDFLAGS=$SAVE_LDFLAGS
  1018. CPPFLAGS=$SAVE_CPPFLAGS
  1019. # test for postgres
  1020. postgres=false
  1021. # even running the check for postgres breaks emscripten ...
  1022. AS_IF([test "$taler_only" != yes],
  1023. [AX_LIB_POSTGRESQL([9.5],
  1024. [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
  1025. AC_CHECK_HEADERS([libpq-fe.h],
  1026. postgres=true)
  1027. ],
  1028. [AC_MSG_RESULT([no postgres])])])
  1029. AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
  1030. LDFLAGS=$SAVE_LDFLAGS
  1031. CPPFLAGS=$SAVE_CPPFLAGS
  1032. # mysql & windows
  1033. AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
  1034. AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
  1035. AS_IF([test "$build_target" = "mingw"]
  1036. [CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"])
  1037. # test for mysql
  1038. mysql=false
  1039. mysqlfail=false
  1040. SAVE_LDFLAGS=$LDFLAGS
  1041. SAVE_CPPFLAGS=$CPPFLAGS
  1042. AC_MSG_CHECKING(for mysql)
  1043. AC_ARG_WITH(mysql,
  1044. [ --with-mysql=PFX base of MySQL installation],
  1045. [AC_MSG_RESULT([$with_mysql])
  1046. AS_CASE([$with_mysql],
  1047. [no],[],
  1048. [yes|""],[
  1049. AC_CHECK_HEADERS(mysql/mysql.h,
  1050. AC_CHECK_LIB(mysqlclient, mysql_init,
  1051. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  1052. ],[
  1053. LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
  1054. CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
  1055. AC_CHECK_HEADERS(mysql/mysql.h,
  1056. AC_CHECK_LIB(mysqlclient, mysql_init,
  1057. MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
  1058. MYSQL_CPPFLAGS="-I$with_mysql/include"
  1059. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  1060. ])
  1061. ],
  1062. [AC_MSG_RESULT([--with-mysql not specified])
  1063. if test -d "/usr/lib64/mysql"; then
  1064. MYSQL_LIBDIR="/usr/lib64/mysql"
  1065. elif test -d "/usr/lib/mysql"; then
  1066. MYSQL_LIBDIR="/usr/lib/mysql"
  1067. else
  1068. MYSQL_LIBDIR="/usr/lib"
  1069. fi
  1070. LDFLAGS="-L$MYSQL_LIBDIR $LDFLAGS $ZLIBS"
  1071. AC_CHECK_LIB(mysqlclient, mysql_init,
  1072. [AC_CHECK_HEADERS(mysql/mysql.h,
  1073. MYSQL_LDFLAGS="-L$MYSQL_LIBDIR"
  1074. mysql=true
  1075. , [], [$CYGWIN_MYSQL_MAGIC])])
  1076. ])
  1077. AC_SUBST(MYSQL_LDFLAGS)
  1078. AC_SUBST(MYSQL_CPPFLAGS)
  1079. # additional version check for mysql
  1080. AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
  1081. AS_IF([test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"],
  1082. [
  1083. AC_MSG_CHECKING(mysql version)
  1084. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  1085. [[$CYGWIN_MYSQL_MAGIC
  1086. #include <mysql/mysql.h>]],
  1087. [[
  1088. #if (MYSQL_VERSION_ID < 40100)
  1089. #error needs at least version >= 4.1
  1090. #endif
  1091. int main () { return 0; }
  1092. ]])
  1093. ],mysql=true,mysql=false)
  1094. AS_IF([test "$mysql" = "false"],
  1095. [
  1096. mysqlfail=true
  1097. AC_MSG_RESULT([fail, >= 4.1 required])
  1098. ],[
  1099. AC_MSG_RESULT(ok)
  1100. ])
  1101. ])
  1102. AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
  1103. AM_CONDITIONAL(HAVE_MYSQLE, false)
  1104. # restore LIBS
  1105. LIBS=$SAVE_LIBS
  1106. LDFLAGS=$SAVE_LDFLAGS
  1107. CPPFLAGS=$SAVE_CPPFLAGS
  1108. AS_IF([test "$sqlite" = 0 -a "$mysql" = 0],
  1109. [
  1110. AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
  1111. ])
  1112. # libmicrohttpd
  1113. lmhd=0
  1114. AC_MSG_CHECKING([for libmicrohttpd])
  1115. AC_ARG_WITH(microhttpd,
  1116. [ --with-microhttpd=PFX base of libmicrohttpd installation],
  1117. [AC_MSG_RESULT([$with_microhttpd])
  1118. AS_CASE([$with_microhttpd],
  1119. [no],[],
  1120. [yes|""],[
  1121. AC_CHECK_HEADERS([microhttpd.h],
  1122. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  1123. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  1124. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.63])
  1125. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1126. #include "$native_srcdir/src/include/platform.h"
  1127. #include <microhttpd.h>
  1128. #if (MHD_VERSION < 0x0096300)
  1129. #error needs at least version 0.9.63
  1130. #endif
  1131. int main () { return 0; }
  1132. ])],
  1133. [AC_MSG_RESULT(ok)
  1134. lmhd=1],
  1135. [AC_MSG_RESULT(failed)])]),
  1136. [],[#include "$native_srcdir/src/include/platform.h"
  1137. #include <microhttpd.h>]),,
  1138. [#include "$native_srcdir/src/include/platform.h"])
  1139. ],[
  1140. LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
  1141. CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
  1142. AC_CHECK_HEADERS(microhttpd.h,
  1143. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  1144. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  1145. EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
  1146. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52])
  1147. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1148. #include "$native_srcdir/src/include/platform.h"
  1149. #include <microhttpd.h>
  1150. #if (MHD_VERSION < 0x0094200)
  1151. #error needs at least version 0.9.42
  1152. #endif
  1153. int main () { return 0; }
  1154. ])],
  1155. [AC_MSG_RESULT(ok)
  1156. lmhd=1],
  1157. [AC_MSG_RESULT(failed)])]),
  1158. [],[#include "$native_srcdir/src/include/platform.h"
  1159. #include <microhttpd.h>]),,
  1160. [#include "$native_srcdir/src/include/platform.h"])
  1161. ])
  1162. ],
  1163. [AC_MSG_RESULT([--with-microhttpd not specified])
  1164. AC_CHECK_HEADERS([microhttpd.h],
  1165. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  1166. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  1167. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52])
  1168. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1169. #include "$native_srcdir/src/include/platform.h"
  1170. #include <microhttpd.h>
  1171. #if (MHD_VERSION < 0x0094200)
  1172. #error needs at least version 0.9.52
  1173. #endif
  1174. ])],
  1175. [AC_MSG_RESULT(ok)
  1176. lmhd=1],
  1177. [AC_MSG_RESULT(failed)])]),
  1178. [],[#include "$native_srcdir/src/include/platform.h"
  1179. #include <microhttpd.h>]),,
  1180. [#include "$native_srcdir/src/include/platform.h"])])
  1181. AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
  1182. AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
  1183. AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
  1184. # restore LIBS
  1185. LIBS=$SAVE_LIBS
  1186. # check for gettext
  1187. AM_GNU_GETTEXT([external])
  1188. AM_GNU_GETTEXT_VERSION([0.18.1])
  1189. # Checks for standard typedefs, structures, and compiler characteristics.
  1190. AC_TYPE_PID_T
  1191. AC_TYPE_SIZE_T
  1192. AC_TYPE_MODE_T
  1193. AC_HEADER_TIME
  1194. AC_HEADER_STAT
  1195. AC_HEADER_STDBOOL
  1196. AC_STRUCT_TM
  1197. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  1198. [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
  1199. ],
  1200. [],
  1201. [
  1202. #include <sys/types.h>
  1203. #include <sys/socket.h>
  1204. #include <netinet/in.h>
  1205. ])
  1206. AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
  1207. [ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN,
  1208. 1,
  1209. [Do we have sockaddr_un.sun_len?])],
  1210. [],
  1211. [
  1212. #include <sys/types.h>
  1213. #include <sys/socket.h>
  1214. #include <sys/un.h>
  1215. ])
  1216. # Checks for library functions.
  1217. AC_FUNC_CLOSEDIR_VOID
  1218. AC_FUNC_FORK
  1219. AC_PROG_GCC_TRADITIONAL
  1220. AC_FUNC_MEMCMP
  1221. AC_FUNC_SELECT_ARGTYPES
  1222. AC_FUNC_CHOWN
  1223. AC_TYPE_SIGNAL
  1224. AC_FUNC_STAT
  1225. AC_FUNC_STRFTIME
  1226. AC_FUNC_VPRINTF
  1227. AC_HEADER_SYS_WAIT
  1228. AC_TYPE_OFF_T
  1229. AC_TYPE_UID_T
  1230. AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs wait4])
  1231. # restore LIBS
  1232. LIBS=$SAVE_LIBS
  1233. GN_INTLINCL=""
  1234. GN_LIBINTL="$LTLIBINTL"
  1235. AC_ARG_ENABLE(framework,
  1236. [AS_HELP_STRING([--enable-framework],[enable Mac OS X framework build helpers])],
  1237. enable_framework_build=$enableval)
  1238. AM_CONDITIONAL(WANT_FRAMEWORK,
  1239. test x$enable_framework_build = xyes)
  1240. AS_IF([test x$enable_framework_build = xyes],
  1241. [AC_DEFINE([FRAMEWORK_BUILD],
  1242. 1,
  1243. [Build a Mac OS X Framework])
  1244. GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
  1245. GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
  1246. AC_LIB_APPENDTOVAR([CPPFLAGS],
  1247. [$GN_INTLINCL])])
  1248. GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
  1249. GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
  1250. AC_SUBST(GN_LIB_LDFLAGS)
  1251. AC_SUBST(GN_PLUGIN_LDFLAGS)
  1252. AC_SUBST(GN_INTLINCL)
  1253. AC_SUBST(GN_LIBINTL)
  1254. AC_SUBST(CPPFLAGS)
  1255. AC_SUBST(LIBS)
  1256. AC_SUBST(LDFLAGS)
  1257. AC_SUBST(EXT_LIB_PATH)
  1258. AC_SUBST(EXT_LIBS)
  1259. AC_SUBST(LIBPREFIX)
  1260. AC_SUBST(DLLDIR)
  1261. AC_SUBST(EXT_LIB_PATH)
  1262. DATAROOTDIR=$datarootdir
  1263. AC_SUBST(DATAROOTDIR)
  1264. # test for sudo
  1265. # TODO: do we need to change anything for "doas" on openbsd?
  1266. AC_MSG_CHECKING(for sudo)
  1267. AC_ARG_WITH(sudo,
  1268. [ --with-sudo=PATH path to sudo binary (or just yes)],
  1269. [AC_MSG_RESULT("$with_sudo")
  1270. AS_CASE([$with_sudo],
  1271. [no],[SUDO_BINARY=],
  1272. [yes],[SUDO_BINARY=sudo],
  1273. [SUDO_BINARY=$with_sudo])],
  1274. [AC_MSG_RESULT([no])])
  1275. AC_SUBST(SUDO_BINARY)
  1276. AM_CONDITIONAL([HAVE_SUDO],
  1277. [test "x$SUDO_BINARY" != "x" -o -w /])
  1278. # test for gnunetdns group name
  1279. GNUNETDNS_GROUP=gnunetdns
  1280. AC_MSG_CHECKING(for gnunetdns group name)
  1281. AC_ARG_WITH(gnunetdns,
  1282. [ --with-gnunetdns=GRPNAME name for gnunetdns group],
  1283. [AC_MSG_RESULT("$with_gnunetdns")
  1284. AS_CASE([$with_gnunetdns],
  1285. [no],[GNUNETDNS_GROUP=gnunet],
  1286. [yes],[GNUNETDNS_GROUP=gnunetdns],
  1287. [GNUNETDNS_GROUP=$with_gnunetdns])],
  1288. [AC_MSG_RESULT([gnunetdns])])
  1289. AC_SUBST(GNUNETDNS_GROUP)
  1290. # gnutls
  1291. gnutls=0
  1292. gnutls_dane=0
  1293. AC_MSG_CHECKING(for gnutls)
  1294. AC_ARG_WITH(gnutls,
  1295. [ --with-gnutls=PFX base of gnutls installation],
  1296. [AC_MSG_RESULT([$with_gnutls])
  1297. AS_CASE([$with_gnutls],
  1298. [no],[],
  1299. [yes],
  1300. [AC_CHECK_HEADERS([gnutls/abstract.h],
  1301. AC_CHECK_LIB([gnutls],
  1302. [gnutls_priority_set],
  1303. gnutls=true))
  1304. AC_CHECK_HEADERS([gnutls/dane.h],
  1305. AC_CHECK_LIB([gnutls-dane],
  1306. [dane_verify_crt_raw],
  1307. gnutls_dane=1))],
  1308. [LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
  1309. CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
  1310. AC_CHECK_HEADERS([gnutls/abstract.h],
  1311. AC_CHECK_LIB([gnutls], [gnutls_priority_set],
  1312. EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH"
  1313. gnutls=true))
  1314. AC_CHECK_HEADERS([gnutls/dane.h],
  1315. AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
  1316. gnutls_dane=1))
  1317. ])
  1318. ],
  1319. [AC_MSG_RESULT([--with-gnutls not specified])
  1320. AC_CHECK_HEADERS([gnutls/abstract.h],
  1321. AC_CHECK_LIB([gnutls], [gnutls_priority_set],
  1322. gnutls=true))
  1323. AC_CHECK_HEADERS([gnutls/dane.h],
  1324. AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
  1325. gnutls_dane=1))
  1326. ])
  1327. AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue)
  1328. AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have GnuTLS])
  1329. AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1)
  1330. AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support])
  1331. # Test if we are building for superMUC
  1332. AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC)
  1333. AC_ARG_ENABLE([supermuc],
  1334. [AS_HELP_STRING([--enable-supermuc],
  1335. [build GNUnet with support to run on the SuperMUC (default is NO)])],
  1336. [AS_IF([test "x$enable_supermuc" = "xno"],
  1337. [supermuc=0],
  1338. [supermuc=1])],
  1339. [supermuc=0
  1340. enable_supermuc=no])
  1341. AC_MSG_RESULT($enable_SUPERMUC)
  1342. AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"])
  1343. AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC])
  1344. # Check if NSE has to send timestamp information to testbed logger for
  1345. # generating histogram of messages received
  1346. AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
  1347. AC_ARG_ENABLE([nse-histogram],
  1348. [AS_HELP_STRING([--enable-nse-histogram],
  1349. [have NSE send timestamp information to testbed logger for generating
  1350. histogram of received messages. NOT useful for production (default is
  1351. NO)])],
  1352. [AS_IF([test "x$enableval" = "xno"],
  1353. [nse_histogram=0],
  1354. [nse_histogram=1])],
  1355. [nse_histogram=0
  1356. enable_nse_histogram=no])
  1357. AC_MSG_RESULT($enable_nse_histogram)
  1358. AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"])
  1359. AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram],
  1360. [have NSE send timestamp information to testbed logger])
  1361. # should 'make check' run tests?
  1362. AC_MSG_CHECKING(whether to run tests)
  1363. AC_ARG_ENABLE([testruns],
  1364. [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])],
  1365. [enable_tests_run=${enableval}],
  1366. [enable_tests_run=yes])
  1367. AC_MSG_RESULT($enable_test_run)
  1368. AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"])
  1369. AC_MSG_CHECKING([whether to compile in benchmarks (currently for http and crypto)])
  1370. AC_ARG_ENABLE([benchmark],
  1371. [AS_HELP_STRING([--enable-benchmark], [enable benchmarking])],
  1372. [enable_benchmark=${enableval}],
  1373. [enable_benchmark=no])
  1374. AC_MSG_RESULT($enable_benchmark)
  1375. AS_IF([test "x$enable_benchmark" = "xyes"],
  1376. [AC_DEFINE_UNQUOTED(ENABLE_BENCHMARK,1,[Benchmarks are enabled])])
  1377. AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmark" = "xyes"])
  1378. # should expensive tests be run?
  1379. AC_MSG_CHECKING(whether to run expensive tests)
  1380. AC_ARG_ENABLE([expensivetests],
  1381. [AS_HELP_STRING([--enable-expensivetests], [enable running expensive testcases])],
  1382. [enable_expensive=${enableval}],
  1383. [enable_expensive=no])
  1384. AC_MSG_RESULT($enable_expensive)
  1385. AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
  1386. # should ports be open for Java services?
  1387. AC_MSG_CHECKING(whether to enable ports for gnunet-java)
  1388. AC_ARG_ENABLE([javaports],
  1389. [AS_HELP_STRING([--enable-javaports], [use non-zero ports for services with Java bindings (default is NO)])],
  1390. [enable_java_ports=${enableval}],
  1391. [enable_java_ports=no])
  1392. AC_MSG_RESULT($enable_java_ports)
  1393. AS_IF([test "x$enable_java_ports" = "xyes"],
  1394. [JAVAPORT=""],
  1395. [JAVAPORT="$UNIXONLY"])
  1396. AC_SUBST(JAVAPORT)
  1397. # should benchmarks be run?
  1398. AC_MSG_CHECKING(whether to run benchmarks during make check)
  1399. AC_ARG_ENABLE([benchmarks],
  1400. [AS_HELP_STRING([--enable-benchmarks], [enable running benchmarks during make check])],
  1401. [enable_benchmarks=${enableval}],
  1402. [enable_benchmarks=no])
  1403. AC_MSG_RESULT($enable_benchmarks)
  1404. AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
  1405. # should gnunet-testing be compiled
  1406. AC_MSG_CHECKING(wether to compile gnunet-testing)
  1407. AC_ARG_ENABLE([testing],
  1408. [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])],
  1409. [enable_testing=${enableval}],
  1410. [enable_testing=yes])
  1411. AC_MSG_RESULT($enable_testing)
  1412. AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"])
  1413. # should experimental code be compiled (code that may not yet compile)?
  1414. AC_MSG_CHECKING(whether to compile experimental code)
  1415. AC_ARG_ENABLE([experimental],
  1416. [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
  1417. [enable_experimental=${enableval}],
  1418. [enable_experimental=no])
  1419. AC_MSG_RESULT($enable_experimental)
  1420. AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
  1421. # should malicious code be compiled (should only be used for testing)?
  1422. AC_MSG_CHECKING(whether to compile malicious code)
  1423. AC_ARG_ENABLE([malicious],
  1424. [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code])],
  1425. [AS_IF([test "x$enableval" = "xno"],
  1426. [malicious=0],
  1427. [malicious=1])],
  1428. [malicious=0
  1429. enable_malicious=no])
  1430. AC_MSG_RESULT($enable_malicious)
  1431. AM_CONDITIONAL([ENABLE_MALICIOUS], [test 1=$malicious])
  1432. AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious],
  1433. [enable compilation of malicious code])
  1434. # should services be started on demand when needed?
  1435. # Some services may choose to never start by default
  1436. # and it is up to the service/module developer to decide
  1437. # by having "START_ON_DEMAND = NO" instead of
  1438. # "START_ON_DEMAND = @START_ON_DEMAND@"
  1439. # in the service/module's conf.in file.
  1440. # See also IMMEDIATE_START for an unconditional immediate start.
  1441. START_ON_DEMAND="YES"
  1442. AC_MSG_CHECKING(whether to start peer's services on demand by default)
  1443. AC_ARG_ENABLE([autostart],
  1444. [AS_HELP_STRING([--disable-autostart], [do not start peer's services by default])],
  1445. [enable_autostart=${enableval}
  1446. AS_IF([test "x$enable_autostart" = "xno"],
  1447. [START_ON_DEMAND="NO"])
  1448. ],
  1449. [enable_autostart=yes])
  1450. AC_MSG_RESULT($enable_autostart)
  1451. #AM_CONDITIONAL([HAVE_START_ON_DEMAND], [test "x$enable_autostart" = "xyes"])
  1452. AC_SUBST(START_ON_DEMAND)
  1453. # should memory statistics be kept (very expensive CPU-wise!)
  1454. AC_MSG_CHECKING(whether to create expensive statistics on memory use)
  1455. AC_ARG_ENABLE([heapstats],
  1456. [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])],
  1457. [enable_heapstats=1],
  1458. [enable_heapstats=0])
  1459. AC_MSG_RESULT($enable_heapstats)
  1460. AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS],$enable_heapstats,[enable expensive heap statistics])
  1461. # should code be enabled that works around missing OS functionality on Windows?
  1462. # used for test cases
  1463. if test $build_target = "mingw"
  1464. then
  1465. workarounds=1
  1466. AC_LINK_IFELSE(
  1467. [AC_LANG_PROGRAM(
  1468. [#include <ws2tcpip.h>
  1469. ],[
  1470. int s = socket (0, 0, 0);])
  1471. ],[
  1472. AC_DEFINE_UNQUOTED([HAVE_SOCKET],1,[Define this if socket() is available])
  1473. ],[
  1474. AC_DEFINE_UNQUOTED([HAVE_SOCKET],0,[Define this if socket() is available])
  1475. ])
  1476. AC_LINK_IFELSE(
  1477. [AC_LANG_PROGRAM(
  1478. [#include <ws2tcpip.h>
  1479. ],[
  1480. int s = select (0, NULL, NULL, NULL, NULL);])
  1481. ],[
  1482. AC_DEFINE_UNQUOTED([HAVE_SELECT],1,[Define this if select() is available])
  1483. ],[
  1484. AC_DEFINE_UNQUOTED([HAVE_SELECT],0,[Define this if select() is available])
  1485. ])
  1486. AC_LINK_IFELSE(
  1487. [AC_LANG_PROGRAM(
  1488. [#include <ws2tcpip.h>
  1489. ],[
  1490. struct in_addr i;
  1491. char *s = inet_ntoa (i);])
  1492. ],[
  1493. AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],1,[Define this if inet_ntoa() is available])
  1494. ],[
  1495. AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],0,[Define this if inet_ntoa() is available])
  1496. ])
  1497. AC_LINK_IFELSE(
  1498. [AC_LANG_PROGRAM(
  1499. [#include <ws2tcpip.h>
  1500. ],[
  1501. int s = getnameinfo (NULL, 0, NULL, 0, NULL, 0, 0);])
  1502. ],[
  1503. AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],1,[Define this if getnameinfo() is available])
  1504. ],[
  1505. AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],0,[Define this if getnameinfo() is available])
  1506. ])
  1507. AC_LINK_IFELSE(
  1508. [AC_LANG_PROGRAM(
  1509. [#include <ws2tcpip.h>
  1510. ],[
  1511. int s = gethostname (NULL, 0);])
  1512. ],[
  1513. AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],1,[Define this if gethostname() is available])
  1514. ],[
  1515. AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],0,[Define this if gethostname() is available])
  1516. ])
  1517. AC_LINK_IFELSE(
  1518. [AC_LANG_PROGRAM(
  1519. [#include <ws2tcpip.h>
  1520. ],[
  1521. void *s = gethostbyname (NULL);])
  1522. ],[
  1523. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],1,[Define this if gethostbyname() is available])
  1524. ],[
  1525. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],0,[Define this if gethostbyname() is available])
  1526. ])
  1527. AC_LINK_IFELSE(
  1528. [AC_LANG_PROGRAM(
  1529. [#include <ws2tcpip.h>
  1530. ],[
  1531. void *s = gethostbyaddr (NULL, 0, 0);])
  1532. ],[
  1533. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],1,[Define this if gethostbyaddr() is available])
  1534. ],[
  1535. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],0,[Define this if gethostbyaddr() is available])
  1536. ])
  1537. AC_LINK_IFELSE(
  1538. [AC_LANG_PROGRAM(
  1539. [#include <ws2tcpip.h>
  1540. ],[
  1541. int s = getaddrinfo (NULL, NULL, NULL, NULL);])
  1542. ],[
  1543. AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],1,[Define this if getaddrinfo() is available])
  1544. ],[
  1545. AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],0,[Define this if getaddrinfo() is available])
  1546. ])
  1547. else
  1548. AC_MSG_CHECKING(whether to enable windows workarounds)
  1549. AC_ARG_ENABLE([windows_workarounds],
  1550. [AS_HELP_STRING([--enable-windows_workarounds], [enable workarounds used on Windows (only useful for test cases)])],
  1551. [enable_workarounds=${enableval}],
  1552. [enable_workarounds=no])
  1553. AC_MSG_RESULT($enable_workarounds)
  1554. AS_IF([test x$enable_windows_workarounds = "xyes"],
  1555. [workarounds=1],
  1556. [workarounds=0])
  1557. fi
  1558. AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable workarounds used on Windows (only useful for test cases)])
  1559. # Check if the __thread storage class for
  1560. # thread-local storage is available.
  1561. AC_MSG_CHECKING(whether __thread is supported)
  1562. AC_LINK_IFELSE(
  1563. [AC_LANG_PROGRAM([#include <stdlib.h>
  1564. #undef __thread
  1565. static __thread int a = 1;],
  1566. [exit(a-1);])],
  1567. [have_thread_local_gcc=1],[have_thread_local_gcc=0])
  1568. AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL_GCC],$have_thread_local_gcc,[Define this if __thread is supported])
  1569. AS_IF([test "x$have_thread_local_gcc" = "x1"],
  1570. [AC_MSG_RESULT(yes)],
  1571. [AC_MSG_RESULT(no)])
  1572. # gcov compilation
  1573. AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
  1574. AC_ARG_ENABLE([coverage],
  1575. AS_HELP_STRING([--enable-coverage],
  1576. [compile the library with code coverage support]),
  1577. [use_gcov=${enableval}],
  1578. [use_gcov=no])
  1579. AC_MSG_RESULT($use_gcov)
  1580. AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
  1581. # version info
  1582. # TODO: git blame says this predates our switch to git.
  1583. # git-svn should be adjusted to simply git, or
  1584. # an external script that does the job.
  1585. AC_PATH_PROG(svnversioncommand, svnversion)
  1586. AC_PATH_PROG(gitcommand, git)
  1587. AC_MSG_CHECKING(for source being under a VCS)
  1588. # version info
  1589. AC_PATH_PROG(gitcommand, git)
  1590. AC_MSG_CHECKING(for source being under a VCS)
  1591. git_version=
  1592. AS_IF([test ! "X$gitcommand" = "X"],
  1593. [
  1594. git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null)
  1595. ])
  1596. AS_IF([test "X$git_version" = "X"],
  1597. [
  1598. vcs_name="no"
  1599. vcs_version="\"release\""
  1600. ],
  1601. [
  1602. vcs_name="yes, git-svn"
  1603. vcs_version="\"git-$git_version\""
  1604. ])
  1605. AC_MSG_RESULT($vcs_name)
  1606. AC_MSG_CHECKING(VCS version)
  1607. AC_MSG_RESULT($vcs_version)
  1608. AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
  1609. AC_CONFIG_FILES([
  1610. Makefile
  1611. contrib/Makefile
  1612. contrib/hellos/Makefile
  1613. contrib/services/Makefile
  1614. contrib/services/openrc/Makefile
  1615. contrib/services/systemd/Makefile
  1616. contrib/scripts/Makefile
  1617. contrib/scripts/gnunet-logread/Makefile
  1618. doc/Makefile
  1619. doc/man/Makefile
  1620. doc/doxygen/Makefile
  1621. doc/handbook/Makefile
  1622. doc/tutorial/Makefile
  1623. lint/Makefile
  1624. m4/Makefile
  1625. po/Makefile.in
  1626. src/Makefile
  1627. src/arm/Makefile
  1628. src/arm/arm.conf
  1629. src/ats/Makefile
  1630. src/ats/ats.conf
  1631. src/ats-tool/Makefile
  1632. src/ats-tests/Makefile
  1633. src/auction/Makefile
  1634. src/block/Makefile
  1635. src/cadet/Makefile
  1636. src/cadet/cadet.conf
  1637. src/core/Makefile
  1638. src/core/core.conf
  1639. src/consensus/Makefile
  1640. src/consensus/consensus.conf
  1641. src/conversation/Makefile
  1642. src/conversation/conversation.conf
  1643. src/curl/Makefile
  1644. src/datacache/Makefile
  1645. src/datastore/Makefile
  1646. src/datastore/datastore.conf
  1647. src/dht/Makefile
  1648. src/dht/dht.conf
  1649. src/dns/Makefile
  1650. src/dns/dns.conf
  1651. src/exit/Makefile
  1652. src/fragmentation/Makefile
  1653. src/fs/Makefile
  1654. src/fs/fs.conf
  1655. src/gns/Makefile
  1656. src/gns/gns.conf
  1657. src/gns/nss/Makefile
  1658. src/gnsrecord/Makefile
  1659. src/hello/Makefile
  1660. src/identity/Makefile
  1661. src/identity/identity.conf
  1662. src/credential/Makefile
  1663. src/credential/credential.conf
  1664. src/include/Makefile
  1665. src/integration-tests/Makefile
  1666. src/json/Makefile
  1667. src/hostlist/Makefile
  1668. src/my/Makefile
  1669. src/mysql/Makefile
  1670. src/namecache/Makefile
  1671. src/namecache/namecache.conf
  1672. src/namestore/Makefile
  1673. src/namestore/namestore.conf
  1674. src/nat/Makefile
  1675. src/nat/nat.conf
  1676. src/nat-auto/Makefile
  1677. src/nat-auto/nat-auto.conf
  1678. src/nse/Makefile
  1679. src/nse/nse.conf
  1680. src/nt/Makefile
  1681. src/peerinfo/Makefile
  1682. src/peerinfo/peerinfo.conf
  1683. src/peerinfo-tool/Makefile
  1684. src/peerstore/Makefile
  1685. src/peerstore/peerstore.conf
  1686. src/pq/Makefile
  1687. src/pt/Makefile
  1688. src/regex/Makefile
  1689. src/regex/regex.conf
  1690. src/revocation/Makefile
  1691. src/revocation/revocation.conf
  1692. src/rps/Makefile
  1693. src/rps/rps.conf
  1694. src/secretsharing/Makefile
  1695. src/secretsharing/secretsharing.conf
  1696. src/scalarproduct/Makefile
  1697. src/scalarproduct/scalarproduct.conf
  1698. src/set/Makefile
  1699. src/set/set.conf
  1700. src/sq/Makefile
  1701. src/statistics/Makefile
  1702. src/statistics/statistics.conf
  1703. src/template/Makefile
  1704. src/testbed/Makefile
  1705. src/testbed/testbed.conf
  1706. src/testbed-logger/Makefile
  1707. src/testbed-logger/testbed-logger.conf
  1708. src/testing/Makefile
  1709. src/topology/Makefile
  1710. src/transport/Makefile
  1711. src/transport/transport.conf
  1712. src/util/Makefile
  1713. src/util/resolver.conf
  1714. src/vpn/Makefile
  1715. src/vpn/vpn.conf
  1716. src/zonemaster/Makefile
  1717. src/zonemaster/zonemaster.conf
  1718. src/rest/Makefile
  1719. src/abe/Makefile
  1720. src/reclaim-attribute/Makefile
  1721. src/reclaim/Makefile
  1722. pkgconfig/Makefile
  1723. pkgconfig/gnunetarm.pc
  1724. pkgconfig/gnunetats.pc
  1725. pkgconfig/gnunetblock.pc
  1726. pkgconfig/gnunetcadet.pc
  1727. pkgconfig/gnunetconsensus.pc
  1728. pkgconfig/gnunetconversation.pc
  1729. pkgconfig/gnunetcore.pc
  1730. pkgconfig/gnunetdatacache.pc
  1731. pkgconfig/gnunetdatastore.pc
  1732. pkgconfig/gnunetdht.pc
  1733. pkgconfig/gnunetdns.pc
  1734. pkgconfig/gnunetenv.pc
  1735. pkgconfig/gnunetfragmentation.pc
  1736. pkgconfig/gnunetfs.pc
  1737. pkgconfig/gnunetgns.pc
  1738. pkgconfig/gnunethello.pc
  1739. pkgconfig/gnunetidentity.pc
  1740. pkgconfig/gnunetmicrophone.pc
  1741. pkgconfig/gnunetmysql.pc
  1742. pkgconfig/gnunetnamestore.pc
  1743. pkgconfig/gnunetnat.pc
  1744. pkgconfig/gnunetnse.pc
  1745. pkgconfig/gnunetpeerinfo.pc
  1746. pkgconfig/gnunetpq.pc
  1747. pkgconfig/gnunetregex.pc
  1748. pkgconfig/gnunetrevocation.pc
  1749. pkgconfig/gnunetrps.pc
  1750. pkgconfig/gnunetscalarproduct.pc
  1751. pkgconfig/gnunetset.pc
  1752. pkgconfig/gnunetspeaker.pc
  1753. pkgconfig/gnunetstatistics.pc
  1754. pkgconfig/gnunettestbed.pc
  1755. pkgconfig/gnunettesting.pc
  1756. pkgconfig/gnunettransport.pc
  1757. pkgconfig/gnunetutil.pc
  1758. pkgconfig/gnunetvpn.pc
  1759. ])
  1760. AC_OUTPUT
  1761. # FIXME: `some modules' -> be more specific which exact modules.
  1762. # java ports
  1763. AS_IF([test "x$enable_java_ports" = "xyes"],
  1764. [AC_MSG_NOTICE([NOTICE: Opening ports for gnunet-java bindings by default.])])
  1765. ####
  1766. #### Lasciate ogne speranza, voi ch'intrate
  1767. ####
  1768. #### This could be moved to the checks above,
  1769. #### but for now let's keep it here.
  1770. ####
  1771. # -- print message regarding enabled experimental features
  1772. AS_IF([test "x$enable_experimental" = "xyes"],
  1773. [experimental_msg="experimental features enabled"])
  1774. # -- OSX Framework
  1775. AS_IF([test "$enable_framework_build" = "yes"],
  1776. [macosx_framework_msg="yes"],
  1777. [macosx_framework_msg="no"])
  1778. # -- libidn 2
  1779. AS_IF([test "x$working_libidn2" = x1],
  1780. [libidn2_msg="libidn2"])
  1781. # -- libidn 1
  1782. AS_IF([test "x$working_libidn1" = x1],
  1783. [libidn1_msg="libidn1"])
  1784. # -- texi2mdoc
  1785. AS_IF([test "x$texi2mdoc_generation" = x1],
  1786. [mdoc_msg="yes"],
  1787. [mdoc_msg="no"])
  1788. # -- texinfo
  1789. AS_IF([test "x$makeinfo" != "x1"],
  1790. [texinfo_msg="no"],
  1791. [texinfo_msg="yes"])
  1792. # -- conversation
  1793. AS_IF([test "x$conversation_backend" = "xnone"],
  1794. [AS_IF([test "x$pulse" != "x1"],
  1795. [AC_MSG_NOTICE([WARNING: libpulse(audio) not found, conversation will not be built.])
  1796. libpulse_msg="no"],
  1797. [libpulse_msg="yes"])
  1798. AS_IF([test "x$opus" != "x1"],
  1799. [AC_MSG_NOTICE([WARNING: libopus not found, conversation will not be built.])
  1800. libopus_msg="no"],
  1801. [libopus_msg="yes"])
  1802. AS_IF([test "x$gst" != "x1"],
  1803. [AC_MSG_NOTICE([WARNING: GStreamer not found, conversation will not be built.])
  1804. gstreamer_msg="no"],
  1805. [gstreamer_msg="yes"])],
  1806. [features_msg="$features_msg conversation"])
  1807. # -- interface
  1808. interface_msg=`echo $DEFAULT_INTERFACE | tr -d \"`
  1809. # -- libmicrohttpd
  1810. AS_IF([test "x$lmhd" != "x1"],
  1811. [libmicrohttpd_msg="no (optional)"],
  1812. [libmicrohttpd_msg="yes"])
  1813. # -- jansson
  1814. AS_IF([test "x$jansson" = "x0"],
  1815. [jansson_msg="no (optional)"],
  1816. [jansson_msg="yes"])
  1817. # -- libextractor
  1818. AS_IF([test "$extractor" != 1],
  1819. [AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])],
  1820. [libextractor_msg="yes"])
  1821. # -- libzbar
  1822. AS_IF([test "x$zbar" = "x1"],
  1823. [libzbar_msg="yes"
  1824. features_msg="$features_msg gnunet-qr"],
  1825. [AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.])
  1826. libzbar_msg="no"])
  1827. # -- libgnurl
  1828. AS_IF([test "$gnurl" = "0"],
  1829. [AS_IF([test "x$curl" = "xfalse"],
  1830. [AC_MSG_NOTICE([WARNING: libgnurl not found. http client support will not be compiled.])
  1831. AC_MSG_WARN([ERROR: libgnurl not found. hostlist daemon will not be compiled, and you probably WANT the hostlist daemon])
  1832. curl_msg="no"],
  1833. [AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.])
  1834. curl_msg="yes"])],
  1835. [gnurl_msg="yes"])
  1836. # -- ifconfig
  1837. AS_IF([test "$VAR_IFCONFIG_BINARY" = "false"],
  1838. [AC_MSG_NOTICE([WARNING: optional ifconfig not found])
  1839. ifconfig_msg="no (optional)"],
  1840. [ifconfig_msg="yes"])
  1841. # -- upnpc
  1842. AS_IF([test "$VAR_UPNPC_BINARY" = "false"],
  1843. [AC_MSG_NOTICE([WARNING: optional upnpc binary not found])
  1844. upnpc_msg="no (optional)"],
  1845. [upnpc_msg="yes"])
  1846. # -- iptables
  1847. AS_IF([test "$VAR_IPTABLES_BINARY" = "false"],
  1848. [AC_MSG_NOTICE([WARNING: optional iptables not found])
  1849. iptables_msg="no (optional)"],
  1850. [iptables_msg="yes"])
  1851. # -- bluetooth
  1852. AS_IF([test "x$bluetooth" = "x0"],
  1853. [AC_MSG_NOTICE([WARNING: optional bluetooth library not found.])
  1854. bluetooth_msg="no (optional)"],
  1855. [bluetooth_msg="yes"])
  1856. # -- gnutls
  1857. AS_IF([test x$gnutls != xtrue],
  1858. [AC_MSG_NOTICE([WARNING: GnuTLS not found, gnunet-gns-proxy will not be built])
  1859. gnutls_msg="no"],
  1860. [AS_IF([test "x$gnutls_dane" != "x1"],
  1861. [AC_MSG_NOTICE([WARNING: GnuTLS has no DANE support, DANE validation will not be possible])
  1862. gnutls_msg="yes (without DANE support)"],
  1863. [gnutls_msg="yes (with DANE support)"])])
  1864. # -- databases
  1865. AS_IF([test $mysqlfail = true]
  1866. [AC_MSG_NOTICE([WARNING: optional MySQL not found (or too old)])])
  1867. AS_IF([test "$mysql" = true],
  1868. [features_msg="$features_msg mysql"
  1869. mysql_msg="yes"],
  1870. [mysql_msg="no"])
  1871. AS_IF([test "$sqlite" = true],
  1872. [features_msg="$features_msg sqlite"
  1873. sqlite_msg="yes"],
  1874. [AC_MSG_ERROR([ERROR: sqlite3 not found, but sqlite3 is required.])
  1875. sqlite_msg="no"])
  1876. AS_IF([test "$postgres" = true],
  1877. [features_msg="$features_msg postgres"
  1878. postgres_msg="yes"],
  1879. [postgres_msg="no"])
  1880. # -- features
  1881. # ---- 1. replace spaces with newlines,
  1882. # ---- 2. sort the lines,
  1883. # ---- 3. replace the newlines with spaces.
  1884. features_msg=`echo $features_msg | tr ' ' '\012' | sort | tr '\012' ' '`
  1885. AC_SUBST(features_msg)
  1886. # The summary
  1887. # TODO: reduce the length of the last message block ("the message")
  1888. AC_MSG_NOTICE([
  1889. GNUnet Configuration (incomplete!)
  1890. gnunet version: ${VERSION}
  1891. Host setup: ${host}
  1892. Install prefix: ${prefix}
  1893. Compiler: ${CC}
  1894. CFLAGS: ${CFLAGS}
  1895. CPPFLAGS: ${CPPFLAGS}
  1896. LDFLAGS: ${LDFLAGS}
  1897. LIBS: ${LIBS}
  1898. Build Target: $build_target
  1899. Mac OSX framework build: ${macosx_framework_msg}
  1900. Default Interface: ${interface_msg}
  1901. MySQL: ${mysql_msg}
  1902. PostgreSQL: ${postgres_msg}
  1903. sqlite3: ${sqlite_msg}
  1904. gnurl: ${gnurl_msg}
  1905. curl: ${curl_msg}
  1906. bluetooth: ${bluetooth_msg}
  1907. jansson: ${jansson_msg}
  1908. iptables: ${iptables_msg}
  1909. ifconfig: ${ifconfig_msg}
  1910. upnpc: ${upnpc_msg}
  1911. gnutls: ${gnutls_msg}
  1912. libzbar: ${libzbar_msg}
  1913. java: ${java_msg}
  1914. libmicrohttpd: ${libmicrohttpd_msg}
  1915. libidn: ${libidn1_msg}${libidn2_msg}
  1916. libopus: ${libopus_msg}
  1917. gstreamer: ${gstreamer_msg}
  1918. libpulse: ${libpulse_msg}
  1919. libextractor: ${libextractor_msg}
  1920. texinfo manual: ${texinfo_msg}
  1921. transpiled mdoc manual: ${mdoc_msg}
  1922. features: ${features_msg}
  1923. experimental: ${experimental_msg}
  1924. IMPORTANT:
  1925. Please make sure NOW that you have created a user and group 'gnunet'
  1926. and additionally a group 'gnunetdns'. On Debian and Ubuntu GNU/Linux,
  1927. type:
  1928. addgroup gnunetdns
  1929. adduser --system --group --disabled-login --home /var/lib/gnunet gnunet
  1930. Make sure that '/var/lib/gnunet' is owned (and writable) by user
  1931. 'gnunet'. Then, you can compile GNUnet with
  1932. make
  1933. After that, run (if necessary as 'root')
  1934. make install
  1935. to install everything.
  1936. Each GNUnet user should be added to the 'gnunet' group (may
  1937. require fresh login to come into effect):
  1938. adduser USERNAME gnunet
  1939. (run the above command as root once for each of your users, replacing
  1940. "USERNAME" with the respective login names). If you have a global IP
  1941. address, no further configuration is required.
  1942. For more detailed setup instructions, see https://docs.gnunet.org/
  1943. Optionally, download and compile gnunet-gtk to get a GUI for
  1944. file-sharing and configuration. This is particularly recommended
  1945. if your network setup is non-trivial, as gnunet-setup can be
  1946. used to test in the GUI if your network configuration is working.
  1947. gnunet-setup should be run as the "gnunet" user under X. As it
  1948. does very little with the network, running it as "root" is likely
  1949. also harmless. You can also run it as a normal user, but then
  1950. you have to copy ~/.gnunet/gnunet.conf" over to the "gnunet" user's
  1951. home directory in the end.
  1952. Once you have configured your peer, run (as the 'gnunet' user)
  1953. gnunet-arm -s
  1954. to start the peer. You can then run the various GNUnet-tools as
  1955. your "normal" user (who should only be in the group 'gnunet').
  1956. ])