configure.ac 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  1. # This file is part of GNUnet.
  2. # (C) 2001--2018 GNUnet e.V.
  3. #
  4. # GNUnet is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published
  6. # by the Free Software Foundation; either version 3, or (at your
  7. # 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. # General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with GNUnet; see the file COPYING. If not, write to the
  16. # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. # Boston, MA 02110-1301, USA.
  18. #
  19. #
  20. # Process this file with autoconf to produce a configure script.
  21. #
  22. #
  23. AC_PREREQ(2.61)
  24. # Checks for programs.
  25. AC_INIT([gnunet], [0.11.0], [bug-gnunet@gnu.org])
  26. AC_CANONICAL_TARGET
  27. AC_CANONICAL_HOST
  28. AC_CANONICAL_SYSTEM
  29. AM_INIT_AUTOMAKE
  30. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  31. AC_CONFIG_HEADERS([gnunet_config.h])
  32. AH_TOP([#define _GNU_SOURCE 1])
  33. AC_CONFIG_MACRO_DIR([m4])
  34. AC_PROG_AWK
  35. AC_PROG_CC_C99
  36. AC_PROG_CPP
  37. AC_PROG_CXX
  38. AC_PROG_OBJC
  39. AC_PROG_INSTALL
  40. AC_PROG_LN_S
  41. AC_PROG_MAKE_SET
  42. AM_PROG_CC_C_O
  43. LT_INIT([disable-static dlopen win32-dll])
  44. AC_SUBST(MKDIR_P)
  45. # large file support
  46. AC_SYS_LARGEFILE
  47. AC_FUNC_FSEEKO
  48. CFLAGS="-Wall $CFLAGS"
  49. # use '-fno-strict-aliasing', but only if the compiler can take it
  50. if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1;
  51. then
  52. CFLAGS="-fno-strict-aliasing $CFLAGS"
  53. fi
  54. # Use Linux interface name unless the OS has a different preference
  55. DEFAULT_INTERFACE="\"eth0\""
  56. funcstocheck="getnameinfo gethostname gethostbyname gethostbyaddr getaddrinfo"
  57. # Srcdir in a form that native compiler understands (i.e. DOS path on W32)
  58. native_srcdir=$srcdir
  59. # Check system type
  60. case "$host_os" in
  61. *darwin* | *rhapsody* | *macosx*)
  62. AC_DEFINE_UNQUOTED(DARWIN,1,[This is an Apple Darwin system])
  63. CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS"
  64. CFLAGS="-fno-common $CFLAGS"
  65. AC_MSG_WARN([WARNING: The VPN application cannot be compiled on your OS])
  66. build_target="darwin"
  67. DEFAULT_INTERFACE="\"en0\""
  68. LIBPREFIX=
  69. DLLDIR=lib
  70. UNIXONLY="#"
  71. ;;
  72. linux*)
  73. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
  74. build_target="linux"
  75. LIBPREFIX=
  76. DLLDIR=lib
  77. UNIXONLY="#"
  78. AC_PATH_XTRA
  79. ;;
  80. *freebsd*)
  81. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  82. AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
  83. CFLAGS="-D_THREAD_SAFE $CFLAGS"
  84. build_target="freebsd"
  85. LIBPREFIX=
  86. DLLDIR=lib
  87. UNIXONLY="#"
  88. ;;
  89. *openbsd*)
  90. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  91. AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
  92. LIBS=`echo $LIBS | sed -e "s/-ldl//"`
  93. build_target="openbsd"
  94. LIBPREFIX=
  95. DLLDIR=lib
  96. UNIXONLY="#"
  97. ;;
  98. *netbsd*)
  99. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  100. AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
  101. LIBPREFIX=
  102. DLLDIR=lib
  103. UNIXONLY="#"
  104. ;;
  105. *solaris*)
  106. AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
  107. AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
  108. AC_CHECK_LIB(resolv, res_init)
  109. AC_CHECK_LIB(rt, nanosleep)
  110. build_target="solaris"
  111. LIBPREFIX=
  112. DLLDIR=lib
  113. UNIXONLY="#"
  114. ;;
  115. *arm-linux*)
  116. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
  117. CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
  118. build_target="linux"
  119. LIBPREFIX=
  120. DLLDIR=lib
  121. UNIXONLY="#"
  122. ;;
  123. *cygwin*)
  124. AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
  125. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  126. AC_CHECK_LIB(intl, gettext)
  127. CFLAGS="-mms-bitfields $CFLAGS"
  128. build_target="cygwin"
  129. LIBPREFIX=lib
  130. DLLDIR=bin
  131. AC_PROG_CXX
  132. UNIXONLY=""
  133. ;;
  134. *mingw*)
  135. AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
  136. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  137. AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
  138. AC_CHECK_LIB(intl, gettext)
  139. LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
  140. LIBS="$LIBS -lws2_32 -lplibc -lgnurx -lole32"
  141. CFLAGS="-mms-bitfields $CFLAGS"
  142. CPPFLAGS="-D_WIN32_WINNT=0x0501 -DHAVE_STAT64=1 -D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS"
  143. build_target="mingw"
  144. AC_PROG_CXX
  145. LIBPREFIX=lib
  146. DLLDIR=bin
  147. UNIXONLY=""
  148. funcstocheck=""
  149. native_srcdir=$(cd $srcdir; pwd -W)
  150. ;;
  151. gnu*)
  152. AC_DEFINE_UNQUOTED(GNU,1,[This is a GNU system])
  153. build_target="gnu"
  154. UNIXONLY="#"
  155. ;;
  156. *)
  157. AC_MSG_RESULT(Unrecognised OS $host_os)
  158. AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
  159. UNIXONLY=""
  160. ;;
  161. esac
  162. AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
  163. AC_SUBST(DEFAULT_INTERFACE)
  164. # Disable TCP-based IPC on systems that support UNIX domain
  165. # sockets in default configuratin:
  166. AC_SUBST(UNIXONLY)
  167. AC_MSG_CHECKING([for build target])
  168. AM_CONDITIONAL(DARWIN, test "$build_target" = "darwin")
  169. AM_CONDITIONAL(CYGWIN, test "$build_target" = "cygwin")
  170. AM_CONDITIONAL(MINGW, test "$build_target" = "mingw")
  171. AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
  172. AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
  173. AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
  174. AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
  175. AM_CONDITIONAL(GNU, test "$build_target" = "gnu")
  176. AC_MSG_RESULT([$build_target])
  177. AC_SUBST(build_target)
  178. AM_CONDITIONAL([am__fastdepOBJC], false)
  179. AC_UNALIGNED_64_ACCESS
  180. # some other checks for standard libs
  181. AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
  182. AC_CHECK_LIB(socket, socket)
  183. AC_CHECK_LIB(m, log)
  184. AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
  185. AC_CHECK_PROG(VAR_GETOPT_BINARY, getopt, true, false)
  186. AM_CONDITIONAL(HAVE_GETOPT_BINARY, $VAR_GETOPT_BINARY)
  187. AC_CHECK_PROG(VAR_SSH_BINARY,ssh,true,false)
  188. AM_CONDITIONAL(HAVE_SSH_BINARY, $VAR_SSH_BINARY)
  189. 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)
  190. rm -f /tmp/gnunet_test_cosks_ssh_garbage
  191. AC_CHECK_MEMBER(struct tm.tm_gmtoff,
  192. [AC_DEFINE(HAVE_TM_GMTOFF, 1,
  193. [Define if struct tm has the tm_gmtoff member.])],
  194. ,
  195. [#include <time.h>])
  196. AC_CHECK_DECLS([_stati64])
  197. # 'save' libs; only those libs found so far will be
  198. # linked against _everywhere_. For the others, we
  199. # will be more selective!
  200. SAVE_LIBS=$LIBS
  201. # tests only run on Windows
  202. if test "x$build_target" = "xmingw"
  203. then
  204. AC_CHECK_LIB(plibc, plibc_init, [], [AC_MSG_ERROR([GNUnet requires PlibC on Windows])])
  205. AC_CHECK_LIB(gnurx, regexec, [], [AC_MSG_ERROR([GNUnet requires libgnurx on Windows])])
  206. fi
  207. # libgcrypt
  208. gcrypt=0
  209. NEED_LIBGCRYPT_API=1
  210. NEED_LIBGCRYPT_VERSION=1.6.0
  211. AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
  212. AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
  213. if test $gcrypt = 0
  214. then
  215. AC_MSG_ERROR([[
  216. ***
  217. *** You need libgcrypt to build this program.
  218. ** This library is for example available at
  219. *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
  220. *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API)
  221. *** is required.)
  222. ***]])
  223. fi
  224. AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version])
  225. # TODO: add check for VERSION
  226. # TODO: add check for alternatives
  227. # TODO: add switch to skip documentation building
  228. AM_MISSING_PROG([MAKEINFO], [makeinfo])
  229. # Adam shostack suggests the following for Windows:
  230. # -D_FORTIFY_SOURCE=2 -fstack-protector-all
  231. AC_ARG_ENABLE(gcc-hardening,
  232. AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
  233. [if test x$enableval = xyes; then
  234. CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
  235. CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
  236. CFLAGS="$CFLAGS --param ssp-buffer-size=1"
  237. LDFLAGS="$LDFLAGS -pie"
  238. fi])
  239. # Linker hardening options
  240. # Currently these options are ELF specific - you can't use this with MacOSX
  241. AC_ARG_ENABLE(linker-hardening,
  242. AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
  243. [if test x$enableval = xyes; then
  244. LDFLAGS="$LDFLAGS -z relro -z now"
  245. fi])
  246. AC_ARG_ENABLE(sanitizer,
  247. AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer),
  248. [if test x$enableval = xyes; then
  249. LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"
  250. fi])
  251. extra_logging=GNUNET_NO
  252. AC_ARG_ENABLE([logging],
  253. AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]),
  254. [AS_IF([test "x$enableval" = "xyes"], [],
  255. [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
  256. [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES]
  257. [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)])
  258. ], [])
  259. AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
  260. # should memory poisoning be enabled?
  261. AC_MSG_CHECKING(whether to poison freed memory)
  262. AC_ARG_ENABLE([poisoning],
  263. [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])],
  264. [enable_poisoning=${enableval}],
  265. [
  266. if test "x$extra_logging" != "xGNUNET_NO"; then
  267. enable_poisoning="defaults to yes (extra logging is enabled)"
  268. else
  269. enable_poisoning=no
  270. fi
  271. ])
  272. AC_MSG_RESULT($enable_poisoning)
  273. if test ! "x$enable_poisoning" = "xno"; then
  274. enable_poisoning=1
  275. else
  276. enable_poisoning=0
  277. fi
  278. AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise])
  279. if test $build = $target
  280. then
  281. AC_MSG_CHECKING([for working HMAC])
  282. AC_LANG_PUSH(C)
  283. LIBS="$LIBS $LIBGCRYPT_LIBS"
  284. CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
  285. AC_RUN_IFELSE(
  286. [AC_LANG_PROGRAM([#include <gcrypt.h>
  287. #include <stdio.h>], [[
  288. gcry_md_hd_t mac;
  289. unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
  290. 0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
  291. 0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde };
  292. unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
  293. unsigned char result[] = {0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
  294. 0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
  295. 0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
  296. 0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
  297. 0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
  298. 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3};
  299. if (!gcry_check_version (GCRYPT_VERSION))
  300. {
  301. fprintf (stderr, "Version mismatch %s <-> %s \n", gcry_check_version (NULL), GCRYPT_VERSION);
  302. return 1;
  303. }
  304. gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
  305. gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
  306. if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
  307. {
  308. fprintf (stderr, "gcry_md_open error\n");
  309. return 2;
  310. }
  311. gcry_md_setkey (mac, key, sizeof (key));
  312. gcry_md_write (mac, data, sizeof (data));
  313. if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
  314. {
  315. fprintf (stderr, "memcmp error\n");
  316. return 3;
  317. }
  318. gcry_md_close (mac);
  319. return 0;
  320. ]])],
  321. [AC_MSG_RESULT([yes])],
  322. [
  323. RESULT=$?
  324. if test $RESULT = 3
  325. then
  326. 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.])
  327. fi
  328. if test $RESULT = 2
  329. then
  330. AC_MSG_FAILURE([HMAC test failed])
  331. fi
  332. if test $RESULT = 1
  333. then
  334. AC_MSG_FAILURE([libgcrypt header version does not match library version])
  335. fi
  336. ],
  337. [AC_MSG_RESULT([cross compiling, test skipped])])
  338. AC_LANG_POP(C)
  339. fi # $build = $target
  340. # check for bluetooth library
  341. bluetooth=0
  342. AC_CHECK_LIB(bluetooth, ba2str,[AC_CHECK_HEADER([bluetooth/bluetooth.h],bluetooth=1)])
  343. if test "$build_target" = "mingw"
  344. then
  345. bluetooth=1
  346. fi
  347. AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
  348. if test "$bluetooth" = 1
  349. then
  350. AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library])
  351. else
  352. AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library])
  353. fi
  354. # check for jansson library
  355. jansson=0
  356. AC_CHECK_HEADER([jansson.h],jansson=1)
  357. AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
  358. if test "x$jansson" = x1
  359. then
  360. AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])
  361. else
  362. AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])
  363. fi
  364. # check for libpulse(audio) library
  365. pulse=0
  366. AC_CHECK_LIB(pulse,pa_stream_peek,
  367. [AC_CHECK_HEADER([pulse/simple.h],pulse=1)])
  368. if test "$build_target" = "mingw"
  369. then
  370. pulse=0
  371. fi
  372. if test "$pulse" = 1
  373. then
  374. AC_DEFINE([HAVE_PULSE],[1],[Have libpulse(audio) library])
  375. fi
  376. # check for libopus(audio) library
  377. opus=0
  378. AC_CHECK_LIB(opus,opus_decode_float,
  379. [AC_CHECK_HEADER([opus/opus.h],
  380. [AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]
  381. )]
  382. )]
  383. )
  384. if test "$opus" = 1
  385. then
  386. AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])
  387. fi
  388. # libogg
  389. AC_CHECK_LIB(ogg, ogg_stream_flush_fill,
  390. [AC_CHECK_HEADERS([ogg/ogg.h],
  391. AM_CONDITIONAL(HAVE_OGG, true)
  392. ogg=1
  393. AC_DEFINE(HAVE_OGG,1,[Have ogg]),
  394. AM_CONDITIONAL(HAVE_OGG, false)
  395. ogg=0
  396. AC_DEFINE(HAVE_OGG,0,[lacking ogg]))],
  397. AM_CONDITIONAL(HAVE_OGG, false)
  398. ogg=0)
  399. PKG_CHECK_MODULES([GLIB], [glib-2.0],
  400. # check for pbc library
  401. pbc=0
  402. AC_CHECK_HEADER([pbc/pbc.h],pbc=1)
  403. AC_CHECK_HEADER([gabe.h],abe=1)
  404. AM_CONDITIONAL(HAVE_PBC, [test "$pbc" = 1])
  405. AM_CONDITIONAL(HAVE_ABE, [test "$abe" = 1])
  406. if test "x$pbc" = x1
  407. then
  408. AC_DEFINE([HAVE_PBC],[1],[Have pbc library])
  409. else
  410. AC_DEFINE([HAVE_PBC],[0],[Lacking pbc library])
  411. fi
  412. if test "x$abe" = x1
  413. then
  414. AC_DEFINE([HAVE_ABE],[1],[Have ABE library])
  415. else
  416. AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library])
  417. fi
  418. ,
  419. # glib-2 not found
  420. AM_CONDITIONAL(HAVE_PBC, [0])
  421. AM_CONDITIONAL(HAVE_ABE, [0])
  422. AC_DEFINE([HAVE_PBC],[0],[Lacking glib library])
  423. )
  424. gst=0
  425. PKG_CHECK_MODULES(
  426. [GST],
  427. [glib-2.0 gobject-2.0 gstreamer-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
  428. [
  429. gst=1
  430. AC_MSG_RESULT(ok)
  431. ], [
  432. gst=0
  433. AC_MSG_RESULT(not found)
  434. ])
  435. # Pulse Audio
  436. if test "x$pulse" != "x1" -o "x$opus" != "x1" -o "x$ogg" != "x1"
  437. then
  438. if test "x$gst" != "x1"
  439. then
  440. conversation_backend=none
  441. AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
  442. AM_CONDITIONAL(BUILD_GST_HELPERS, false)
  443. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  444. else
  445. conversation_backend=gst
  446. AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
  447. AM_CONDITIONAL(BUILD_GST_HELPERS, true)
  448. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  449. fi
  450. else
  451. conversation_backend=pulse
  452. AM_CONDITIONAL(BUILD_PULSE_HELPERS, true)
  453. AM_CONDITIONAL(BUILD_GST_HELPERS, false)
  454. AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
  455. fi
  456. # libgnurl
  457. LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
  458. if test "$gnurl" = 1
  459. then
  460. AM_CONDITIONAL(HAVE_LIBGNURL, true)
  461. AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl])
  462. else
  463. AM_CONDITIONAL(HAVE_LIBGNURL, false)
  464. AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
  465. fi
  466. SAVE_CPPFLAGS=$CPPFLAGS
  467. CPPFLAGS="$LIBGNURL_CPPFLAGS $LIBCURL_CPPFLAGS $CPPFLAGS"
  468. LIBS="$LIBGNURL $LIBCURL $LIBS"
  469. # libcurl-gnutls
  470. LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
  471. if test "x$curl" = xtrue
  472. then
  473. AC_CHECK_HEADERS([curl/curl.h],
  474. AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include <curl/curl.h>]]),
  475. [curl=false])
  476. AC_CHECK_HEADERS([gnurl/curl.h],
  477. AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],,[[#include <gnurl/curl.h>]]))
  478. # need libcurl-gnutls.so, everything else is not acceptable
  479. AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=false])
  480. # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
  481. fi
  482. # Check for curl/curl.h and gnurl/curl.h so we can use #ifdef
  483. # HAVE_CURL_CURL_H later (the above LIBCURL_CHECK_CONFIG accepted
  484. # *either* header set).
  485. AC_CHECK_HEADERS([curl/curl.h],,
  486. curl=false
  487. AC_CHECK_HEADERS([gnurl/curl.h],,
  488. gnurl=false))
  489. if test x$curl = xfalse
  490. then
  491. AM_CONDITIONAL(HAVE_LIBCURL, false)
  492. if test "$gnurl" = 0
  493. then
  494. AC_MSG_WARN([ERROR: GNUnet requires libcurl-gnutls or gnurl >= 7.34])
  495. fi
  496. else
  497. AM_CONDITIONAL(HAVE_LIBCURL, true)
  498. AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL])
  499. fi
  500. # restore LIBS & CPPFLAGS
  501. LIBS=$SAVE_LIBS
  502. CPPFLAGS=$SAVE_CPPFLAGS
  503. AC_CHECK_HEADERS([glpk.h],[glpk=true],[gplk=false])
  504. # GLPK must support glpk_init_env, version >= 4.43
  505. AC_CHECK_LIB([glpk],[glp_init_env],,[gplk=false])
  506. # GLPK must support atm MLP presolving, version >= 4.32
  507. AC_CHECK_MEMBERS(glp_iocp.presolve,,[gplk=false],[[#include <glpk.h>]])
  508. if test x$gplk = xfalse
  509. then
  510. AM_CONDITIONAL(HAVE_LIBGLPK, false)
  511. AC_MSG_WARN([ERROR: GNUnet requires GLPK >= 4.32])
  512. else
  513. AM_CONDITIONAL(HAVE_LIBGLPK, true)
  514. AC_DEFINE([HAVE_LIBGLPK],[1],[Have GLPK])
  515. fi
  516. AC_CHECK_HEADERS([nss.h],[nss=true],[nss=false])
  517. if test x$nss = xfalse
  518. then
  519. AM_CONDITIONAL(HAVE_GLIBCNSS, false)
  520. AC_MSG_WARN([ERROR: No GNU libc nss header, will not build NSS plugin])
  521. else
  522. AM_CONDITIONAL(HAVE_GLIBCNSS, true)
  523. fi
  524. # test for kvm and kstat (for CPU stats under BSD/Solaris)
  525. AC_CHECK_LIB([kvm],[kvm_open])
  526. AC_CHECK_LIB([kstat],[kstat_open])
  527. # should the build process be building the documentation?
  528. AC_MSG_CHECKING(whether to build documentation)
  529. AC_ARG_ENABLE([documentation],
  530. [AS_HELP_STRING([--enable-documentation], [build the documentation])],
  531. [documentation=${enableval}],
  532. [documentation=yes])
  533. AC_MSG_RESULT($documentation)
  534. if test "x$documentation" = "xyes"
  535. then
  536. AM_CONDITIONAL([DOCUMENTATION],true)
  537. AC_DEFINE([DOCUMENTATION],[1],[Building the documentation])
  538. else
  539. AM_CONDITIONAL([DOCUMENTATION],false)
  540. AC_DEFINE([DOCUMENTATION],[0],[Not building the documentation])
  541. fi
  542. # should the build process be building only the documentation?
  543. AC_MSG_CHECKING(whether to build only documentation)
  544. AC_ARG_ENABLE([documentation-only],
  545. [AS_HELP_STRING([--enable-documentation-only], [build only the documentation])],
  546. [documentation_only=${enableval}],
  547. [documentation_only=no])
  548. AC_MSG_RESULT($documentation_only)
  549. if test "x$documentation_only" = "xyes"
  550. then
  551. AM_CONDITIONAL([DOCUMENTATION_ONLY],true)
  552. AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation])
  553. else
  554. AM_CONDITIONAL([DOCUMENTATION_ONLY],false)
  555. AC_DEFINE([DOCUMENTATION_ONLY],[0],[Not building only the documentation])
  556. fi
  557. # should the build process be restricted to the code required
  558. # for GNU Taler wallets?
  559. AC_MSG_CHECKING(whether to compile GNU Taler Wallet library ONLY)
  560. AC_ARG_ENABLE([taler-wallet],
  561. [AS_HELP_STRING([--enable-taler-wallet], [only compile for Taler wallet])],
  562. [taler_only=${enableval}],
  563. [taler_only=no])
  564. AC_MSG_RESULT($taler_only)
  565. if test "x$taler_only" = "xyes"
  566. then
  567. AM_CONDITIONAL([TALER_ONLY],true)
  568. AC_DEFINE([TALER_WALLET_ONLY],[1],[Compiling for Taler wallet])
  569. else
  570. AM_CONDITIONAL([TALER_ONLY],false)
  571. AC_DEFINE([TALER_WALLET_ONLY],[0],[Canonical compilation])
  572. fi
  573. # test for libextractor
  574. extractor=0
  575. AC_MSG_CHECKING(for libextractor)
  576. AC_ARG_WITH(extractor,
  577. [ --with-extractor=PFX base of libextractor installation],
  578. [AC_MSG_RESULT([$with_extractor])
  579. case $with_extractor in
  580. no)
  581. ;;
  582. yes)
  583. AC_CHECK_HEADERS(extractor.h,
  584. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  585. extractor=1))
  586. ;;
  587. *)
  588. LDFLAGS="-L$with_extractor/lib $LDFLAGS"
  589. CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
  590. AC_CHECK_HEADERS(extractor.h,
  591. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  592. EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
  593. extractor=1))
  594. ;;
  595. esac
  596. ],
  597. [AC_MSG_RESULT([--with-extractor not specified])
  598. AC_CHECK_HEADERS(extractor.h,
  599. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  600. extractor=1))])
  601. # restore LIBS
  602. LIBS=$SAVE_LIBS
  603. if test "$extractor" != 1
  604. then
  605. AM_CONDITIONAL(HAVE_LIBEXTRACTOR, false)
  606. AC_DEFINE([HAVE_LIBEXTRACTOR],[0],[Lacking libextractor])
  607. else
  608. AM_CONDITIONAL(HAVE_LIBEXTRACTOR, true)
  609. AC_DEFINE([HAVE_LIBEXTRACTOR],[1],[Have libextractor])
  610. fi
  611. if test "$taler_only" != yes
  612. then
  613. # Check for libltdl header (#2999)
  614. ltdl=0
  615. AC_MSG_CHECKING(for libltdl)
  616. AC_ARG_WITH(ltdl,
  617. [ --with-ltdl=PFX base of libltdl installation],
  618. [AC_MSG_RESULT([$with_ltdl])
  619. case $with_ltdl in
  620. no)
  621. ;;
  622. yes)
  623. AC_CHECK_HEADERS(ltdl.h,
  624. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  625. ltdl=1))
  626. ;;
  627. *)
  628. LDFLAGS="-L$with_ltdl/lib $LDFLAGS"
  629. CPPFLAGS="-I$with_ltdl/include $CPPFLAGS"
  630. AC_CHECK_HEADERS(ltdl.h,
  631. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  632. EXT_LIB_PATH="-L$with_ltdl/lib $EXT_LIB_PATH"
  633. ltdl=1))
  634. ;;
  635. esac
  636. ],
  637. [AC_MSG_RESULT([--with-ltdl not specified])
  638. AC_CHECK_HEADERS(ltdl.h,
  639. AC_CHECK_LIB([ltdl], [lt_dlopenext],
  640. ltdl=1))])
  641. if test x$ltdl = x1
  642. then
  643. AC_MSG_RESULT([libltdl found])
  644. else
  645. AC_MSG_ERROR([GNUnet requires libltdl (from GNU libtool), try installing libltdl-dev])
  646. fi
  647. # restore LIBS
  648. LIBS=$SAVE_LIBS
  649. # libidn
  650. AC_MSG_CHECKING([if Libidn can be used])
  651. AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
  652. [Support IDN (needs GNU Libidn)]),
  653. libidn=$withval, libidn=yes)
  654. if test "$libidn" != "no"; then
  655. if test "$libidn" != "yes"; then
  656. LDFLAGS="${LDFLAGS} -L$libidn/lib"
  657. CPPFLAGS="${CPPFLAGS} -I$libidn/include"
  658. fi
  659. fi
  660. libidn=no
  661. AC_CHECK_HEADER(idna.h,
  662. AC_CHECK_LIB(idn, stringprep_check_version,
  663. [libidn=yes LIBS="${LIBS} -lidn"], []), [])
  664. if test "$libidn" != "yes"; then
  665. AC_MSG_FAILURE([GNUnet requires libidn.
  666. libidn-1.13 should be sufficient, newer versions work too.])
  667. fi
  668. AC_MSG_RESULT($libidn)
  669. # test for zlib
  670. SAVE_LDFLAGS=$LDFLAGS
  671. SAVE_CPPFLAGS=$CPPFLAGS
  672. AC_ARG_WITH(zlib,
  673. [ --with-zlib[[=DIR]] use libz in DIR],
  674. [AS_IF([test "$withval" = "no"],
  675. [AC_MSG_ERROR([GNUnet requires zlib])],
  676. [test "$withval" != "yes"],
  677. [
  678. Z_DIR=$withval
  679. CPPFLAGS="${CPPFLAGS} -I$withval/include"
  680. LDFLAGS="${LDFLAGS} -L$withval/lib"
  681. ])
  682. ])
  683. AC_CHECK_HEADER(zlib.h,
  684. [],
  685. [AC_MSG_ERROR([GNUnet requires zlib])])
  686. AC_CHECK_LIB(z, compress2,
  687. [
  688. AC_DEFINE([HAVE_ZLIB], [], [Have compression library])
  689. if test "x${Z_DIR}" != "x"; then
  690. Z_CFLAGS="-I${Z_DIR}/include"
  691. Z_LIBS="-L${Z_DIR}/lib -lz"
  692. else
  693. Z_LIBS="-lz"
  694. fi],
  695. [AC_MSG_ERROR([GNUnet requires zlib])])
  696. AC_SUBST(Z_CFLAGS)
  697. AC_SUBST(Z_LIBS)
  698. if test "$enable_shared" = "no"
  699. then
  700. AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])
  701. fi
  702. # restore LIBS
  703. LIBS=$SAVE_LIBS
  704. fi
  705. # check for iconv
  706. AM_ICONV
  707. # test for libunistring
  708. gl_LIBUNISTRING
  709. if test $HAVE_LIBUNISTRING != yes; then
  710. AC_MSG_ERROR([GNUnet requires libunistring])
  711. fi
  712. # under emscripten, $gl_libunistring_hexversion is undefined
  713. if test "$taler_only" != yes; then
  714. if test "x$gl_libunistring_hexversion" = "x" || test "$gl_libunistring_hexversion" -le 2305; then
  715. AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1])
  716. fi
  717. fi
  718. AC_CHECK_HEADERS([unistr.h],,AC_MSG_ERROR([Compiling GNUnet requires unistr.h (from libunistring) to be installed]))
  719. # restore LIBS
  720. LIBS=$SAVE_LIBS
  721. # Checks for standard header files.
  722. AC_HEADER_DIRENT
  723. AC_HEADER_STDC
  724. # Check for headers that are ALWAYS required
  725. 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]))
  726. # Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there)
  727. AC_CHECK_HEADERS([malloc.h malloc/malloc.h malloc/malloc_np.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h ucred.h sys/ucred.h endian.h sys/endian.h execinfo.h byteswap.h])
  728. # FreeBSD requires something more funky for netinet/in_systm.h and netinet/ip.h...
  729. AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
  730. [#ifdef HAVE_SYS_TYPES_H
  731. #include <sys/types.h>
  732. #endif
  733. #ifdef HAVE_NETINET_IN_SYSTM_H
  734. #include <netinet/in_systm.h>
  735. #endif
  736. #ifdef HAVE_NETINET_IN_H
  737. #include <netinet/in.h>
  738. #endif
  739. ])
  740. SAVE_LDFLAGS=$LDFLAGS
  741. SAVE_CPPFLAGS=$CPPFLAGS
  742. # test for sqlite
  743. sqlite=false
  744. AC_MSG_CHECKING(for SQLite)
  745. AC_ARG_WITH(sqlite,
  746. [ --with-sqlite=PFX base of SQLite installation],
  747. [AC_MSG_RESULT("$with_sqlite")
  748. case $with_sqlite in
  749. no)
  750. ;;
  751. yes)
  752. AC_CHECK_HEADERS(sqlite3.h,
  753. sqlite=true)
  754. ;;
  755. *)
  756. LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
  757. CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
  758. AC_CHECK_HEADERS(sqlite3.h,
  759. EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
  760. SQLITE_LDFLAGS="-L$with_sqlite/lib"
  761. SQLITE_CPPFLAGS="-I$with_sqlite/include"
  762. sqlite=true)
  763. LDFLAGS=$SAVE_LDFLAGS
  764. CPPFLAGS=$SAVE_CPPFLAGS
  765. ;;
  766. esac
  767. ],
  768. [AC_MSG_RESULT([--with-sqlite not specified])
  769. AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
  770. AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
  771. AC_SUBST(SQLITE_CPPFLAGS)
  772. AC_SUBST(SQLITE_LDFLAGS)
  773. LDFLAGS=$SAVE_LDFLAGS
  774. CPPFLAGS=$SAVE_CPPFLAGS
  775. # test for postgres
  776. postgres=false
  777. # even running the check for postgres breaks emscripten ...
  778. if test "$taler_only" != yes; then
  779. AX_LIB_POSTGRESQL([9.5])
  780. if test "$found_postgresql" = "yes"; then
  781. CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
  782. AC_CHECK_HEADERS([libpq-fe.h],
  783. postgres=true)
  784. fi
  785. fi
  786. AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
  787. LDFLAGS=$SAVE_LDFLAGS
  788. CPPFLAGS=$SAVE_CPPFLAGS
  789. # mysql & windows
  790. AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
  791. AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
  792. if test "$build_target" = "mingw"
  793. then
  794. CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
  795. fi
  796. # test for mysql
  797. mysql=false
  798. mysqlfail=false
  799. SAVE_LDFLAGS=$LDFLAGS
  800. SAVE_CPPFLAGS=$CPPFLAGS
  801. AC_MSG_CHECKING(for mysql)
  802. AC_ARG_WITH(mysql,
  803. [ --with-mysql=PFX base of MySQL installation],
  804. [AC_MSG_RESULT([$with_mysql])
  805. case $with_mysql in
  806. no)
  807. ;;
  808. yes|"")
  809. AC_CHECK_HEADERS(mysql/mysql.h,
  810. AC_CHECK_LIB(mysqlclient, mysql_init,
  811. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  812. ;;
  813. *)
  814. LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
  815. CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
  816. AC_CHECK_HEADERS(mysql/mysql.h,
  817. AC_CHECK_LIB(mysqlclient, mysql_init,
  818. MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
  819. MYSQL_CPPFLAGS="-I$with_mysql/include"
  820. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  821. ;;
  822. esac
  823. ],
  824. [AC_MSG_RESULT([--with-mysql not specified])
  825. if test -d "/usr/lib64/mysql"; then
  826. MYSQL_LIBDIR="/usr/lib64/mysql"
  827. elif test -d "/usr/lib/mysql"; then
  828. MYSQL_LIBDIR="/usr/lib/mysql"
  829. else
  830. MYSQL_LIBDIR="/usr/lib"
  831. fi
  832. LDFLAGS="-L$MYSQL_LIBDIR $LDFLAGS $ZLIBS"
  833. AC_CHECK_LIB(mysqlclient, mysql_init,
  834. [AC_CHECK_HEADERS(mysql/mysql.h,
  835. MYSQL_LDFLAGS="-L$MYSQL_LIBDIR"
  836. mysql=true
  837. , [], [$CYGWIN_MYSQL_MAGIC])])
  838. ])
  839. AC_SUBST(MYSQL_LDFLAGS)
  840. AC_SUBST(MYSQL_CPPFLAGS)
  841. # additional version check for mysql
  842. AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
  843. if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
  844. then
  845. AC_MSG_CHECKING(mysql version)
  846. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  847. [[$CYGWIN_MYSQL_MAGIC
  848. #include <mysql/mysql.h>]],
  849. [[
  850. #if (MYSQL_VERSION_ID < 40100)
  851. #error needs at least version >= 4.1
  852. #endif
  853. int main () { return 0; }
  854. ]])
  855. ],mysql=true,mysql=false)
  856. if test "$mysql" = "false"
  857. then
  858. mysqlfail=true
  859. AC_MSG_RESULT([fail, >= 4.1 required])
  860. else
  861. AC_MSG_RESULT(ok)
  862. fi
  863. fi
  864. AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
  865. AM_CONDITIONAL(HAVE_MYSQLE, test "0" = "1")
  866. # restore LIBS
  867. LIBS=$SAVE_LIBS
  868. LDFLAGS=$SAVE_LDFLAGS
  869. CPPFLAGS=$SAVE_CPPFLAGS
  870. if test "$sqlite" = 0 -a "$mysql" = 0
  871. then
  872. AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
  873. fi
  874. # libmicrohttpd
  875. lmhd=0
  876. AC_MSG_CHECKING([for libmicrohttpd])
  877. AC_ARG_WITH(microhttpd,
  878. [ --with-microhttpd=PFX base of libmicrohttpd installation],
  879. [AC_MSG_RESULT([$with_microhttpd])
  880. case $with_microhttpd in
  881. no)
  882. ;;
  883. yes|"")
  884. AC_CHECK_HEADERS([microhttpd.h],
  885. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  886. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  887. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.42])
  888. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  889. #include "$native_srcdir/src/include/platform.h"
  890. #include <microhttpd.h>
  891. #if (MHD_VERSION < 0x0094200)
  892. #error needs at least version 0.9.42
  893. #endif
  894. int main () { return 0; }
  895. ])],
  896. [AC_MSG_RESULT(ok)
  897. lmhd=1],
  898. [AC_MSG_RESULT(failed)])]),
  899. [],[#include "$native_srcdir/src/include/platform.h"
  900. #include <microhttpd.h>]),,
  901. [#include "$native_srcdir/src/include/platform.h"])
  902. ;;
  903. *)
  904. LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
  905. CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
  906. AC_CHECK_HEADERS(microhttpd.h,
  907. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  908. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  909. EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
  910. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.42])
  911. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  912. #include "$native_srcdir/src/include/platform.h"
  913. #include <microhttpd.h>
  914. #if (MHD_VERSION < 0x0094200)
  915. #error needs at least version 0.9.42
  916. #endif
  917. int main () { return 0; }
  918. ])],
  919. [AC_MSG_RESULT(ok)
  920. lmhd=1],
  921. [AC_MSG_RESULT(failed)])]),
  922. [],[#include "$native_srcdir/src/include/platform.h"
  923. #include <microhttpd.h>]),,
  924. [#include "$native_srcdir/src/include/platform.h"])
  925. ;;
  926. esac
  927. ],
  928. [AC_MSG_RESULT([--with-microhttpd not specified])
  929. AC_CHECK_HEADERS([microhttpd.h],
  930. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  931. AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
  932. [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.42])
  933. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  934. #include "$native_srcdir/src/include/platform.h"
  935. #include <microhttpd.h>
  936. #if (MHD_VERSION < 0x0094200)
  937. #error needs at least version 0.9.42
  938. #endif
  939. ])],
  940. [AC_MSG_RESULT(ok)
  941. lmhd=1],
  942. [AC_MSG_RESULT(failed)])]),
  943. [],[#include "$native_srcdir/src/include/platform.h"
  944. #include <microhttpd.h>]),,
  945. [#include "$native_srcdir/src/include/platform.h"])])
  946. AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
  947. AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
  948. AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
  949. # restore LIBS
  950. LIBS=$SAVE_LIBS
  951. # check for python & pexpect (used for some testcases only)
  952. AM_PATH_PYTHON([2.6],, [:])
  953. AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
  954. # check for gettext
  955. AM_GNU_GETTEXT([external])
  956. AM_GNU_GETTEXT_VERSION([0.18.1])
  957. # Checks for standard typedefs, structures, and compiler characteristics.
  958. AC_TYPE_PID_T
  959. AC_TYPE_SIZE_T
  960. AC_TYPE_MODE_T
  961. AC_HEADER_TIME
  962. AC_HEADER_STAT
  963. AC_HEADER_STDBOOL
  964. AC_STRUCT_TM
  965. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  966. [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
  967. ],
  968. [],
  969. [
  970. #include <sys/types.h>
  971. #include <sys/socket.h>
  972. #include <netinet/in.h>
  973. ])
  974. AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
  975. [ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN, 1, [Do we have sockaddr_un.sun_len?])
  976. ],
  977. [],
  978. [
  979. #include <sys/types.h>
  980. #include <sys/socket.h>
  981. #include <sys/un.h>
  982. ])
  983. # Checks for library functions.
  984. AC_FUNC_CLOSEDIR_VOID
  985. AC_FUNC_FORK
  986. AC_PROG_GCC_TRADITIONAL
  987. AC_FUNC_MEMCMP
  988. AC_FUNC_SELECT_ARGTYPES
  989. AC_FUNC_CHOWN
  990. AC_TYPE_SIGNAL
  991. AC_FUNC_STAT
  992. AC_FUNC_STRFTIME
  993. AC_FUNC_VPRINTF
  994. AC_HEADER_SYS_WAIT
  995. AC_TYPE_OFF_T
  996. AC_TYPE_UID_T
  997. 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])
  998. # restore LIBS
  999. LIBS=$SAVE_LIBS
  1000. GN_INTLINCL=""
  1001. GN_LIBINTL="$LTLIBINTL"
  1002. AC_ARG_ENABLE(framework, [ --enable-framework enable Mac OS X framework build helpers],enable_framework_build=$enableval)
  1003. AM_CONDITIONAL(WANT_FRAMEWORK, test x$enable_framework_build = xyes)
  1004. if test x$enable_framework_build = xyes
  1005. then
  1006. AC_DEFINE([FRAMEWORK_BUILD], 1, [Build a Mac OS X Framework])
  1007. GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
  1008. GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
  1009. AC_LIB_APPENDTOVAR([CPPFLAGS], [$GN_INTLINCL])
  1010. fi
  1011. GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
  1012. GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
  1013. AC_SUBST(GN_LIB_LDFLAGS)
  1014. AC_SUBST(GN_PLUGIN_LDFLAGS)
  1015. AC_SUBST(GN_INTLINCL)
  1016. AC_SUBST(GN_LIBINTL)
  1017. AC_SUBST(CPPFLAGS)
  1018. AC_SUBST(LIBS)
  1019. AC_SUBST(LDFLAGS)
  1020. AC_SUBST(EXT_LIB_PATH)
  1021. AC_SUBST(EXT_LIBS)
  1022. AC_SUBST(LIBPREFIX)
  1023. AC_SUBST(DLLDIR)
  1024. AC_SUBST(EXT_LIB_PATH)
  1025. # test for sudo
  1026. AC_MSG_CHECKING(for sudo)
  1027. AC_ARG_WITH(sudo,
  1028. [ --with-sudo=PATH path to sudo binary (or just yes)],
  1029. [AC_MSG_RESULT("$with_sudo")
  1030. case $with_sudo in
  1031. no)
  1032. SUDO_BINARY=
  1033. ;;
  1034. yes)
  1035. SUDO_BINARY=sudo
  1036. ;;
  1037. *)
  1038. SUDO_BINARY=$with_sudo
  1039. ;;
  1040. esac
  1041. ],
  1042. [AC_MSG_RESULT([no])])
  1043. AC_SUBST(SUDO_BINARY)
  1044. AM_CONDITIONAL([HAVE_SUDO], [test "x$SUDO_BINARY" != "x" -o -w /])
  1045. # test for gnunetdns group name
  1046. GNUNETDNS_GROUP=gnunetdns
  1047. AC_MSG_CHECKING(for gnunetdns group name)
  1048. AC_ARG_WITH(gnunetdns,
  1049. [ --with-gnunetdns=GRPNAME name for gnunetdns group],
  1050. [AC_MSG_RESULT("$with_gnunetdns")
  1051. case $with_gnunetdns in
  1052. no)
  1053. GNUNETDNS_GROUP=gnunet
  1054. ;;
  1055. yes)
  1056. GNUNETDNS_GROUP=gnunetdns
  1057. ;;
  1058. *)
  1059. GNUNETDNS_GROUP=$with_gnunetdns
  1060. ;;
  1061. esac
  1062. ],
  1063. [AC_MSG_RESULT([gnunetdns])])
  1064. AC_SUBST(GNUNETDNS_GROUP)
  1065. # gnutls
  1066. gnutls=0
  1067. gnutls_dane=0
  1068. AC_MSG_CHECKING(for gnutls)
  1069. AC_ARG_WITH(gnutls,
  1070. [ --with-gnutls=PFX base of gnutls installation],
  1071. [AC_MSG_RESULT([$with_gnutls])
  1072. case $with_gnutls in
  1073. no)
  1074. ;;
  1075. yes)
  1076. AC_CHECK_HEADERS([gnutls/abstract.h],
  1077. AC_CHECK_LIB([gnutls], [gnutls_priority_set],
  1078. gnutls=true))
  1079. AC_CHECK_HEADERS([gnutls/dane.h],
  1080. AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
  1081. gnutls_dane=1))
  1082. ;;
  1083. *)
  1084. LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
  1085. CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
  1086. AC_CHECK_HEADERS([gnutls/abstract.h],
  1087. AC_CHECK_LIB([gnutls], [gnutls_priority_set],
  1088. EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH"
  1089. gnutls=true))
  1090. AC_CHECK_HEADERS([gnutls/dane.h],
  1091. AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
  1092. gnutls_dane=1))
  1093. ;;
  1094. esac
  1095. ],
  1096. [AC_MSG_RESULT([--with-gnutls not specified])
  1097. AC_CHECK_HEADERS([gnutls/abstract.h],
  1098. AC_CHECK_LIB([gnutls], [gnutls_priority_set],
  1099. gnutls=true))
  1100. AC_CHECK_HEADERS([gnutls/dane.h],
  1101. AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
  1102. gnutls_dane=1))
  1103. ])
  1104. AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue)
  1105. AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have GnuTLS])
  1106. AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1)
  1107. AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support])
  1108. # Test if we are building for superMUC
  1109. AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC)
  1110. AC_ARG_ENABLE([supermuc],
  1111. [AS_HELP_STRING([--enable-supermuc],
  1112. [build GNUnet with support to run on the SuperMUC (default is NO)])],
  1113. [if test "x$enable_supermuc" = "xno"
  1114. then
  1115. supermuc=0
  1116. else
  1117. supermuc=1
  1118. fi],
  1119. [supermuc=0
  1120. enable_supermuc=no])
  1121. AC_MSG_RESULT($enable_SUPERMUC)
  1122. AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"])
  1123. AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC])
  1124. # Check if NSE has to send timestamp information to testbed logger for
  1125. # generating histogram of messages received
  1126. AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
  1127. AC_ARG_ENABLE([nse-histogram],
  1128. [AS_HELP_STRING([--enable-nse-histogram],
  1129. [have NSE send timestamp information to testbed logger for generating
  1130. histogram of received messages. NOT useful for production (default is
  1131. NO)])],
  1132. [if test "x$enableval" = "xno"
  1133. then
  1134. nse_histogram=0
  1135. else
  1136. nse_histogram=1
  1137. fi],
  1138. [nse_histogram=0
  1139. enable_nse_histogram=no])
  1140. AC_MSG_RESULT($enable_nse_histogram)
  1141. AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"])
  1142. AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram],
  1143. [have NSE send timestamp information to testbed logger])
  1144. # should 'make check' run tests?
  1145. AC_MSG_CHECKING(whether to run tests)
  1146. AC_ARG_ENABLE([testruns],
  1147. [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])],
  1148. [enable_tests_run=${enableval}],
  1149. [enable_tests_run=yes])
  1150. AC_MSG_RESULT($enable_test_run)
  1151. AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"])
  1152. # should monkey be used when running (certain) services?
  1153. AC_MSG_CHECKING(whether to run with monkey)
  1154. AC_ARG_ENABLE([monkey],
  1155. [AS_HELP_STRING([--enable-monkey], [enable running with monkey])],
  1156. [enable_monkey=${enableval}],
  1157. [enable_monkey=no])
  1158. AC_MSG_RESULT($enable_monkey)
  1159. AM_CONDITIONAL([ENABLE_MONKEY], [test "x$enable_monkey" = "xyes"])
  1160. if test "x$enable_monkey" = "xyes"
  1161. then
  1162. MONKEYPREFIX="pathologist -d $(eval echo ${datarootdir}/gnunet/gnunet.sqlite) -p 30 --"
  1163. else
  1164. MONKEYPREFIX=""
  1165. fi
  1166. AC_SUBST(MONKEYPREFIX)
  1167. # should expensive tests be run?
  1168. AC_MSG_CHECKING(whether to run expensive tests)
  1169. AC_ARG_ENABLE([expensivetests],
  1170. [AS_HELP_STRING([--enable-expensivetests], [enable running expensive testcases])],
  1171. [enable_expensive=${enableval}],
  1172. [enable_expensive=no])
  1173. AC_MSG_RESULT($enable_expensive)
  1174. AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
  1175. # should ports be open for Java services?
  1176. AC_MSG_CHECKING(whether to enable ports for gnunet-java)
  1177. AC_ARG_ENABLE([javaports],
  1178. [AS_HELP_STRING([--enable-javaports], [use non-zero ports for services with Java bindings (default is NO)])],
  1179. [enable_java_ports=${enableval}],
  1180. [enable_java_ports=no])
  1181. AC_MSG_RESULT($enable_java_ports)
  1182. if test "x$enable_java_ports" = "xyes"
  1183. then
  1184. JAVAPORT=""
  1185. else
  1186. JAVAPORT="$UNIXONLY"
  1187. fi
  1188. AC_SUBST(JAVAPORT)
  1189. # should benchmarks be run?
  1190. AC_MSG_CHECKING(whether to run benchmarks during make check)
  1191. AC_ARG_ENABLE([benchmarks],
  1192. [AS_HELP_STRING([--enable-benchmarks], [enable running benchmarks during make check])],
  1193. [enable_benchmarks=${enableval}],
  1194. [enable_benchmarks=no])
  1195. AC_MSG_RESULT($enable_benchmarks)
  1196. AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
  1197. # should gnunet-testing be compiled
  1198. AC_MSG_CHECKING(wether to compile gnunet-testing)
  1199. AC_ARG_ENABLE([testing],
  1200. [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])],
  1201. [enable_testing=${enableval}],
  1202. [enable_testing=yes])
  1203. AC_MSG_RESULT($enable_testing)
  1204. AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"])
  1205. # should experimental code be compiled (code that may not yet compile)?
  1206. AC_MSG_CHECKING(whether to compile experimental code)
  1207. AC_ARG_ENABLE([experimental],
  1208. [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
  1209. [enable_experimental=${enableval}],
  1210. [enable_experimental=no])
  1211. AC_MSG_RESULT($enable_experimental)
  1212. AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
  1213. # should malicious code be compiled (should only be used for testing)?
  1214. AC_MSG_CHECKING(whether to compile malicious code)
  1215. AC_ARG_ENABLE([malicious],
  1216. [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code])],
  1217. [if test "x$enableval" = "xno"
  1218. then
  1219. malicious=0
  1220. else
  1221. malicious=1
  1222. fi],
  1223. [malicious=0
  1224. enable_malicious=no])
  1225. AC_MSG_RESULT($enable_malicious)
  1226. AM_CONDITIONAL([ENABLE_MALICIOUS], [test 1=$malicious])
  1227. AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious],
  1228. [enable compilation of malicious code])
  1229. # should services be started by default when a peer starts? Some services may
  1230. # choose to never start by default and it is upto the service/module developer to
  1231. # decide it by having "AUTOSTART = NO" instead of "AUTOSTART = @AUTOSTART@" in
  1232. # the service/module's conf.in file.
  1233. AUTOSTART="YES"
  1234. AC_MSG_CHECKING(whether to auto-start peer's services by default)
  1235. AC_ARG_ENABLE([autostart],
  1236. [AS_HELP_STRING([--disable-autostart], [do not start peer's services by default])],
  1237. [enable_autostart=${enableval}
  1238. if test "x$enable_autostart" == "xno"
  1239. then
  1240. AUTOSTART="NO"
  1241. fi
  1242. ],
  1243. [enable_autostart=yes])
  1244. AC_MSG_RESULT($enable_autostart)
  1245. #AM_CONDITIONAL([HAVE_AUTOSTART], [test "x$enable_autostart" = "xyes"])
  1246. AC_SUBST(AUTOSTART)
  1247. # should memory statistics be kept (very expensive CPU-wise!)
  1248. AC_MSG_CHECKING(whether to create expensive statistics on memory use)
  1249. AC_ARG_ENABLE([heapstats],
  1250. [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])],
  1251. [enable_heapstats=1],
  1252. [enable_heapstats=0])
  1253. AC_MSG_RESULT($enable_heapstats)
  1254. AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS],$enable_heapstats,[enable expensive heap statistics])
  1255. # should code be enabled that works around missing OS functionality on Windows?
  1256. # used for test cases
  1257. if test $build_target = "mingw"
  1258. then
  1259. workarounds=1
  1260. AC_LINK_IFELSE(
  1261. [AC_LANG_PROGRAM(
  1262. [#include <ws2tcpip.h>
  1263. ],[
  1264. int s = socket (0, 0, 0);])
  1265. ],[
  1266. AC_DEFINE_UNQUOTED([HAVE_SOCKET],1,[Define this if socket() is available])
  1267. ],[
  1268. AC_DEFINE_UNQUOTED([HAVE_SOCKET],0,[Define this if socket() is available])
  1269. ])
  1270. AC_LINK_IFELSE(
  1271. [AC_LANG_PROGRAM(
  1272. [#include <ws2tcpip.h>
  1273. ],[
  1274. int s = select (0, NULL, NULL, NULL, NULL);])
  1275. ],[
  1276. AC_DEFINE_UNQUOTED([HAVE_SELECT],1,[Define this if select() is available])
  1277. ],[
  1278. AC_DEFINE_UNQUOTED([HAVE_SELECT],0,[Define this if select() is available])
  1279. ])
  1280. AC_LINK_IFELSE(
  1281. [AC_LANG_PROGRAM(
  1282. [#include <ws2tcpip.h>
  1283. ],[
  1284. struct in_addr i;
  1285. char *s = inet_ntoa (i);])
  1286. ],[
  1287. AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],1,[Define this if inet_ntoa() is available])
  1288. ],[
  1289. AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],0,[Define this if inet_ntoa() is available])
  1290. ])
  1291. AC_LINK_IFELSE(
  1292. [AC_LANG_PROGRAM(
  1293. [#include <ws2tcpip.h>
  1294. ],[
  1295. int s = getnameinfo (NULL, 0, NULL, 0, NULL, 0, 0);])
  1296. ],[
  1297. AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],1,[Define this if getnameinfo() is available])
  1298. ],[
  1299. AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],0,[Define this if getnameinfo() is available])
  1300. ])
  1301. AC_LINK_IFELSE(
  1302. [AC_LANG_PROGRAM(
  1303. [#include <ws2tcpip.h>
  1304. ],[
  1305. int s = gethostname (NULL, 0);])
  1306. ],[
  1307. AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],1,[Define this if gethostname() is available])
  1308. ],[
  1309. AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],0,[Define this if gethostname() is available])
  1310. ])
  1311. AC_LINK_IFELSE(
  1312. [AC_LANG_PROGRAM(
  1313. [#include <ws2tcpip.h>
  1314. ],[
  1315. void *s = gethostbyname (NULL);])
  1316. ],[
  1317. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],1,[Define this if gethostbyname() is available])
  1318. ],[
  1319. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],0,[Define this if gethostbyname() is available])
  1320. ])
  1321. AC_LINK_IFELSE(
  1322. [AC_LANG_PROGRAM(
  1323. [#include <ws2tcpip.h>
  1324. ],[
  1325. void *s = gethostbyaddr (NULL, 0, 0);])
  1326. ],[
  1327. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],1,[Define this if gethostbyaddr() is available])
  1328. ],[
  1329. AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],0,[Define this if gethostbyaddr() is available])
  1330. ])
  1331. AC_LINK_IFELSE(
  1332. [AC_LANG_PROGRAM(
  1333. [#include <ws2tcpip.h>
  1334. ],[
  1335. int s = getaddrinfo (NULL, NULL, NULL, NULL);])
  1336. ],[
  1337. AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],1,[Define this if getaddrinfo() is available])
  1338. ],[
  1339. AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],1,[Define this if getaddrinfo() is available])
  1340. ])
  1341. else
  1342. AC_MSG_CHECKING(whether to enable windows workarounds)
  1343. AC_ARG_ENABLE([windows_workarounds],
  1344. [AS_HELP_STRING([--enable-windows_workarounds], [enable workarounds used on Windows (only useful for test cases)])],
  1345. [enable_workarounds=${enableval}],
  1346. [enable_workarounds=no])
  1347. AC_MSG_RESULT($enable_workarounds)
  1348. if test x$enable_windows_workarounds = "xyes"
  1349. then
  1350. workarounds=1
  1351. else
  1352. workarounds=0
  1353. fi
  1354. fi
  1355. AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable workarounds used on Windows (only useful for test cases)])
  1356. # gcov compilation
  1357. AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
  1358. AC_ARG_ENABLE([coverage],
  1359. AS_HELP_STRING([--enable-coverage],
  1360. [compile the library with code coverage support]),
  1361. [use_gcov=${enableval}],
  1362. [use_gcov=no])
  1363. AC_MSG_RESULT($use_gcov)
  1364. AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
  1365. # version info
  1366. # TODO: git blame says this predates our switch to git. git-svn should be adjusted to simply git, or
  1367. # an external script that does the job.
  1368. AC_PATH_PROG(svnversioncommand, svnversion)
  1369. AC_PATH_PROG(gitcommand, git)
  1370. AC_MSG_CHECKING(for source being under a VCS)
  1371. svn_version=
  1372. gitsvn_version=
  1373. AS_IF([test ! "X$svnversioncommand" = "X"],
  1374. [
  1375. svn_version=$(cd $srcdir ; $svnversioncommand -n 2>/dev/null)
  1376. ])
  1377. AS_IF([test ! "X$gitcommand" = "X"],
  1378. [
  1379. gitsvn_version=$(cd $srcdir ; git log -1 2>/dev/null | grep "git-svn-id" | sed -e 's/.*@\([[0-9]]\+\) .*/\1/')
  1380. ])
  1381. AS_IF([test "X$svn_version" = "X" -o "X$svn_version" = "Xexported" -o "X$svn_version" = "XUnversioned directory"],
  1382. [
  1383. AS_IF([test "X$gitsvn_version" = "X"],
  1384. [
  1385. vcs_name="no"
  1386. vcs_version="\"release\""
  1387. ],
  1388. [
  1389. vcs_name="yes, git-svn"
  1390. vcs_version="\"svn-r$gitsvn_version\""
  1391. ])
  1392. ],
  1393. [
  1394. vcs_name="yes, svn"
  1395. vcs_version="\"svn-r$svn_version\""
  1396. ])
  1397. AC_MSG_RESULT($vcs_name)
  1398. AC_MSG_CHECKING(VCS version)
  1399. AC_MSG_RESULT($vcs_version)
  1400. AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
  1401. AC_CONFIG_FILES([
  1402. Makefile
  1403. contrib/Makefile
  1404. doc/Makefile
  1405. doc/man/Makefile
  1406. doc/doxygen/Makefile
  1407. doc/documentation/Makefile
  1408. m4/Makefile
  1409. po/Makefile.in
  1410. src/Makefile
  1411. src/arm/Makefile
  1412. src/arm/arm.conf
  1413. src/ats/Makefile
  1414. src/ats/ats.conf
  1415. src/ats-tool/Makefile
  1416. src/ats-tests/Makefile
  1417. src/auction/Makefile
  1418. src/block/Makefile
  1419. src/cadet/Makefile
  1420. src/cadet/cadet.conf
  1421. src/core/Makefile
  1422. src/core/core.conf
  1423. src/consensus/Makefile
  1424. src/consensus/consensus.conf
  1425. src/conversation/Makefile
  1426. src/conversation/conversation.conf
  1427. src/curl/Makefile
  1428. src/datacache/Makefile
  1429. src/datastore/Makefile
  1430. src/datastore/datastore.conf
  1431. src/dht/Makefile
  1432. src/dht/dht.conf
  1433. src/dns/Makefile
  1434. src/dns/dns.conf
  1435. src/exit/Makefile
  1436. src/fragmentation/Makefile
  1437. src/fs/Makefile
  1438. src/fs/fs.conf
  1439. src/gns/Makefile
  1440. src/gns/gns.conf
  1441. src/gns/nss/Makefile
  1442. src/gnsrecord/Makefile
  1443. src/hello/Makefile
  1444. src/identity/Makefile
  1445. src/identity/identity.conf
  1446. src/credential/Makefile
  1447. src/credential/credential.conf
  1448. src/include/Makefile
  1449. src/integration-tests/Makefile
  1450. src/json/Makefile
  1451. src/jsonapi/Makefile
  1452. src/hostlist/Makefile
  1453. src/multicast/Makefile
  1454. src/multicast/multicast.conf
  1455. src/my/Makefile
  1456. src/mysql/Makefile
  1457. src/namecache/Makefile
  1458. src/namecache/namecache.conf
  1459. src/namestore/Makefile
  1460. src/namestore/namestore.conf
  1461. src/nat/Makefile
  1462. src/nat/nat.conf
  1463. src/nat-auto/Makefile
  1464. src/nat-auto/nat-auto.conf
  1465. src/nse/Makefile
  1466. src/nse/nse.conf
  1467. src/peerinfo/Makefile
  1468. src/peerinfo/peerinfo.conf
  1469. src/peerinfo-tool/Makefile
  1470. src/peerstore/Makefile
  1471. src/peerstore/peerstore.conf
  1472. src/pq/Makefile
  1473. src/psycutil/Makefile
  1474. src/psyc/Makefile
  1475. src/psyc/psyc.conf
  1476. src/psycstore/Makefile
  1477. src/psycstore/psycstore.conf
  1478. src/pt/Makefile
  1479. src/regex/Makefile
  1480. src/regex/regex.conf
  1481. src/revocation/Makefile
  1482. src/revocation/revocation.conf
  1483. src/rps/Makefile
  1484. src/rps/rps.conf
  1485. src/secretsharing/Makefile
  1486. src/secretsharing/secretsharing.conf
  1487. src/scalarproduct/Makefile
  1488. src/scalarproduct/scalarproduct.conf
  1489. src/set/Makefile
  1490. src/set/set.conf
  1491. src/social/Makefile
  1492. src/social/social.conf
  1493. src/sq/Makefile
  1494. src/statistics/Makefile
  1495. src/statistics/statistics.conf
  1496. src/template/Makefile
  1497. src/testbed/Makefile
  1498. src/testbed/testbed.conf
  1499. src/testbed-logger/Makefile
  1500. src/testbed-logger/testbed-logger.conf
  1501. src/testing/Makefile
  1502. src/topology/Makefile
  1503. src/transport/Makefile
  1504. src/transport/transport.conf
  1505. src/tun/Makefile
  1506. src/util/Makefile
  1507. src/util/resolver.conf
  1508. src/vpn/Makefile
  1509. src/vpn/vpn.conf
  1510. src/zonemaster/Makefile
  1511. src/zonemaster/zonemaster.conf
  1512. src/rest/Makefile
  1513. src/abe/Makefile
  1514. src/identity-attribute/Makefile
  1515. src/identity-provider/Makefile
  1516. pkgconfig/Makefile
  1517. pkgconfig/gnunetarm.pc
  1518. pkgconfig/gnunetats.pc
  1519. pkgconfig/gnunetblock.pc
  1520. pkgconfig/gnunetcadet.pc
  1521. pkgconfig/gnunetconsensus.pc
  1522. pkgconfig/gnunetconversation.pc
  1523. pkgconfig/gnunetcore.pc
  1524. pkgconfig/gnunetdatacache.pc
  1525. pkgconfig/gnunetdatastore.pc
  1526. pkgconfig/gnunetdht.pc
  1527. pkgconfig/gnunetdns.pc
  1528. pkgconfig/gnunetdnsparser.pc
  1529. pkgconfig/gnunetdnsstub.pc
  1530. pkgconfig/gnunetdv.pc
  1531. pkgconfig/gnunetenv.pc
  1532. pkgconfig/gnunetfragmentation.pc
  1533. pkgconfig/gnunetfs.pc
  1534. pkgconfig/gnunetgns.pc
  1535. pkgconfig/gnunethello.pc
  1536. pkgconfig/gnunetidentity.pc
  1537. pkgconfig/gnunetmicrophone.pc
  1538. pkgconfig/gnunetmulticast.pc
  1539. pkgconfig/gnunetmysql.pc
  1540. pkgconfig/gnunetnamestore.pc
  1541. pkgconfig/gnunetnat.pc
  1542. pkgconfig/gnunetnse.pc
  1543. pkgconfig/gnunetpeerinfo.pc
  1544. pkgconfig/gnunetpq.pc
  1545. pkgconfig/gnunetpsyc.pc
  1546. pkgconfig/gnunetpsycstore.pc
  1547. pkgconfig/gnunetregex.pc
  1548. pkgconfig/gnunetrevocation.pc
  1549. pkgconfig/gnunetrps.pc
  1550. pkgconfig/gnunetscalarproduct.pc
  1551. pkgconfig/gnunetset.pc
  1552. pkgconfig/gnunetsocial.pc
  1553. pkgconfig/gnunetspeaker.pc
  1554. pkgconfig/gnunetstatistics.pc
  1555. pkgconfig/gnunettestbed.pc
  1556. pkgconfig/gnunettesting.pc
  1557. pkgconfig/gnunettransport.pc
  1558. pkgconfig/gnunettun.pc
  1559. pkgconfig/gnunetutil.pc
  1560. pkgconfig/gnunetvpn.pc
  1561. ])
  1562. AC_OUTPUT
  1563. # Finally: summary!
  1564. # warn user if mysql found but not used due to version
  1565. if test "$mysqlfail" = "true"
  1566. then
  1567. AC_MSG_NOTICE([WARNING: MySQL found, but too old. MySQL support will not be compiled.])
  1568. fi
  1569. # sqlite
  1570. if test "x$sqlite" = "x0"
  1571. then
  1572. AC_MSG_ERROR([ERROR: sqlite3 not found, but sqlite3 is required.])
  1573. fi
  1574. # libgnurl
  1575. if test "$gnurl" = "0"
  1576. then
  1577. if test "x$curl" = "xfalse"
  1578. then
  1579. AC_MSG_NOTICE([WARNING: libgnurl not found. http client support will not be compiled.])
  1580. AC_MSG_WARN([ERROR: libgnurl not found. hostlist daemon will not be compiled, and you probably WANT the hostlist daemon])
  1581. else
  1582. AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.])
  1583. fi
  1584. fi
  1585. # bluetooth
  1586. if test "x$bluetooth" = "x0"
  1587. then
  1588. AC_MSG_NOTICE([WARNING: bluetooth library not found. bluetooth support will not be compiled.])
  1589. fi
  1590. # jansson
  1591. if test "x$jansson" = "x0"
  1592. then
  1593. AC_MSG_NOTICE([WARNING: jansson library not found. json support will not be compiled.])
  1594. fi
  1595. #gnutls
  1596. if test x$gnutls != xtrue
  1597. then
  1598. AC_MSG_NOTICE([WARNING: GnuTLS not found, gnunet-gns-proxy will not be built])
  1599. else
  1600. if test "x$gnutls_dane" != "x1"
  1601. then
  1602. AC_MSG_NOTICE([WARNING: GnuTLS has no DANE support, DANE validation will not be possible])
  1603. fi
  1604. fi
  1605. # java ports
  1606. if test "x$enable_java_ports" = "xyes"
  1607. then
  1608. AC_MSG_NOTICE([NOTICE: Opening ports for gnunet-java bindings by default.])
  1609. fi
  1610. # MHD
  1611. if test "x$lmhd" != "x1"
  1612. then
  1613. AC_MSG_NOTICE([WARNING: libmicrohttpd not found, http transport will not be installed.])
  1614. fi
  1615. # conversation
  1616. if test "x$conversation_backend" = "xnone"
  1617. then
  1618. if test "x$pulse" != "x1"
  1619. then
  1620. AC_MSG_NOTICE([WARNING: libpulse(audio) not found, conversation will not be built.])
  1621. fi
  1622. if test "x$opus" != "x1"
  1623. then
  1624. AC_MSG_NOTICE([WARNING: libopus not found, conversation will not be built.])
  1625. fi
  1626. if test "x$gst" != "x1"
  1627. then
  1628. AC_MSG_NOTICE([WARNING: GStreamer not found, conversation will not be built.])
  1629. fi
  1630. fi
  1631. if test "$extractor" != 1
  1632. then
  1633. AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])
  1634. fi
  1635. AC_MSG_NOTICE([NOTICE: Database support is set to MySQL: $mysql, SQLite: $sqlite, Postgres: $postgres])
  1636. if test "$enable_framework_build" = "yes"
  1637. then
  1638. AC_MSG_NOTICE([Mac OS X framework build enabled.])
  1639. fi
  1640. AC_MSG_NOTICE([********************************************
  1641. Please make sure NOW that you have created a user and group 'gnunet'
  1642. and additionally a group 'gnunetdns'. On Debian and Ubuntu GNU/Linux, type:
  1643. addgroup gnunetdns
  1644. adduser --system --group --disabled-login --home /var/lib/gnunet gnunet
  1645. Make sure that '/var/lib/gnunet' is owned (and writable) by user
  1646. 'gnunet'. Then, you can compile GNUnet with
  1647. make
  1648. After that, run (if necessary as 'root')
  1649. make install
  1650. to install everything.
  1651. Each GNUnet user should be added to the 'gnunet' group (may
  1652. require fresh login to come into effect):
  1653. adduser USERNAME gnunet
  1654. (run the above command as root once for each of your users, replacing
  1655. "USERNAME" with the respective login names). If you have a global IP
  1656. address, no further configuration is required.
  1657. For more detailed setup instructions, see https://gnunet.org/installation
  1658. Optionally, download and compile gnunet-gtk to get a GUI for
  1659. file-sharing and configuration. This is particularly recommended
  1660. if your network setup is non-trivial, as gnunet-setup can be
  1661. used to test in the GUI if your network configuration is working.
  1662. gnunet-setup should be run as the "gnunet" user under X. As it
  1663. does very little with the network, running it as "root" is likely
  1664. also harmless. You can also run it as a normal user, but then
  1665. you have to copy ~/.gnunet/gnunet.conf" over to the "gnunet" user's
  1666. home directory in the end.
  1667. Once you have configured your peer, run (as the 'gnunet' user)
  1668. gnunet-arm -s
  1669. to start the peer. You can then run the various GNUnet-tools as
  1670. your "normal" user (who should only be in the group 'gnunet').
  1671. ********************************************])