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