Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.395
diff -u -r1.395 configure.ac
--- configure.ac	13 Mar 2009 09:58:15 -0000	1.395
+++ configure.ac	30 Mar 2009 18:23:04 -0000
@@ -109,7 +109,7 @@
 
 dnl
 dnl initialize all the info variables
-    curl_ssl_msg="no      (--with-ssl / --with-gnutls)"
+    curl_ssl_msg="no      (--with-ssl / --with-gnutls / --with-cyassl)"
     curl_ssh_msg="no      (--with-libssh2)"
    curl_zlib_msg="no      (--with-zlib)"
    curl_krb4_msg="no      (--with-krb4*)"
@@ -1716,7 +1716,61 @@
 
 fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
 
+dnl -----------------------------------------------------------------
+dnl CyaSSL. Only check if GnuTLS, OpenSSL and NSS are not enabled
+dnl -----------------------------------------------------------------
+
+OPT_CYASSL=no
+
+AC_ARG_WITH(cyassl,dnl
+AC_HELP_STRING([--with-cyassl=PATH],[where to look for cyassl, PATH points to the build root])
+AC_HELP_STRING([--without-cyassl], [disable cyassl detection]),
+  OPT_CYASSL=$withval)
+
 if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
+
+  CLEANLIBS="$LIBS"
+  CLEANCPPFLAGS="$CPPFLAGS"
+
+  if test X"$OPT_CYASSL" != Xno; then
+    if test "x$OPT_CYASSL" = "xyes"; then
+      echo "ERROR: Not using cyassl"
+      echo "ERROR: We need full path to cyassl build directory"
+    else
+      addldflags="-L$OPT_CYASSL/src/.libs -R$OPT_CYASSL/src/.libs"
+      addlib="-lcyassl -lm"
+      addcflags="-I$OPT_CYASSL/include -I$OPT_CYASSL/ctaocrypt/include"
+      dnl version="unknown"
+      cyasslprofix=$OPT_CYASSL 
+      if test -z "$version"; then
+        version="unknown"
+      fi
+      CYASSL_ENABLED=1
+      curl_ssl_msg="enabled (CyaSSL)"
+      AC_DEFINE(USE_CYASSL, 1, [if cyassl is enabled])
+      AC_SUBST(USE_CYASSL, [1])
+
+      AC_MSG_NOTICE([CYASSL_ENABLED = $CYASSL_ENABLED])
+      AC_MSG_NOTICE([USE_CYASSL = $USE_CYASSL])
+    fi
+  fi
+
+  if test "x$CYASSL_ENABLED" = "x1"; then
+    if test "$addcflags" != "-I/usr/include"; then
+      CPPFLAGS="$CPPFLAGS $addcflags"
+      AC_MSG_NOTICE([Added $addcflags to CPPFLAGS])
+    fi
+    LDFLAGS="$LDFLAGS $addldflags"
+    AC_MSG_NOTICE([Added $addldflags to LDFLAGS])
+    LIBS="$LIBS $addlib"
+    AC_MSG_NOTICE([Added $addlib to LIBS])
+    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OPT_CYASSL/src/.libs"
+    AC_MSG_NOTICE([Added $OPT_CYASSL/src/.libs to LD_LIBRARY_PATH])
+  fi
+
+fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1 -a NSS_ENABLED != 1
+
+if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$CYASSL_ENABLED" = "x"; then
   AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
   AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
 else
@@ -2036,7 +2090,6 @@
 CURL_CHECK_FUNC_IOCTLSOCKET
 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
 CURL_CHECK_FUNC_LOCALTIME_R
-CURL_CHECK_FUNC_POLL
 CURL_CHECK_FUNC_SETSOCKOPT
 CURL_CHECK_FUNC_SIGACTION
 CURL_CHECK_FUNC_SIGINTERRUPT
@@ -2082,6 +2135,7 @@
   inet_addr \
   perror \
   pipe \
+  poll \
   setlocale \
   setmode \
   setrlimit \
@@ -2138,6 +2192,45 @@
   CURL_CHECK_NI_WITHSCOPEID
 fi
 
+AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
+disable_poll=no
+case $host in
+  *-*-darwin*)
+    disable_poll="yes";
+    ;;
+  *)
+    ;;
+esac
+AC_MSG_RESULT($disable_poll)
+
+if test "$disable_poll" = "no"; then
+
+  dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
+  dnl to find out we make an extra check here!
+  if test "$ac_cv_func_poll" = "yes"; then
+    AC_MSG_CHECKING([if poll works with NULL inputs])
+    AC_RUN_IFELSE([
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#elif defined(HAVE_POLL_H)
+#include <poll.h>
+#endif
+
+  int main(void)
+  {
+    /* make this return 0 == timeout since there's nothing to read from */
+    return poll((void *)0, 0, 10 /*ms*/);
+  }
+],
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
+    AC_MSG_RESULT(no),
+    AC_MSG_RESULT(cross-compiling assumes yes)
+    AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
+    ) dnl end of AC_RUN_IFELSE
+  fi dnl poll() was found
+fi dnl poll()-check is not disabled
+
 dnl ************************************************************
 dnl enable non-blocking communications
 dnl
@@ -2472,7 +2565,7 @@
 if test "x$USE_WINDOWS_SSPI" = "x1"; then
   SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
 fi
-if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" -o "x$GNUTLS_ENABLED" = "x1"; then
+if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1"; then
   SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
 fi
 


