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 2009/11/24 12:19:36 UTC

svn commit: r883653 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/io/Pipe.java native/configure native/include/arch/unix/acr_arch.h native/include/arch/windows/acr_arch.h

Author: mturk
Date: Tue Nov 24 11:19:33 2009
New Revision: 883653

URL: http://svn.apache.org/viewvc?rev=883653&view=rev
Log:
Check the optional library function when checking for library presence

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Pipe.java
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Pipe.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Pipe.java?rev=883653&r1=883652&r2=883653&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Pipe.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Pipe.java Tue Nov 24 11:19:33 2009
@@ -69,7 +69,7 @@
         mode = PipeIoMode.valueOf(type & 0xff);
     }
 
-    PipeIoMode getMode()
+    synchronized PipeIoMode getMode()
         throws IOException
     {
         if (!valid())

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=883653&r1=883652&r2=883653&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Tue Nov 24 11:19:33 2009
@@ -765,18 +765,28 @@
 have_library()
 {
     printf "Checking for %-32s" "$1 library" 1>&2
-    cat > $test.c << EOF
-#include <stdlib.h>
-#include <$cccinc.h>
-EOF
     if [ ".$2" != . ]; then
         cat >> $test.c << EOF
-#include <$2.h>
+#define $2 wrapper_$2
+#ifdef __STDC__
+#include <limits.h>
+#else
+#include <assert.h>
+#endif
+#undef $2
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+char $2();
+int main() {return $2();}
 EOF
-    fi
-    cat >> $test.c << EOF
+    else
+        cat >> $test.c << EOF
+#include <stdlib.h>
+#include <$cccinc.h>
 int main() {return 0;}
 EOF
+    fi
     rc=0
     if [ ".$host" = .windows ]; then
         co="`$cc $ccflags $cppopts $test.c /link /out:$test$exe $1 2>&1`"
@@ -981,27 +991,27 @@
     have_aio=`have_include 0 aio`
     have_libaio=`have_include 0 libaio`
     if [ ".$have_libaio" = .1 ]; then
-        have_libaio=`have_library aio`
+        have_libaio=`have_library aio io_setup`
         test ".$have_libaio" = .1 && varadds ldflags -laio
     fi
     have_windows=0
     have_uuid_uuid=`have_include 0 uuid/uuid`
     if [ ".$have_uuid_uuid" = .1 ]; then
-        ok=`have_library uuid`
+        ok=`have_library uuid uuid_generate`
         if [ ".$ok" = .1 ]; then
             varadds ldflags -luuid
         else
             have_uuid_uuid=0
         fi
     fi
-    ok=`have_library resolv`
+    ok=`have_library resolv res_init`
     test ".$ok" = .1 && varadds ldflags -lresolv
 fi
 
 if [ ".$host" = ".linux" ]; then
     have_selinux=`have_include 0 selinux/selinux`
     if [ ".$have_selinux" = .1 ]; then
-        ok=`have_library selinux`
+        ok=`have_library selinux is_selinux_enabled`
         if [ ".$ok" = .1 ]; then
             varadds ldflags -lselinux
         else

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h?rev=883653&r1=883652&r2=883653&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h Tue Nov 24 11:19:33 2009
@@ -150,6 +150,17 @@
     }
 }
 
+static ACR_INLINE void *x_realloc(void *ptr, size_t size)
+{
+    if (size > 0 && size < INT_MAX)
+        return realloc(ptr, size);
+    else if (size == 0)
+        x_free(ptr);
+    else
+        errno = ENOMEM;
+    return NULL;
+}
+
 #define s_malloc(T, N)  ((T *)x_malloc(sizeof(T) * (N)))
 #define s_calloc(T, N)  ((T *)x_calloc(sizeof(T) * (N)))
 

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=883653&r1=883652&r2=883653&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Tue Nov 24 11:19:33 2009
@@ -361,6 +361,19 @@
     }
 }
 
+static ACR_INLINE void *x_realloc(void *ptr, size_t size)
+{
+    if (size > 0 && size < INT_MAX)
+        return realloc(ptr, size);
+    else if (size == 0)
+        x_free(ptr);
+    else {
+        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+        errno = ENOMEM;
+    }
+    return NULL;
+}
+
 #define s_malloc(T, N)  ((T *)x_malloc(sizeof(T) * (N)))
 #define s_calloc(T, N)  ((T *)x_calloc(sizeof(T) * (N)))