updates.
[silc.git] / configure.in.pre
index b39677d6b131f4b99ad7af8f4a9e135d37aca115..73dfd0d51009e50360a227cb4c925e3d3deb1039 100644 (file)
@@ -33,8 +33,8 @@ case "$target" in
     ;;
 esac
 
-# ./prepare script will automatically put the correct date. Do not edit!
-AM_INIT_AUTOMAKE(silc, YYYYMMDD)
+# ./prepare script will automatically put the correct version. Do not edit!
+AM_INIT_AUTOMAKE(silc, SILC_VERSION)
 AC_PREREQ(2.3)
 AM_CONFIG_HEADER(includes/silcdefs.h)
 
@@ -70,7 +70,7 @@ 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)
+AC_CHECK_HEADERS(ncurses.h signal.h ctype.h regex.h)
 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h)
 
 # Data type checking
@@ -80,16 +80,45 @@ AC_TYPE_MODE_T
 AC_TYPE_UID_T
 AC_TYPE_PID_T
 
-# Function checking
-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)
-AC_CHECK_FUNCS(gethostname gethostbyname gethostbyaddr)
-AC_CHECK_FUNCS(select socket listen bind shutdown close connect)
+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_FUNC(initscr, ac_initscr_found=1, ac_initscr_found=0)
+if test x$ac_initscr_found = x0; then
+    AC_CHECK_LIB(ncurses, initscr, LIBS="$LIBS -lncurses")
+fi
+AC_CHECK_FUNC(gethostbyname, ac_gethostbyname_found=1,
+ac_gethostbyname_found=0)
+if test x$ac_gethostbyname_found = x0; then
+    AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
+    AC_CHECK_FUNC(res_gethostbyname, ac_res_ghbn_found=1, ac_res_ghbn_found=0)
+    if test x$ac_res_ghbn_found = x0; then
+        AC_CHECK_LIB(resolv, res_gethostbyname,  LIBS="$LIBS -lresolv")
+    fi
+fi
+AC_CHECK_FUNC(socket, ac_socket_found=1, ac_socket_found=0)
+if test x$ac_socket_found = x0; then
+    AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+fi
+AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
+AC_CHECK_FUNCS(select listen bind shutdown close connect)
 AC_CHECK_FUNCS(fcntl setsockopt)
-AC_CHECK_FUNCS(getservbyname getservbyport)
 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.
@@ -103,6 +132,93 @@ AC_CHECK_HEADERS(dlfcn.h,
     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,
@@ -123,7 +239,7 @@ esac ], CFLAGS="-O2 -g $CFLAGS"
 # SOCKS4 support checking
 AC_MSG_CHECKING(whether to support SOCKS4)
 AC_ARG_WITH(socks4,
-[  --with-socks4[=PATH]    Compile with SOCKS4 support.],
+[  --with-socks4[=PATH]    Compile with SOCKS4 support],
 [ case "$withval" in
   no)
     AC_MSG_RESULT(no)
@@ -157,7 +273,7 @@ AC_ARG_WITH(socks4,
 # SOCKS5 support checking
 AC_MSG_CHECKING(whether to support SOCKS5)
 AC_ARG_WITH(socks5,
-[  --with-socks5[=PATH]    Compile with SOCKS5 support.],
+[  --with-socks5[=PATH]    Compile with SOCKS5 support],
 [ case "$withval" in
   no)
     AC_MSG_RESULT(no)
@@ -219,11 +335,47 @@ if test "x$socks" = "x5"; then
   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.],
+                          server [/etc/silc/silcd.conf]],
 [ AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval") ])
 
 # XXX
@@ -231,9 +383,9 @@ AC_ARG_WITH(silcd-config-file,
 
 # 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_CONFIG_SUBDIRS(lib/dotconf)
 
 AC_OUTPUT( \
 Makefile