67 }
68 initialize(library);
69 return null;
70 } catch (Throwable e) {
71 return e;
72 }
73 }
74 });
75 }
76
77 // expand $LIBISA to the system specific directory name for libraries
78 private static String expand(String lib) {
79 int k = lib.indexOf("$LIBISA");
80 if (k == -1) {
81 return lib;
82 }
83 String s1 = lib.substring(0, k);
84 String s2 = lib.substring(k + 7);
85 String libDir;
86 if ("64".equals(System.getProperty("sun.arch.data.model"))) {
87 if ("SunOS".equals(System.getProperty("os.name"))) {
88 libDir = "lib/64";
89 } else {
90 // assume Linux convention
91 libDir = "lib64";
92 }
93 } else {
94 // must be 32-bit
95 libDir = "lib";
96 }
97 String s = s1 + libDir + s2;
98 return s;
99 }
100
101 private static String getLibraryName() throws IOException {
102 // if system property is set, use that library
103 String lib = expand(System.getProperty(PROP_NAME, "").trim());
104 if (lib.length() != 0) {
105 return lib;
106 }
107 lib = expand(LIB1);
108 if (new File(lib).isFile()) {
109 // if LIB1 exists, use that
110 return lib;
111 }
112 lib = expand(LIB2);
|
67 }
68 initialize(library);
69 return null;
70 } catch (Throwable e) {
71 return e;
72 }
73 }
74 });
75 }
76
77 // expand $LIBISA to the system specific directory name for libraries
78 private static String expand(String lib) {
79 int k = lib.indexOf("$LIBISA");
80 if (k == -1) {
81 return lib;
82 }
83 String s1 = lib.substring(0, k);
84 String s2 = lib.substring(k + 7);
85 String libDir;
86 if ("64".equals(System.getProperty("sun.arch.data.model"))) {
87 // assume Linux convention
88 libDir = "lib64";
89 } else {
90 // must be 32-bit
91 libDir = "lib";
92 }
93 String s = s1 + libDir + s2;
94 return s;
95 }
96
97 private static String getLibraryName() throws IOException {
98 // if system property is set, use that library
99 String lib = expand(System.getProperty(PROP_NAME, "").trim());
100 if (lib.length() != 0) {
101 return lib;
102 }
103 lib = expand(LIB1);
104 if (new File(lib).isFile()) {
105 // if LIB1 exists, use that
106 return lib;
107 }
108 lib = expand(LIB2);
|