AC_PREREQ(2.52)
AC_CONFIG_HEADERS(includes/silcdefs.h)
+CFLAGS=
AC_PROG_CC
AC_C_INLINE
AC_C_CONST
AC_PROG_LN_S
AC_SUBST(LN_S)
-# Distribution definition. ./prepare will automatically add here a correct
-# value. Do not edit!
-#
+##
+## Distribution definition. ./prepare will automatically add here a correct
+## value. Do not edit!
+##
silc_dist=SILC_PACKAGE
SILC_DIST_SUBDIRS="SILC_DISTRIBUTION_SUBDIRS"
AC_DEFINE(SILC_DIST_DEFINE)
-# XXX
-# Compiler flags
+
+##
+## Library versioning.
+##
+# Do the releases and library versioning according to following rules:
+#
+# - If any code has changed in library, increment [LIB]_REVISION
+# - If functions were added, set [LIB]_REVISION to 0
+# - If functions were added, removed or changed, increment [LIB]_CURRENT
+# - If functions were added, increment [LIB]_AGE
+# - If functions were removed, set [LIB]_AGE to 0
+#
+# where [LIB] is LIBSILC and LIBSILCCLIENT, and where "functions" means
+# functions public interfaces.
+#
+# The LIB_BASE_VERSION defines the SILC software major.minor version and
+# it is increment only when these version numbers actually change.
#
-if test "$GCC"; then
- CFLAGS="-Wall -finline-functions $CFLAGS"
-fi
+# Base version for libraries. Do not change this unless SILC version
+# changes too.
+LIB_BASE_VERSION=1.0
+
+# libsilc versions
+LIBSILC_CURRENT=1
+LIBSILC_REVISION=0
+LIBSILC_AGE=1
+
+# libsilcclient versions
+LIBSILCCLIENT_CURRENT=1
+LIBSILCCLIENT_REVISION=1
+LIBSILCCLIENT_AGE=0
+
+# Substitute the version numbers
+AC_SUBST(LIB_BASE_VERSION)
+AC_SUBST(LIBSILC_CURRENT)
+AC_SUBST(LIBSILC_REVISION)
+AC_SUBST(LIBSILC_AGE)
+AC_SUBST(LIBSILCCLIENT_CURRENT)
+AC_SUBST(LIBSILCCLIENT_REVISION)
+AC_SUBST(LIBSILCCLIENT_AGE)
+
+#
# Program checking
#
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_MAKE_SET
+AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_PATH_PROG(sedpath, sed)
AC_TYPE_PID_T
AC_CHECK_SIZEOF(long long, 0)
-AC_DEFINE_UNQUOTED(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
+AC_SUBST(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_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
AC_CHECK_SIZEOF(int, 0)
-AC_DEFINE_UNQUOTED(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
+AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
AC_CHECK_SIZEOF(short, 0)
-AC_DEFINE_UNQUOTED(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
+AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
AC_CHECK_SIZEOF(char, 0)
-AC_DEFINE_UNQUOTED(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
+AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
AC_CHECK_SIZEOF(void *, 0)
-AC_DEFINE_UNQUOTED(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
+AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
# Function and library checking
#
AC_MSG_CHECKING(for SIM support)
AC_MSG_RESULT()
AC_CHECK_HEADERS(dlfcn.h,
- AC_CHECK_LIB(dl, dlopen,
- [
- AC_DEFINE(SILC_SIM)
- sim_support=true
- LIBS="$LIBS -ldl"
- ],
- [
- AC_CHECK_LIB(c, dlopen,
- [
- AC_DEFINE(SILC_SIM)
- sim_support=true
- ])
- ])
- )
+ [
+ AC_CHECK_LIB(dl, dlopen,
+ [
+ AC_DEFINE(SILC_SIM)
+ sim_support=true
+ LIBS="$LIBS -ldl"
+ ],
+ [
+ AC_CHECK_LIB(c, dlopen,
+ [
+ AC_DEFINE(SILC_SIM)
+ sim_support=true
+ ])
+ ])
+ ])
AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
if test x$sim_support = xtrue; then
AC_CHECK_FUNC(getopt_long, have_getopt_long=1, have_getopt_long=0)
AM_CONDITIONAL(HAVE_GETOPT_LONG, test x$have_getopt_long = x1)
-
##
## Enable/disable checking
##
summary_ipv6="no"
AC_TRY_COMPILE(
[
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(SILC_DEBUG)
- CFLAGS="-O -g $CFLAGS"
summary_debug="yes"
;;
*)
AC_MSG_RESULT(no)
- CFLAGS="-O2 -g $CFLAGS"
;;
esac
],
[
- CFLAGS="-O2 -g $CFLAGS"
AC_MSG_RESULT(no)
])
])
+##
+## Compiler and compiler flag checks
+##
+
+# Function to check if compiler flag works
+# Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
+AC_DEFUN(SILC_ADD_CFLAGS,
+[ tmp_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_MSG_CHECKING(whether $CC accepts $1 flag)
+ AC_TRY_LINK(, , AC_MSG_RESULT(yes), [AC_MSG_RESULT(no)
+ CFLAGS="$tmp_CFLAGS"
+ $2])
+ unset tmp_CFLAGS
+])
+
+if test "$GCC"; then
+ # GCC specific options
+ if test "x$summary_debug" = "xyes"; then
+ SILC_ADD_CFLAGS(-g -O)
+ else
+ SILC_ADD_CFLAGS(-g -O2)
+ fi
+ SILC_ADD_CFLAGS(-Wall -finline-functions)
+else
+ # Other compilers
+ case "$target" in
+ alpha*-dec-osf*)
+ SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+ ;;
+ *)
+ SILC_ADD_CFLAGS(-g)
+ SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+ ;;
+ esac
+
+ # Intel C++ Compiler needs -restrict
+ if test "x$CC" = "xicc"; then
+ SILC_ADD_CFLAGS(-restrict)
+ fi
+fi
+
+
##
## Installation
##
[[ --with-etcdir=DIR directory for system files [/etc/silc]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
ETCDIR="$withval"
[[ --with-helpdir=DIR directory for SILC help files [PREFIX/help]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
HELPDIR="$withval"
[[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
DOCDIR="$withval"
[[ --with-simdir=DIR directory for SIM modules [PREFIX/modules]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
MODULESDIR="$withval"
[[ --with-logsdir=DIR directory for SILC Server logs [PREFIX/logs]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
LOGSDIR="$withval"
Server [/var/run/silcd.pid]]],
[
case "$withval" in
- no)
+ no|yes)
;;
*)
PIDFILE="$withval"
# SOCKS4 support checking
#
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING(whether to support SOCKS4)
AC_ARG_WITH(socks4,
[[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
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"
+ LDFLAGS="$LDFLAGS -L$withval/lib"
fi
- LIBS="$withval $LIBS"
- AC_TRY_LINK([],
- [
- Rconnect();
- ], [],
- [
- AC_MSG_ERROR(Could not find SOCKS4 library.)
- ])
+ LIBS="-lsocks $LIBS"
;;
esac
+
+ AC_TRY_LINK([],
+ [
+ Rconnect();
+ ], [],
+ [
+ AC_MSG_ERROR(Could not find SOCKS4 library.)
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ ])
],
AC_MSG_RESULT(no)
)
# SOCKS5 support checking
#
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING(whether to support SOCKS5)
AC_ARG_WITH(socks5,
[[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
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"
+ LDFLAGS="$LDFLAGS -L$withval/lib"
fi
- LIBS="$withval $LIBS"
- AC_TRY_LINK([],
- [
- SOCKSconnect();
- ], [],
- [
- AC_MSG_ERROR(Could not find SOCKS5 library.)
- ])
+ LIBS="-lsocks5 $LIBS"
;;
esac
+
+ AC_TRY_LINK([],
+ [
+ SOCKSconnect();
+ ], [],
+ [
+ AC_MSG_ERROR(Could not find SOCKS5 library.)
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ ])
],
AC_MSG_RESULT(no)
)
# source tree.
#
mp_gmp=false
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING(whether to search for GMP)
AC_ARG_WITH(gmp,
[[ --with-gmp[=DIR] use GMP instead of MPI [search in DIR/lib and DIR/include]]],
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 -lgmp"
- else
- withval="-L$withval -lgmp"
+ LDFLAGS="$LDFLAGS -L$withval/lib"
fi
- LIBS="$withval $LIBS"
- AC_CHECK_LIB(gmp, __gmpz_init,
- [
- mp_gmp=true
- AC_DEFINE(SILC_MP_GMP)
- AC_MSG_RESULT(Using GMP as a MP library.)
- ])
+ LIBS="-lgmp $LIBS"
;;
esac
+
+ AC_CHECK_LIB(gmp, __gmpz_init,
+ [
+ mp_gmp=true
+ AC_DEFINE(SILC_MP_GMP)
+ AC_MSG_RESULT(Using GMP as a MP library.)
+ ],
+ [
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ ])
],
AC_MSG_RESULT(no)
)
#
check_iconv=true
has_iconv=false
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+SAVE_CPPFLAGS="$CPPFLAGS"
AC_MSG_CHECKING(whether to implicit search for libiconv)
AC_ARG_WITH(iconv,
[[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
case "${withval}" in
no)
AC_MSG_RESULT(no)
-
- AC_CHECK_HEADERS(iconv.h, AC_CHECK_FUNC(iconv, has_iconv=true))
+ AC_CHECK_HEADERS(iconv.h,
+ [
+ AC_CHECK_FUNC(iconv, has_iconv=true)
+ ])
check_iconv=false
;;
*)
AC_MSG_RESULT(yes)
-
if test -d $withval/include; then
CPPFLAGS="$CPPFLAGS -I$withval/include"
CFLAGS="$CFLAGS -I$withval/include"
if test -d $withval/lib; then
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
+ ;;
esac
],
[
AC_MSG_RESULT(no)
-
- AC_CHECK_HEADERS(iconv.h, AC_CHECK_FUNCS(iconv,
- [
- has_iconv=true
- check_iconv=false
- ]))
+ AC_CHECK_HEADERS(iconv.h,
+ [
+ AC_CHECK_FUNCS(iconv,
+ [
+ has_iconv=true
+ check_iconv=false
+ ])
+ ])
])
if test x$check_iconv = xtrue; then
[
echo "yes"
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
- has_iconv=true
- check_iconv=true
+ has_iconv=true
+ check_iconv=false
+ ],
+ [
+ echo "no"
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
])
])
fi
if test x$check_iconv = xtrue; then
# search for iconv library..
- SAVE_CPPFLAGS="$CPPFLAGS"
+ SAVE_LIBS="$LIBS"
SAVE_CFLAGS="$CFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
+ SAVE_CPPFLAGS="$CPPFLAGS"
for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
if test x$has_iconv = xfalse; then
AC_MSG_RESULT(searching in $dir...)
-
- CPPFLAGS="$SAVE_CPPFLAGS"
- CFLAGS="$SAVE_CFLAGS"
- LDFLAGS="$SAVE_LDFLAGS"
-
+
if test -d $dir/include; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
CFLAGS="$CFLAGS -I$dir/include"
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
],
[
+ echo "no"
has_iconv=false
+
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
])
+ ],
+ [
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
])
fi
done
)
if test x$ac_iconv_good = xno; then
- AC_MSG_ERROR(Try using libiconv instead.)
+ AC_MSG_RESULT(Try using libiconv instead.)
fi
fi
])
if test x$check_threads = xtrue; then
+ SAVE_LIBS="$LIBS"
+ SAVE_CFLAGS="$CFLAGS"
+ SAVE_LDFLAGS="$LDFLAGS"
+ SAVE_CPPFLAGS="$CPPFLAGS"
+
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(pthread.h,
[
- SAVE_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
[
case "${target}" in
*-*-freebsd*)
LIBS="$SAVE_LIBS -pthread"
- AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true)
+ AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
+ ;;
+ *)
+ LIBS="$SAVE_LIBS"
;;
esac
])
],
[
# search for pthread library..
- SAVE_CPPFLAGS="$CPPFLAGS"
- SAVE_CFLAGS="$CFLAGS"
- SAVE_LDFLAGS="$LDFLAGS"
-
for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
if test x$has_threads = xfalse; then
AC_MSG_RESULT(searching in $dir...)
- CPPFLAGS="$SAVE_CPPFLAGS"
- CFLAGS="$SAVE_CFLAGS"
- LDFLAGS="$SAVE_LDFLAGS"
-
if test -d $dir/include; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
CFLAGS="$CFLAGS -I$dir/include"
[
LIBS="$LIBS -lpthread"
AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
- has_threads=false)
+ [
+ has_threads=false
+
+ LIBS="$SAVE_LIBS"
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ ])
+ ],
+ [
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ CPPFLAGS="$SAVE_CPPFLAGS"
])
fi
done
AC_MSG_RESULT(yes)
])
+libtoolfix=true
+AC_MSG_CHECKING(whether to do libtoolfix)
+AC_ARG_WITH(libtoolfix,
+ [ --without-libtoolfix Do not fix libtool, for package builders],
+ [
+ AC_MSG_RESULT(no)
+ libtoolfix=false
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ])
+
+AC_SUBST(ETCDIR)
+AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
+
+
##
## Misc
fi
fi
-AC_CONFIG_SUBDIRS(lib/silcmath/mpi)
+if test x$mp_gmp = xfalse; then
+ AC_CONFIG_SUBDIRS(lib/silcmath/mpi)
+fi
+
#AC_CONFIG_SUBDIRS(lib/zlib)
SILC_TOP_SRCDIR=`pwd`
AC_SUBST(INCLUDE_DEFINES_INT)
AC_SUBST(SILC_DIST_SUBDIRS)
+#
+# Fix the libtool to support run-time configuration. This allows us
+# to in run-time specify when to compile shared/static libraries without
+# need to reconfigure the entire libtool.
+#
+if test x$libtoolfix = xtrue; then
+ ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
+fi
+AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
+
+
+#
# Makefile outputs
#
AC_CONFIG_FILES(
lib/Makefile
lib/contrib/Makefile
lib/silccore/Makefile
+lib/silccore/tests/Makefile
lib/silccrypt/Makefile
+lib/silccrypt/tests/Makefile
lib/silcmath/Makefile
lib/silcmath/mpi/Makefile.defines
lib/silcmath/mpi/Makefile.defines_int
lib/silcsftp/Makefile
lib/silcsftp/tests/Makefile
doc/example_silcd.conf
+includes/silcincludes.h
)
if test "x$silc_dist" = "xsilc-client" ||
win32/Makefile
win32/libsilc/Makefile
win32/libsilcclient/Makefile
+tutorial/Makefile
+tutorial/Makefile.defines
+tutorial/Makefile.defines_int
)
fi
echo " Installation prefix ...........: $prefix"
echo " bin directory .................: $s_bindir"
echo " sbin directory ................: $s_sbindir"
+echo " etc directory .................: $ETCDIR"
echo " man directory .................: $s_mandir"
echo " help directory ................: $HELPDIR"
echo " doc directory .................: $DOCDIR"
test "x$silc_dist" = "xsilc-toolkit"; then
silcd="yes"
if test x$without_silcd = xtrue; then
- without_silcd="no"
+ silcd="no"
fi
echo " Compile SILC Server ...........: $silcd"
echo " Server configuration file .....: $summary_silcd_configfile"
else
sim_support="yes"
fi
+if test x$has_iconv = xfalse; then
+ iconv_support="no"
+else
+ iconv_support="yes"
+fi
echo " SIM support ...................: $sim_support"
echo " IPv6 support ..................: $summary_ipv6"
-echo " Assmebler optimizations .......: $summary_asm"
+echo " Iconv support .................: $iconv_support"
+echo " Assembler optimizations .......: $summary_asm"
mp="MPI"
if test x$mp_gmp = xtrue; then
echo " Debugging enabled .............: $summary_debug"
echo " Stack-trace enabled ...........: $summary_stacktrace"
echo ""
-echo "Compile the sources with 'make' or 'gmake' command."
+if test "x$silc_dist" = "xsilc-client"; then
+ echo "Compile the sources with 'make' or 'gmake' command (GNU make is required)."
+else
+ echo "Compile the sources with 'make' or 'gmake' command."
+fi