aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac821
1 files changed, 821 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 000000000..ff6a91d33
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,821 @@
1# This file is part of GNUnet.
2# (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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#
23AC_PREREQ(2.61)
24AC_INIT([gnunet], [0.9.0pre0],[bug-gnunet@gnu.org])
25AM_INIT_AUTOMAKE([gnunet], [0.9.0pre0])
26AC_CONFIG_HEADERS([gnunet_config.h])
27
28AH_TOP([#define _GNU_SOURCE 1])
29
30# Checks for programs.
31AC_CANONICAL_HOST
32AC_PROG_AWK
33AC_PROG_CC
34AC_PROG_CPP
35AC_PROG_CXX
36AC_PROG_OBJC
37AC_PROG_INSTALL
38AC_PROG_LN_S
39AC_PROG_MAKE_SET
40LT_CONFIG_LTDL_DIR([libltdl])
41AC_CANONICAL_HOST
42LT_INIT([disable-static dlopen win32-dll])
43LTDL_INIT
44AC_SUBST(LTDLINCL)
45AC_SUBST(LIBLTDL)
46AC_SUBST(MKDIR_P)
47
48# large file support
49AC_SYS_LARGEFILE
50AC_FUNC_FSEEKO
51
52
53if test "$enable_shared" = "no"
54then
55 AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])
56fi
57
58CFLAGS="-Wall $CFLAGS"
59# use '-fno-strict-aliasing', but only if the compiler can take it
60if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1;
61then
62 CFLAGS="-fno-strict-aliasing $CFLAGS"
63fi
64
65# Use Linux interface name unless the OS has a different preference
66DEFAULT_INTERFACE="\"eth0\""
67
68# Check system type
69case "$host_os" in
70*darwin* | *rhapsody* | *macosx*)
71 AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
72 CFLAGS="-no-cpp-precomp -fno-common $CFLAGS"
73 AC_MSG_WARN([The VPN application cannot be compiled on your OS])
74 build_target="macosx"
75 DEFAULT_INTERFACE="\"en0\""
76 LIBPREFIX=
77 DLLDIR=lib
78 ;;
79linux*)
80 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
81 build_target="linux"
82 LIBPREFIX=
83 DLLDIR=lib
84 AC_PATH_XTRA
85 ;;
86freebsd*)
87 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
88 AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
89 CFLAGS="-D_THREAD_SAFE $CFLAGS"
90 build_target="freebsd"
91 LIBPREFIX=
92 DLLDIR=lib
93 ;;
94openbsd*)
95 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
96 AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
97 LIBS=`echo $LIBS | sed -e "s/-ldl//"`
98 build_target="openbsd"
99 LIBPREFIX=
100 DLLDIR=lib
101 ;;
102netbsd*)
103 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
104 AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
105 LIBPREFIX=
106 DLLDIR=lib
107 ;;
108*solaris*)
109 AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
110 AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
111 AC_CHECK_LIB(resolv, res_init)
112 AC_CHECK_LIB(rt, nanosleep)
113 build_target="solaris"
114 LIBPREFIX=
115 DLLDIR=lib
116 ;;
117*arm-linux*)
118 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
119 CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
120 build_target="linux"
121 LIBPREFIX=
122 DLLDIR=lib
123 ;;
124*cygwin*)
125 AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
126 AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
127 AC_CHECK_LIB(intl, gettext)
128 LDFLAGS="$LDFLAGS -no-undefined"
129 CFLAGS="-mms-bitfields $CFLAGS"
130 build_target="cygwin"
131 LIBPREFIX=lib
132 DLLDIR=bin
133 AC_PROG_CXX
134 ;;
135*mingw*)
136 AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
137 AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
138 AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
139 AC_CHECK_LIB(intl, gettext)
140 LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols"
141 LIBS="$LIBS -lws2_32 -lplibc"
142 CFLAGS="-mms-bitfields $CFLAGS"
143 build_target="mingw"
144 AC_PROG_CXX
145 LIBPREFIX=lib
146 DLLDIR=bin
147 ;;
148*)
149 AC_MSG_RESULT(Unrecognised OS $host_os)
150 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
151;;
152esac
153AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
154AC_SUBST(DEFAULT_INTERFACE)
155
156AC_MSG_CHECKING([for build target])
157AM_CONDITIONAL(MACOSX, test "$build_target" = "macosx")
158AM_CONDITIONAL(CYGWIN, test "$build_target" = "cygwin")
159AM_CONDITIONAL(MINGW, test "$build_target" = "mingw")
160AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
161AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
162AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
163AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
164AC_MSG_RESULT([$build_target])
165AC_SUBST(build_target)
166AM_CONDITIONAL([am__fastdepOBJC], false)
167AC_UNALIGNED_64_ACCESS
168
169# some other checks for standard libs
170AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
171AC_CHECK_LIB(socket, socket)
172AC_CHECK_LIB(m, log)
173AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
174
175# 'save' libs; only those libs found so far will be
176# linked against _everywhere_. For the others, we
177# will be more selective!
178SAVE_LIBS=$LIBS
179
180# libgcrypt
181gcrypt=0
182AM_PATH_LIBGCRYPT(1.2.0, gcrypt=1)
183
184if test $gcrypt = 0
185then
186 AC_MSG_ERROR([GNUnet needs libgcrypt])
187fi
188
189
190# libcurl
191LIBCURL_CHECK_CONFIG(,7.15.4,,AC_MSG_ERROR([GNUnet requires libcurl >= 7.15.4]))
192# restore LIBS
193LIBS=$SAVE_LIBS
194
195# restore LIBS
196LIBS=$SAVE_LIBS
197
198# test for kvm and kstat (for CPU stats under BSD/Solaris)
199AC_CHECK_LIB([kvm],[kvm_open])
200AC_CHECK_LIB([kstat],[kstat_open])
201
202# test for libextractor
203extractor=0
204AC_MSG_CHECKING(for libextractor)
205AC_ARG_WITH(extractor,
206 [ --with-extractor=PFX base of libextractor installation],
207 [AC_MSG_RESULT([$with_extractor])
208 case $with_extractor in
209 no)
210 ;;
211 yes)
212 AC_CHECK_HEADERS(extractor.h,
213 AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
214 extractor=1))
215 ;;
216 *)
217 LDFLAGS="-L$with_extractor/lib $LDFLAGS"
218 CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
219 AC_CHECK_HEADERS(extractor.h,
220 AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
221 EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
222 extractor=1))
223 ;;
224 esac
225 ],
226 [AC_MSG_RESULT([--with-extractor not specified])
227 AC_CHECK_HEADERS(extractor.h,
228 AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
229 extractor=1))])
230if test "$extractor" != 1
231then
232 AC_MSG_ERROR([GNUnet requires libextractor])
233fi
234# restore LIBS
235LIBS=$SAVE_LIBS
236
237
238# Checks for standard header files.
239AC_HEADER_DIRENT
240AC_HEADER_STDC
241
242# Check for headers that are ALWAYS required
243AC_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]))
244
245# Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there)
246AC_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 sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h iconv.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h])
247
248# Check for GMP header (and abort if not present)
249AC_CHECK_HEADERS([gmp.h],,AC_MSG_ERROR([Compiling GNUnet requires gmp.h (from the GNU MP library, libgmp)]))
250
251# test for libgmp
252gmp=0
253AC_MSG_CHECKING(for libgmp)
254AC_ARG_WITH(gmp,
255 [ --with-gmp=PFX base of libgmp installation],
256 [AC_MSG_RESULT([$with_gmp])
257 case $with_gmp in
258 no)
259 ;;
260 yes)
261 AC_CHECK_HEADERS(gmp.h,
262 AC_CHECK_LIB([gmp], [__gmpz_add],
263 gmp=1))
264 ;;
265 *)
266 LDFLAGS="-L$with_gmp/lib $LDFLAGS"
267 CPPFLAGS="-I$with_gmp/include $CPPFLAGS"
268 AC_CHECK_HEADERS(gmp.h,
269 AC_CHECK_LIB([gmp], [__gmpz_add],
270 EXT_LIB_PATH="-L$with_gmp/lib $EXT_LIB_PATH"
271 gmp=1))
272 ;;
273 esac
274 ],
275 [AC_MSG_RESULT([--with-gmp not specified])
276 AC_CHECK_HEADERS(gmp.h,
277 AC_CHECK_LIB([gmp], [__gmpz_add],
278 gmp=1))])
279if test "$gmp" != 1
280then
281 AC_MSG_ERROR([GNUnet requires libgmp])
282fi
283
284SAVE_LDFLAGS=$LDFLAGS
285SAVE_CPPFLAGS=$CPPFLAGS
286
287# test for sqlite
288sqlite=false
289AC_MSG_CHECKING(for SQLite)
290AC_ARG_WITH(sqlite,
291 [ --with-sqlite=PFX base of SQLite installation],
292 [AC_MSG_RESULT("$with_sqlite")
293 case $with_sqlite in
294 no)
295 ;;
296 yes)
297 AC_CHECK_HEADERS(sqlite3.h,
298 sqlite=true)
299 ;;
300 *)
301 LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
302 CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
303 AC_CHECK_HEADERS(sqlite3.h,
304 EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
305 SQLITE_LDFLAGS="-L$with_sqlite/lib"
306 SQLITE_CPPFLAGS="-I$with_sqlite/include"
307 sqlite=true)
308 LDFLAGS=$SAVE_LDFLAGS
309 CPPFLAGS=$SAVE_CPPFLAGS
310 ;;
311 esac
312 ],
313 [AC_MSG_RESULT([--with-sqlite not specified])
314 AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
315AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
316AC_SUBST(SQLITE_CPPFLAGS)
317AC_SUBST(SQLITE_LDFLAGS)
318
319# test for postgres
320postgres=false
321AC_MSG_CHECKING(for postgres)
322AC_ARG_WITH(postgres,
323 [ --with-postgres=PFX base of postgres installation],
324 [AC_MSG_RESULT("$with_postgres")
325 case $with_postgres in
326 no)
327 ;;
328 yes)
329 AC_CHECK_HEADERS(postgresql/libpq-fe.h,
330 postgres=true)
331 ;;
332 *)
333 LDFLAGS="-L$with_postgres/lib $LDFLAGS"
334 CPPFLAGS="-I$with_postgres/include $CPPFLAGS"
335 AC_CHECK_HEADERS(postgresql/libpq-fe.h,
336 EXT_LIB_PATH="-L$with_postgres/lib $EXT_LIB_PATH"
337 SQLITE_LDFLAGS="-L$with_postgres/lib"
338 SQLITE_CPPFLAGS="-I$with_postgres/include"
339 postgres=true)
340 LDFLAGS=$SAVE_LDFLAGS
341 CPPFLAGS=$SAVE_CPPFLAGS
342 ;;
343 esac
344 ],
345 [AC_MSG_RESULT([--with-postgres not specified])
346 AC_CHECK_HEADERS(postgresql/libpq-fe.h, postgres=true)])
347AM_CONDITIONAL(HAVE_POSTGRES, test x$postgres = xtrue)
348AC_SUBST(POSTGRES_CPPFLAGS)
349AC_SUBST(POSTGRES_LDFLAGS)
350
351
352# test for libz (maybe required for linking mysql)
353zlib=1
354AC_CHECK_LIB(z, compress,,zlib=0)
355AM_CONDITIONAL(HAVE_ZLIB, test x$zlib = x1)
356if test "$zlib" != 1
357then
358 AC_MSG_ERROR([GNUnet requires zlib])
359fi
360
361# mysql & windows
362AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
363AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
364
365if test "$build_target" = "mingw"
366then
367 CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
368fi
369
370# test for mysql
371mysql=false
372mysqlfail=false
373SAVE_LDFLAGS=$LDFLAGS
374SAVE_CPPFLAGS=$CPPFLAGS
375AC_MSG_CHECKING(for mysql)
376AC_ARG_WITH(mysql,
377 [ --with-mysql=PFX base of MySQL installation],
378 [AC_MSG_RESULT("$with_mysql")
379 if test "$with_mysql" != "no"
380 then
381 if test "$with_mysql" != "yes"
382 then
383 LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
384 CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
385 fi
386 AC_CHECK_HEADERS(mysql/mysql.h,
387 AC_CHECK_LIB(mysqlclient, mysql_init,
388 MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
389 MYSQL_CPPFLAGS="-I$with_mysql/include"
390
391 mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
392 fi
393 ],
394 [AC_MSG_RESULT([--with-mysql not specified])
395 LDFLAGS="-L/usr/lib/mysql $LDFLAGS $ZLIBS"
396 AC_CHECK_LIB(mysqlclient, mysql_init,
397 [AC_CHECK_HEADERS(mysql/mysql.h,
398 MYSQL_LDFLAGS="-L/usr/lib/mysql"
399 mysql=true
400
401 , [], [$CYGWIN_MYSQL_MAGIC])])
402 ])
403
404AC_SUBST(MYSQL_LDFLAGS)
405AC_SUBST(MYSQL_CPPFLAGS)
406
407# additional version check for mysql
408AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
409if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
410then
411 AC_MSG_CHECKING(mysql version)
412 AC_RUN_IFELSE([AC_LANG_PROGRAM(
413 [[$CYGWIN_MYSQL_MAGIC
414 #include <mysql/mysql.h>]],
415 [[if (MYSQL_VERSION_ID < 40100)
416 return(-1);
417 else
418 return(0);
419 ]])
420 ],mysql=true,mysql=false)
421 if test "$mysql" = "false"
422 then
423 mysqlfail=true
424 AC_MSG_RESULT([fail, >= 4.1 required])
425 else
426 AC_MSG_RESULT(ok)
427 fi
428fi
429AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
430AM_CONDITIONAL(HAVE_MYSQLE, test "0" = "1")
431# restore LIBS
432LIBS=$SAVE_LIBS
433LDFLAGS=$SAVE_LDFLAGS
434CPPFLAGS=$SAVE_CPPFLAGS
435
436if test "$sqlite" = 0 -a "$mysql" = 0
437then
438 AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
439fi
440
441# GNUnet Setup
442dialog=0
443LIBS="-lm $LIBS"
444AC_CHECK_LIB([ncursesw],[wmove])
445AC_MSG_CHECKING([for dialog 1.0-20051207])
446AC_ARG_WITH(dialog,
447 [ --with-dialog=PFX base of dialog installation],
448 [AC_MSG_RESULT([$with_dialog])
449 case $with_dialog in
450 no)
451 ;;
452 yes)
453 AC_CHECK_HEADERS(dialog.h,
454 AC_CHECK_LIB([dialog], [dlg_menu],
455 dialog=1))
456 ;;
457 *)
458 LDFLAGS="-L$with_dialog/lib $LDFLAGS"
459 CPPFLAGS="-I$with_dialog/include $CPPFLAGS"
460 AC_CHECK_HEADERS(dialog.h,
461 AC_CHECK_LIB([dialog], [dlg_menu],
462 EXT_LIB_PATH="-L$with_dialog/lib $EXT_LIB_PATH"
463 dialog=1))
464 ;;
465 esac
466 ],
467 [AC_MSG_RESULT([--with-dialog not specified])
468 AC_CHECK_HEADERS(dialog.h,
469 AC_CHECK_LIB([dialog], [dlg_menu],
470 dialog=1))])
471
472AM_CONDITIONAL(HAVE_DIALOG, test x$dialog = x1)
473AC_DEFINE_UNQUOTED([HAVE_DIALOG], $dialog, [We have dialog])
474
475cdialog=0
476AC_ARG_WITH(cdialog,
477 [ --with-cdialog=PFX base of cdialog installation],
478 [AC_MSG_RESULT([$with_cdialog])
479 case $with_cdialog in
480 no)
481 ;;
482 yes)
483 AC_CHECK_HEADERS(cdialog/dialog.h,
484 AC_CHECK_LIB([cdialog], [dlg_menu],
485 cdialog=1))
486 ;;
487 *)
488 LDFLAGS="-L$with_cdialog/lib $LDFLAGS"
489 CPPFLAGS="-I$with_cdialog/include $CPPFLAGS"
490 AC_CHECK_HEADERS(cdialog/dialog.h,
491 AC_CHECK_LIB([cdialog], [dlg_menu],
492 EXT_LIB_PATH="-L$with_cdialog/lib $EXT_LIB_PATH"
493 cdialog=1))
494 ;;
495 esac
496 ],
497 [AC_MSG_RESULT([--with-cdialog not specified])
498 AC_CHECK_HEADERS(cdialog/dialog.h,
499 AC_CHECK_LIB([cdialog], [dlg_menu],
500 cdialog=1))])
501
502AM_CONDITIONAL(HAVE_CDIALOG, test x$cdialog = x1)
503AC_DEFINE_UNQUOTED([HAVE_CDIALOG], $cdialog, [We have cdialog])
504# restore LIBS
505LIBS=$SAVE_LIBS
506
507# libmicrohttpd
508lmhd=0
509AC_MSG_CHECKING([for libmicrohttpd])
510AC_ARG_WITH(microhttpd,
511 [ --with-microhttpd=PFX base of libmicrohttpd installation],
512 [AC_MSG_RESULT([$with_microhttpd])
513 case $with_microhttpd in
514 no)
515 ;;
516 yes)
517 AC_CHECK_HEADERS([microhttpd.h],
518 AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
519 AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
520 lmhd=1),
521 [],[#include "src/include/platform.h"
522 #include <microhttpd.h>]),,
523 [#include "src/include/platform.h"])
524 ;;
525 *)
526 LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
527 CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
528 AC_CHECK_HEADERS(microhttpd.h,
529 AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
530 AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
531 EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
532 lmhd=1),
533 [],[#include "src/include/platform.h"
534 #include <microhttpd.h>]),,
535 [#include "src/include/platform.h"])
536 ;;
537 esac
538 ],
539 [AC_MSG_RESULT([--with-microhttpd not specified])
540 AC_CHECK_HEADERS([microhttpd.h],
541 AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
542 AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
543 lmhd=1),
544 [],[#include "src/include/platform.h"
545 #include <microhttpd.h>]),,
546 [#include "src/include/platform.h"])])
547AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
548AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
549# restore LIBS
550LIBS=$SAVE_LIBS
551
552# libesmtp
553esmtp=0
554AC_MSG_CHECKING([for libesmtp])
555AC_ARG_WITH(esmtp,
556 [ --with-esmtp=PFX base of libesmtp installation],
557 [AC_MSG_RESULT([$with_esmtp])
558 case $with_esmtp in
559 no)
560 ;;
561 yes)
562 AC_CHECK_HEADERS(libesmtp.h,
563 AC_CHECK_LIB([esmtp], [smtp_start_session],
564 esmtp=1))
565 ;;
566 *)
567 LDFLAGS="-L$with_esmtp/lib $LDFLAGS"
568 CPPFLAGS="-I$with_esmtp/include $CPPFLAGS"
569 AC_CHECK_HEADERS(libesmtp.h,
570 AC_CHECK_LIB([esmtp], [smtp_start_session],
571 EXT_LIB_PATH="-L$with_esmtp/lib $EXT_LIB_PATH"
572 esmtp=1))
573 ;;
574 esac
575 ],
576 [AC_MSG_RESULT([--with-esmtp not specified])
577 AC_CHECK_HEADERS(libesmtp.h,
578 AC_CHECK_LIB([esmtp], [smtp_start_session],
579 esmtp=1))])
580AM_CONDITIONAL(HAVE_ESMTP, test x$esmtp = x1)
581AC_DEFINE_UNQUOTED([HAVE_ESMTP], $esmtp, [We have libesmtp])
582# restore LIBS
583LIBS=$SAVE_LIBS
584
585# check for gettext
586AM_GNU_GETTEXT_VERSION([0.16.1])
587AM_GNU_GETTEXT([external])
588
589# check for iconv
590AM_ICONV
591
592# Checks for standard typedefs, structures, and compiler characteristics.
593AC_C_CONST
594AC_TYPE_PID_T
595AC_TYPE_SIZE_T
596AC_TYPE_MODE_T
597AC_HEADER_TIME
598AC_HEADER_STAT
599AC_HEADER_STDBOOL
600AC_STRUCT_TM
601
602
603
604
605# Checks for library functions.
606AC_FUNC_CLOSEDIR_VOID
607AC_FUNC_FORK
608AC_PROG_GCC_TRADITIONAL
609AC_FUNC_MEMCMP
610AC_FUNC_SELECT_ARGTYPES
611AC_FUNC_CHOWN
612
613AC_TYPE_SIGNAL
614AC_FUNC_STAT
615AC_FUNC_STRFTIME
616AC_FUNC_VPRINTF
617AC_HEADER_SYS_WAIT
618AC_TYPE_OFF_T
619AC_TYPE_UID_T
620AC_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 gethostbyaddr initgroups getifaddrs freeifaddrs getnameinfo getaddrinfo inet_ntoa localtime_r nl_langinfo putenv realpath strndup gethostbyname2 gethostbyname])
621
622# restore LIBS
623LIBS=$SAVE_LIBS
624
625
626
627# check for guile
628guile=0
629AC_MSG_CHECKING(for guile 1.8)
630AC_ARG_WITH(guile,
631 [ --with-guile=PFX base of guile installation],
632 [AC_MSG_RESULT([$with_guile])
633 case $with_guile in
634 no)
635 ;;
636 yes)
637 AC_CHECK_HEADERS(libguile.h,
638 AC_CHECK_LIB([guile], [scm_c_define_gsubr],
639 guile=1, [],
640 -lgmp $LIBLTDL))
641 ;;
642 *)
643 LDFLAGS="-L$with_guile/lib $LDFLAGS"
644 CPPFLAGS="-I$with_guile/include $CPPFLAGS"
645 AC_CHECK_HEADERS(libguile.h,
646 AC_CHECK_LIB([guile], [scm_c_define_gsubr],
647 EXT_LIB_PATH="-L$with_guile/lib $EXT_LIB_PATH"
648 guile=1, [],
649 -lgmp $LIBLTDL))
650 ;;
651 esac
652 ],
653 [AC_MSG_RESULT([--with-guile not specified])
654 AC_CHECK_HEADERS(libguile.h,
655 AC_CHECK_LIB([guile], [scm_c_define_gsubr],
656 guile=1, [], -lgmp $LIBLTDL))])
657
658if test "$guile" = 1
659then
660 AC_CHECK_LIB([guile], [scm_init_guile], [],
661 AC_MSG_ERROR([Guile doesn't provide scm_init_guile(). Please report to bug-gnunet@gnu.org]), -lgmp $LIBLTDL)
662 AC_DEFINE_UNQUOTED([HAVE_GUILE], 1, [We have GUILE])
663else
664 AC_DEFINE_UNQUOTED([HAVE_GUILE], 0, [We do NOT have GUILE])
665fi
666AM_CONDITIONAL(HAVE_GUILE, test x$guile = x1)
667# restore LIBS
668LIBS=$SAVE_LIBS
669
670gn_user_home_dir="~/.gnunet"
671AC_ARG_WITH(user-home-dir,
672 AC_HELP_STRING(
673 [--with-user-home-dir=DIR],
674 [default user home directory (~/.gnunet)]),
675 [gn_user_home_dir=$withval])
676AC_SUBST(GN_USER_HOME_DIR, $gn_user_home_dir)
677gn_daemon_home_dir="/var/lib/gnunet"
678AC_ARG_WITH(daemon-home-dir,
679 AC_HELP_STRING(
680 [--with-daemon-home-dir=DIR],
681 [default daemon home directory (/var/lib/gnunet)]),
682 [gn_daemon_home_dir=$withval])
683AC_SUBST(GN_DAEMON_HOME_DIR, $gn_daemon_home_dir)
684gn_daemon_config_dir="/etc"
685AC_ARG_WITH(daemon-config-dir,
686 AC_HELP_STRING(
687 [--with-daemon-config-dir=DIR],
688 [default daemon config directory (/etc)]),
689 [gn_daemon_config_dir=$withval])
690AC_SUBST(GN_DAEMON_CONFIG_DIR, $gn_daemon_config_dir)
691gn_daemon_pidfile="/var/run/gnunetd/pid"
692AC_ARG_WITH(daemon-pidfile,
693 AC_HELP_STRING(
694 [--with-daemon-pidfile=FILE],
695 [default daemon pidfile (/var/run/gnunetd/pid)]),
696 [gn_daemon_pidfile=$withval])
697AC_SUBST(GN_DAEMON_PIDFILE, $gn_daemon_pidfile)
698
699GN_INTLINCL=""
700GN_LIBINTL="$LTLIBINTL"
701AC_ARG_ENABLE(framework, [ --enable-framework enable Mac OS X framework build helpers],enable_framework_build=$enableval)
702AM_CONDITIONAL(WANT_FRAMEWORK, test x$enable_framework_build = xyes)
703if test x$enable_framework_build = xyes
704then
705 AC_DEFINE([FRAMEWORK_BUILD], 1, [Build a Mac OS X Framework])
706 GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
707 GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
708 AC_LIB_APPENDTOVAR([CPPFLAGS], [$GN_INTLINCL])
709fi
710
711GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
712GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
713dnl TODO insert a proper check here
714AC_CACHE_CHECK([whether -export-symbols-regex works],
715 gn_cv_export_symbols_regex_works,
716 [
717 case "$host_os" in
718 mingw*) gn_cv_export_symbols_regex_works=no;;
719 *) gn_cv_export_symbols_regex_works=yes;;
720 esac
721 ])
722if test "x$gn_cv_export_symbols_regex_works" = "xyes"
723then
724 GN_LIB_LDFLAGS="$GN_LIB_LDFLAGS -export-symbols-regex \"GNUNET_@<:@a-zA-Z0-9_@:>@*\""
725 GN_PLUGIN_LDFLAGS="$GN_PLUGIN_LDFLAGS -export-symbols-regex \"@<:@a-zA-Z0-9_@:>@*\""
726fi
727AC_SUBST(GN_LIB_LDFLAGS)
728AC_SUBST(GN_PLUGIN_LDFLAGS)
729AC_SUBST(GN_INTLINCL)
730AC_SUBST(GN_LIBINTL)
731
732AC_SUBST(CPPFLAGS)
733AC_SUBST(LIBS)
734AC_SUBST(LDFLAGS)
735AC_SUBST(EXT_LIB_PATH)
736AC_SUBST(EXT_LIBS)
737
738AC_SUBST(LIBPREFIX)
739AC_SUBST(DLLDIR)
740AC_SUBST(EXT_LIB_PATH)
741
742
743# gcov compilation
744use_gcov=no
745AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage],
746 [Compile the library with code coverage support (default is NO)]),
747 [use_gcov=yes], [use_gcov=no])
748AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
749
750
751
752AC_CONFIG_FILES([ po/Makefile.in m4/Makefile
753Makefile
754contrib/Makefile
755src/Makefile
756src/arm/Makefile
757src/core/Makefile
758src/include/Makefile
759src/include/gnunet_directories.h
760src/util/Makefile
761src/fragmentation/Makefile
762src/hello/Makefile
763src/peerinfo/Makefile
764src/resolver/Makefile
765src/statistics/Makefile
766src/template/Makefile
767src/transport/Makefile
768])
769AC_OUTPUT
770
771# Finally: summary!
772
773# warn user if mysql found but not used due to version
774if test "$mysqlfail" = "true"
775then
776 AC_MSG_NOTICE([NOTICE: MySQL found, but too old. MySQL support will not be compiled.])
777fi
778
779# sqlite
780if test "x$sqlite" = "x0"
781then
782 AC_MSG_NOTICE([NOTICE: sqlite not found. sqLite support will not be compiled.])
783fi
784
785if test "x$dialog" != "x1" -a "x$cdialog" != "x1"
786then
787 AC_MSG_NOTICE([NOTICE: curses based gnunet-setup frontends will not be installed.])
788fi
789
790if test "x$lmhd" != "x1"
791then
792 AC_MSG_NOTICE([NOTICE: libmicrohttpd not found, http transport will not be installed.])
793fi
794
795AC_MSG_NOTICE([NOTICE: Database support is set to MySQL: $mysql, SQLite: $sqlite])
796
797# guile
798if test "x$guile" = "x0"
799then
800 AC_MSG_NOTICE([WARNING: Guile not found, gnunet-setup will not be installed.])
801fi
802
803if test "$enable_framework_build" = "yes"
804then
805 AC_MSG_NOTICE([NOTICE: Mac OS X framework build enabled.])
806fi
807
808AC_MSG_NOTICE([********************************************
809You can build GNUnet with
810 make install
811now. After that, install gnunet-gtk or gnunet-qt and run
812 gnunet-setup -d wizard-gtk
813(on graphical systems with GTK) or
814 gnunet-setup -d wizard-qt
815(on graphical systems with QT) or
816 gnunet-setup -d wizard-curses
817(on text-based systems with curses) in order to make important configuration
818settings. If neither works for you, you can find a template configuration
819file in the contrib/ subdirectory. Copy it to /etc/gnunetd.conf and modify it
820using your favourite text editor.
821********************************************])