Author: ek.kato
Date: Tue Mar  3 02:52:20 2009
New Revision: 5888

Modified:
   trunk/m4/openssl.m4
   trunk/po/POTFILES.in
   trunk/scm/http-client.scm
   trunk/uim/openssl.c

Log:
* m4/openssl.m4 : Check DTLSv1 existence.
* uim/openssl.c
  - Include <string.h> for strerror().
  - Include "gettext.h".
  - (c_DTLSv1_method)
  - (c_DTLSv1_server_method)
  - (c_DTLSv1_client_method)
    - Check TDLSv1 functions.  Return #f if these are not
      available.
* scm/http-client.scm (http:make-get-request-string) : Check
  ssl method.
* po/POTFILES.in : Add openssl.c        


Modified: trunk/m4/openssl.m4
==============================================================================
--- trunk/m4/openssl.m4 (original)
+++ trunk/m4/openssl.m4 Tue Mar  3 02:52:20 2009
@@ -186,6 +186,38 @@
        ]
 )

+AC_MSG_CHECKING([if programs using OpenSSL DTLSv1 functions will link])
+AC_LINK_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <openssl/ssl.h>
+int main(void) { DTLSv1_method(); }
+       ]])],
+       [
+               AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_OPENSSL_DTLSv1, 1, [Define 1 if have DTLSv1 OpenSSL support])
+       ],
+       [
+               AC_MSG_RESULT(no)
+               saved_LIBS="$LIBS"
+               LIBS="$LIBS -ldl"
+               AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
+               AC_LINK_IFELSE(
+                       [AC_LANG_SOURCE([[
+#include <openssl/ssl.h>
+int main(void) { DTLSv1_method(); }
+                       ]])],
+                       [
+                               AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_OPENSSL_DTLSv1, 1, [Define 1 if have DTLSv1 OpenSSL support])
+                       ],
+                       [
+                               AC_MSG_RESULT(no)
+                               LIBS="$saved_LIBS"
+                       ]
+               )
+       ]
+)
+
 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
 AC_LINK_IFELSE(
        [AC_LANG_SOURCE([[

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in        (original)
+++ trunk/po/POTFILES.in        Tue Mar  3 02:52:20 2009
@@ -80,6 +80,7 @@
 uim/m17nlib.c
 uim/mana.c
 uim/dynlib.c
+uim/openssl.c
 uim/sj3.c
 uim/skk.c
 uim/uim-error.c

Modified: trunk/scm/http-client.scm
==============================================================================
--- trunk/scm/http-client.scm   (original)
+++ trunk/scm/http-client.scm   Tue Mar  3 02:52:20 2009
@@ -224,7 +224,8 @@
                         (ssl #f)
                         (request-alist '()))
     (let* ((with-ssl? (and (provided? "openssl")
-                           (http-ssl? ssl)))
+                           (http-ssl? ssl)
+                           (method? ssl)))
            (call-with-open-file-port-function
             (if with-ssl?
                 ;; cut

Modified: trunk/uim/openssl.c
==============================================================================
--- trunk/uim/openssl.c (original)
+++ trunk/uim/openssl.c Tue Mar  3 02:52:20 2009
@@ -32,6 +32,7 @@
 */

 #include <config.h>
+#include <string.h>
 #include <openssl/crypto.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
@@ -41,6 +42,7 @@
 #include "uim-scm-abbrev.h"
 #include "uim-posix.h"
 #include "uim-notify.h"
+#include "gettext.h"
 #include "dynlib.h"

 #ifdef USE_OPENSSL_ENGINE
@@ -278,17 +280,32 @@
 static uim_lisp
 c_DTLSv1_method(void)
 {
+#ifdef HAVE_OPENSSL_DTLSv1
   return MAKE_PTR(DTLSv1_method());
+#else
+ uim_notify_fatal(N_("uim-openssl: DTLSv1_method() is not supported on this system"));
+  return uim_scm_f();
+#endif
 }
 static uim_lisp
 c_DTLSv1_server_method(void)
 {
+#ifdef HAVE_OPENSSL_DTLSv1
   return MAKE_PTR(DTLSv1_server_method());
+#else
+ uim_notify_fatal(N_("uim-openssl: DTLSv1_server_method() is not supported on this system"));
+  return uim_scm_f();
+#endif
 }
 static uim_lisp
 c_DTLSv1_client_method(void)
 {
+#ifdef HAVE_OPENSSL_DTLSv1
   return MAKE_PTR(DTLSv1_client_method());
+#else
+ uim_notify_fatal(N_("uim-openssl: DTLSv1_client_method() is not supported on this system"));
+  return uim_scm_f();
+#endif
 }


Reply via email to