This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

extend jni.exp for dynamic libs


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
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]