3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 22:23:22 +00:00

improved jni.h detection

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-12-10 06:43:57 -08:00
parent af37aa2743
commit 1fb0fec7d1

View file

@ -211,6 +211,13 @@ def check_java():
raise MKException('Failed testing Java program. Set environment variable JAVA with the path to the Java virtual machine') raise MKException('Failed testing Java program. Set environment variable JAVA with the path to the Java virtual machine')
find_java_home() find_java_home()
def find_jni_h(path):
for root, dirs, files in os.walk(path):
for f in files:
if f == 'jni.h':
return root
return False
def find_java_home(): def find_java_home():
global JAVA_HOME global JAVA_HOME
if JAVA_HOME != None: if JAVA_HOME != None:
@ -238,9 +245,12 @@ def find_java_home():
path = string.join(tmp[:len(tmp) - 3], os.sep) path = string.join(tmp[:len(tmp) - 3], os.sep)
if is_verbose(): if is_verbose():
print "Checking jni.h..." print "Checking jni.h..."
if not os.path.exists(os.path.join(path, 'include', 'jni.h')): jni_dir = find_jni_h(path)
raise MKException("Failed to detect jni.h at '%s'" % os.path.join(path, 'include')) if not jni_dir:
JAVA_HOME = path raise MKException("Failed to detect jni.h at '%s'.Possible solution: set JAVA_HOME with the path to JDK." % os.path.join(path, 'include'))
JAVA_HOME = os.path.split(jni_dir)[0]
if is_verbose():
print 'JAVA_HOME=%s' % JAVA_HOME
return return
raise MKException('Failed to find JAVA_HOME') raise MKException('Failed to find JAVA_HOME')