Hi all,

this is a request for comments before I commit changes to CVS
regarding how the openssl libaries are detected within the configure
process:

This change should solve the problem that on different platforms the
openssl libs are not detected and hence no SSL support is compiled in
to the gateway.

All core developers may vote on this before I go on. I will produce an
updated configure out of configure.in and commit it too.

Changed files:

  * gateway/config.h.in: added #def OPENSSL_VERSION to indicate the
openssl lib version used

  * gateway/configure.in: changed how VERSION is set in config.h. If
the tree is a cvs checkout we include the date of the checkout, i.e.
VERSION=cvs-20011120. This should be usefull to any users that have
several compiled cvs checkouts, so they can distinguish if they have
been installed as running versions. Changed the way the openssl
libraries are detected. This detection should be more sofisticated
then the previous.

  * gateway/gw/shared.c: added #ifdef to display the used openssl
version in case SSL support it is compiled in.

  * gateway/gwlib/cfg.def: swapped OCTSTR(ppg-port-ssl) to be directly
after OCTSTR(ppg-port). Only for cosmetic reasons :)


Changes to the documentation regarding the SSL config directives will
be also commited then.

Stipe

[EMAIL PROTECTED]
-------------------------------------------------------------------
Wapme Systems AG

Münsterstr. 248
40470 Düsseldorf

Tel: +49-211-74845-0
Fax: +49-211-74845-299

E-Mail: [EMAIL PROTECTED]
Internet: http://www.wapme-systems.de
-------------------------------------------------------------------
wapme.net - wherever you are
diff -ur gateway/config.h.in gateway-new/config.h.in
--- gateway/config.h.in Fri Jul  6 07:49:41 2001
+++ gateway-new/config.h.in     Tue Nov 20 10:25:22 2001
@@ -110,10 +110,13 @@
 /* Define if you have <syslog.h>.  */
 #undef HAVE_SYSLOG_H
 
-/* Define if you have and want to use the ssl library (-lssl) */
+/* Define if you have and want to use the openssl library (-lssl) */
 #undef HAVE_LIBSSL
 
-/* Defined if we're using OpenSSL WTLS */
+/* Define which version of the openssl library is used */
+#undef OPENSSL_VERSION
+
+/* Defined if we're using the openssl library for WTLS */
 #undef HAVE_WTLS_OPENSSL
 
 #endif
diff -ur gateway/configure.in gateway-new/configure.in
--- gateway/configure.in        Mon Sep  3 21:55:10 2001
+++ gateway-new/configure.in    Tue Nov 20 10:35:22 2001
@@ -8,9 +8,18 @@
 AC_CONFIG_HEADER(config.h)
 AC_SUBST(SHELL)
 AC_CONFIG_AUX_DIR(.)
-dnl Gateway version number.
 
-AC_DEFINE_UNQUOTED(VERSION, "`head -1 VERSION`")
+dnl Kannel version number. 
+dnl Add date of checkout if cvs version.
+
+AC_MSG_CHECKING(for kannel version)
+VERSION=`head -1 VERSION`
+if test "$VERSION" = "cvs"; then
+  date_string=`ls -do --full-time . | awk '{print $5, $6, $7, $9}'`
+  VERSION=cvs-`date -d "$date_string" +%Y%m%d`
+fi  
+AC_MSG_RESULT($VERSION)
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
 
 dnl Target installation directory for documentation
 
@@ -39,6 +48,8 @@
 AC_CHECK_LIB(m, log)
 AC_CHECK_LIB(socket, accept)
 AC_CHECK_LIB(nsl, inet_ntoa)
+AC_CHECK_LIB(bind, inet_ntoa)
+AC_CHECK_LIB(resolv, inet_ntop)
 AC_CHECK_LIB(pthread, pthread_exit)
 if test -z "$pthread"; then
        AC_CHECK_LIB(c_r, pthread_exit, [LIBS="$LIBS -lc_r"])
@@ -56,15 +67,13 @@
        *2.2.[5-9]*) ;;
        *2.2.[1-9][0-9]*) ;;
        *2.[3-9].[0-9]*) ;;
-       *) AC_MSG_ERROR(<<Libxml is too old. You need at least 2.2.5>>) ;;
+       *) echo "Libxml $xml_version is too old. You need at least 2.2.5."; exit 1 ;;
        esac
        changequote([, ])dnl
        LIBS="$LIBS `$XML_CONFIG --libs`"
        CFLAGS="$CFLAGS `$XML_CONFIG --cflags`"
 fi
 
-AC_CHECK_LIB(resolv, inet_ntop)
-
 
 dnl Check to see if we should do the WTLS thing, and which version to use
 
@@ -377,11 +386,21 @@
 ])
 
 if test "x$SSL" = "xssl" ; then
-  echo Attempting to compile with SSL support.
-  AC_CHECK_LIB(ssl, SSL_library_init,
-  [ AC_MSG_CHECKING(whether the OpenSSL library is multithread-enabled)
-    AC_TRY_RUN([ #define OPENSSL_THREAD_DEFINES
-                 #include <openssl/opensslconf.h>
+  echo Attempting to compile with SSL client and server support.
+  AC_CHECK_LIB(crypto, RSA_new, 
+  [ LIBS="$LIBS -lcrypto"
+    AC_CHECK_LIB(ssl, SSL_library_init,  
+    [ AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h)
+      AC_PATH_PROG(OPENSSL, openssl, no)
+      if test "$OPENSSL" != "yes"; then
+         AC_MSG_CHECKING([openssl version])
+            openssl_version=`openssl version | awk '{print $2}'`
+         AC_MSG_RESULT([$openssl_version])
+         AC_DEFINE_UNQUOTED(OPENSSL_VERSION, "$openssl_version")
+      fi
+      AC_MSG_CHECKING(whether the OpenSSL library is multithread-enabled)
+      AC_TRY_RUN([ #define OPENSSL_THREAD_DEFINES
+                #include <openssl/opensslconf.h>
                  int main(void) {
                  #if defined(THREADS)
                   exit(0);
@@ -390,11 +409,12 @@
                  #endif
                  }
               ], echo yes;AC_DEFINE(HAVE_LIBSSL)
-              LIBS="$LIBS -lssl",
-              echo no;echo Either get a multithread-enabled SSL or configure with 
--disable-ssl;
-              exit 1,
+              LIBS="$LIBS -lssl -lcrypto",
+             echo no;AC_DEFINE(HAVE_LIBSSL)
+              LIBS="$LIBS -lssl -lcrypto";echo "WARNING: OpenSSL is not 
+multithread-enabled!",
               echo "Cross-compiling; make sure your SSL library is 
multithread-enabled"
-              )
+       )
+     ])
   ])
 fi
 
diff -ur gateway/gw/shared.c gateway-new/gw/shared.c
--- gateway/gw/shared.c Thu Oct 11 17:18:33 2001
+++ gateway-new/gw/shared.c     Tue Nov 20 10:43:42 2001
@@ -34,13 +34,19 @@
                         "System %s, release %s, version %s, machine %s.\n"
                         "Hostname %s, IP %s.\n"
                         "Libxml version %s.\n"
-                         "Using %s malloc.\n",
+#if defined(HAVE_LIBSSL) && defined(OPENSSL_VERSION)
+             "OpenSSL version %s.\n"
+#endif
+             "Using %s malloc.\n",
                         boxname, VERSION,
                         u.sysname, u.release, u.version, u.machine,
                         octstr_get_cstr(get_official_name()),
                         octstr_get_cstr(get_official_ip()),
                         LIBXML_VERSION_STRING,
-                         octstr_get_cstr(gwmem_type()));
+#if defined(HAVE_LIBSSL) && defined(OPENSSL_VERSION)
+             OPENSSL_VERSION,
+#endif
+             octstr_get_cstr(gwmem_type()));
 }
 
 
diff -ur gateway/gwlib/cfg.def gateway-new/gwlib/cfg.def
--- gateway/gwlib/cfg.def       Fri Nov  9 11:28:58 2001
+++ gateway-new/gwlib/cfg.def   Tue Nov 20 11:10:18 2001
@@ -77,9 +77,9 @@
 SINGLE_GROUP(ppg,
     OCTSTR(ppg-url)
     OCTSTR(ppg-port)
+    OCTSTR(ppg-port-ssl)
     OCTSTR(trusted-pi)
     OCTSTR(concurrent-pushes)
-    OCTSTR(ppg-port-ssl)
     OCTSTR(users)
     OCTSTR(ppg-allow-ip)
     OCTSTR(ppg-deny-ip)

Reply via email to