configure.ac 77 KB

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