AC_CHECK_FUNC(getopt_long, have_getopt_long=1, have_getopt_long=0)
AM_CONDITIONAL(HAVE_GETOPT_LONG, test x$have_getopt_long = x1)
-# Installation
+
+##
+## Enable/disable checking
+##
+
+# IPv6 support
#
+AC_MSG_CHECKING(for IPv6 support)
+AC_ARG_ENABLE(ipv6,
+ [ --enable-ipv6 enable IPv6 support],
+ [
+ case "${enableval}" in
+ yes)
+ want_ipv6=true
+ check_ipv6=false
+ AC_DEFINE(HAVE_IPV6)
+ AC_MSG_RESULT(yes)
+ ;;
+ *)
+ want_ipv6=false
+ check_ipv6=false
+ AC_MSG_RESULT(no)
+ ;;
+ esac
+ ],
+ check_ipv6=true
+ )
+
+if test x$check_ipv6 = xtrue; then
+ AC_TRY_COMPILE(
+ [
+ #ifdef HAVE_NETINET_TCP_H
+ #include <netinet/tcp.h>
+ #endif
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+ #include <sys/socket.h>
+ #ifdef HAVE_NETDB_IN_H
+ #include <netinet/in.h>
+ #endif
+ ],
+ [
+ struct sockaddr_in6 sin6;
+ int family = AF_INET6;
+ ],
+ [
+ AC_DEFINE(HAVE_IPV6)
+ AC_MSG_RESULT(yes)
+ ],
+ AC_MSG_RESULT(no)
+ )
+fi
+
+# Debug checking
+#
+AC_MSG_CHECKING(for enabled debugging)
+AC_ARG_ENABLE(debug,
+ [ --enable-debug enable debugging],
+ [
+ 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)
+ ])
+
+# Stack trace checking
+#
+AC_MSG_CHECKING(for enabled stack tracing)
+AC_ARG_ENABLE(stack-trace,
+ [ --enable-stack-trace enable memory stack trace],
+ [
+ case "${enableval}" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(SILC_STACKTRACE)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac
+ ],
+ AC_MSG_RESULT(no)
+ )
+
+# Disable all assembler optimizations
+#
+AC_ARG_ENABLE(asm,
+ [ --disable-asm do not use assembler optimizations])
+
+# Threads support
+#
+want_threads=false
+AC_ARG_ENABLE(threads,
+ [ --disable-threads do not compile with multi-thread support],
+ [
+ case "${enableval}" in
+ yes)
+ want_threads=true
+ check_threads=true
+ ;;
+ *)
+ check_threads=false
+ ;;
+ esac
+ ])
+
+if test x$check_threads = xtrue; then
+AC_CHECK_HEADERS(pthread.h,
+ [
+ AC_DEFINE(SILC_HAVE_PTHREAD)
+ want_threads=true
+ ],
+ [
+ if test -f /usr/pkg/include/pthread.h ; then
+ AC_DEFINE(SILC_HAVE_PTHREAD)
+ want_threads=true
+ AC_MSG_RESULT(Found pthread.h in /usr/pkg/include/)
+ CFLAGS="$CFLAGS -I/usr/pkg/include"
+ elif test -f /usr/contrib/include/pthread.h ; then
+ AC_DEFINE(SILC_HAVE_PTHREAD)
+ want_threads=true
+ AC_MSG_RESULT(Found pthread.h in /usr/contrib/include/)
+ CFLAGS="$CFLAGS -I/usr/contrib/include"
+ fi
+ ])
+fi
+
+AM_CONDITIONAL(SILC_THREADS, test x$want_threads = xtrue)
+if test x$want_threads = xtrue; then
+ TMP_LIBS="$LIBS"
+ LIBS="-lpthread"
+ AC_TRY_LINK(
+ [
+ #include <pthread.h>
+ ],
+ [
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ ],
+ [
+ AC_DEFINE(SILC_THREADS)
+ ],
+ [
+ LIBS="-L/usr/pkg/lib -lpthread"
+ AC_TRY_LINK(
+ [
+ #include <pthread.h>
+ ],
+ [
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ ],
+ [
+ AC_DEFINE(SILC_THREADS)
+ ],
+ [
+ LIBS="-L/usr/contrib/lib -lpthread"
+ AC_TRY_LINK(
+ [
+ #include <pthread.h>
+ ],
+ [
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ ],
+ [
+ AC_DEFINE(SILC_THREADS)
+ ],
+ LIBS=""
+ )
+ ])
+ ])
+
+ CFLAGS="$CFLAGS -D_REENTRANT"
+ case $host in
+ *-aix*)
+ CFLAGS="$CFLAGS -D_THREAD_SAFE"
+ if test x"$GCC" = xyes; then
+ CFLAGS="$CFLAGS -mthreads"
+ fi
+ ;;
+ *-freebsd2.2*)
+ CFLAGS="$CFLAGS -D_THREAD_SAFE"
+ ;;
+ *-sysv5uw7*) # UnixWare 7
+ if test "$GCC" != "yes"; then
+ CFLAGS="$CFLAGS -Kthread"
+ else
+ CFLAGS="$CFLAGS -pthread"
+ fi
+ ;;
+ *-dg-dgux*) # DG/UX
+ CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
+ ;;
+ esac
+ LIBS="$TMP_LIBS $LIBS"
+fi
+
+
+##
+## Installation
+##
# Default installation destination
#
fi
AC_ARG_WITH(etcdir,
- [ --with-etcdir[=PATH] Directory for system files [/etc/silc]],
+ [[ --with-etcdir=DIR directory for system files [/etc/silc]]],
[
case "$withval" in
no)
;;
- yes)
- ETCDIR="$withval"
- ;;
*)
ETCDIR="$withval"
;;
#
HELPDIR="$silc_prefix/help"
AC_ARG_WITH(helpdir,
- [ --with-helpdir[=PATH] Directory for SILC help files [PREFIX/help]],
+ [[ --with-helpdir=DIR directory for SILC help files [PREFIX/help]]],
[
case "$withval" in
no)
;;
- yes)
- HELPDIR="$withval"
- ;;
*)
HELPDIR="$withval"
;;
#
DOCDIR="$silc_prefix/doc"
AC_ARG_WITH(docdir,
- [ --with-docdir[=PATH] Directory for SILC documentation [PREFIX/doc]],
+ [[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
[
case "$withval" in
no)
;;
- yes)
- DOCDIR="$withval"
- ;;
*)
DOCDIR="$withval"
;;
#
MODULESDIR="$silc_prefix/modules"
AC_ARG_WITH(simdir,
- [ --with-simdir[=PATH] Directory for SIM modules [PREFIX/modules]],
+ [[ --with-simdir=DIR directory for SIM modules [PREFIX/modules]]],
[
case "$withval" in
no)
;;
- yes)
- MODULESDIR="$withval"
- ;;
*)
MODULESDIR="$withval"
;;
#
LOGSDIR="$silc_prefix/logs"
AC_ARG_WITH(logsdir,
- [ --with-logsdir[=PATH] Directory for Server logs [PREFIX/logs]],
+ [[ --with-logsdir=DIR directory for SILC Server logs [PREFIX/logs]]],
[
case "$withval" in
no)
;;
- yes)
- LOGSDIR="$withval"
- ;;
*)
LOGSDIR="$withval"
;;
AC_SUBST(LOGSDIR)
AC_DEFINE_UNQUOTED(SILC_LOGSDIR, "$LOGSDIR")
+# silcd config file checking
+#
+AC_ARG_WITH(silcd-conf,
+ [[ --with-silcd-conf=FILE use FILE as default configuration file for SILC
+ Server [/etc/silc/silcd.conf]]],
+ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval")
+ )
+
+# silcd pid file checking
+#
+if test "x$localstatedir" != 'x${prefix}/var'; then
+ PIDFILE="$localstatedir/silcd.pid"
+else
+ PIDFILE="$silc_prefix/var/silcd.pid"
+fi
+
+AC_ARG_WITH(silcd-pid,
+ [[ --with-silcd-pid=FILE use FILE as default pid file for SILC
+ Server [/var/run/silcd.pid]]],
+ [
+ case "$withval" in
+ no)
+ ;;
+ *)
+ PIDFILE="$withval"
+ ;;
+ esac
+ ])
+AC_SUBST(PIDFILE)
+
+
+##
+## With/without checkings
+##
+
# SOCKS4 support checking
#
AC_MSG_CHECKING(whether to support SOCKS4)
AC_ARG_WITH(socks4,
- [ --with-socks4[=PATH] Compile with SOCKS4 support],
+ [[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
[
case "$withval" in
no)
#
AC_MSG_CHECKING(whether to support SOCKS5)
AC_ARG_WITH(socks5,
- [ --with-socks5[=PATH] Compile with SOCKS5 support],
+ [[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
[
case "$withval" in
no)
mp_gmp=false
AC_MSG_CHECKING(whether to support GMP)
AC_ARG_WITH(gmp,
- [ --with-gmp[=PATH] Compile with GMP support instead of MPI],
+ [[ --with-gmp[=DIR] use GMP instead of MPI [search in DIR/lib and DIR/include]]],
[
case "$withval" in
no)
[
mp_gmp=true
AC_DEFINE(SILC_MP_GMP)
- AC_MSG_RESULT(Using GMP as MP library.)
+ AC_MSG_RESULT(Using GMP as a MP library.)
])
;;
esac
AM_CONDITIONAL(SILC_MP_NSS_MPI, test x$mp_gmp = xfalse)
if test x$mp_gmp = xfalse; then
AC_DEFINE(SILC_MP_NSS_MPI)
- AC_MSG_RESULT(Using NSS MPI as MP library.)
+ AC_MSG_RESULT(Using NSS MPI as a MP library.)
fi
# iconv support
#
AC_ARG_WITH(iconv,
- [ --with-iconv[=PATH] Search for libiconv in DIR/include and DIR/lib],
+ [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
[
- for dir in `echo "$withval" | tr : ' '`; do
- if test -d $dir/include; then
- CPPFLAGS="$CPPFLAGS -I$dir/include"
- CFLAGS="$CFLAGS -I$dir/include"
- fi
- if test -d $dir/lib; then
- LDFLAGS="$LDFLAGS -L$dir/lib"
- fi
- done
+ if test -d $dir/include; then
+ CPPFLAGS="$CPPFLAGS -I$dir/include"
+ CFLAGS="$CFLAGS -I$dir/include"
+ fi
+ if test -d $dir/lib; then
+ LDFLAGS="$LDFLAGS -L$dir/lib"
+ fi
])
AC_CHECK_HEADER(iconv.h,
fi
fi
-# silcd config file checking
-#
-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")
- )
-
-# silcd pid file checking
-#
-if test "x$localstatedir" != 'x${prefix}/var'; then
- PIDFILE="$localstatedir/silcd.pid"
-else
- PIDFILE="$silc_prefix/var/silcd.pid"
-fi
-
-AC_ARG_WITH(silcd-pid-file,
- [ --with-silcd-pid-file[=PATH]
- Use PATH as default pid file in SILC
- server [/var/run/silcd.pid]],
- [
- case "$withval" in
- no)
- ;;
- yes)
- PIDFILE="$withval"
- ;;
- *)
- PIDFILE="$withval"
- ;;
- esac
- ])
-AC_SUBST(PIDFILE)
-
# Native WIN32 compilation under cygwin
#
AC_ARG_WITH(win32,
- [ --with-win32 Compile native WIN32 code (-mno-cygwin)],
+ [ --with-win32 compile native WIN32 code (-mno-cygwin)],
[
AC_DEFINE(SILC_WIN32)
win32_support=true
#
without_irssi=false
AC_ARG_WITH(irssi,
- [ --without-irssi Compile without Irssi SILC Client],
+ [ --without-irssi compile without Irssi SILC Client],
[
without_irssi=true
SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/irssi//'`
#
without_silcd=false
AC_ARG_WITH(silcd,
- [ --without-silcd Compile without SILC Server],
+ [ --without-silcd compile without SILC Server],
[
without_silcd=true
SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/silcd//'`
])
-# Disable all assembler optimizations
-#
-AC_ARG_ENABLE(asm,
- [ --disable-asm Do not use assembler optimizations ])
-
-# Threads support
-#
-want_threads=false
-AC_ARG_ENABLE(threads,
- [ --disable-threads Do not compile with multi-thread support ],
- [
- case "${enableval}" in
- yes)
- want_threads=true
- check_threads=true
- ;;
- *)
- check_threads=false
- ;;
- esac
- ])
-
-if test x$check_threads = xtrue; then
-AC_CHECK_HEADERS(pthread.h,
- [
- AC_DEFINE(SILC_HAVE_PTHREAD)
- want_threads=true
- ],
- [
- if test -f /usr/pkg/include/pthread.h ; then
- AC_DEFINE(SILC_HAVE_PTHREAD)
- want_threads=true
- AC_MSG_RESULT(Found pthread.h in /usr/pkg/include/)
- CFLAGS="$CFLAGS -I/usr/pkg/include"
- elif test -f /usr/contrib/include/pthread.h ; then
- AC_DEFINE(SILC_HAVE_PTHREAD)
- want_threads=true
- AC_MSG_RESULT(Found pthread.h in /usr/contrib/include/)
- CFLAGS="$CFLAGS -I/usr/contrib/include"
- fi
- ])
-fi
-
-AM_CONDITIONAL(SILC_THREADS, test x$want_threads = xtrue)
-if test x$want_threads = xtrue; then
- TMP_LIBS="$LIBS"
- LIBS="-lpthread"
- AC_TRY_LINK(
- [
- #include <pthread.h>
- ],
- [
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- ],
- [
- AC_DEFINE(SILC_THREADS)
- ],
- [
- LIBS="-L/usr/pkg/lib -lpthread"
- AC_TRY_LINK(
- [
- #include <pthread.h>
- ],
- [
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- ],
- [
- AC_DEFINE(SILC_THREADS)
- ],
- [
- LIBS="-L/usr/contrib/lib -lpthread"
- AC_TRY_LINK(
- [
- #include <pthread.h>
- ],
- [
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- ],
- [
- AC_DEFINE(SILC_THREADS)
- ],
- LIBS=""
- )
- ])
- ])
-
- CFLAGS="$CFLAGS -D_REENTRANT"
- case $host in
- *-aix*)
- CFLAGS="$CFLAGS -D_THREAD_SAFE"
- if test x"$GCC" = xyes; then
- CFLAGS="$CFLAGS -mthreads"
- fi
- ;;
- *-freebsd2.2*)
- CFLAGS="$CFLAGS -D_THREAD_SAFE"
- ;;
- *-sysv5uw7*) # UnixWare 7
- if test "$GCC" != "yes"; then
- CFLAGS="$CFLAGS -Kthread"
- else
- CFLAGS="$CFLAGS -pthread"
- fi
- ;;
- *-dg-dgux*) # DG/UX
- CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
- ;;
- esac
- LIBS="$TMP_LIBS $LIBS"
-fi
-# IPv6 support
-#
-AC_MSG_CHECKING(for IPv6 support)
-AC_ARG_ENABLE(ipv6,
- [ --enable-ipv6 Enable IPv6 support],
- [
- case "${enableval}" in
- yes)
- want_ipv6=true
- check_ipv6=false
- AC_DEFINE(HAVE_IPV6)
- AC_MSG_RESULT(yes)
- ;;
- *)
- want_ipv6=false
- check_ipv6=false
- AC_MSG_RESULT(no)
- ;;
- esac
- ],
- check_ipv6=true
- )
-
-if test x$check_ipv6 = xtrue; then
- AC_TRY_COMPILE(
- [
- #ifdef HAVE_NETINET_TCP_H
- #include <netinet/tcp.h>
- #endif
- #ifdef HAVE_NETDB_H
- #include <netdb.h>
- #endif
- #include <sys/socket.h>
- #ifdef HAVE_NETDB_IN_H
- #include <netinet/in.h>
- #endif
- ],
- [
- struct sockaddr_in6 sin6;
- int family = AF_INET6;
- ],
- [
- AC_DEFINE(HAVE_IPV6)
- AC_MSG_RESULT(yes)
- ],
- AC_MSG_RESULT(no)
- )
-fi
-
-# Debug checking
-#
-AC_MSG_CHECKING(for enabled debugging)
-AC_ARG_ENABLE(debug,
- [ --enable-debug Enable debugging],
- [
- 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)
- ])
-
-# Stack trace checking
-#
-AC_MSG_CHECKING(for enabled stack tracing)
-AC_ARG_ENABLE(stack-trace,
- [ --enable-stack-trace Enable memory stack trace],
- [
- case "${enableval}" in
- yes)
- AC_MSG_RESULT(yes)
- AC_DEFINE(SILC_STACKTRACE)
- ;;
- *)
- AC_MSG_RESULT(no)
- ;;
- esac
- ],
- AC_MSG_RESULT(no)
- )
+##
+## Misc
+##
# Other configure scripts
#