4 # Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6 # Copyright (C) 2000 - 2001 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/version.h)
22 CFLAGS="-Wall $CFLAGS"
25 # Put here any platform specific stuff
29 *-*-linux*|*-*-mklinux*)
30 CFLAGS="-D_GNU_SOURCE $CFLAGS"
36 # ./prepare script will automatically put the correct version. Do not edit!
37 AM_INIT_AUTOMAKE(SILC_PACKAGE, SILC_VERSION)
39 AM_CONFIG_HEADER(includes/silcdefs.h)
52 CFLAGS="-finline-functions $CFLAGS"
54 # Currently GCC is only supported compiler
55 AC_MSG_ERROR(GCC is only supported compiler currently)
68 # More header checking
69 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
70 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h)
71 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h netdb.h)
72 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
73 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h regex.h)
74 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h)
83 AC_CHECK_SIZEOF(long long, 0)
84 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
85 AC_CHECK_SIZEOF(long, 0)
86 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
87 AC_CHECK_SIZEOF(int, 0)
88 AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
89 AC_CHECK_SIZEOF(short, 0)
90 AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
91 AC_CHECK_SIZEOF(char, 0)
92 AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
93 AC_CHECK_SIZEOF(void *, 0)
94 AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
96 dnl Curses detection: Munged from Midnight Commander's configure.in
97 AC_DEFUN(AC_CHECK_CURSES,[
104 AC_SUBST(CURSES_LIBS)
105 AC_SUBST(CURSES_INCLUDEDIR)
108 [ --with-sco Use this to turn on SCO-specific code],[
109 if test x$withval = xyes; then
110 AC_DEFINE(SCO_FLAVOR)
111 CFLAGS="$CFLAGS -D_SVID3"
115 AC_ARG_WITH(sunos-curses,
116 [ --with-sunos-curses Used to force SunOS 4.x curses],[
117 if test x$withval = xyes; then
122 AC_ARG_WITH(osf1-curses,
123 [ --with-osf1-curses Used to force OSF/1 curses],[
124 if test x$withval = xyes; then
130 [ --with-vcurses[=incdir] Used to force SysV curses],
131 if test x$withval != xyes; then
132 CURSES_INCLUDEDIR="-I$withval"
138 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
139 if test x$withval = xno ; then
141 elif test x$withval != xyes ; then
142 AC_NCURSES($withval/include, ncurses.h, -L$withval/lib -lncurses, -I$withval/include, "ncurses on $withval/include")
153 AC_DEFUN(AC_USE_SUNOS_CURSES, [
155 screen_manager="SunOS 4.x /usr/5include curses"
156 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
157 AC_DEFINE(USE_SUNOS_CURSES)
158 AC_DEFINE(HAS_CURSES)
160 AC_DEFINE(NO_COLOR_CURSES)
161 AC_DEFINE(USE_SYSV_CURSES)
162 CURSES_INCLUDEDIR="-I/usr/5include"
163 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
164 AC_MSG_RESULT(Please note that some screen refreshs may fail)
167 AC_DEFUN(AC_USE_OSF1_CURSES, [
168 AC_MSG_RESULT(Using OSF1 curses)
170 screen_manager="OSF1 curses"
171 AC_DEFINE(HAS_CURSES)
173 AC_DEFINE(NO_COLOR_CURSES)
174 AC_DEFINE(USE_SYSV_CURSES)
175 CURSES_LIBS="-lcurses"
178 AC_DEFUN(AC_USE_SYSV_CURSES, [
179 AC_MSG_RESULT(Using SysV curses)
180 AC_DEFINE(HAS_CURSES)
182 AC_DEFINE(USE_SYSV_CURSES)
184 screen_manager="SysV/curses"
185 CURSES_LIBS="-lcurses"
189 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
191 AC_DEFUN(AC_NCURSES, [
196 AC_MSG_RESULT(Found ncurses on $1/$2)
199 AC_CHECK_LIB(ncurses, initscr, [
201 CHECKLIBS=`echo "$3"|sed 's/-lncurses/-lcurses/g'`
202 AC_CHECK_LIB(curses, initscr, [
203 CURSES_LIBS="$CHECKLIBS"
206 CURSES_INCLUDEDIR="$4"
209 AC_DEFINE(HAS_CURSES)
212 AC_DEFINE(USE_NCURSES)
217 AC_DEFUN(AC_SEARCH_NCURSES, [
218 AC_CHECKING("location of ncurses.h file")
220 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
221 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
222 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
223 AC_NCURSES(/usr/pkg/include, ncurses.h, -L/usr/pkg/lib -lncurses, -I/usr/pkg/include, "ncurses on /usr/pkg")
224 AC_NCURSES(/usr/contrib/include, ncurses.h, -L/usr/contrib/lib -lncurses, -I/usr/contrib/include, "ncurses on /usr/contrib")
225 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
227 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
229 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
232 dnl We couldn't find ncurses, try SysV curses
236 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
238 AC_EGREP_CPP(USE_NCURSES,[
245 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
246 AC_DEFINE(HAS_CURSES)
249 AC_DEFINE(USE_NCURSES)
251 screen_manager="ncurses installed as curses"
256 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
257 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
258 dnl should be replaced by a more fine grained selection routine
262 if test -f /usr/5include/curses.h
268 dnl use whatever curses there happens to be
271 if test -f /usr/include/curses.h
273 CURSES_LIBS="-lcurses"
274 AC_DEFINE(HAS_CURSES)
277 screen_manager="curses"
283 LIBS="$LIBS $CURSES_LIBS"
285 # Function and library checking
286 AC_CHECK_FUNC(gethostbyname, ac_gethostbyname_found=1,
287 ac_gethostbyname_found=0)
288 if test x$ac_gethostbyname_found = x0; then
289 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
290 AC_CHECK_FUNC(res_gethostbyname, ac_res_ghbn_found=1, ac_res_ghbn_found=0)
291 if test x$ac_res_ghbn_found = x0; then
292 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
295 AC_CHECK_FUNC(socket, ac_socket_found=1, ac_socket_found=0)
296 if test x$ac_socket_found = x0; then
297 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
299 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
300 AC_CHECK_FUNCS(select listen bind shutdown close connect)
301 AC_CHECK_FUNCS(fcntl setsockopt)
302 AC_CHECK_FUNCS(getopt_long time)
303 AC_CHECK_FUNCS(mlock munlock)
304 AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday)
305 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
306 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
308 # SIM support checking
309 # XXX These needs to be changed as more supported platforms appear.
310 # XXX This probably needs to be made platform dependant check.
312 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
313 AC_CHECKING(for SIM support)
314 AC_CHECK_HEADERS(dlfcn.h,
315 AC_CHECK_LIB(dl, dlopen,
318 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
319 AC_MSG_RESULT(enabled SIM support)
321 AC_MSG_RESULT(no SIM support found)),
322 AC_MSG_RESULT(no SIM support found))
328 # Default installation destination
329 AC_PREFIX_DEFAULT(/usr/local/silc)
334 [ --with-etcdir[=PATH] Directory for system files [/etc/silc]],
351 [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]],
368 [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]],
382 # SIM modules directory
385 [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]],
390 MODULESDIR="$withval"
393 MODULESDIR="$withval"
402 [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]],
417 AC_MSG_CHECKING(for enabled debugging)
419 [ --enable-debug Enable debugging (warning: it is heavy!)],
420 [ case "${enableval}" in
423 AC_DEFINE(SILC_DEBUG)
424 CFLAGS="-O -g $CFLAGS"
428 CFLAGS="-O2 -g $CFLAGS"
430 esac ], CFLAGS="-O2 -g $CFLAGS"
433 # SOCKS4 support checking
434 AC_MSG_CHECKING(whether to support SOCKS4)
436 [ --with-socks4[=PATH] Compile with SOCKS4 support],
445 if test -d "$withval/include"; then
446 CFLAGS="$CFLAGS -I$withval/include"
448 CFLAGS="$CFLAGS -I$withval"
450 if test -d "$withval/lib"; then
451 withval="-L$withval/lib -lsocks"
453 withval="-L$withval -lsocks"
456 LIBS="$withval $LIBS"
461 [ AC_MSG_ERROR(Could not find SOCKS4 library.)])
467 # SOCKS5 support checking
468 AC_MSG_CHECKING(whether to support SOCKS5)
470 [ --with-socks5[=PATH] Compile with SOCKS5 support],
479 if test -d "$withval/include"; then
480 CFLAGS="$CFLAGS -I$withval/include"
482 CFLAGS="$CFLAGS -I$withval"
484 if test -d "$withval/lib"; then
485 withval="-L$withval/lib -lsocks5"
487 withval="-L$withval -lsocks5"
490 LIBS="$withval $LIBS"
495 [ AC_MSG_ERROR(Could not find SOCKS5 library.)])
501 if test "x$socks" = "x4"; then
503 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
506 if test "x$socks" = "x5"; then
509 AC_DEFINE(Rconnect, SOCKSconnect)
510 AC_DEFINE(Rgetsockname, SOCKSgetsockname)
511 AC_DEFINE(Rgetpeername, SOCKSgetpeername)
512 AC_DEFINE(Rbind, SOCKSbind)
513 AC_DEFINE(Raccept, SOCKSaccept)
514 AC_DEFINE(Rlisten, SOCKSlisten)
515 AC_DEFINE(Rselect, SOCKSselect)
516 AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
517 AC_DEFINE(Rsendto, SOCKSsendto)
518 AC_DEFINE(Rrecv, SOCKSrecv)
519 AC_DEFINE(Rsend, SOCKSsend)
520 AC_DEFINE(Rread, SOCKSread)
521 AC_DEFINE(Rwrite, SOCKSwrite)
522 AC_DEFINE(Rrresvport, SOCKSrresvport)
523 AC_DEFINE(Rshutdown, SOCKSshutdown)
524 AC_DEFINE(Rlisten, SOCKSlisten)
525 AC_DEFINE(Rclose, SOCKSclose)
526 AC_DEFINE(Rdup, SOCKSdup)
527 AC_DEFINE(Rdup2, SOCKSdup2)
528 AC_DEFINE(Rfclose, SOCKSfclose)
529 AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
532 # GMP Library checking
533 AC_MSG_CHECKING(whether to compile GMP)
535 [ --with-gmp Build the GMP in the SILC source tree],
536 [ case "${withval}" in
538 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = xyes)
542 AC_CHECK_HEADER(gmp.h,
543 AC_CHECK_LIB(gmp, __gmpz_init,
544 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = yes)
545 LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
546 AC_MSG_RESULT(GMP will not be compiled),
547 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes)
548 AC_MSG_RESULT(GMP will be compiled)
550 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes)
551 AC_MSG_RESULT(GMP will be compiled)
555 AC_CHECK_HEADER(gmp.h,
556 AC_CHECK_LIB(gmp, __gmpz_init,
558 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
559 LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
560 AC_MSG_RESULT(GMP will not be compiled),
562 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
563 AC_MSG_RESULT(GMP will be compiled)
566 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
567 AC_MSG_RESULT(GMP will be compiled)
571 AC_ARG_WITH(silcd-config-file,
572 [ --with-silcd-config-file[=PATH]
573 Use PATH as default configuration file in SILC
574 server [/etc/silc/silcd.conf]],
575 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
578 # Other configure scripts
580 AC_CONFIG_SUBDIRS(irssi)
581 AC_CONFIG_SUBDIRS(lib/dotconf)
582 AC_CONFIG_SUBDIRS(lib/silcmath/gmp)
583 AC_CONFIG_SUBDIRS(lib/trq)
584 #AC_CONFIG_SUBDIRS(lib/zlib)
586 SILC_TOP_SRCDIR=`pwd`
587 AC_SUBST(SILC_TOP_SRCDIR)
588 #SILC_INSTALL_PREFIX=$ac_default_prefix
589 #AC_SUBST(SILC_INSTALL_PREFIX)
591 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
592 AC_SUBST(INCLUDE_DEFINES_INT)
601 irssi/Makefile.defines
602 irssi/Makefile.defines_int
607 lib/silcclient/Makefile
608 lib/silccore/Makefile
609 lib/silccrypt/Makefile
610 lib/silcmath/Makefile
612 lib/silcsim/modules/Makefile
614 lib/silcutil/Makefile