Index: libjna-java-3.2.7/src/com/sun/jna/Platform.java
===================================================================
--- libjna-java-3.2.7.orig/src/com/sun/jna/Platform.java	2009-07-07 05:41:18.000000000 +0100
+++ libjna-java-3.2.7/src/com/sun/jna/Platform.java	2011-05-25 23:24:11.725855192 +0100
@@ -99,4 +99,57 @@
         }
         return Native.POINTER_SIZE == 8;
     }
+    public static final boolean isGNU() {
+        String name = System.getProperty("os.name").toLowerCase().trim();
+        return "gnu".equals(name);
+    }
+    public static final boolean iskFreeBSD() {
+        String name = System.getProperty("os.name").toLowerCase().trim();
+        return "gnu/kfreebsd".equals(name);
+    }
+    public static final String getBaseArch() {
+        String arch =
+            System.getProperty("os.arch").toLowerCase().trim();
+        if("amd64".equals(arch))
+            arch = "x86_64";
+        if("i686-at386".equals(arch))
+            arch = "i386";
+        if("ppc".equals(arch))
+            arch = "powerpc";
+        if("ppc64".equals(arch))
+            arch = "powerpc64";
+        return arch;
+    }
+    public static final boolean isIntel() {
+        String arch =
+            System.getProperty("os.arch").toLowerCase().trim();
+        if (arch.equals("i386") ||
+            arch.equals("x86_64") ||
+            arch.equals("amd64")) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static final boolean isPPC() {
+        String arch =
+            System.getProperty("os.arch").toLowerCase().trim();
+        if (arch.equals("ppc") ||
+            arch.equals("ppc64")) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static final boolean isARM() {
+        String arch =
+            System.getProperty("os.arch").toLowerCase().trim();
+        if (arch.equals("arm"))  {
+            return true;
+        } else {
+            return false;
+        }
+    }
 }
Index: libjna-java-3.2.7/src/com/sun/jna/NativeLibrary.java
===================================================================
--- libjna-java-3.2.7.orig/src/com/sun/jna/NativeLibrary.java	2010-07-19 08:57:18.000000000 +0100
+++ libjna-java-3.2.7/src/com/sun/jna/NativeLibrary.java	2011-05-25 23:27:45.045855352 +0100
@@ -618,7 +618,7 @@
             // 64bit machines, so we have to explicitly search the 64bit one when
             // running a 64bit JVM.
             //
-            if (Platform.isLinux() || Platform.isSolaris() || Platform.isFreeBSD()) {
+            if (Platform.isLinux() || Platform.isSolaris() || Platform.isFreeBSD() || Platform.iskFreeBSD()) {
                 // Linux & FreeBSD use /usr/lib32, solaris uses /usr/lib/32
                 archPath = (Platform.isSolaris() ? "/" : "") + Pointer.SIZE * 8;
             }
@@ -628,11 +628,48 @@
                 "/usr/lib",
                 "/lib",
             };
-            // Linux 64-bit does not use /lib or /usr/lib
-            if (Platform.isLinux() && Pointer.SIZE == 8) {
+            // Fix for multi-arch support on Ubuntu (and other
+            // multi-arch distributions)
+            // paths is scanned against real directory
+            // so for platforms which are not multi-arch
+            // this should continue to work.
+            if (Platform.isLinux() || Platform.iskFreeBSD()) {
+                // Defaults - overridden below
+                String cpu = Platform.getBaseArch();
+                String kernel = "linux";
+                String libc = "gnu";
+
+                if (Platform.isARM()) {
+                    libc = "gnueabi";
+                }
+
+                String multiArchPath =
+                    cpu + "-" + kernel + "-" + libc;
+
+                // Assemble path with all possible options
+                paths = new String[] {
+                    "/usr/lib/" + multiArchPath,
+                    "/lib/" + multiArchPath,
+                    "/usr/lib" + archPath,
+                    "/lib" + archPath,
+                    "/usr/lib",
+                    "/lib",
+                };
+            }
+            if (Platform.isGNU()) {
+                String cpu = Platform.getBaseArch();
+                String libc = "gnu";
+                String multiArchPath =
+                    cpu + "-" + libc;
+
+               // Assemble path with all possible options
                 paths = new String[] {
+                    "/usr/lib/" + multiArchPath,
+                    "/lib/" + multiArchPath,
                     "/usr/lib" + archPath,
                     "/lib" + archPath,
+                    "/usr/lib",
+                    "/lib",
                 };
             }
             for (int i=0;i < paths.length;i++) {
Index: libjna-java-3.2.7/build.xml
===================================================================
--- libjna-java-3.2.7.orig/build.xml	2011-05-25 21:26:05.084188334 +0100
+++ libjna-java-3.2.7/build.xml	2011-05-25 21:28:42.574188163 +0100
@@ -72,6 +72,8 @@
     <echo>${java.vm.name} (${java.vm.vendor}, ${java.vm.version})</echo>
     <echo>java.home=${java.home}</echo>
     <echo>java.library.path=${java.library.path}</echo>
+    <echo>os.name=${os.name}</echo>
+    <echo>os.arch=${os.arch}</echo>
 
     <replaceregexp match="(&lt;version&gt;).*(&lt;/version&gt;)"
                    replace="\1${jna.version}\2" 
