]> git.saurik.com Git - cycript.git/commitdiff
On Mac OS X, detect -framework JavaVM for CY_JAVA.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 18 Nov 2015 07:49:01 +0000 (23:49 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 18 Nov 2015 07:49:01 +0000 (23:49 -0800)
Java/Execute.cpp
configure
configure.ac

index e5cd1f69e88c7ccc580bb8f5b9a8eca4a885b391..48c5808e0313c6752517b4cc8fde3ead238dcd1f 100644 (file)
@@ -19,4 +19,8 @@
 **/
 /* }}} */
 
+#ifdef __APPLE__
+#include <JavaVM/jni.h>
+#else
 #include <jni.h>
+#endif
index 4b8170a65c46236063239172244a48665bf72893..c5f9a0f0fd599d0adc8e11e65850dd82848cc12b 100755 (executable)
--- a/configure
+++ b/configure
 
 
 
-    ac_fn_cxx_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for framework JavaVM" >&5
+$as_echo_n "checking for framework JavaVM... " >&6; }
+if ${ac_cv_framework_JavaVM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+               ac_check_framework_save_LIBS=$LIBS
+               LIBS="-framework JavaVM  $LIBS"
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        #include <JavaVM/jni.h>
+
+int
+main ()
+{
+JNI_GetCreatedJavaVMs(NULL, 0, NULL);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+                       ac_cv_framework_JavaVM=yes
+
+else
+  ac_cv_framework_JavaVM=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+               LIBS=$ac_check_framework_save_LIBS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_framework_JavaVM" >&5
+$as_echo "$ac_cv_framework_JavaVM" >&6; }
+       if test $ac_cv_framework_JavaVM = yes; then :
+
+
+  for element in "-framework JavaVM"; do
+    haveit=
+    for x in $LIBS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      LIBS="${LIBS}${LIBS:+ }$element"
+    fi
+  done
+
+
+        CY_JAVA=1
+
+
+
+else
+  ac_fn_cxx_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
 if test "x$ac_cv_header_jni_h" = xyes; then :
 
         CY_JAVA=1
@@ -21302,6 +21369,7 @@ else
 fi
 
 
+fi
 
     ac_ext=mm
 ac_cpp='$OBJCXXCPP $CPPFLAGS'
index b9dc7f82b25f95a74a855afa8f7c50057ac6f31d..aa814004a619fdbf78037a357732c512e8906311 100644 (file)
@@ -202,13 +202,17 @@ AS_CASE([$CY_EXECUTE], [1], [
         AS_CASE([$ac_cv_search_ffi_call], [no], [CY_CHECK_PKG_CONFIG_LIBFFI])
     ]))
 
-    AC_CHECK_HEADER([jni.h], [
+    AC_CHECK_FRAMEWORK([JavaVM], [
+        #include <JavaVM/jni.h>
+    ], [JNI_GetCreatedJavaVMs(NULL, 0, NULL);], [
+        AC_SUBST([CY_JAVA], [1])
+    ], [AC_CHECK_HEADER([jni.h], [
         AC_SUBST([CY_JAVA], [1])
         CY_LT_LIB([LTJAVA], [AC_SEARCH_LIBS([JNI_GetCreatedJavaVMs], [dvm], [
         ])])
     ], [
         AC_SUBST([CY_JAVA], [0])
-    ])
+    ])])
 
     AC_LANG_PUSH([Objective C++])