$OpenBSD: patch-Modules_FindJNI_cmake,v 1.4 2011/10/14 17:22:10 dcoppa Exp $ --- Modules/FindJNI.cmake.orig Tue Oct 4 18:09:24 2011 +++ Modules/FindJNI.cmake Fri Oct 14 09:48:33 2011 @@ -26,6 +26,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +SET(MODJAVA_VER $ENV{MODJAVA_VER}) + # Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} MACRO(java_append_library_directories _var) # Determine java arch-specific library subdir @@ -88,40 +90,65 @@ ENDMACRO(java_append_library_directories) GET_FILENAME_COMPONENT(java_install_version "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) -SET(JAVA_AWT_LIBRARY_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" - ) - FILE(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME) -JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - ${_JAVA_HOME}/jre/lib/{libarch} - ${_JAVA_HOME}/jre/lib - ${_JAVA_HOME}/lib - ${_JAVA_HOME} - /usr/lib - /usr/local/lib - /usr/lib/jvm/java/lib - /usr/lib/java/jre/lib/{libarch} - /usr/lib/jvm/jre/lib/{libarch} - /usr/local/lib/java/jre/lib/{libarch} - /usr/local/share/java/jre/lib/{libarch} - /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} - /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} - /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun/jre/lib/{libarch} - /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} - /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora - # Debian specific paths for default JVM - /usr/lib/jvm/default-java/jre/lib/{libarch} - /usr/lib/jvm/default-java/jre/lib - /usr/lib/jvm/default-java/lib - ) +IF(MODJAVA_VER) + IF(MODJAVA_VER MATCHES "^1\\.5.*") + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${LOCALBASE}/jdk-1.5.0/jre/lib/{libarch} + ${LOCALBASE}/jre-1.5.0/lib/{libarch} + ) + ELSEIF(MODJAVA_VER MATCHES "^1\\.6.*") + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${LOCALBASE}/jdk-1.6.0/jre/lib/{libarch} + ${LOCALBASE}/jre-1.6.0/lib/{libarch} + ) + ELSE(MODJAVA_VER MATCHES "^1\\.5.*") + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${LOCALBASE}/jdk-1.7.0/jre/lib/{libarch} + ${LOCALBASE}/jre-1.7.0/lib/{libarch} + ) + ENDIF(MODJAVA_VER MATCHES "^1\\.5.*") +ELSE(MODJAVA_VER) + SET(JAVA_AWT_LIBRARY_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" + ) + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${_JAVA_HOME}/jre/lib/{libarch} + ${_JAVA_HOME}/jre/lib + ${_JAVA_HOME}/lib + ${_JAVA_HOME} + ${LOCALBASE}/jdk-1.7.0/jre/lib/{libarch} + ${LOCALBASE}/jdk-1.6.0/jre/lib/{libarch} + ${LOCALBASE}/jdk-1.5.0/jre/lib/{libarch} + ${LOCALBASE}/jre-1.7.0/lib/{libarch} + ${LOCALBASE}/jre-1.6.0/lib/{libarch} + ${LOCALBASE}/jre-1.5.0/lib/{libarch} + /usr/lib + /usr/local/lib + /usr/lib/jvm/java/lib + /usr/lib/java/jre/lib/{libarch} + /usr/lib/jvm/jre/lib/{libarch} + /usr/local/lib/java/jre/lib/{libarch} + /usr/local/share/java/jre/lib/{libarch} + /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} + /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} + /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun/jre/lib/{libarch} + /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} + /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora + # Debian specific paths for default JVM + /usr/lib/jvm/default-java/jre/lib/{libarch} + /usr/lib/jvm/default-java/jre/lib + /usr/lib/jvm/default-java/lib + ) +ENDIF(MODJAVA_VER) + SET(JAVA_JVM_LIBRARY_DIRECTORIES) FOREACH(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) SET(JAVA_JVM_LIBRARY_DIRECTORIES @@ -132,29 +159,47 @@ FOREACH(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) ) ENDFOREACH(dir) +IF(MODJAVA_VER) + IF(MODJAVA_VER MATCHES "^1\\.5.*") + SET(JAVA_AWT_INCLUDE_DIRECTORIES + ${LOCALBASE}/jdk-1.5.0/include + ) + ELSEIF(MODJAVA_VER MATCHES "^1\\.6.*") + SET(JAVA_AWT_INCLUDE_DIRECTORIES + ${LOCALBASE}/jdk-1.6.0/include + ) + ELSE(MODJAVA_VER MATCHES "^1\\.5.*") + SET(JAVA_AWT_INCLUDE_DIRECTORIES + ${LOCALBASE}/jdk-1.7.0/include + ) + ENDIF(MODJAVA_VER MATCHES "^1\\.5.*") +ELSE(MODJAVA_VER) + SET(JAVA_AWT_INCLUDE_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" + ${_JAVA_HOME}/include + ${LOCALBASE}/jdk-1.7.0/include + ${LOCALBASE}/jdk-1.6.0/include + ${LOCALBASE}/jdk-1.5.0/include + /usr/include + /usr/local/include + /usr/lib/java/include + /usr/local/lib/java/include + /usr/lib/jvm/java/include + /usr/lib/jvm/java-6-sun/include + /usr/lib/jvm/java-1.5.0-sun/include + /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/include + /usr/local/share/java/include + /usr/lib/j2sdk1.4-sun/include + /usr/lib/j2sdk1.5-sun/include + /opt/sun-jdk-1.5.0.04/include + # Debian specific path for default JVM + /usr/lib/jvm/default-java/include + ) +ENDIF(MODJAVA_VER) -SET(JAVA_AWT_INCLUDE_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" - ${_JAVA_HOME}/include - /usr/include - /usr/local/include - /usr/lib/java/include - /usr/local/lib/java/include - /usr/lib/jvm/java/include - /usr/lib/jvm/java-6-sun/include - /usr/lib/jvm/java-1.5.0-sun/include - /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/include - /usr/local/share/java/include - /usr/lib/j2sdk1.4-sun/include - /usr/lib/j2sdk1.5-sun/include - /opt/sun-jdk-1.5.0.04/include - # Debian specific path for default JVM - /usr/lib/jvm/default-java/include - ) - FOREACH(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") GET_FILENAME_COMPONENT(jpath "${JAVA_PROG}" PATH) FOREACH(JAVA_INC_PATH ../include ../java/include ../share/java/include) @@ -227,6 +272,7 @@ FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH}/win32 ${JAVA_INCLUDE_PATH}/linux ${JAVA_INCLUDE_PATH}/freebsd + ${JAVA_INCLUDE_PATH}/openbsd ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha