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