From 1b382a2e0a42cede8eb8d7974294e6910bcab8bc Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 29 Apr 2018 19:27:02 +0100
Subject: [PATCH 11/13] Revert part of 9b818c6dc00143ff18775a4015a3f43b5196fa31
 (support for old Java on macOS)

---
 src/scripts/javareconf.in | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/R/bin/javareconf b/lib/R/bin/javareconf
index 5dbe3a3e9a..ca72145269 100644
--- a/lib/R/bin/javareconf
+++ b/lib/R/bin/javareconf
@@ -199,6 +199,23 @@ custom_JAVA_CPPFLAGS="${JAVA_CPPFLAGS}"
 custom_JAVA_LD_LIBRARY_PATH="${JAVA_LD_LIBRARY_PATH}"
 
 
+# sys-dependent tweaks to JNI flags
+hostos=`uname 2>/dev/null`
+if test "${hostos}" = "Darwin"; then
+     ## This changed for Java 9.
+     ## pref=`echo "${JAVA_HOME}" | grep "/Home$"`
+     pref=`echo "${JAVA_HOME}" | grep "^/System/Library"`
+     if test "${pref}" = "${JAVA_HOME}"; then
+       echo "System Java on macOS"
+       JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers"
+       JAVA_LIBS="-framework JavaVM"
+       JAVA_LD_LIBRARY_PATH=
+       has_libjvm=unknown
+    else
+       echo "Non-system Java on macOS"
+    fi
+fi
+
 # sys-dependent tweaks to JNI flags -- Darwin ones removed for R 3.5
 
 ## we now look for a path to put in R_LD_LIBRARY_PATH which will
-- 
2.17.0

