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)
49 # Distribution definition. ./prepare will automatically add here a correct
51 AC_DEFINE(SILC_DIST_DEFINE)
52 AM_CONDITIONAL(SILC_DIST_DEFINE, test xtrue = xtrue)
57 CFLAGS="-finline-functions $CFLAGS"
59 # Currently GCC is only supported compiler
60 AC_MSG_ERROR(GCC is only supported compiler currently)
73 # More header checking
74 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
75 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h)
76 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h netdb.h)
77 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
78 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h regex.h)
79 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h)
88 AC_CHECK_SIZEOF(long long, 0)
89 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
90 AC_CHECK_SIZEOF(long, 0)
91 AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
92 AC_CHECK_SIZEOF(int, 0)
93 AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
94 AC_CHECK_SIZEOF(short, 0)
95 AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
96 AC_CHECK_SIZEOF(char, 0)
97 AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
98 AC_CHECK_SIZEOF(void *, 0)
99 AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
101 dnl Curses detection: Munged from Midnight Commander's configure.in
102 AC_DEFUN(AC_CHECK_CURSES,[
109 AC_SUBST(CURSES_LIBS)
110 AC_SUBST(CURSES_INCLUDEDIR)
113 [ --with-sco Use this to turn on SCO-specific code],[
114 if test x$withval = xyes; then
115 AC_DEFINE(SCO_FLAVOR)
116 CFLAGS="$CFLAGS -D_SVID3"
120 AC_ARG_WITH(sunos-curses,
121 [ --with-sunos-curses Used to force SunOS 4.x curses],[
122 if test x$withval = xyes; then
127 AC_ARG_WITH(osf1-curses,
128 [ --with-osf1-curses Used to force OSF/1 curses],[
129 if test x$withval = xyes; then
135 [ --with-vcurses[=incdir] Used to force SysV curses],
136 if test x$withval != xyes; then
137 CURSES_INCLUDEDIR="-I$withval"
143 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
144 if test x$withval = xno ; then
146 elif test x$withval != xyes ; then
147 AC_NCURSES($withval/include, ncurses.h, -L$withval/lib -lncurses, -I$withval/include, "ncurses on $withval/include")
158 AC_DEFUN(AC_USE_SUNOS_CURSES, [
160 screen_manager="SunOS 4.x /usr/5include curses"
161 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
162 AC_DEFINE(USE_SUNOS_CURSES)
163 AC_DEFINE(HAS_CURSES)
165 AC_DEFINE(NO_COLOR_CURSES)
166 AC_DEFINE(USE_SYSV_CURSES)
167 CURSES_INCLUDEDIR="-I/usr/5include"
168 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
169 AC_MSG_RESULT(Please note that some screen refreshs may fail)
172 AC_DEFUN(AC_USE_OSF1_CURSES, [
173 AC_MSG_RESULT(Using OSF1 curses)
175 screen_manager="OSF1 curses"
176 AC_DEFINE(HAS_CURSES)
178 AC_DEFINE(NO_COLOR_CURSES)
179 AC_DEFINE(USE_SYSV_CURSES)
180 CURSES_LIBS="-lcurses"
183 AC_DEFUN(AC_USE_SYSV_CURSES, [
184 AC_MSG_RESULT(Using SysV curses)
185 AC_DEFINE(HAS_CURSES)
187 AC_DEFINE(USE_SYSV_CURSES)
189 screen_manager="SysV/curses"
190 CURSES_LIBS="-lcurses"
194 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
196 AC_DEFUN(AC_NCURSES, [
201 AC_MSG_RESULT(Found ncurses on $1/$2)
204 AC_CHECK_LIB(ncurses, initscr, [
206 CHECKLIBS=`echo "$3"|sed 's/-lncurses/-lcurses/g'`
207 AC_CHECK_LIB(curses, initscr, [
208 CURSES_LIBS="$CHECKLIBS"
211 CURSES_INCLUDEDIR="$4"
214 AC_DEFINE(HAS_CURSES)
217 AC_DEFINE(USE_NCURSES)
222 AC_DEFUN(AC_SEARCH_NCURSES, [
223 AC_CHECKING("location of ncurses.h file")
225 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
226 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
227 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
228 AC_NCURSES(/usr/pkg/include, ncurses.h, -L/usr/pkg/lib -lncurses, -I/usr/pkg/include, "ncurses on /usr/pkg")
229 AC_NCURSES(/usr/contrib/include, ncurses.h, -L/usr/contrib/lib -lncurses, -I/usr/contrib/include, "ncurses on /usr/contrib")
230 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")
232 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")
234 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
237 dnl We couldn't find ncurses, try SysV curses
241 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
243 AC_EGREP_CPP(USE_NCURSES,[
250 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
251 AC_DEFINE(HAS_CURSES)
254 AC_DEFINE(USE_NCURSES)
256 screen_manager="ncurses installed as curses"
261 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
262 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
263 dnl should be replaced by a more fine grained selection routine
267 if test -f /usr/5include/curses.h
273 dnl use whatever curses there happens to be
276 if test -f /usr/include/curses.h
278 CURSES_LIBS="-lcurses"
279 AC_DEFINE(HAS_CURSES)
282 screen_manager="curses"
288 LIBS="$LIBS $CURSES_LIBS"
290 # Function and library checking
291 AC_CHECK_FUNC(gethostbyname, ac_gethostbyname_found=1,
292 ac_gethostbyname_found=0)
293 if test x$ac_gethostbyname_found = x0; then
294 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
295 AC_CHECK_FUNC(res_gethostbyname, ac_res_ghbn_found=1, ac_res_ghbn_found=0)
296 if test x$ac_res_ghbn_found = x0; then
297 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
300 AC_CHECK_FUNC(socket, ac_socket_found=1, ac_socket_found=0)
301 if test x$ac_socket_found = x0; then
302 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
304 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
305 AC_CHECK_FUNCS(select listen bind shutdown close connect)
306 AC_CHECK_FUNCS(fcntl setsockopt)
307 AC_CHECK_FUNCS(getopt_long time)
308 AC_CHECK_FUNCS(mlock munlock)
309 AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday)
310 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
311 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
313 # SIM support checking
314 # XXX These needs to be changed as more supported platforms appear.
315 # XXX This probably needs to be made platform dependant check.
317 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
318 AC_CHECKING(for SIM support)
319 AC_CHECK_HEADERS(dlfcn.h,
320 AC_CHECK_LIB(dl, dlopen,
323 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
324 AC_MSG_RESULT(enabled SIM support)
326 AC_MSG_RESULT(no SIM support found)),
327 AC_MSG_RESULT(no SIM support found))
333 # Default installation destination
334 AC_PREFIX_DEFAULT(/usr/local/silc)
339 [ --with-etcdir[=PATH] Directory for system files [/etc/silc]],
356 [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]],
373 [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]],
387 # SIM modules directory
390 [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]],
395 MODULESDIR="$withval"
398 MODULESDIR="$withval"
407 [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]],
422 AC_MSG_CHECKING(for enabled debugging)
424 [ --enable-debug Enable debugging (warning: it is heavy!)],
425 [ case "${enableval}" in
428 AC_DEFINE(SILC_DEBUG)
429 CFLAGS="-O -g $CFLAGS"
433 CFLAGS="-O2 -g $CFLAGS"
435 esac ], CFLAGS="-O2 -g $CFLAGS"
438 # SOCKS4 support checking
439 AC_MSG_CHECKING(whether to support SOCKS4)
441 [ --with-socks4[=PATH] Compile with SOCKS4 support],
450 if test -d "$withval/include"; then
451 CFLAGS="$CFLAGS -I$withval/include"
453 CFLAGS="$CFLAGS -I$withval"
455 if test -d "$withval/lib"; then
456 withval="-L$withval/lib -lsocks"
458 withval="-L$withval -lsocks"
461 LIBS="$withval $LIBS"
466 [ AC_MSG_ERROR(Could not find SOCKS4 library.)])
472 # SOCKS5 support checking
473 AC_MSG_CHECKING(whether to support SOCKS5)
475 [ --with-socks5[=PATH] Compile with SOCKS5 support],
484 if test -d "$withval/include"; then
485 CFLAGS="$CFLAGS -I$withval/include"
487 CFLAGS="$CFLAGS -I$withval"
489 if test -d "$withval/lib"; then
490 withval="-L$withval/lib -lsocks5"
492 withval="-L$withval -lsocks5"
495 LIBS="$withval $LIBS"
500 [ AC_MSG_ERROR(Could not find SOCKS5 library.)])
506 if test "x$socks" = "x4"; then
508 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
511 if test "x$socks" = "x5"; then
514 AC_DEFINE(Rconnect, SOCKSconnect)
515 AC_DEFINE(Rgetsockname, SOCKSgetsockname)
516 AC_DEFINE(Rgetpeername, SOCKSgetpeername)
517 AC_DEFINE(Rbind, SOCKSbind)
518 AC_DEFINE(Raccept, SOCKSaccept)
519 AC_DEFINE(Rlisten, SOCKSlisten)
520 AC_DEFINE(Rselect, SOCKSselect)
521 AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
522 AC_DEFINE(Rsendto, SOCKSsendto)
523 AC_DEFINE(Rrecv, SOCKSrecv)
524 AC_DEFINE(Rsend, SOCKSsend)
525 AC_DEFINE(Rread, SOCKSread)
526 AC_DEFINE(Rwrite, SOCKSwrite)
527 AC_DEFINE(Rrresvport, SOCKSrresvport)
528 AC_DEFINE(Rshutdown, SOCKSshutdown)
529 AC_DEFINE(Rlisten, SOCKSlisten)
530 AC_DEFINE(Rclose, SOCKSclose)
531 AC_DEFINE(Rdup, SOCKSdup)
532 AC_DEFINE(Rdup2, SOCKSdup2)
533 AC_DEFINE(Rfclose, SOCKSfclose)
534 AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
537 # GMP Library checking
538 AC_MSG_CHECKING(whether to compile GMP)
540 [ --with-gmp Build the GMP in the SILC source tree],
541 [ case "${withval}" in
543 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = xyes)
547 AC_CHECK_HEADER(gmp.h,
548 AC_CHECK_LIB(gmp, __gmpz_init,
549 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = yes)
550 LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
551 AC_MSG_RESULT(GMP will not be compiled),
552 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes)
553 AC_MSG_RESULT(GMP will be compiled)
555 AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes)
556 AC_MSG_RESULT(GMP will be compiled)
560 AC_CHECK_HEADER(gmp.h,
561 AC_CHECK_LIB(gmp, __gmpz_init,
563 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
564 LIBS="$LIBS -L/usr/lib -L/usr/local/lib -lgmp"
565 AC_MSG_RESULT(GMP will not be compiled),
567 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
568 AC_MSG_RESULT(GMP will be compiled)
571 AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue)
572 AC_MSG_RESULT(GMP will be compiled)
576 AC_ARG_WITH(silcd-config-file,
577 [ --with-silcd-config-file[=PATH]
578 Use PATH as default configuration file in SILC
579 server [/etc/silc/silcd.conf]],
580 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
583 # Other configure scripts
585 AC_CONFIG_SUBDIRS(irssi)
586 AC_CONFIG_SUBDIRS(lib/dotconf)
587 AC_CONFIG_SUBDIRS(lib/silcmath/gmp)
588 AC_CONFIG_SUBDIRS(lib/trq)
589 #AC_CONFIG_SUBDIRS(lib/zlib)
591 SILC_TOP_SRCDIR=`pwd`
592 AC_SUBST(SILC_TOP_SRCDIR)
593 #SILC_INSTALL_PREFIX=$ac_default_prefix
594 #AC_SUBST(SILC_INSTALL_PREFIX)
596 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
597 AC_SUBST(INCLUDE_DEFINES_INT)
606 irssi/Makefile.defines
607 irssi/Makefile.defines_int
612 lib/silcclient/Makefile
613 lib/silccore/Makefile
614 lib/silccrypt/Makefile
615 lib/silcmath/Makefile
617 lib/silcsim/modules/Makefile
619 lib/silcutil/Makefile