configure.ac 76 KB

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