configure.ac 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. # This file is part of GNUnet.
  2. # (C) 2001--2010 Christian Grothoff (and other contributing authors)
  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 2, 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., 59 Temple Place - Suite 330,
  17. # Boston, MA 02111-1307, 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.9.0pre3],[bug-gnunet@gnu.org])
  26. AC_CANONICAL_TARGET
  27. AC_CANONICAL_HOST
  28. AC_CANONICAL_SYSTEM
  29. AM_INIT_AUTOMAKE([gnunet], [0.9.0pre3])
  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_PROG_AWK
  34. AC_PROG_CC
  35. AC_PROG_CPP
  36. AC_PROG_CXX
  37. AC_PROG_OBJC
  38. AC_PROG_INSTALL
  39. AC_PROG_LN_S
  40. AC_PROG_MAKE_SET
  41. AM_PROG_CC_C_O
  42. LT_INIT([disable-static dlopen win32-dll])
  43. LTDL_INIT
  44. AC_SUBST(LTDLINCL)
  45. AC_SUBST(LIBLTDL)
  46. AC_SUBST(MKDIR_P)
  47. # large file support
  48. AC_SYS_LARGEFILE
  49. AC_FUNC_FSEEKO
  50. if test "$enable_shared" = "no"
  51. then
  52. AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])
  53. fi
  54. CFLAGS="-Wall $CFLAGS"
  55. # use '-fno-strict-aliasing', but only if the compiler can take it
  56. if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1;
  57. then
  58. CFLAGS="-fno-strict-aliasing $CFLAGS"
  59. fi
  60. # Use Linux interface name unless the OS has a different preference
  61. DEFAULT_INTERFACE="\"eth0\""
  62. # Check system type
  63. case "$host_os" in
  64. *darwin* | *rhapsody* | *macosx*)
  65. AC_DEFINE_UNQUOTED(DARWIN,1,[This is an Apple Darwin system])
  66. CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS"
  67. CFLAGS="-no-cpp-precomp -fno-common $CFLAGS"
  68. AC_MSG_WARN([The VPN application cannot be compiled on your OS])
  69. build_target="darwin"
  70. DEFAULT_INTERFACE="\"en0\""
  71. LIBPREFIX=
  72. DLLDIR=lib
  73. ;;
  74. linux*)
  75. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
  76. build_target="linux"
  77. LIBPREFIX=
  78. DLLDIR=lib
  79. AC_PATH_XTRA
  80. ;;
  81. freebsd*)
  82. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  83. AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
  84. CFLAGS="-D_THREAD_SAFE $CFLAGS"
  85. build_target="freebsd"
  86. LIBPREFIX=
  87. DLLDIR=lib
  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. ;;
  97. netbsd*)
  98. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  99. AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
  100. LIBPREFIX=
  101. DLLDIR=lib
  102. ;;
  103. *solaris*)
  104. AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
  105. AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
  106. AC_CHECK_LIB(resolv, res_init)
  107. AC_CHECK_LIB(rt, nanosleep)
  108. build_target="solaris"
  109. LIBPREFIX=
  110. DLLDIR=lib
  111. ;;
  112. *arm-linux*)
  113. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
  114. CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
  115. build_target="linux"
  116. LIBPREFIX=
  117. DLLDIR=lib
  118. ;;
  119. *cygwin*)
  120. AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
  121. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  122. AC_CHECK_LIB(intl, gettext)
  123. LDFLAGS="$LDFLAGS -no-undefined"
  124. CFLAGS="-mms-bitfields $CFLAGS"
  125. build_target="cygwin"
  126. LIBPREFIX=lib
  127. DLLDIR=bin
  128. AC_PROG_CXX
  129. ;;
  130. *mingw*)
  131. AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
  132. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  133. AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
  134. AC_CHECK_LIB(intl, gettext)
  135. LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols"
  136. LIBS="$LIBS -lws2_32 -lplibc"
  137. CFLAGS="-mms-bitfields $CFLAGS"
  138. CPPFLAGS="-D_WIN32_WINNT=0x0501 $CPPFLAGS"
  139. build_target="mingw"
  140. AC_PROG_CXX
  141. LIBPREFIX=lib
  142. DLLDIR=bin
  143. ;;
  144. *)
  145. AC_MSG_RESULT(Unrecognised OS $host_os)
  146. AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
  147. ;;
  148. esac
  149. AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
  150. AC_SUBST(DEFAULT_INTERFACE)
  151. AC_MSG_CHECKING([for build target])
  152. AM_CONDITIONAL(DARWIN, test "$build_target" = "darwin")
  153. AM_CONDITIONAL(CYGWIN, test "$build_target" = "cygwin")
  154. AM_CONDITIONAL(MINGW, test "$build_target" = "mingw")
  155. AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
  156. AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
  157. AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
  158. AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
  159. AC_MSG_RESULT([$build_target])
  160. AC_SUBST(build_target)
  161. AM_CONDITIONAL([am__fastdepOBJC], false)
  162. AC_UNALIGNED_64_ACCESS
  163. # some other checks for standard libs
  164. AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
  165. AC_CHECK_LIB(socket, socket)
  166. AC_CHECK_LIB(m, log)
  167. AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
  168. # 'save' libs; only those libs found so far will be
  169. # linked against _everywhere_. For the others, we
  170. # will be more selective!
  171. SAVE_LIBS=$LIBS
  172. # libgcrypt
  173. gcrypt=0
  174. AM_PATH_LIBGCRYPT(1.2.0, gcrypt=1)
  175. AC_CHECK_DECLS([gcry_mpi_lshift], [], [], [[#include <gcrypt.h>]])
  176. if test $gcrypt = 0
  177. then
  178. AC_MSG_ERROR([GNUnet needs libgcrypt])
  179. fi
  180. if test $build = $target
  181. then
  182. AC_MSG_CHECKING([for working HMAC])
  183. AC_LANG_PUSH(C)
  184. LIBS="$LIBS $LIBGCRYPT_LIBS"
  185. CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
  186. AC_RUN_IFELSE(
  187. [AC_LANG_PROGRAM([#include <gcrypt.h>], [[
  188. gcry_md_hd_t mac;
  189. unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
  190. 0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
  191. 0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde };
  192. unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
  193. unsigned char result[] = {0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
  194. 0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
  195. 0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
  196. 0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
  197. 0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
  198. 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3};
  199. if (!gcry_check_version (GCRYPT_VERSION))
  200. return 1;
  201. gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
  202. gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
  203. if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
  204. return 2;
  205. gcry_md_setkey (mac, key, sizeof (key));
  206. gcry_md_write (mac, data, sizeof (data));
  207. if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
  208. return 3;
  209. gcry_md_close (mac);
  210. return 0;
  211. ]])],
  212. [AC_MSG_RESULT([yes])],
  213. [
  214. if test $? = 3
  215. then
  216. 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.])
  217. else
  218. AC_MSG_FAILURE([HMAC test failed])
  219. fi
  220. ])
  221. AC_LANG_POP(C)
  222. fi # $build = $target
  223. # libcurl
  224. LIBCURL_CHECK_CONFIG(,7.20.1,,AC_MSG_ERROR([GNUnet requires libcurl >= 7.20.1]))
  225. # restore LIBS
  226. LIBS=$SAVE_LIBS
  227. AC_ARG_ENABLE([ats],
  228. [AS_HELP_STRING([--enable-ats], [enable ATS code])],
  229. [enable_ats=${enableval}],
  230. [enable_ats=no])
  231. if test x${enable_ats} = xyes
  232. then
  233. AC_CHECK_HEADERS([glpk.h],[glpk=true],[gplk=false])
  234. AC_CHECK_LIB([glpk],[glp_create_prob],,[gplk=false])
  235. # GLPK must support atm MLP presolving, version >= 4.32
  236. AC_CHECK_MEMBERS(glp_iocp.presolve,,[gplk=false],[[#include <glpk.h>]])
  237. if test x$gplk = xfalse
  238. then
  239. AM_CONDITIONAL(HAVE_LIBGLPK, false)
  240. AC_MSG_WARN([GNUnet requires GLPK >= 4.32])
  241. else
  242. AM_CONDITIONAL(HAVE_LIBGLPK, true)
  243. AC_DEFINE([HAVE_LIBGLPK],[1],[Have GLPK])
  244. fi
  245. else
  246. AM_CONDITIONAL(HAVE_LIBGLPK, false)
  247. AC_MSG_RESULT([no])
  248. fi
  249. # test for kvm and kstat (for CPU stats under BSD/Solaris)
  250. AC_CHECK_LIB([kvm],[kvm_open])
  251. AC_CHECK_LIB([kstat],[kstat_open])
  252. # test for libextractor
  253. extractor=0
  254. AC_MSG_CHECKING(for libextractor)
  255. AC_ARG_WITH(extractor,
  256. [ --with-extractor=PFX base of libextractor installation],
  257. [AC_MSG_RESULT([$with_extractor])
  258. case $with_extractor in
  259. no)
  260. ;;
  261. yes)
  262. AC_CHECK_HEADERS(extractor.h,
  263. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  264. extractor=1))
  265. ;;
  266. *)
  267. LDFLAGS="-L$with_extractor/lib $LDFLAGS"
  268. CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
  269. AC_CHECK_HEADERS(extractor.h,
  270. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  271. EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
  272. extractor=1))
  273. ;;
  274. esac
  275. ],
  276. [AC_MSG_RESULT([--with-extractor not specified])
  277. AC_CHECK_HEADERS(extractor.h,
  278. AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
  279. extractor=1))])
  280. if test "$extractor" != 1
  281. then
  282. AC_MSG_ERROR([GNUnet requires libextractor])
  283. fi
  284. # restore LIBS
  285. LIBS=$SAVE_LIBS
  286. # Checks for standard header files.
  287. AC_HEADER_DIRENT
  288. AC_HEADER_STDC
  289. # Check for headers that are ALWAYS required
  290. 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]))
  291. # Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there)
  292. AC_CHECK_HEADERS([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 netinet/in_systm.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 endian.h sys/endian.h])
  293. SAVE_LDFLAGS=$LDFLAGS
  294. SAVE_CPPFLAGS=$CPPFLAGS
  295. # test for sqlite
  296. sqlite=false
  297. AC_MSG_CHECKING(for SQLite)
  298. AC_ARG_WITH(sqlite,
  299. [ --with-sqlite=PFX base of SQLite installation],
  300. [AC_MSG_RESULT("$with_sqlite")
  301. case $with_sqlite in
  302. no)
  303. ;;
  304. yes)
  305. AC_CHECK_HEADERS(sqlite3.h,
  306. sqlite=true)
  307. ;;
  308. *)
  309. LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
  310. CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
  311. AC_CHECK_HEADERS(sqlite3.h,
  312. EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
  313. SQLITE_LDFLAGS="-L$with_sqlite/lib"
  314. SQLITE_CPPFLAGS="-I$with_sqlite/include"
  315. sqlite=true)
  316. LDFLAGS=$SAVE_LDFLAGS
  317. CPPFLAGS=$SAVE_CPPFLAGS
  318. ;;
  319. esac
  320. ],
  321. [AC_MSG_RESULT([--with-sqlite not specified])
  322. AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
  323. AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
  324. AC_SUBST(SQLITE_CPPFLAGS)
  325. AC_SUBST(SQLITE_LDFLAGS)
  326. # test for postgres
  327. postgres=false
  328. AC_MSG_CHECKING(for postgres)
  329. AC_ARG_WITH(postgres,
  330. [ --with-postgres=PFX base of postgres installation],
  331. [AC_MSG_RESULT("$with_postgres")
  332. case $with_postgres in
  333. no)
  334. ;;
  335. yes)
  336. AC_CHECK_HEADERS(postgresql/libpq-fe.h,
  337. postgres=true)
  338. ;;
  339. *)
  340. LDFLAGS="-L$with_postgres/lib $LDFLAGS"
  341. CPPFLAGS="-I$with_postgres/include $CPPFLAGS"
  342. AC_CHECK_HEADERS(postgresql/libpq-fe.h,
  343. EXT_LIB_PATH="-L$with_postgres/lib $EXT_LIB_PATH"
  344. POSTGRES_LDFLAGS="-L$with_postgres/lib"
  345. POSTGRES_CPPFLAGS="-I$with_postgres/include"
  346. postgres=true)
  347. LDFLAGS=$SAVE_LDFLAGS
  348. CPPFLAGS=$SAVE_CPPFLAGS
  349. ;;
  350. esac
  351. ],
  352. [AC_MSG_RESULT([--with-postgres not specified])
  353. AC_CHECK_HEADERS(postgresql/libpq-fe.h, postgres=true)])
  354. AM_CONDITIONAL(HAVE_POSTGRES, test x$postgres = xtrue)
  355. AC_SUBST(POSTGRES_CPPFLAGS)
  356. AC_SUBST(POSTGRES_LDFLAGS)
  357. # test for libz (maybe required for linking mysql)
  358. zlib=1
  359. AC_CHECK_LIB(z, compress,,zlib=0)
  360. AM_CONDITIONAL(HAVE_ZLIB, test x$zlib = x1)
  361. if test "$zlib" != 1
  362. then
  363. AC_MSG_ERROR([GNUnet requires zlib])
  364. fi
  365. # mysql & windows
  366. AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
  367. AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
  368. if test "$build_target" = "mingw"
  369. then
  370. CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
  371. fi
  372. # test for mysql
  373. mysql=false
  374. mysqlfail=false
  375. SAVE_LDFLAGS=$LDFLAGS
  376. SAVE_CPPFLAGS=$CPPFLAGS
  377. AC_MSG_CHECKING(for mysql)
  378. AC_ARG_WITH(mysql,
  379. [ --with-mysql=PFX base of MySQL installation],
  380. [AC_MSG_RESULT("$with_mysql")
  381. if test "$with_mysql" != "no"
  382. then
  383. if test "$with_mysql" != "yes"
  384. then
  385. LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
  386. CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
  387. fi
  388. AC_CHECK_HEADERS(mysql/mysql.h,
  389. AC_CHECK_LIB(mysqlclient, mysql_init,
  390. MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
  391. MYSQL_CPPFLAGS="-I$with_mysql/include"
  392. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  393. fi
  394. ],
  395. [AC_MSG_RESULT([--with-mysql not specified])
  396. LDFLAGS="-L/usr/lib/mysql $LDFLAGS $ZLIBS"
  397. AC_CHECK_LIB(mysqlclient, mysql_init,
  398. [AC_CHECK_HEADERS(mysql/mysql.h,
  399. MYSQL_LDFLAGS="-L/usr/lib/mysql"
  400. mysql=true
  401. , [], [$CYGWIN_MYSQL_MAGIC])])
  402. ])
  403. AC_SUBST(MYSQL_LDFLAGS)
  404. AC_SUBST(MYSQL_CPPFLAGS)
  405. # additional version check for mysql
  406. AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
  407. if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
  408. then
  409. AC_MSG_CHECKING(mysql version)
  410. AC_RUN_IFELSE([AC_LANG_PROGRAM(
  411. [[$CYGWIN_MYSQL_MAGIC
  412. #include <mysql/mysql.h>]],
  413. [[if (MYSQL_VERSION_ID < 40100)
  414. return(-1);
  415. else
  416. return(0);
  417. ]])
  418. ],mysql=true,mysql=false)
  419. if test "$mysql" = "false"
  420. then
  421. mysqlfail=true
  422. AC_MSG_RESULT([fail, >= 4.1 required])
  423. else
  424. AC_MSG_RESULT(ok)
  425. fi
  426. fi
  427. AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
  428. AM_CONDITIONAL(HAVE_MYSQLE, test "0" = "1")
  429. # restore LIBS
  430. LIBS=$SAVE_LIBS
  431. LDFLAGS=$SAVE_LDFLAGS
  432. CPPFLAGS=$SAVE_CPPFLAGS
  433. if test "$sqlite" = 0 -a "$mysql" = 0
  434. then
  435. AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
  436. fi
  437. # libmicrohttpd
  438. lmhd=0
  439. AC_MSG_CHECKING([for libmicrohttpd])
  440. AC_ARG_WITH(microhttpd,
  441. [ --with-microhttpd=PFX base of libmicrohttpd installation],
  442. [AC_MSG_RESULT([$with_microhttpd])
  443. case $with_microhttpd in
  444. no)
  445. ;;
  446. yes)
  447. AC_CHECK_HEADERS([microhttpd.h],
  448. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  449. AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
  450. lmhd=1),
  451. [],[#include "src/include/platform.h"
  452. #include <microhttpd.h>]),,
  453. [#include "src/include/platform.h"])
  454. ;;
  455. *)
  456. LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
  457. CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
  458. AC_CHECK_HEADERS(microhttpd.h,
  459. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  460. AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
  461. EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
  462. lmhd=1),
  463. [],[#include "src/include/platform.h"
  464. #include <microhttpd.h>]),,
  465. [#include "src/include/platform.h"])
  466. ;;
  467. esac
  468. ],
  469. [AC_MSG_RESULT([--with-microhttpd not specified])
  470. AC_CHECK_HEADERS([microhttpd.h],
  471. AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
  472. AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
  473. lmhd=1),
  474. [],[#include "src/include/platform.h"
  475. #include <microhttpd.h>]),,
  476. [#include "src/include/platform.h"])])
  477. AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
  478. AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
  479. # restore LIBS
  480. LIBS=$SAVE_LIBS
  481. # check for python & pexpect (used for some testcases only)
  482. AM_PATH_PYTHON([2.5],, [:])
  483. AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
  484. if test "$PYTHON" != :
  485. then
  486. AC_MSG_CHECKING([for pexpect])
  487. $PYTHON -c "import pexpect" > /dev/null 2> /dev/null
  488. PYEX=$?
  489. AM_CONDITIONAL(HAVE_PYTHON_PEXPECT, test $PYEX -eq 0)
  490. if test $PYEX -eq 0
  491. then
  492. AC_MSG_RESULT([yes])
  493. else
  494. AC_MSG_RESULT([not found])
  495. fi
  496. else
  497. AM_CONDITIONAL(HAVE_PYTHON_PEXPECT, 0)
  498. fi
  499. # check for gettext
  500. AM_GNU_GETTEXT([external])
  501. AM_GNU_GETTEXT_VERSION([0.16.1])
  502. # check for iconv
  503. AM_ICONV
  504. # Checks for standard typedefs, structures, and compiler characteristics.
  505. AC_TYPE_PID_T
  506. AC_TYPE_SIZE_T
  507. AC_TYPE_MODE_T
  508. AC_HEADER_TIME
  509. AC_HEADER_STAT
  510. AC_HEADER_STDBOOL
  511. AC_STRUCT_TM
  512. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  513. [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
  514. ],
  515. [],
  516. [
  517. #include <sys/types.h>
  518. #include <sys/socket.h>
  519. #include <netinet/in.h>
  520. ])
  521. # Checks for library functions.
  522. AC_FUNC_CLOSEDIR_VOID
  523. AC_FUNC_FORK
  524. AC_FUNC_VFORK
  525. AC_PROG_GCC_TRADITIONAL
  526. AC_FUNC_MEMCMP
  527. AC_FUNC_SELECT_ARGTYPES
  528. AC_FUNC_CHOWN
  529. AC_TYPE_SIGNAL
  530. AC_FUNC_STAT
  531. AC_FUNC_STRFTIME
  532. AC_FUNC_VPRINTF
  533. AC_HEADER_SYS_WAIT
  534. AC_TYPE_OFF_T
  535. AC_TYPE_UID_T
  536. AC_CHECK_FUNCS([floor gethostname memmove rmdir strncasecmp strrchr strtol atoll dup2 fdatasync ftruncate gettimeofday memset mkdir mkfifo select socket strcasecmp strchr strdup strerror strstr clock_gettime getrusage rand uname setlocale getcwd mktime gmtime_r gmtime strlcpy strlcat ftruncate stat64 sbrk mmap mremap setrlimit sysconf gethostbyaddr initgroups getifaddrs freeifaddrs getnameinfo getaddrinfo inet_ntoa localtime_r nl_langinfo putenv realpath strndup gethostbyname2 gethostbyname getpeerucred getpeereid])
  537. # restore LIBS
  538. LIBS=$SAVE_LIBS
  539. gn_user_home_dir="~/.gnunet"
  540. AC_ARG_WITH(user-home-dir,
  541. AC_HELP_STRING(
  542. [--with-user-home-dir=DIR],
  543. [default user home directory (~/.gnunet)]),
  544. [gn_user_home_dir=$withval])
  545. AC_SUBST(GN_USER_HOME_DIR, $gn_user_home_dir)
  546. gn_daemon_home_dir="/var/lib/gnunet"
  547. AC_ARG_WITH(daemon-home-dir,
  548. AC_HELP_STRING(
  549. [--with-daemon-home-dir=DIR],
  550. [default daemon home directory (/var/lib/gnunet)]),
  551. [gn_daemon_home_dir=$withval])
  552. AC_SUBST(GN_DAEMON_HOME_DIR, $gn_daemon_home_dir)
  553. gn_daemon_config_dir="/etc"
  554. AC_ARG_WITH(daemon-config-dir,
  555. AC_HELP_STRING(
  556. [--with-daemon-config-dir=DIR],
  557. [default daemon config directory (/etc)]),
  558. [gn_daemon_config_dir=$withval])
  559. AC_SUBST(GN_DAEMON_CONFIG_DIR, $gn_daemon_config_dir)
  560. GN_INTLINCL=""
  561. GN_LIBINTL="$LTLIBINTL"
  562. AC_ARG_ENABLE(framework, [ --enable-framework enable Mac OS X framework build helpers],enable_framework_build=$enableval)
  563. AM_CONDITIONAL(WANT_FRAMEWORK, test x$enable_framework_build = xyes)
  564. if test x$enable_framework_build = xyes
  565. then
  566. AC_DEFINE([FRAMEWORK_BUILD], 1, [Build a Mac OS X Framework])
  567. GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
  568. GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
  569. AC_LIB_APPENDTOVAR([CPPFLAGS], [$GN_INTLINCL])
  570. fi
  571. GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
  572. GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
  573. AC_SUBST(GN_LIB_LDFLAGS)
  574. AC_SUBST(GN_PLUGIN_LDFLAGS)
  575. AC_SUBST(GN_INTLINCL)
  576. AC_SUBST(GN_LIBINTL)
  577. AC_SUBST(CPPFLAGS)
  578. AC_SUBST(LIBS)
  579. AC_SUBST(LDFLAGS)
  580. AC_SUBST(EXT_LIB_PATH)
  581. AC_SUBST(EXT_LIBS)
  582. AC_SUBST(LIBPREFIX)
  583. AC_SUBST(DLLDIR)
  584. AC_SUBST(EXT_LIB_PATH)
  585. # should 'make check' run tests?
  586. AC_MSG_CHECKING(whether to run tests)
  587. AC_ARG_ENABLE([testruns],
  588. [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])],
  589. [enable_tests_run=${enableval}],
  590. [enable_tests_run=yes])
  591. AC_MSG_RESULT($enable_test_run)
  592. AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"])
  593. # should expensive tests be run?
  594. AC_MSG_CHECKING(whether to run expensive tests)
  595. AC_ARG_ENABLE([expensivetests],
  596. [AS_HELP_STRING([--enable-expensive-tests], [enable running expensive testcases])],
  597. [enable_expensive=${enableval}],
  598. [enable_expensive=no])
  599. AC_MSG_RESULT($enable_expensive)
  600. AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
  601. # should benchmarks be run?
  602. AC_MSG_CHECKING(whether to run benchmarks during make check)
  603. AC_ARG_ENABLE([benchmarks],
  604. [AS_HELP_STRING([--enable-benchmarks], [enable running benchmarks during make check])],
  605. [enable_benchmarks=${enableval}],
  606. [enable_benchmarks=no])
  607. AC_MSG_RESULT($enable_benchmarks)
  608. AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
  609. # should experimental code be compiled (code that may not yet compile)?
  610. AC_MSG_CHECKING(whether to compile experimental code)
  611. AC_ARG_ENABLE([experimental],
  612. [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
  613. [enable_experimental=${enableval}],
  614. [enable_experimental=no])
  615. AC_MSG_RESULT($enable_experimental)
  616. AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
  617. # should malicious code be compiled (code used for testing with malicious peers)
  618. AC_MSG_CHECKING(whether to compile malicious code)
  619. AC_ARG_ENABLE([malicious],
  620. [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code (only for developers for testing)])],
  621. [enable_malicious=${enableval}],
  622. [enable_malicious=no])
  623. AC_MSG_RESULT($enable_malicious)
  624. AM_CONDITIONAL([HAVE_MALICIOUS], [test "x$enable_malicious" = "xyes"])
  625. if test "$enable_malicious" = "yes"
  626. then
  627. AC_DEFINE([HAVE_MALICIOUS],[1],[include malicious code])
  628. else
  629. AC_DEFINE([HAVE_MALICIOUS],[0],[disable malicious code])
  630. fi
  631. # should code be enabled that works around missing OS functionality on Windows?
  632. # used for test cases
  633. if test $build_target = "mingw"
  634. then
  635. workarounds=1
  636. else
  637. AC_MSG_CHECKING(whether to enable windows workarounds)
  638. AC_ARG_ENABLE([windows_workarounds],
  639. [AS_HELP_STRING([--enable-windows_workarounds], [enable workarounds used on Windows (only useful for test cases)])],
  640. [enable_workarounds=${enableval}],
  641. [enable_workarounds=no])
  642. AC_MSG_RESULT($enable_workarounds)
  643. if test x$enable_windows_workarounds = "xyes"
  644. then
  645. workarounds=1
  646. else
  647. workarounds=0
  648. fi
  649. fi
  650. AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable workarounds used on Windows (only useful for test cases)])
  651. # gcov compilation
  652. AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
  653. AC_ARG_ENABLE([coverage],
  654. AS_HELP_STRING([--enable-coverage],
  655. [compile the library with code coverage support]),
  656. [use_gcov=${enableval}],
  657. [use_gcov=no])
  658. AC_MSG_RESULT($use_gcov)
  659. AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
  660. AC_CONFIG_FILES([
  661. Makefile
  662. contrib/Makefile
  663. doc/Makefile
  664. doc/man/Makefile
  665. m4/Makefile
  666. po/Makefile.in
  667. src/Makefile
  668. src/arm/Makefile
  669. src/block/Makefile
  670. src/core/Makefile
  671. src/datacache/Makefile
  672. src/datastore/Makefile
  673. src/dht/Makefile
  674. src/dv/Makefile
  675. src/fragmentation/Makefile
  676. src/fs/Makefile
  677. src/hello/Makefile
  678. src/include/Makefile
  679. src/include/gnunet_directories.h
  680. src/hostlist/Makefile
  681. src/mesh/Makefile
  682. src/nat/Makefile
  683. src/nse/Makefile
  684. src/peerinfo/Makefile
  685. src/peerinfo-tool/Makefile
  686. src/statistics/Makefile
  687. src/template/Makefile
  688. src/testing/Makefile
  689. src/topology/Makefile
  690. src/transport/Makefile
  691. src/util/Makefile
  692. src/vpn/Makefile
  693. src/chat/Makefile
  694. pkgconfig/Makefile
  695. pkgconfig/gnunetarm.pc
  696. pkgconfig/gnunetblock.pc
  697. pkgconfig/gnunetcore.pc
  698. pkgconfig/gnunetdatacache.pc
  699. pkgconfig/gnunetdatastore.pc
  700. pkgconfig/gnunetdht.pc
  701. pkgconfig/gnunetdhtlog.pc
  702. pkgconfig/gnunetdv.pc
  703. pkgconfig/gnunetfragmentation.pc
  704. pkgconfig/gnunetfs.pc
  705. pkgconfig/gnunethello.pc
  706. pkgconfig/gnunetpeerinfo.pc
  707. pkgconfig/gnunetstatistics.pc
  708. pkgconfig/gnunettesting.pc
  709. pkgconfig/gnunettransport.pc
  710. pkgconfig/gnunetutil.pc
  711. ])
  712. AC_OUTPUT
  713. # Finally: summary!
  714. # warn user if mysql found but not used due to version
  715. if test "$mysqlfail" = "true"
  716. then
  717. AC_MSG_NOTICE([NOTICE: MySQL found, but too old. MySQL support will not be compiled.])
  718. fi
  719. # sqlite
  720. if test "x$sqlite" = "x0"
  721. then
  722. AC_MSG_NOTICE([NOTICE: sqlite not found. sqLite support will not be compiled.])
  723. fi
  724. if test "x$lmhd" != "x1"
  725. then
  726. AC_MSG_NOTICE([NOTICE: libmicrohttpd not found, http transport will not be installed.])
  727. fi
  728. AC_MSG_NOTICE([NOTICE: Database support is set to MySQL: $mysql, SQLite: $sqlite, Postgres: $postgres])
  729. if test "$enable_framework_build" = "yes"
  730. then
  731. AC_MSG_NOTICE([NOTICE: Mac OS X framework build enabled.])
  732. fi
  733. AC_MSG_NOTICE([********************************************
  734. You can compile GNUnet with
  735. make
  736. now. After that, run (if necessary as 'root')
  737. make install
  738. to install everything. You may want to create a new user account
  739. to run the GNUnet service:
  740. adduser gnunet
  741. You also need to create an configuration file that should
  742. specify the path where GNUnet should store data. For example,
  743. you could store in "/etc/gnunet.conf" the following lines:
  744. [[PATHS]]
  745. SERVICEHOME = /var/lib/gnunet
  746. DEFAULTCONFIG = /etc/gnunet.conf
  747. Now, in order to start your peer, run as the 'gnunet' user
  748. gnunet-arm -s
  749. Each GNUnet user should also create an (at least initially) empty
  750. configuration file:
  751. mkdir $HOME/.gnunet/
  752. touch $HOME/.gnunet/gnunet.conf
  753. Optionally, download and compile:
  754. - gnunet-gtk to get a GUI for file-sharing.
  755. - gnunet-setup to get a GUI for configuration.
  756. ********************************************])