towards suspend
[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.0pre0],[bug-gnunet@gnu.org])
25 AM_INIT_AUTOMAKE([gnunet], [0.9.0pre0])
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.15.4,,AC_MSG_ERROR([GNUnet requires libcurl >= 7.15.4]))
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 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 argz.h])
248
249 # Check for GMP header (and abort if not present)
250 AC_CHECK_HEADERS([gmp.h],,AC_MSG_ERROR([Compiling GNUnet requires gmp.h (from the GNU MP library, libgmp)]))
251
252 # test for libgmp
253 gmp=0
254 AC_MSG_CHECKING(for libgmp)
255 AC_ARG_WITH(gmp,
256    [  --with-gmp=PFX          base of libgmp installation],
257    [AC_MSG_RESULT([$with_gmp])
258     case $with_gmp in
259       no)
260         ;;
261       yes)
262         AC_CHECK_HEADERS(gmp.h,
263           AC_CHECK_LIB([gmp], [__gmpz_add],
264             gmp=1))
265         ;;
266       *)
267         LDFLAGS="-L$with_gmp/lib $LDFLAGS"
268         CPPFLAGS="-I$with_gmp/include $CPPFLAGS"
269         AC_CHECK_HEADERS(gmp.h,
270           AC_CHECK_LIB([gmp], [__gmpz_add],
271             EXT_LIB_PATH="-L$with_gmp/lib $EXT_LIB_PATH"
272             gmp=1))
273         ;;
274     esac
275    ],
276    [AC_MSG_RESULT([--with-gmp not specified])
277     AC_CHECK_HEADERS(gmp.h,
278      AC_CHECK_LIB([gmp], [__gmpz_add],
279       gmp=1))])
280 if test "$gmp" != 1
281 then
282  AC_MSG_ERROR([GNUnet requires libgmp])
283 fi
284
285 SAVE_LDFLAGS=$LDFLAGS
286 SAVE_CPPFLAGS=$CPPFLAGS
287
288 # test for sqlite
289 sqlite=false
290 AC_MSG_CHECKING(for SQLite)
291 AC_ARG_WITH(sqlite,
292   [  --with-sqlite=PFX       base of SQLite installation],
293   [AC_MSG_RESULT("$with_sqlite")
294    case $with_sqlite in
295    no)
296      ;;
297    yes)
298     AC_CHECK_HEADERS(sqlite3.h,
299      sqlite=true)
300      ;;
301    *)
302     LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
303     CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
304     AC_CHECK_HEADERS(sqlite3.h,
305      EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
306      SQLITE_LDFLAGS="-L$with_sqlite/lib"
307      SQLITE_CPPFLAGS="-I$with_sqlite/include"
308      sqlite=true)
309     LDFLAGS=$SAVE_LDFLAGS
310     CPPFLAGS=$SAVE_CPPFLAGS
311     ;;
312    esac
313   ],
314   [AC_MSG_RESULT([--with-sqlite not specified])
315     AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
316 AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
317 AC_SUBST(SQLITE_CPPFLAGS)
318 AC_SUBST(SQLITE_LDFLAGS)
319
320 # test for postgres
321 postgres=false
322 AC_MSG_CHECKING(for postgres)
323 AC_ARG_WITH(postgres,
324   [  --with-postgres=PFX       base of postgres installation],
325   [AC_MSG_RESULT("$with_postgres")
326    case $with_postgres in
327    no)
328      ;;
329    yes)
330     AC_CHECK_HEADERS(postgresql/libpq-fe.h,
331      postgres=true)
332      ;;
333    *)
334     LDFLAGS="-L$with_postgres/lib $LDFLAGS"
335     CPPFLAGS="-I$with_postgres/include $CPPFLAGS"
336     AC_CHECK_HEADERS(postgresql/libpq-fe.h,
337      EXT_LIB_PATH="-L$with_postgres/lib $EXT_LIB_PATH"
338      SQLITE_LDFLAGS="-L$with_postgres/lib"
339      SQLITE_CPPFLAGS="-I$with_postgres/include"
340      postgres=true)
341     LDFLAGS=$SAVE_LDFLAGS
342     CPPFLAGS=$SAVE_CPPFLAGS
343     ;;
344    esac
345   ],
346   [AC_MSG_RESULT([--with-postgres not specified])
347     AC_CHECK_HEADERS(postgresql/libpq-fe.h, postgres=true)])
348 AM_CONDITIONAL(HAVE_POSTGRES, test x$postgres = xtrue)
349 AC_SUBST(POSTGRES_CPPFLAGS)
350 AC_SUBST(POSTGRES_LDFLAGS)
351
352
353 # test for libz (maybe required for linking mysql)
354 zlib=1
355 AC_CHECK_LIB(z, compress,,zlib=0)
356 AM_CONDITIONAL(HAVE_ZLIB, test x$zlib = x1)
357 if test "$zlib" != 1
358 then
359  AC_MSG_ERROR([GNUnet requires zlib])
360 fi
361
362 # mysql & windows
363 AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
364 AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
365
366 if test "$build_target" = "mingw"
367 then
368   CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
369 fi
370
371 # test for mysql
372 mysql=false
373 mysqlfail=false
374 SAVE_LDFLAGS=$LDFLAGS
375 SAVE_CPPFLAGS=$CPPFLAGS
376 AC_MSG_CHECKING(for mysql)
377 AC_ARG_WITH(mysql,
378   [  --with-mysql=PFX        base of MySQL installation],
379   [AC_MSG_RESULT("$with_mysql")
380    if test "$with_mysql" != "no"
381    then
382     if test "$with_mysql" != "yes"
383     then
384       LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
385       CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
386     fi
387     AC_CHECK_HEADERS(mysql/mysql.h,
388      AC_CHECK_LIB(mysqlclient, mysql_init,
389       MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
390       MYSQL_CPPFLAGS="-I$with_mysql/include"
391
392       mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
393    fi
394   ],
395   [AC_MSG_RESULT([--with-mysql not specified])
396    LDFLAGS="-L/usr/lib/mysql $LDFLAGS $ZLIBS"
397    AC_CHECK_LIB(mysqlclient, mysql_init,
398     [AC_CHECK_HEADERS(mysql/mysql.h,
399       MYSQL_LDFLAGS="-L/usr/lib/mysql"
400       mysql=true
401
402      , [], [$CYGWIN_MYSQL_MAGIC])])
403   ])
404
405 AC_SUBST(MYSQL_LDFLAGS)
406 AC_SUBST(MYSQL_CPPFLAGS)
407
408 # additional version check for mysql
409 AC_ARG_ENABLE(mysql-version-check, [  --disable-mysql-version-check  do not check MySQL version],, enable_mysql_version_check=yes)
410 if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
411 then
412   AC_MSG_CHECKING(mysql version)
413   AC_RUN_IFELSE([AC_LANG_PROGRAM(
414     [[$CYGWIN_MYSQL_MAGIC
415       #include <mysql/mysql.h>]],
416     [[if (MYSQL_VERSION_ID < 40100)
417         return(-1);
418       else
419         return(0);
420     ]])
421     ],mysql=true,mysql=false)
422   if test "$mysql" = "false"
423   then
424     mysqlfail=true
425     AC_MSG_RESULT([fail, >= 4.1 required])
426   else
427     AC_MSG_RESULT(ok)
428   fi
429 fi
430 AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
431 AM_CONDITIONAL(HAVE_MYSQLE, test "0" = "1")
432 # restore LIBS
433 LIBS=$SAVE_LIBS
434 LDFLAGS=$SAVE_LDFLAGS
435 CPPFLAGS=$SAVE_CPPFLAGS
436
437 if test "$sqlite" = 0 -a "$mysql" = 0
438 then
439  AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
440 fi
441
442 # libmicrohttpd
443 lmhd=0
444 AC_MSG_CHECKING([for libmicrohttpd])
445 AC_ARG_WITH(microhttpd,
446    [  --with-microhttpd=PFX   base of libmicrohttpd installation],
447    [AC_MSG_RESULT([$with_microhttpd])
448     case $with_microhttpd in
449       no)
450         ;;
451       yes)
452         AC_CHECK_HEADERS([microhttpd.h],
453           AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
454             AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
455               lmhd=1),
456             [],[#include "src/include/platform.h"
457                 #include <microhttpd.h>]),,
458             [#include "src/include/platform.h"])
459         ;;
460       *)
461         LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
462         CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
463         AC_CHECK_HEADERS(microhttpd.h,
464           AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
465             AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
466               EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
467               lmhd=1),
468             [],[#include "src/include/platform.h"
469                 #include <microhttpd.h>]),,
470             [#include "src/include/platform.h"])
471         ;;
472     esac
473    ],
474    [AC_MSG_RESULT([--with-microhttpd not specified])
475     AC_CHECK_HEADERS([microhttpd.h],
476       AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
477         AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
478           lmhd=1),
479         [],[#include "src/include/platform.h"
480             #include <microhttpd.h>]),,
481        [#include "src/include/platform.h"])])
482 AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
483 AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
484 # restore LIBS
485 LIBS=$SAVE_LIBS
486
487 # check for python & pexpect (used for some testcases only)
488 AM_PATH_PYTHON([2.5],, [:])
489 AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
490
491 if test "$PYTHON" != :
492 then
493   AC_MSG_CHECKING([for pexpect])
494   $PYTHON -c "import pexpect" > /dev/null 2> /dev/null
495   PYEX=$?
496   AM_CONDITIONAL(HAVE_PYTHON_PEXPECT, test $PYEX -eq 0)
497   if test $PYEX -eq 0
498   then
499     AC_MSG_RESULT([yes])
500   else
501     AC_MSG_RESULT([not found])
502   fi
503 fi
504
505 # libesmtp
506 esmtp=0
507 AC_MSG_CHECKING([for libesmtp])
508 AC_ARG_WITH(esmtp,
509    [  --with-esmtp=PFX        base of libesmtp installation],
510    [AC_MSG_RESULT([$with_esmtp])
511     case $with_esmtp in
512       no)
513         ;;
514       yes)
515         AC_CHECK_HEADERS(libesmtp.h,
516           AC_CHECK_LIB([esmtp], [smtp_start_session],
517             esmtp=1))
518         ;;
519       *)
520         LDFLAGS="-L$with_esmtp/lib $LDFLAGS"
521         CPPFLAGS="-I$with_esmtp/include $CPPFLAGS"
522         AC_CHECK_HEADERS(libesmtp.h,
523           AC_CHECK_LIB([esmtp], [smtp_start_session],
524             EXT_LIB_PATH="-L$with_esmtp/lib $EXT_LIB_PATH"
525               esmtp=1))
526         ;;
527     esac
528    ],
529    [AC_MSG_RESULT([--with-esmtp not specified])
530     AC_CHECK_HEADERS(libesmtp.h,
531       AC_CHECK_LIB([esmtp], [smtp_start_session],
532           esmtp=1))])
533 AM_CONDITIONAL(HAVE_ESMTP, test x$esmtp = x1)
534 AC_DEFINE_UNQUOTED([HAVE_ESMTP], $esmtp, [We have libesmtp])
535 # restore LIBS
536 LIBS=$SAVE_LIBS
537
538 # check for gettext
539 AM_GNU_GETTEXT_VERSION([0.16.1])
540 AM_GNU_GETTEXT([external])
541
542 # check for iconv
543 AM_ICONV
544
545 # Checks for standard typedefs, structures, and compiler characteristics.
546 AC_TYPE_PID_T
547 AC_TYPE_SIZE_T
548 AC_TYPE_MODE_T
549 AC_HEADER_TIME
550 AC_HEADER_STAT
551 AC_HEADER_STDBOOL
552 AC_STRUCT_TM
553
554 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
555    [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
556    ],
557    [],
558    [
559       #include <sys/types.h>
560       #include <sys/socket.h>
561       #include <netinet/in.h>
562    ])
563
564
565
566 # Checks for library functions.
567 AC_FUNC_CLOSEDIR_VOID
568 AC_FUNC_FORK
569 AC_FUNC_VFORK
570 AC_PROG_GCC_TRADITIONAL
571 AC_FUNC_MEMCMP
572 AC_FUNC_SELECT_ARGTYPES
573 AC_FUNC_CHOWN
574
575 AC_TYPE_SIGNAL
576 AC_FUNC_STAT
577 AC_FUNC_STRFTIME
578 AC_FUNC_VPRINTF
579 AC_HEADER_SYS_WAIT
580 AC_TYPE_OFF_T
581 AC_TYPE_UID_T
582 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])
583
584 # restore LIBS
585 LIBS=$SAVE_LIBS
586
587 gn_user_home_dir="~/.gnunet"
588 AC_ARG_WITH(user-home-dir,
589         AC_HELP_STRING(
590                 [--with-user-home-dir=DIR],
591                 [default user home directory (~/.gnunet)]),
592         [gn_user_home_dir=$withval])
593 AC_SUBST(GN_USER_HOME_DIR, $gn_user_home_dir)
594 gn_daemon_home_dir="/var/lib/gnunet"
595 AC_ARG_WITH(daemon-home-dir,
596         AC_HELP_STRING(
597                 [--with-daemon-home-dir=DIR],
598                 [default daemon home directory (/var/lib/gnunet)]),
599         [gn_daemon_home_dir=$withval])
600 AC_SUBST(GN_DAEMON_HOME_DIR, $gn_daemon_home_dir)
601 gn_daemon_config_dir="/etc"
602 AC_ARG_WITH(daemon-config-dir,
603         AC_HELP_STRING(
604                 [--with-daemon-config-dir=DIR],
605                 [default daemon config directory (/etc)]),
606         [gn_daemon_config_dir=$withval])
607 AC_SUBST(GN_DAEMON_CONFIG_DIR, $gn_daemon_config_dir)
608
609 GN_INTLINCL=""
610 GN_LIBINTL="$LTLIBINTL"
611 AC_ARG_ENABLE(framework, [  --enable-framework      enable Mac OS X framework build helpers],enable_framework_build=$enableval)
612 AM_CONDITIONAL(WANT_FRAMEWORK, test x$enable_framework_build = xyes)
613 if test x$enable_framework_build = xyes
614 then
615   AC_DEFINE([FRAMEWORK_BUILD], 1, [Build a Mac OS X Framework])
616   GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
617   GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
618   AC_LIB_APPENDTOVAR([CPPFLAGS], [$GN_INTLINCL]) 
619 fi
620
621 GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
622 GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
623
624 AC_SUBST(GN_LIB_LDFLAGS)
625 AC_SUBST(GN_PLUGIN_LDFLAGS)
626 AC_SUBST(GN_INTLINCL)
627 AC_SUBST(GN_LIBINTL)
628
629 AC_SUBST(CPPFLAGS)
630 AC_SUBST(LIBS)
631 AC_SUBST(LDFLAGS)
632 AC_SUBST(EXT_LIB_PATH)
633 AC_SUBST(EXT_LIBS)
634
635 AC_SUBST(LIBPREFIX)
636 AC_SUBST(DLLDIR)
637 AC_SUBST(EXT_LIB_PATH)
638
639
640 # gcov compilation
641 use_gcov=no
642 AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage],
643                                         [Compile the library with code coverage support (default is NO)]),
644                                         [use_gcov=yes], [use_gcov=no])
645 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
646
647 AC_CONFIG_FILES([ 
648 Makefile
649 contrib/Makefile
650 m4/Makefile
651 po/Makefile.in 
652 src/Makefile
653 src/arm/Makefile
654 src/block/Makefile
655 src/core/Makefile
656 src/datacache/Makefile
657 src/datastore/Makefile
658 src/dht/Makefile
659 src/dv/Makefile
660 src/fragmentation/Makefile
661 src/fs/Makefile
662 src/hello/Makefile
663 src/include/Makefile
664 src/include/gnunet_directories.h
665 src/hostlist/Makefile
666 src/migration/Makefile
667 src/nat/Makefile
668 src/nat/libnatpmp/Makefile
669 src/nat/miniupnp/Makefile
670 src/peerinfo/Makefile
671 src/peerinfo-tool/Makefile
672 src/statistics/Makefile
673 src/template/Makefile
674 src/testing/Makefile
675 src/topology/Makefile
676 src/transport/Makefile
677 src/util/Makefile
678 ])
679 AC_OUTPUT
680
681 # Finally: summary!
682
683 # warn user if mysql found but not used due to version
684 if test "$mysqlfail" = "true"
685 then
686   AC_MSG_NOTICE([NOTICE: MySQL found, but too old. MySQL support will not be compiled.])
687 fi
688
689 # sqlite
690 if test "x$sqlite" = "x0"
691 then
692   AC_MSG_NOTICE([NOTICE: sqlite not found.  sqLite support will not be compiled.])
693 fi
694
695 if test "x$lmhd" != "x1"
696 then
697  AC_MSG_NOTICE([NOTICE: libmicrohttpd not found, http transport will not be installed.])
698 fi
699
700 AC_MSG_NOTICE([NOTICE: Database support is set to MySQL: $mysql, SQLite: $sqlite])
701
702 if test "$enable_framework_build" = "yes"
703 then
704   AC_MSG_NOTICE([NOTICE: Mac OS X framework build enabled.])
705 fi
706
707 AC_MSG_NOTICE([********************************************
708 You can build GNUnet with
709         make install
710 now. After that, install gnunet-gtk or gnunet-qt and run 
711         gnunet-setup -d wizard-gtk
712 (on graphical systems with GTK) or
713         gnunet-setup -d wizard-qt
714 (on graphical systems with QT) or
715         gnunet-setup -d wizard-curses
716 (on text-based systems with curses) in order to make important configuration
717 settings. If neither works for you, you can find a template configuration
718 file in the contrib/ subdirectory. Copy it to /etc/gnunetd.conf and modify it
719 using your favourite text editor.
720 ********************************************])