You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

410 lines
12 KiB

  1. # This file is part of GNUnet.
  2. # (C) 2001-2019 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., 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. AC_PREREQ(2.61)
  23. AC_INIT([gnunet-secushare],[0.11.0],[bug-gnunet@gnu.org])
  24. AM_INIT_AUTOMAKE
  25. AC_CONFIG_HEADERS([gnunet_secushare_config.h])
  26. AC_CONFIG_MACRO_DIR([m4])
  27. AH_TOP([#define _GNU_SOURCE 1])
  28. AC_ISC_POSIX
  29. AC_PROG_AWK
  30. AC_PROG_CC
  31. AC_PROG_CPP
  32. AC_PROG_INSTALL
  33. AC_PROG_LN_S
  34. AC_PROG_MAKE_SET
  35. AC_LIBTOOL_WIN32_DLL
  36. AC_PROG_CC
  37. AM_PROG_CC_STDC
  38. AC_HEADER_STDC
  39. AC_CANONICAL_HOST
  40. AC_SUBST(MKDIR_P)
  41. # dynamic libraries/plugins
  42. AC_DISABLE_STATIC
  43. AC_PROG_LIBTOOL
  44. AC_SYS_LARGEFILE
  45. AC_FUNC_FSEEKO
  46. CFLAGS="-Wall $CFLAGS"
  47. # use '-fno-strict-aliasing', but only if the compiler can take it
  48. if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1;
  49. then
  50. CFLAGS="-fno-strict-aliasing $CFLAGS"
  51. fi
  52. # Check system type
  53. case "$host_os" in
  54. *darwin* | *rhapsody* | *macosx*)
  55. AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
  56. CFLAGS="-no-cpp-precomp $CFLAGS"
  57. LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS"
  58. ;;
  59. linux*)
  60. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
  61. ;;
  62. freebsd*)
  63. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  64. AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
  65. ;;
  66. openbsd*)
  67. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  68. AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
  69. ;;
  70. netbsd*)
  71. AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
  72. AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
  73. ;;
  74. *solaris*)
  75. AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
  76. AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
  77. build_target="solaris"
  78. ;;
  79. *arm-linux*)
  80. AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
  81. ;;
  82. *cygwin*)
  83. AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
  84. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  85. AC_CHECK_LIB(intl, gettext)
  86. LDFLAGS="$LDFLAGS -no-undefined"
  87. build_target="cygwin"
  88. ;;
  89. *mingw*)
  90. AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
  91. AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
  92. AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
  93. AC_CHECK_LIB(intl, gettext)
  94. LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols -lws2_32"
  95. CFLAGS="-mms-bitfields $CFLAGS"
  96. build_target="mingw"
  97. ;;
  98. *)
  99. AC_MSG_RESULT(Unrecognised OS $host_os)
  100. AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
  101. ;;
  102. esac
  103. AM_CONDITIONAL(MINGW, test "$build_target" = "mingw")
  104. # check for gettext
  105. AM_GNU_GETTEXT_VERSION([0.18.1])
  106. AM_GNU_GETTEXT([external])
  107. AC_CHECK_HEADERS([errno.h stdio.h unistd.h locale.h sys/stat.h sys/types.h langinfo.h libintl.h unistd.h stddef.h argz.h sys/socket.h netinet/in.h stdarg.h])
  108. # test for GNUnet core
  109. gnunet=0
  110. lookin=${prefix}
  111. backup_LDFLAGS="$LDFLAGS"
  112. backup_CPPFLAGS="$CPPFLAGS"
  113. GNUNET_LDFLAGS=""
  114. GNUNET_CPPFLAGS=""
  115. AC_MSG_CHECKING(for GNUnet core)
  116. AC_ARG_WITH(gnunet,
  117. [ --with-gnunet=PFX Base of GNUnet installation],
  118. [AC_MSG_RESULT([$with_gnunet])
  119. case $with_gnunet in
  120. no)
  121. lookin=""
  122. ;;
  123. yes)
  124. lookin="${prefix}"
  125. ;;
  126. *)
  127. lookin="$with_gnunet"
  128. ;;
  129. esac
  130. ],
  131. [
  132. AC_MSG_RESULT([--with-gnunet not specified])
  133. PKG_CHECK_MODULES([GNUNET], [gnunetutil >= 0.9.0], gnunet=1)
  134. ]
  135. )
  136. if test "x$gnunet" == "x0" -a ! "x$lookin" == "x"
  137. then
  138. AC_MSG_CHECKING(for GNUnet util library in $lookin)
  139. GNUNET_LDFLAGS="-L${lookin}/lib"
  140. GNUNET_CPPFLAGS="-I${lookin}/include"
  141. LDFLAGS="$GNUNET_LDFLAGS $backup_LDFLAGS"
  142. CPPFLAGS="$GNUNET_CPPFLAGS $backup_CPPFLAGS"
  143. AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
  144. AC_CHECK_LIB([gnunetutil], [GNUNET_xfree_],
  145. [
  146. gnunet=1
  147. EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH"
  148. ]
  149. ),,[#include <gnunet/platform.h>]
  150. )
  151. fi
  152. if test "x$gnunet" == "x0"
  153. then
  154. AC_MSG_ERROR([gnunet-ext requires GNUnet])
  155. fi
  156. # gcov compilation
  157. AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
  158. AC_ARG_ENABLE([coverage],
  159. AS_HELP_STRING([--enable-coverage],
  160. [compile the library with code coverage support]),
  161. [use_gcov=${enableval}],
  162. [use_gcov=no])
  163. AC_MSG_RESULT($use_gcov)
  164. AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
  165. # should 'make check' run tests?
  166. AC_MSG_CHECKING(whether to run tests)
  167. AC_ARG_ENABLE([testruns],
  168. [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])],
  169. [enable_tests_run=${enableval}],
  170. [enable_tests_run=yes])
  171. AC_MSG_RESULT($enable_test_run)
  172. AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"])
  173. # should gnunet-testing be compiled
  174. AC_MSG_CHECKING(wether to compile gnunet-testing)
  175. AC_ARG_ENABLE([testing],
  176. [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])],
  177. [enable_testing=${enableval}],
  178. [enable_testing=yes])
  179. AC_MSG_RESULT($enable_testing)
  180. AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"])
  181. # should experimental code be compiled (code that may not yet compile)?
  182. AC_MSG_CHECKING(whether to compile experimental code)
  183. AC_ARG_ENABLE([experimental],
  184. [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
  185. [enable_experimental=${enableval}],
  186. [enable_experimental=no])
  187. AC_MSG_RESULT($enable_experimental)
  188. AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
  189. # Linker hardening options
  190. # Currently these options are ELF specific - you can't use this with MacOSX
  191. AC_ARG_ENABLE(linker-hardening,
  192. AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
  193. [if test x$enableval = xyes; then
  194. LDFLAGS="$LDFLAGS -z relro -z now"
  195. fi])
  196. SAVE_LDFLAGS=$LDFLAGS
  197. SAVE_CPPFLAGS=$CPPFLAGS
  198. # test for sqlite
  199. sqlite=false
  200. AC_MSG_CHECKING(for SQLite)
  201. AC_ARG_WITH(sqlite,
  202. [ --with-sqlite=PFX base of SQLite installation],
  203. [AC_MSG_RESULT("$with_sqlite")
  204. case $with_sqlite in
  205. no)
  206. ;;
  207. yes)
  208. AC_CHECK_HEADERS(sqlite3.h,
  209. sqlite=true)
  210. ;;
  211. *)
  212. LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
  213. CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
  214. AC_CHECK_HEADERS(sqlite3.h,
  215. EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
  216. SQLITE_LDFLAGS="-L$with_sqlite/lib"
  217. SQLITE_CPPFLAGS="-I$with_sqlite/include"
  218. sqlite=true)
  219. LDFLAGS=$SAVE_LDFLAGS
  220. CPPFLAGS=$SAVE_CPPFLAGS
  221. ;;
  222. esac
  223. ],
  224. [AC_MSG_RESULT([--with-sqlite not specified])
  225. AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
  226. AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
  227. AC_SUBST(SQLITE_CPPFLAGS)
  228. AC_SUBST(SQLITE_LDFLAGS)
  229. LDFLAGS=$SAVE_LDFLAGS
  230. CPPFLAGS=$SAVE_CPPFLAGS
  231. # test for postgres
  232. postgres=false
  233. # even running the check for postgres breaks emscripten ...
  234. AS_IF([test "$taler_only" != yes],
  235. [AX_LIB_POSTGRESQL([9.5],
  236. [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
  237. AC_CHECK_HEADERS([libpq-fe.h],
  238. postgres=true)
  239. ],
  240. [AC_MSG_RESULT([no postgres])])])
  241. AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
  242. LDFLAGS=$SAVE_LDFLAGS
  243. CPPFLAGS=$SAVE_CPPFLAGS
  244. # mysql & windows
  245. AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
  246. AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
  247. if test "$build_target" = "mingw"
  248. then
  249. CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
  250. fi
  251. # test for mysql
  252. mysql=false
  253. mysqlfail=false
  254. SAVE_LDFLAGS=$LDFLAGS
  255. SAVE_CPPFLAGS=$CPPFLAGS
  256. AC_MSG_CHECKING(for mysql)
  257. AC_ARG_WITH(mysql,
  258. [ --with-mysql=PFX base of MySQL installation],
  259. [AC_MSG_RESULT([$with_mysql])
  260. case $with_mysql in
  261. no)
  262. ;;
  263. yes|"")
  264. AC_CHECK_HEADERS(mysql/mysql.h,
  265. AC_CHECK_LIB(mysqlclient, mysql_init,
  266. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  267. ;;
  268. *)
  269. LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
  270. CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
  271. AC_CHECK_HEADERS(mysql/mysql.h,
  272. AC_CHECK_LIB(mysqlclient, mysql_init,
  273. MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
  274. MYSQL_CPPFLAGS="-I$with_mysql/include"
  275. mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
  276. ;;
  277. esac
  278. ],
  279. [AC_MSG_RESULT([--with-mysql not specified])
  280. if test -d "/usr/lib64/mysql"; then
  281. MYSQL_LIBDIR="/usr/lib64/mysql"
  282. elif test -d "/usr/lib/mysql"; then
  283. MYSQL_LIBDIR="/usr/lib/mysql"
  284. else
  285. MYSQL_LIBDIR="/usr/lib"
  286. fi
  287. LDFLAGS="-L$MYSQL_LIBDIR $LDFLAGS $ZLIBS"
  288. AC_CHECK_LIB(mysqlclient, mysql_init,
  289. [AC_CHECK_HEADERS(mysql/mysql.h,
  290. MYSQL_LDFLAGS="-L$MYSQL_LIBDIR"
  291. mysql=true
  292. , [], [$CYGWIN_MYSQL_MAGIC])])
  293. ])
  294. AC_SUBST(MYSQL_LDFLAGS)
  295. AC_SUBST(MYSQL_CPPFLAGS)
  296. # additional version check for mysql
  297. AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
  298. if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
  299. then
  300. AC_MSG_CHECKING(mysql version)
  301. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  302. [[$CYGWIN_MYSQL_MAGIC
  303. #include <mysql/mysql.h>]],
  304. [[
  305. #if (MYSQL_VERSION_ID < 40100)
  306. #error needs at least version >= 4.1
  307. #endif
  308. int main () { return 0; }
  309. ]])
  310. ],mysql=true,mysql=false)
  311. if test "$mysql" = "false"
  312. then
  313. mysqlfail=true
  314. AC_MSG_RESULT([fail, >= 4.1 required])
  315. else
  316. AC_MSG_RESULT(ok)
  317. fi
  318. fi
  319. AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
  320. AM_CONDITIONAL(HAVE_MYSQLE, false)
  321. # restore LIBS
  322. LIBS=$SAVE_LIBS
  323. LDFLAGS=$SAVE_LDFLAGS
  324. CPPFLAGS=$SAVE_CPPFLAGS
  325. if test "$sqlite" = 0 -a "$mysql" = 0
  326. then
  327. AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
  328. fi
  329. extra_logging=GNUNET_NO
  330. AC_ARG_ENABLE([logging],
  331. AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]),
  332. [AS_IF([test "x$enableval" = "xyes"], [],
  333. [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
  334. [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES]
  335. [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)])
  336. ], [])
  337. AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
  338. AC_SUBST(GNUNET_CPPFLAGS)
  339. AC_SUBST(GNUNET_LDFLAGS)
  340. LDFLAGS="$backup_LDFLAGS"
  341. CPPFLAGS="$backup_CPPFLAGS"
  342. AC_DEFINE_DIR([PACKAGE_DATA], [datarootdir], [The directory for installing read-only architecture-independent data])
  343. # Set PACKAGE_SOURCE_DIR in gnunet_ext_config.h.
  344. packagesrcdir=`cd $srcdir && pwd`
  345. AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir])
  346. AC_OUTPUT([ po/Makefile.in
  347. Makefile
  348. pkgconfig/Makefile
  349. src/Makefile
  350. src/include/Makefile
  351. src/multicast/Makefile
  352. src/multicast/multicast.conf
  353. src/psycutil/Makefile
  354. src/psyc/Makefile
  355. src/psyc/psyc.conf
  356. src/psycstore/Makefile
  357. src/psycstore/psycstore.conf
  358. src/social/Makefile
  359. src/social/social.conf
  360. pkgconfig/gnunetmulticast.pc
  361. pkgconfig/gnunetpsyc.pc
  362. pkgconfig/gnunetpsycstore.pc
  363. pkgconfig/gnunetsocial.pc
  364. ])