libaltos: Build -m64 and -m32 for fat tarball when possible
[fw/altos] / altosuilib / AltosUILib.java
index 307ef19dc048413886d6e5e5cb47d8f65d9b9068..18c4c3d9eee0bc2035331eddab9b76bbdaf0dd21 100644 (file)
@@ -81,18 +81,20 @@ public class AltosUILib extends AltosLib {
        static public boolean initialized = false;
        static public boolean loaded_library = false;
 
+       static final String[] library_names = { "altos", "altos32", "altos64" };
+
        public static boolean load_library() {
                if (!initialized) {
-                       try {
-                               System.loadLibrary("altos");
-                               libaltos.altos_init();
-                               loaded_library = true;
-                       } catch (UnsatisfiedLinkError e) {
+                       for (String name : library_names) {
                                try {
-                                       System.loadLibrary("altos64");
+                                       System.out.printf ("Trying library %s\n", name);
+                                       System.loadLibrary(name);
                                        libaltos.altos_init();
                                        loaded_library = true;
-                               } catch (UnsatisfiedLinkError e2) {
+                                       System.out.printf ("Using library %s\n", name);
+                                       break;
+                               } catch (UnsatisfiedLinkError e) {
+                                       System.out.printf("Link error %s\n", e.getMessage());
                                        loaded_library = false;
                                }
                        }