extend jni.exp for dynamic libs

Andreas Tobler toa@pop.agri.ch
Wed Feb 19 18:26:00 GMT 2003


Hi,
could we introduce something like this in jni.exp?
The thing I need to improve is the detection of the test target, right 
now as you see I did it with hardcoded.
This patchlet would at least build and link the jni test on darwin. I'm 
going further in finding the right way to make tests also work.
Opinions?
Andreas
--- jni.exp	13 Dec 2002 05:00:14 -0000	1.9
+++ jni.exp	19 Feb 2003 18:20:48 -0000
@@ -5,11 +5,19 @@
 # success.
 proc gcj_jni_compile_c_to_so {file {options {}}} {
 global srcdir
+ set test_host "darwin"
+ if { $test_host == "darwin"} {
+		set so_extension "dylib"
+		set so_flag "-dynamiclib"
+	} else {
+		set so_extension "so"
+		set so_flag "-shared"
+	}
 set name [file rootname [file tail $file]]
- set soname lib${name}.so
+ set soname lib${name}.${so_extension}
- lappend options "additional_flags=-shared -fPIC"
+ lappend options "additional_flags=${so_flag} -fPIC"
 # Find the generated header.
 lappend options "additional_flags=-I. -I.."
 # Find jni.h.
@@ -156,7 +164,7 @@
 }
 # When we succeed we remove all our clutter.
- eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main 
lib${main}.so]
+ eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main 
lib${main}.${so_extension}]
 return 1
 }


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /