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 regex.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)
114 AC_CHECK_FUNCS(getopt_long time)
115 AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday)
116 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
117 AC_CHECK_FUNCS(setgroups initgroups)
118 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove utime iconv)
119 AC_CHECK_FUNCS(pthread_create nl_langinfo)
121 # SIM support checking
122 # XXX These needs to be changed as more supported platforms appear.
123 # XXX This probably needs to be made platform dependant check.
125 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
126 AC_CHECKING(for SIM support)
127 AC_CHECK_HEADERS(dlfcn.h,
128 AC_CHECK_LIB(dl, dlopen,
131 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
132 AC_MSG_RESULT(enabled SIM support)
134 AC_MSG_RESULT(no SIM support found)),
135 AC_MSG_RESULT(no SIM support found))
141 # Default installation destination
142 AC_PREFIX_DEFAULT(/usr/local/silc)
144 if test "x$prefix" != xNONE; then
145 silc_prefix="$prefix"
147 silc_prefix="$ac_default_prefix"
151 if test "x$sysconfdir" != 'x${prefix}/etc'; then
154 ETCDIR="$silc_prefix/etc"
157 [ --with-etcdir[=PATH] Directory for system files [/etc/silc]],
170 AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
173 HELPDIR="$silc_prefix/help"
175 [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]],
188 AC_DEFINE_UNQUOTED(SILC_HELPDIR, "$HELPDIR")
191 DOCDIR="$silc_prefix/doc"
193 [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]],
206 AC_DEFINE_UNQUOTED(SILC_DOCDIR, "$DOCDIR")
208 # SIM modules directory
209 MODULESDIR="$silc_prefix/modules"
211 [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]],
216 MODULESDIR="$withval"
219 MODULESDIR="$withval"
224 AC_DEFINE_UNQUOTED(SILC_MODULESDIR, "$MODULESDIR")
227 LOGSDIR="$silc_prefix/logs"
229 [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]],
242 AC_DEFINE_UNQUOTED(SILC_LOGSDIR, "$LOGSDIR")
244 # SOCKS4 support checking
245 AC_MSG_CHECKING(whether to support SOCKS4)
247 [ --with-socks4[=PATH] Compile with SOCKS4 support],
256 if test -d "$withval/include"; then
257 CFLAGS="$CFLAGS -I$withval/include"
259 CFLAGS="$CFLAGS -I$withval"
261 if test -d "$withval/lib"; then
262 withval="-L$withval/lib -lsocks"
264 withval="-L$withval -lsocks"
267 LIBS="$withval $LIBS"
272 [ AC_MSG_ERROR(Could not find SOCKS4 library.)])
278 # SOCKS5 support checking
279 AC_MSG_CHECKING(whether to support SOCKS5)
281 [ --with-socks5[=PATH] Compile with SOCKS5 support],
290 if test -d "$withval/include"; then
291 CFLAGS="$CFLAGS -I$withval/include"
293 CFLAGS="$CFLAGS -I$withval"
295 if test -d "$withval/lib"; then
296 withval="-L$withval/lib -lsocks5"
298 withval="-L$withval -lsocks5"
301 LIBS="$withval $LIBS"
306 [ AC_MSG_ERROR(Could not find SOCKS5 library.)])
312 if test "x$socks" = "x4"; then
314 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
317 if test "x$socks" = "x5"; then
320 AC_DEFINE(Rconnect, SOCKSconnect)
321 AC_DEFINE(Rgetsockname, SOCKSgetsockname)
322 AC_DEFINE(Rgetpeername, SOCKSgetpeername)
323 AC_DEFINE(Rbind, SOCKSbind)
324 AC_DEFINE(Raccept, SOCKSaccept)
325 AC_DEFINE(Rlisten, SOCKSlisten)
326 AC_DEFINE(Rselect, SOCKSselect)
327 AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
328 AC_DEFINE(Rsendto, SOCKSsendto)
329 AC_DEFINE(Rrecv, SOCKSrecv)
330 AC_DEFINE(Rsend, SOCKSsend)
331 AC_DEFINE(Rread, SOCKSread)
332 AC_DEFINE(Rwrite, SOCKSwrite)
333 AC_DEFINE(Rrresvport, SOCKSrresvport)
334 AC_DEFINE(Rshutdown, SOCKSshutdown)
335 AC_DEFINE(Rlisten, SOCKSlisten)
336 AC_DEFINE(Rclose, SOCKSclose)
337 AC_DEFINE(Rdup, SOCKSdup)
338 AC_DEFINE(Rdup2, SOCKSdup2)
339 AC_DEFINE(Rfclose, SOCKSfclose)
340 AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
344 # MP library checking. First check whether user wants to use GMP and use
345 # it if found. If not or not defined then compile the MPI library in the
348 AC_MSG_CHECKING(whether to support GMP)
350 [ --with-gmp[=PATH] Compile with GMP support instead of MPI],
359 if test -d "$withval/include"; then
360 CFLAGS="$CFLAGS -I$withval/include"
362 CFLAGS="$CFLAGS -I$withval"
364 if test -d "$withval/lib"; then
365 withval="-L$withval/lib -lgmp"
367 withval="-L$withval -lgmp"
370 LIBS="$withval $LIBS"
372 AC_CHECK_LIB(gmp, __gmpz_init,
374 AC_DEFINE(SILC_MP_GMP)
375 AC_MSG_RESULT(Using GMP as MP library)
383 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
384 AM_CONDITIONAL(SILC_MP_NSS_MPI, test x$mp_gmp = xfalse)
385 if test x$mp_gmp = xfalse; then
386 AC_DEFINE(SILC_MP_NSS_MPI)
387 AC_MSG_RESULT(Using NSS MPI as MP library)
390 AC_ARG_WITH(silcd-config-file,
391 [ --with-silcd-config-file[=PATH]
392 Use PATH as default configuration file in SILC
393 server [/etc/silc/silcd.conf]],
394 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
396 if test "x$localstatedir" != 'x${prefix}/var'; then
397 PIDFILE="$localstatedir/silcd.pid"
399 PIDFILE="$silc_prefix/var/silcd.pid"
401 AC_ARG_WITH(silcd-pid-file,
402 [ --with-silcd-pid-file[=PATH]
403 Use PATH as default pid file in SILC
404 server [/var/run/silcd.pid]],
419 # Native WIN32 compilation under cygwin
422 [ --with-win32 Compile native WIN32 code (-mno-cygwin)],
423 [ AC_DEFINE(SILC_WIN32)
425 CFLAGS="-mno-cygwin $CFLAGS"
426 LIBS="$LIBS -lwsock32" ])
428 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
431 # Native EPOC support (disabled by default)
433 AM_CONDITIONAL(SILC_EPOC, test xfalse = xtrue)
436 # Native BeOS support (disabled by default)
438 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
441 # Native OS2 support (disabled by default)
443 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
450 [ --without-irssi Compile without Irssi SILC Client],
452 SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/irssi//'`
460 [ --without-silcd Compile without SILC Server],
462 SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/silcd//'`
468 AC_MSG_CHECKING(for IPv6 support)
470 [ --enable-ipv6 Enable IPv6 support],
471 [ case "${enableval}" in
483 esac ], check_ipv6=true)
485 if test x$check_ipv6 = xtrue; then
486 AC_TRY_COMPILE([#ifdef HAVE_NETINET_TCP_H
487 #include <netinet/tcp.h>
492 #include <sys/socket.h>
493 #ifdef HAVE_NETDB_IN_H
494 #include <netinet/in.h>
496 [struct sockaddr_in6 sin6;
497 int family = AF_INET6;
498 ], [AC_DEFINE(HAVE_IPV6)
499 AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
505 AC_MSG_CHECKING(for enabled debugging)
507 [ --enable-debug Enable debugging],
508 [ case "${enableval}" in
511 AC_DEFINE(SILC_DEBUG)
512 CFLAGS="-O -g $CFLAGS"
516 CFLAGS="-O2 -g $CFLAGS"
518 esac ], CFLAGS="-O2 -g $CFLAGS"
521 AC_MSG_CHECKING(for enabled stack tracing)
522 AC_ARG_ENABLE(stack-trace,
523 [ --enable-stack-trace Enable memory stack trace],
524 [ case "${enableval}" in
527 AC_DEFINE(SILC_STACKTRACE)
532 esac ], AC_MSG_RESULT(no))
535 # Disable all assembler optimizations
538 [ --disable-asm Do not use assembler optimizations ],
544 AC_ARG_ENABLE(threads,
545 [ --disable-threads Do not compile with multi-thread support],
546 [ case "${enableval}" in
557 if test x$check_threads = xtrue; then
559 AC_CHECK_HEADERS(pthread.h,
560 [ AC_DEFINE(SILC_HAVE_PTHREAD)
562 [ if test -f /usr/pkg/include/pthread.h ; then
563 AC_DEFINE(SILC_HAVE_PTHREAD)
564 AC_MSG_RESULT(Found pthread.h in /usr/pkg/include/)
565 CFLAGS="$CFLAGS -I/usr/pkg/include"
567 elif test -f /usr/contrib/include/pthread.h ; then
568 AC_DEFINE(SILC_HAVE_PTHREAD)
569 AC_MSG_RESULT(Found pthread.h in /usr/contrib/include/)
570 CFLAGS="$CFLAGS -I/usr/contrib/include"
575 AM_CONDITIONAL(SILC_THREADS, test x$want_threads = xtrue)
576 if test x$want_threads = xtrue; then
579 AC_TRY_LINK([#include <pthread.h>],
580 [pthread_attr_t attr; pthread_attr_init(&attr);],
581 AC_DEFINE(SILC_THREADS),
582 LIBS="-L/usr/pkg/lib -lpthread"
583 AC_TRY_LINK([#include <pthread.h>],
584 [pthread_attr_t attr; pthread_attr_init(&attr);],
585 AC_DEFINE(SILC_THREADS),
586 LIBS="-L/usr/contrib/lib -lpthread"
587 AC_TRY_LINK([#include <pthread.h>],
588 [pthread_attr_t attr; pthread_attr_init(&attr);],
589 AC_DEFINE(SILC_THREADS),
593 CFLAGS="$CFLAGS -D_REENTRANT"
596 CFLAGS="$CFLAGS -D_THREAD_SAFE"
597 if test x"$GCC" = xyes; then
598 CFLAGS="$CFLAGS -mthreads"
602 CFLAGS="$CFLAGS -D_THREAD_SAFE"
604 *-sysv5uw7*) # UnixWare 7
605 if test "$GCC" != "yes"; then
606 CFLAGS="$CFLAGS -Kthread"
608 CFLAGS="$CFLAGS -pthread"
612 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
616 LIBS="$TMP_LIBS $LIBS"
621 # Other configure scripts
623 if test x$without_irssi = xfalse; then
624 if test "x$silc_dist" = "xsilc-client" ||
625 test "x$silc_dist" = "xsilc-toolkit"; then
626 AC_CONFIG_SUBDIRS(irssi)
630 AC_CONFIG_SUBDIRS(lib/silcmath/mpi)
631 #AC_CONFIG_SUBDIRS(lib/zlib)
633 SILC_TOP_SRCDIR=`pwd`
634 AC_SUBST(SILC_TOP_SRCDIR)
635 #SILC_INSTALL_PREFIX=$ac_default_prefix
636 #AC_SUBST(SILC_INSTALL_PREFIX)
638 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
639 AC_SUBST(INCLUDE_DEFINES_INT)
640 AC_SUBST(SILC_DIST_SUBDIRS)
653 lib/silccore/Makefile
654 lib/silccrypt/Makefile
655 lib/silcmath/Makefile
656 lib/silcmath/mpi/Makefile.defines
657 lib/silcmath/mpi/Makefile.defines_int
660 lib/silcutil/Makefile
661 lib/silcutil/unix/Makefile
662 lib/silcutil/win32/Makefile
663 lib/silcutil/beos/Makefile
664 lib/silcutil/os2/Makefile
665 lib/silcutil/epoc/Makefile
666 lib/silcsftp/Makefile
667 lib/silcsftp/tests/Makefile
668 doc/example_silcd.conf
671 if test "x$silc_dist" = "xsilc-client" ||
672 test "x$silc_dist" = "xsilc-toolkit"; then
673 AC_CONFIG_FILES(lib/silcclient/Makefile)
676 if test x$without_irssi = xfalse ; then
677 if test "x$silc_dist" = "xsilc-client" ||
678 test "x$silc_dist" = "xsilc-toolkit"; then
680 irssi/Makefile.defines
681 irssi/Makefile.defines_int
686 if test x$without_silcd = xfalse ; then
687 if test "x$silc_dist" = "xsilc-server" ||
688 test "x$silc_dist" = "xsilc-toolkit"; then
695 if test "x$silc_dist" = "xsilc-toolkit"; then
699 win32/libsilc/Makefile
700 win32/libsilcclient/Makefile