configure.ac 76 KB

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