updates.
[silc.git] / configure.ad
index 90c55578620cb88cc25988ab15659cf0f00cc8f7..3282af2a73ff404fba88d54880310afb6a6fc13c 100644 (file)
@@ -3,8 +3,8 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2006 Pekka Riikonen
-#
+#  Copyright (C) 2000 - 2007 Pekka Riikonen
+s#
 #  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; version 2 of the License.
@@ -36,6 +36,9 @@ case "$target" in
   *-*-freebsd*)
     check_threads=true
     ;;
+  *-*-netbsd*)
+    check_threads=true
+    ;;
   *-*-*bsd*)
     check_threads=false
     ;;
@@ -135,6 +138,8 @@ AC_CHECK_SIZEOF(char, 0)
 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
 AC_CHECK_SIZEOF(void *, 0)
 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
+AC_CHECK_TYPES(long long)
+AC_CHECK_TYPES(long double)
 
 # Function to check if compiler flag works
 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
@@ -176,9 +181,9 @@ AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
-AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
-AC_CHECK_FUNCS(setgroups initgroups nl_langinfo epoll_wait)
-AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
+AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
+AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep tzset)
+AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
 
 #ifdef SILC_DIST_SIM
 # SIM support checking
@@ -1119,7 +1124,35 @@ if test x$has_threads = xtrue; then
       ;;
    esac
 
+  # Check for threads
   AC_CHECK_FUNC(pthread_create)
+
+  # Check for read/write locks
+  AC_CHECK_FUNC(pthread_rwlock_init,
+  [
+    AC_RUN_IFELSE(
+      [
+        #include <pthread.h>
+        int main()
+        {
+          pthread_rwlock_t rwlock;
+          pthread_rwlock_init(&rwlock, NULL);
+          pthread_rwlock_destroy(&rwlock);
+          return 0;
+        }
+      ],
+      [],
+      [
+       # Rwlock not defined
+        CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
+      ]
+    )
+  ],
+  [
+    # Rwlock not defined
+    CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
+  ])
+
   AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
   AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
   __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
@@ -1142,9 +1175,9 @@ AC_ARG_WITH(win32,
   ])
 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
 
-# Native EPOC support (disabled by default)
+# Native Symbian OS support (disabled by default)
 #
-AM_CONDITIONAL(SILC_EPOC, test xfalse = xtrue)
+AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
 
 # Native BeOS support (disabled by default)
 #
@@ -1154,38 +1187,9 @@ AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
 #
 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
 
-#ifdef SILC_DIST_TOOLKIT
-# --with-irssi
-#
-without_irssi=true
-AC_MSG_CHECKING(whether to compile Irssi SILC Client)
-AC_ARG_WITH(irssi,
-  [  --with-irssi            compile with Irssi SILC Client],
-  [
-    AC_MSG_RESULT(yes)
-    without_irssi=false
-  ],
-  [
-    AC_MSG_RESULT(no)
-    without_irssi=true
-  ])
-AM_CONDITIONAL(with_irssi, test xwithout_irssi = xfalse)
-
-# --with-silcd
-#
-without_silcd=true
-AC_MSG_CHECKING(whether to compile SILC Server)
-AC_ARG_WITH(silcd,
-  [  --with-silcd            compile with SILC Server],
-  [
-    AC_MSG_RESULT(yes)
-    without_silcd=false
-  ],
-  [
-    AC_MSG_RESULT(no)
-    without_silcd=true
-  ])
-#endif SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_SERVER
+without_silcd=false
+#endif SILC_DIST_SERVER
 #ifdef SILC_DIST_CLIENT
 AM_CONDITIONAL(with_irssi, true)
 #endif SILC_DIST_CLIENT
@@ -1310,20 +1314,17 @@ echo " include directory .............: $s_includedir"
 #endif SILC_DIST_INCLUDES
 echo ""
 
-#ifdef SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_CLIENT
 if test x$without_irssi = xtrue; then
   irssi="no"
 fi
-if test x$without_silcd = xtrue; then
-  silcd="no"
-fi
-#endif SILC_DIST_TOOLKIT
-
-#ifdef SILC_DIST_CLIENT
 echo " Compile SILC Client ...........: $irssi"
 #endif SILC_DIST_CLIENT
 
 #ifdef SILC_DIST_SERVER
+if test x$without_silcd = xtrue; then
+  silcd="no"
+fi
 echo " Compile SILC Server ...........: $silcd"
 #endif SILC_DIST_SERVER