4 # Author: Pekka Riikonen <priikone@silcnet.org>
6 # Copyright (C) 2000 - 2002 Pekka Riikonen
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
19 AC_INIT(includes/silcversion.h)
22 # Put here any platform specific stuff
34 # ./prepare script will automatically put the correct version. Do not edit!
35 AM_INIT_AUTOMAKE(SILC_PACKAGE, SILC_VERSION)
37 AM_CONFIG_HEADER(includes/silcdefs.h)
46 # Distribution definition. ./prepare will automatically add here a correct
48 silc_dist=SILC_PACKAGE
49 SILC_DIST_SUBDIRS="SILC_DISTRIBUTION_SUBDIRS"
50 AC_DEFINE(SILC_DIST_DEFINE)
55 CFLAGS="-Wall -finline-functions $CFLAGS"
63 AC_PATH_PROG(sedpath, sed)
70 # More header checking
71 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
72 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
73 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h)
74 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
75 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h iconv.h)
76 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
85 AC_CHECK_SIZEOF(long long, 0)
86 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
87 AC_CHECK_SIZEOF(long, 0)
88 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
89 AC_CHECK_SIZEOF(int, 0)
90 AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
91 AC_CHECK_SIZEOF(short, 0)
92 AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
93 AC_CHECK_SIZEOF(char, 0)
94 AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
95 AC_CHECK_SIZEOF(void *, 0)
96 AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
98 # Function and library checking
99 AC_CHECK_FUNC(gethostbyname, ac_gethostbyname_found=1,ac_gethostbyname_found=0)
100 if test x$ac_gethostbyname_found = x0; then
101 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
102 AC_CHECK_FUNC(res_gethostbyname, ac_res_ghbn_found=1, ac_res_ghbn_found=0)
103 if test x$ac_res_ghbn_found = x0; then
104 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
107 AC_CHECK_FUNC(socket, ac_socket_found=1, ac_socket_found=0)
108 if test x$ac_socket_found = x0; then
109 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
111 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
112 AC_CHECK_FUNCS(select listen bind shutdown close connect)
113 AC_CHECK_FUNCS(fcntl setsockopt time)
114 AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday)
115 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
116 AC_CHECK_FUNCS(setgroups initgroups)
117 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove utime iconv)
118 AC_CHECK_FUNCS(pthread_create nl_langinfo)
120 # SIM support checking
121 # XXX These needs to be changed as more supported platforms appear.
122 # XXX This probably needs to be made platform dependant check.
124 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
125 AC_CHECKING(for SIM support)
126 AC_CHECK_HEADERS(dlfcn.h,
127 AC_CHECK_LIB(dl, dlopen,
130 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
131 AC_MSG_RESULT(enabled SIM support)
133 AC_MSG_RESULT(no SIM support found)),
134 AC_MSG_RESULT(no SIM support found))
137 # lib/contrib conditionals
139 AC_CHECK_HEADER(regex.h, have_regex=1, have_regex=0)
140 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
141 AC_CHECK_FUNC(getopt_long, have_getopt_long=1, have_getopt_long=0)
142 AM_CONDITIONAL(HAVE_GETOPT_LONG, test x$have_getopt_long = x1)
148 # Default installation destination
149 AC_PREFIX_DEFAULT(/usr/local/silc)
151 if test "x$prefix" != xNONE; then
152 silc_prefix="$prefix"
154 silc_prefix="$ac_default_prefix"
158 if test "x$sysconfdir" != 'x${prefix}/etc'; then
161 ETCDIR="$silc_prefix/etc"
164 [ --with-etcdir[=PATH] Directory for system files [/etc/silc]],
177 AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
180 HELPDIR="$silc_prefix/help"
182 [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]],
195 AC_DEFINE_UNQUOTED(SILC_HELPDIR, "$HELPDIR")
198 DOCDIR="$silc_prefix/doc"
200 [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]],
213 AC_DEFINE_UNQUOTED(SILC_DOCDIR, "$DOCDIR")
215 # SIM modules directory
216 MODULESDIR="$silc_prefix/modules"
218 [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]],
223 MODULESDIR="$withval"
226 MODULESDIR="$withval"
231 AC_DEFINE_UNQUOTED(SILC_MODULESDIR, "$MODULESDIR")
234 LOGSDIR="$silc_prefix/logs"
236 [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]],
249 AC_DEFINE_UNQUOTED(SILC_LOGSDIR, "$LOGSDIR")
251 # SOCKS4 support checking
252 AC_MSG_CHECKING(whether to support SOCKS4)
254 [ --with-socks4[=PATH] Compile with SOCKS4 support],
263 if test -d "$withval/include"; then
264 CFLAGS="$CFLAGS -I$withval/include"
266 CFLAGS="$CFLAGS -I$withval"
268 if test -d "$withval/lib"; then
269 withval="-L$withval/lib -lsocks"
271 withval="-L$withval -lsocks"
274 LIBS="$withval $LIBS"
279 [ AC_MSG_ERROR(Could not find SOCKS4 library.)])
285 # SOCKS5 support checking
286 AC_MSG_CHECKING(whether to support SOCKS5)
288 [ --with-socks5[=PATH] Compile with SOCKS5 support],
297 if test -d "$withval/include"; then
298 CFLAGS="$CFLAGS -I$withval/include"
300 CFLAGS="$CFLAGS -I$withval"
302 if test -d "$withval/lib"; then
303 withval="-L$withval/lib -lsocks5"
305 withval="-L$withval -lsocks5"
308 LIBS="$withval $LIBS"
313 [ AC_MSG_ERROR(Could not find SOCKS5 library.)])
319 if test "x$socks" = "x4"; then
321 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
324 if test "x$socks" = "x5"; then
327 AC_DEFINE(Rconnect, SOCKSconnect)
328 AC_DEFINE(Rgetsockname, SOCKSgetsockname)
329 AC_DEFINE(Rgetpeername, SOCKSgetpeername)
330 AC_DEFINE(Rbind, SOCKSbind)
331 AC_DEFINE(Raccept, SOCKSaccept)
332 AC_DEFINE(Rlisten, SOCKSlisten)
333 AC_DEFINE(Rselect, SOCKSselect)
334 AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
335 AC_DEFINE(Rsendto, SOCKSsendto)
336 AC_DEFINE(Rrecv, SOCKSrecv)
337 AC_DEFINE(Rsend, SOCKSsend)
338 AC_DEFINE(Rread, SOCKSread)
339 AC_DEFINE(Rwrite, SOCKSwrite)
340 AC_DEFINE(Rrresvport, SOCKSrresvport)
341 AC_DEFINE(Rshutdown, SOCKSshutdown)
342 AC_DEFINE(Rlisten, SOCKSlisten)
343 AC_DEFINE(Rclose, SOCKSclose)
344 AC_DEFINE(Rdup, SOCKSdup)
345 AC_DEFINE(Rdup2, SOCKSdup2)
346 AC_DEFINE(Rfclose, SOCKSfclose)
347 AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
351 # MP library checking. First check whether user wants to use GMP and use
352 # it if found. If not or not defined then compile the MPI library in the
355 AC_MSG_CHECKING(whether to support GMP)
357 [ --with-gmp[=PATH] Compile with GMP support instead of MPI],
366 if test -d "$withval/include"; then
367 CFLAGS="$CFLAGS -I$withval/include"
369 CFLAGS="$CFLAGS -I$withval"
371 if test -d "$withval/lib"; then
372 withval="-L$withval/lib -lgmp"
374 withval="-L$withval -lgmp"
377 LIBS="$withval $LIBS"
379 AC_CHECK_LIB(gmp, __gmpz_init,
381 AC_DEFINE(SILC_MP_GMP)
382 AC_MSG_RESULT(Using GMP as MP library)
390 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
391 AM_CONDITIONAL(SILC_MP_NSS_MPI, test x$mp_gmp = xfalse)
392 if test x$mp_gmp = xfalse; then
393 AC_DEFINE(SILC_MP_NSS_MPI)
394 AC_MSG_RESULT(Using NSS MPI as MP library)
397 AC_ARG_WITH(silcd-config-file,
398 [ --with-silcd-config-file[=PATH]
399 Use PATH as default configuration file in SILC
400 server [/etc/silc/silcd.conf]],
401 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
403 if test "x$localstatedir" != 'x${prefix}/var'; then
404 PIDFILE="$localstatedir/silcd.pid"
406 PIDFILE="$silc_prefix/var/silcd.pid"
408 AC_ARG_WITH(silcd-pid-file,
409 [ --with-silcd-pid-file[=PATH]
410 Use PATH as default pid file in SILC
411 server [/var/run/silcd.pid]],
426 # Native WIN32 compilation under cygwin
429 [ --with-win32 Compile native WIN32 code (-mno-cygwin)],
430 [ AC_DEFINE(SILC_WIN32)
432 CFLAGS="-mno-cygwin $CFLAGS"
433 LIBS="$LIBS -lwsock32" ])
435 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
438 # Native EPOC support (disabled by default)
440 AM_CONDITIONAL(SILC_EPOC, test xfalse = xtrue)
443 # Native BeOS support (disabled by default)
445 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
448 # Native OS2 support (disabled by default)
450 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
457 [ --without-irssi Compile without Irssi SILC Client],
459 SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/irssi//'`
467 [ --without-silcd Compile without SILC Server],
469 SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/silcd//'`
475 AC_MSG_CHECKING(for IPv6 support)
477 [ --enable-ipv6 Enable IPv6 support],
478 [ case "${enableval}" in
490 esac ], check_ipv6=true)
492 if test x$check_ipv6 = xtrue; then
493 AC_TRY_COMPILE([#ifdef HAVE_NETINET_TCP_H
494 #include <netinet/tcp.h>
499 #include <sys/socket.h>
500 #ifdef HAVE_NETDB_IN_H
501 #include <netinet/in.h>
503 [struct sockaddr_in6 sin6;
504 int family = AF_INET6;
505 ], [AC_DEFINE(HAVE_IPV6)
506 AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
512 AC_MSG_CHECKING(for enabled debugging)
514 [ --enable-debug Enable debugging],
515 [ case "${enableval}" in
518 AC_DEFINE(SILC_DEBUG)
519 CFLAGS="-O -g $CFLAGS"
523 CFLAGS="-O2 -g $CFLAGS"
525 esac ], CFLAGS="-O2 -g $CFLAGS"
528 AC_MSG_CHECKING(for enabled stack tracing)
529 AC_ARG_ENABLE(stack-trace,
530 [ --enable-stack-trace Enable memory stack trace],
531 [ case "${enableval}" in
534 AC_DEFINE(SILC_STACKTRACE)
539 esac ], AC_MSG_RESULT(no))
542 # Disable all assembler optimizations
545 [ --disable-asm Do not use assembler optimizations ],
551 AC_ARG_ENABLE(threads,
552 [ --disable-threads Do not compile with multi-thread support],
553 [ case "${enableval}" in
564 if test x$check_threads = xtrue; then
566 AC_CHECK_HEADERS(pthread.h,
567 [ AC_DEFINE(SILC_HAVE_PTHREAD)
569 [ if test -f /usr/pkg/include/pthread.h ; then
570 AC_DEFINE(SILC_HAVE_PTHREAD)
571 AC_MSG_RESULT(Found pthread.h in /usr/pkg/include/)
572 CFLAGS="$CFLAGS -I/usr/pkg/include"
574 elif test -f /usr/contrib/include/pthread.h ; then
575 AC_DEFINE(SILC_HAVE_PTHREAD)
576 AC_MSG_RESULT(Found pthread.h in /usr/contrib/include/)
577 CFLAGS="$CFLAGS -I/usr/contrib/include"
582 AM_CONDITIONAL(SILC_THREADS, test x$want_threads = xtrue)
583 if test x$want_threads = xtrue; then
586 AC_TRY_LINK([#include <pthread.h>],
587 [pthread_attr_t attr; pthread_attr_init(&attr);],
588 AC_DEFINE(SILC_THREADS),
589 LIBS="-L/usr/pkg/lib -lpthread"
590 AC_TRY_LINK([#include <pthread.h>],
591 [pthread_attr_t attr; pthread_attr_init(&attr);],
592 AC_DEFINE(SILC_THREADS),
593 LIBS="-L/usr/contrib/lib -lpthread"
594 AC_TRY_LINK([#include <pthread.h>],
595 [pthread_attr_t attr; pthread_attr_init(&attr);],
596 AC_DEFINE(SILC_THREADS),
600 CFLAGS="$CFLAGS -D_REENTRANT"
603 CFLAGS="$CFLAGS -D_THREAD_SAFE"
604 if test x"$GCC" = xyes; then
605 CFLAGS="$CFLAGS -mthreads"
609 CFLAGS="$CFLAGS -D_THREAD_SAFE"
611 *-sysv5uw7*) # UnixWare 7
612 if test "$GCC" != "yes"; then
613 CFLAGS="$CFLAGS -Kthread"
615 CFLAGS="$CFLAGS -pthread"
619 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
623 LIBS="$TMP_LIBS $LIBS"
628 # Other configure scripts
630 if test x$without_irssi = xfalse; then
631 if test "x$silc_dist" = "xsilc-client" ||
632 test "x$silc_dist" = "xsilc-toolkit"; then
633 AC_CONFIG_SUBDIRS(irssi)
637 AC_CONFIG_SUBDIRS(lib/silcmath/mpi)
638 #AC_CONFIG_SUBDIRS(lib/zlib)
640 SILC_TOP_SRCDIR=`pwd`
641 AC_SUBST(SILC_TOP_SRCDIR)
642 #SILC_INSTALL_PREFIX=$ac_default_prefix
643 #AC_SUBST(SILC_INSTALL_PREFIX)
645 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
646 AC_SUBST(INCLUDE_DEFINES_INT)
647 AC_SUBST(SILC_DIST_SUBDIRS)
660 lib/silccore/Makefile
661 lib/silccrypt/Makefile
662 lib/silcmath/Makefile
663 lib/silcmath/mpi/Makefile.defines
664 lib/silcmath/mpi/Makefile.defines_int
667 lib/silcutil/Makefile
668 lib/silcutil/unix/Makefile
669 lib/silcutil/win32/Makefile
670 lib/silcutil/beos/Makefile
671 lib/silcutil/os2/Makefile
672 lib/silcutil/epoc/Makefile
673 lib/silcsftp/Makefile
674 lib/silcsftp/tests/Makefile
675 doc/example_silcd.conf
678 if test "x$silc_dist" = "xsilc-client" ||
679 test "x$silc_dist" = "xsilc-toolkit"; then
680 AC_CONFIG_FILES(lib/silcclient/Makefile)
683 if test x$without_irssi = xfalse ; then
684 if test "x$silc_dist" = "xsilc-client" ||
685 test "x$silc_dist" = "xsilc-toolkit"; then
687 irssi/Makefile.defines
688 irssi/Makefile.defines_int
693 if test x$without_silcd = xfalse ; then
694 if test "x$silc_dist" = "xsilc-server" ||
695 test "x$silc_dist" = "xsilc-toolkit"; then
702 if test "x$silc_dist" = "xsilc-toolkit"; then
706 win32/libsilc/Makefile
707 win32/libsilcclient/Makefile