From: Jay Freeman (saurik) Date: Wed, 18 Nov 2015 07:49:01 +0000 (-0800) Subject: On Mac OS X, detect -framework JavaVM for CY_JAVA. X-Git-Tag: v0.9.590~309 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/def9084602162fbc6081fadd247ad50a78ad0bce On Mac OS X, detect -framework JavaVM for CY_JAVA. --- diff --git a/Java/Execute.cpp b/Java/Execute.cpp index e5cd1f6..48c5808 100644 --- a/Java/Execute.cpp +++ b/Java/Execute.cpp @@ -19,4 +19,8 @@ **/ /* }}} */ +#ifdef __APPLE__ +#include +#else #include +#endif diff --git a/configure b/configure index 4b8170a..c5f9a0f 100755 --- a/configure +++ b/configure @@ -21224,7 +21224,74 @@ fi - 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 + +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' diff --git a/configure.ac b/configure.ac index b9dc7f8..aa81400 100644 --- a/configure.ac +++ b/configure.ac @@ -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 + ], [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++])