You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/07/20 09:47:54 UTC

svn commit: r1148639 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/Native.java native/configure native/shared/native.c test/org/apache/commons/runtime/TestMain.java

Author: mturk
Date: Wed Jul 20 07:47:53 2011
New Revision: 1148639

URL: http://svn.apache.org/viewvc?rev=1148639&view=rev
Log:
Add api to chack for OpenSSL module

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/shared/native.c
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java?rev=1148639&r1=1148638&r2=1148639&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java Wed Jul 20 07:47:53 2011
@@ -33,14 +33,20 @@ public final class Native
     private static native boolean init0()
         throws Throwable;
     private static native boolean isdbg0();
+    private static native boolean hasopenssl0();
     private static native void    fini0();
 
     /**
-     * True if the native code compiled with debugging support.
+     * True if the native code is compiled with debugging support.
      */
     public static final boolean HAS_MAINTAINER_MODE = isdbg0();
 
     /**
+     * True if the native code is compiled with OpenSSL support.
+     */
+    public static final boolean HAS_OPENSSL = hasopenssl0();
+
+    /**
      * Initialize Apache Commons Runtime native library.
      * <p>
      * This method must be called after the {@code native} library

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=1148639&r1=1148638&r2=1148639&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Wed Jul 20 07:47:53 2011
@@ -116,7 +116,8 @@ has_shared=yes
 has_shared_version=no
 has_zlib_asm=yes
 has_openssl=no
-has_openssl_static=no
+has_openssl_static=yes
+has_openssl_runtime=no
 openssl_home="$OPENSSL_HOME"
 openssl_inc=""
 openssl_lib=""
@@ -284,7 +285,7 @@ Optional features:
   --debug                  Compile code with debug options.
                               [disabled]
   --enable-maintainer-mode Same as --debug
-
+                              [disabled]
   --enable-32-bit          Forces 32-bit code compilation
                               [platform dependent]
   --enable-64-bit          Forces 64-bit code compilation
@@ -303,9 +304,11 @@ Optional features:
 Optional packages:
   --enable-openssl        Enable compilation of OpenSSL SSL/TLS module
                               [disabled]
-  --with-openssl=DIR      Path to the  OpenSSL toolkit install location
-                          If not specified default compiler include path
-                          will be used.
+  --enable-openssl-static Link to the OpenSSL library at compile time.
+                              [enabled]
+  --with-openssl=DIR      Path to the  OpenSSL toolkit install location.
+                          If not specified default compiler include and
+                          library paths will be used.
 EOH
         exit 1
         ;;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/native.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/native.c?rev=1148639&r1=1148638&r2=1148639&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/native.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/native.c Wed Jul 20 07:47:53 2011
@@ -26,6 +26,15 @@ ACR_JNI_EXPORT(jboolean, Native, isdbg0)
 #endif
 }
 
+ACR_JNI_EXPORT(jboolean, Native, hasopenssl0)(JNI_STDARGS)
+{
+#if HAVE_OPENSSL
+    return JNI_TRUE;
+#else
+    return JNI_FALSE;
+#endif
+}
+
 ACR_JNI_EXPORT(jboolean, Native, init0)(JNI_STDARGS)
 {
     return AcrLoadRuntimeClasses(env);

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java?rev=1148639&r1=1148638&r2=1148639&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java Wed Jul 20 07:47:53 2011
@@ -32,9 +32,12 @@ public class TestMain extends Assert
     @Test(groups = { "core" })
     public void testOs()
     {
-        System.out.println("Running on " + Os.getSysname() + "/" +
-                           Os.getDataModel() + " with " +
-                           Os.getNumCpu() + " cpu's");
+        System.out.print("Running on " + Os.getSysname() + "/" +
+                         Os.getDataModel() + " with " +
+                         Os.getNumCpu() + " cpu's");
+        System.out.print(". OpenSSL=" + Native.HAS_OPENSSL);
+        System.out.print(", Debug=" + Native.HAS_MAINTAINER_MODE);
+        System.out.println(".");
         System.out.flush();
     }