# # configure.in # # Author: Pekka Riikonen # # Copyright (C) 2000 - 2001 Pekka Riikonen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # AC_INIT(includes/version.h) # Compiler settings CFLAGS="-Wall $CFLAGS" # # Put here any platform specific stuff # AC_CANONICAL_SYSTEM case "$target" in *-*-linux*|*-*-mklinux*) CFLAGS="-D_GNU_SOURCE $CFLAGS" ;; *) ;; esac # ./prepare script will automatically put the correct date. Do not edit! AM_INIT_AUTOMAKE(silc, YYYYMMDD) AC_PREREQ(2.3) AM_CONFIG_HEADER(includes/silcdefs.h) AC_PROG_CC AC_C_INLINE AC_C_CONST AC_ARG_PROGRAM AC_PROG_LN_S AC_SUBST(LN_S) # XXX # Compiler flags if test "$GCC"; then CFLAGS="-finline-functions $CFLAGS" else # Currently GCC is only supported compiler AC_MSG_ERROR(GCC is only supported compiler currently) fi # Program checking AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_MAKE_SET # Header checking AC_HEADER_STDC AC_HEADER_TIME AC_HEADER_STAT # More header checking AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h) AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h) AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h netdb.h) AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h) AC_CHECK_HEADERS(ncurses.h signal.h ctype.h regex.h) AC_CHECK_HEADERS(arpa/inet.h sys/mman.h) # Data type checking AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_TYPE_MODE_T AC_TYPE_UID_T AC_TYPE_PID_T AC_CHECK_SIZEOF(long long, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long) AC_CHECK_SIZEOF(long, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG, $ac_cv_sizeof_long) AC_CHECK_SIZEOF(int, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int) AC_CHECK_SIZEOF(short, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short) AC_CHECK_SIZEOF(char, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char) AC_CHECK_SIZEOF(void *, 0) AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p) # Function and library checking AC_CHECK_FUNCS(initscr) AC_CHECK_LIB(ncurses, initscr, LIBS="$LIBS -lncurses") AC_CHECK_FUNCS(gethostbyname) AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl -lresolv") AC_CHECK_FUNCS(socket) AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport) AC_CHECK_FUNCS(select listen bind shutdown close connect) AC_CHECK_FUNCS(fcntl setsockopt) AC_CHECK_FUNCS(getopt_long time) AC_CHECK_FUNCS(mlock munlock) AC_CHECK_FUNCS(chmod stat fstat getenv putenv strerror ctime gettimeofday) AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid) AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove) # SIM support checking # XXX These needs to be changed as more supported platforms appear. # XXX This probably needs to be made platform dependant check. AC_CHECKING(for SIM support) AC_CHECK_HEADERS(dlfcn.h, AC_CHECK_LIB(dl, dlopen, AC_DEFINE(SILC_SIM) AC_MSG_RESULT(enabled SIM support) LIBS="$LIBS -ldl", AC_MSG_RESULT(no SIM support found)), AC_MSG_RESULT(no SIM support found)) # # Installation # # Default installation destination AC_PREFIX_DEFAULT(/usr/local/silc) # etc directory ETCDIR="/etc/silc" AC_ARG_WITH(etcdir, [ --with-etcdir[=PATH] Directory for system files [/etc/silc]], [ case "$withval" in no) ;; yes) ;; *) ETCDIR="$withwal" ;; esac ], ) AC_SUBST(ETCDIR) # help directory HELPDIR="help" AC_ARG_WITH(helpdir, [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]], [ case "$withval" in no) ;; yes) ;; *) HELPDIR="$withwal" ;; esac ], ) AC_SUBST(HELPDIR) # doc directory DOCDIR="doc" AC_ARG_WITH(docdir, [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]], [ case "$withval" in no) ;; yes) ;; *) DOCDIR="$withwal" ;; esac ], ) AC_SUBST(DOCDIR) # SIM modules directory MODULESDIR="modules" AC_ARG_WITH(simdir, [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]], [ case "$withval" in no) ;; yes) ;; *) MODULESDIR="$withwal" ;; esac ], ) AC_SUBST(MODULESDIR) # Logs directory LOGSDIR="logs" AC_ARG_WITH(logsdir, [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]], [ case "$withval" in no) ;; yes) ;; *) LOGSDIR="$withwal" ;; esac ], ) AC_SUBST(LOGSDIR) # Debug checking AC_MSG_CHECKING(for enabled debugging) AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging (warning: it is heavy!)], [ case "${enableval}" in yes) AC_MSG_RESULT(yes) AC_DEFINE(SILC_DEBUG) CFLAGS="-O -g $CFLAGS" ;; *) AC_MSG_RESULT(no) CFLAGS="-O2 -g $CFLAGS" ;; esac ], CFLAGS="-O2 -g $CFLAGS" AC_MSG_RESULT(no)) # SOCKS4 support checking AC_MSG_CHECKING(whether to support SOCKS4) AC_ARG_WITH(socks4, [ --with-socks4[=PATH] Compile with SOCKS4 support], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) socks=4 if test -d "$withval/include"; then CFLAGS="$CFLAGS -I$withval/include" else CFLAGS="$CFLAGS -I$withval" fi if test -d "$withval/lib"; then withval="-L$withval/lib -lsocks" else withval="-L$withval -lsocks" fi LIBS="$withval $LIBS" AC_TRY_LINK([], [ Rconnect(); ], [], [ AC_MSG_ERROR(Could not find SOCKS4 library.)]) ;; esac ], AC_MSG_RESULT(no) ) # SOCKS5 support checking AC_MSG_CHECKING(whether to support SOCKS5) AC_ARG_WITH(socks5, [ --with-socks5[=PATH] Compile with SOCKS5 support], [ case "$withval" in no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) socks=5 if test -d "$withval/include"; then CFLAGS="$CFLAGS -I$withval/include" else CFLAGS="$CFLAGS -I$withval" fi if test -d "$withval/lib"; then withval="-L$withval/lib -lsocks5" else withval="-L$withval -lsocks5" fi LIBS="$withval $LIBS" AC_TRY_LINK([], [ SOCKSconnect(); ], [], [ AC_MSG_ERROR(Could not find SOCKS5 library.)]) ;; esac ], AC_MSG_RESULT(no) ) if test "x$socks" = "x4"; then AC_DEFINE(SOCKS) CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect" fi if test "x$socks" = "x5"; then AC_DEFINE(SOCKS) AC_DEFINE(SOCKS5) AC_DEFINE(Rconnect, SOCKSconnect) AC_DEFINE(Rgetsockname, SOCKSgetsockname) AC_DEFINE(Rgetpeername, SOCKSgetpeername) AC_DEFINE(Rbind, SOCKSbind) AC_DEFINE(Raccept, SOCKSaccept) AC_DEFINE(Rlisten, SOCKSlisten) AC_DEFINE(Rselect, SOCKSselect) AC_DEFINE(Rrecvfrom, SOCKSrecvfrom) AC_DEFINE(Rsendto, SOCKSsendto) AC_DEFINE(Rrecv, SOCKSrecv) AC_DEFINE(Rsend, SOCKSsend) AC_DEFINE(Rread, SOCKSread) AC_DEFINE(Rwrite, SOCKSwrite) AC_DEFINE(Rrresvport, SOCKSrresvport) AC_DEFINE(Rshutdown, SOCKSshutdown) AC_DEFINE(Rlisten, SOCKSlisten) AC_DEFINE(Rclose, SOCKSclose) AC_DEFINE(Rdup, SOCKSdup) AC_DEFINE(Rdup2, SOCKSdup2) AC_DEFINE(Rfclose, SOCKSfclose) AC_DEFINE(Rgethostbyname, SOCKSgethostbyname) fi # GMP Library checking AC_MSG_CHECKING(whether to compile GMP) AC_ARG_WITH(gmp, [ --with-gmp Build the GMP in the SILC source tree], [ case "${withval}" in yes) AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = xyes) AC_MSG_RESULT(yes) ;; *) AC_CHECK_HEADER(gmp.h, AC_CHECK_LIB(gmp, __gmpz_init, AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval = yes) AC_MSG_RESULT(GMP will not be compiled), AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes) AC_MSG_RESULT(GMP will be compiled) ), AM_CONDITIONAL(SILC_BUILD_GMP, test x$withval != yes) AC_MSG_RESULT(GMP will be compiled) ) ;; esac ], [ AC_CHECK_HEADER(gmp.h, AC_CHECK_LIB(gmp, __gmpz_init, build_gmp=false AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue) AC_MSG_RESULT(GMP will not be compiled), build_gmp=true AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue) AC_MSG_RESULT(GMP will be compiled) ), build_gmp=true AM_CONDITIONAL(SILC_BUILD_GMP, test x$build_gmp = xtrue) AC_MSG_RESULT(GMP will be compiled) ) ]) AC_ARG_WITH(silcd-config-file, [ --with-silcd-config-file[=PATH] Use PATH as default configuration file in SILC server [/etc/silc/silcd.conf]], [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ]) # XXX #LIBS="$LIBS -lefence" # Other configure scripts #AC_CONFIG_SUBDIRS(lib/zlib) AC_CONFIG_SUBDIRS(lib/dotconf) AC_CONFIG_SUBDIRS(lib/silcmath/gmp) AC_CONFIG_SUBDIRS(lib/trq) AC_OUTPUT( \ Makefile doc/Makefile includes/Makefile lib/Makefile lib/contrib/Makefile lib/silcclient/Makefile lib/silccore/Makefile lib/silccrypt/Makefile lib/silcmath/Makefile lib/silcsim/Makefile lib/silcsim/modules/Makefile lib/silcske/Makefile lib/silcutil/Makefile silc/Makefile silcd/Makefile)