2
dnl Copyright 1999-2004 The Apache Software Foundation
4
dnl Licensed under the Apache License, Version 2.0 (the "License");
5
dnl you may not use this file except in compliance with the License.
6
dnl You may obtain a copy of the License at
8
dnl http://www.apache.org/licenses/LICENSE-2.0
10
dnl Unless required by applicable law or agreed to in writing, software
11
dnl distributed under the License is distributed on an "AS IS" BASIS,
12
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
dnl See the License for the specific language governing permissions and
14
dnl limitations under the License.
17
dnl --------------------------------------------------------------------------
18
dnl Author Henri Gomez <hgomez@apache.org>
20
dnl Inspired by Pier works on webapp m4 macros :)
22
dnl Version $Id: jk_java.m4,v 1.9 2004/05/28 00:04:43 yoavs Exp $
23
dnl --------------------------------------------------------------------------
25
dnl --------------------------------------------------------------------------
28
dnl Detection of JDK location and Java Platform (1.1, 1.2, 1.3, 1.4)
29
dnl result goes in JAVA_HOME / JAVA_PLATFORM (1 -> 1.1, 2 -> 1.2 and higher)
31
dnl --------------------------------------------------------------------------
36
[ --with-jni Build jni support],
39
y | yes | true) use_jni=true ;;
40
n | no | false) use_jni=false ;;
44
if ${TEST} "${use_jni}" = "true"; then
54
if ${TEST} "${use_jni}" = "true"; then
56
AC_MSG_CHECKING([for JDK location (please wait)])
57
if ${TEST} -n "${JAVA_HOME}" ; then
58
JAVA_HOME_ENV="${JAVA_HOME}"
68
[ --with-java-home=DIR Location of JDK directory.],
71
# This stuff works if the command line parameter --with-java-home was
72
# specified, so it takes priority rightfully.
76
if ${TEST} ! -d "${tempval}" ; then
77
AC_MSG_ERROR(Not a directory: ${tempval})
81
AC_MSG_RESULT(${JAVA_HOME})
84
# This works if the parameter was NOT specified, so it's a good time
85
# to see what the enviroment says.
86
# Since Sun uses JAVA_HOME a lot, we check it first and ignore the
87
# JAVA_HOME, otherwise just use whatever JAVA_HOME was specified.
89
if ${TEST} -n "${JAVA_HOME_ENV}" ; then
90
JAVA_HOME=${JAVA_HOME_ENV}
91
AC_MSG_RESULT(${JAVA_HOME_ENV} from environment)
95
if ${TEST} -z "${JAVA_HOME}" ; then
97
# Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess
98
# The following code is based on the code submitted by Henner Zeller
99
# for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec
100
# Two variables will be set as a result:
104
AC_MSG_CHECKING([Try to guess JDK location])
106
for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt /usr/java ; do
108
for JAVA_PLATFORM in 4 3 2 1 ; do
110
for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
112
for VARIANT in IBMJava2- java java- jdk jdk-; do
113
GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
114
dnl AC_MSG_CHECKING([${GUESS}])
115
if ${TEST} -d "${GUESS}/bin" & ${TEST} -d "${GUESS}/include" ; then
117
AC_MSG_RESULT([${GUESS}])
122
if ${TEST} -n "${JAVA_HOME}" ; then
128
if ${TEST} -n "${JAVA_HOME}" ; then
134
if ${TEST} -n "${JAVA_HOME}" ; then
140
if ${TEST} ! -n "${JAVA_HOME}" ; then
141
AC_MSG_ERROR(can't locate a valid JDK location)
146
if ${TEST} -n "${JAVA_PLATFORM}"; then
147
AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
149
AC_MSG_CHECKING(Java platform)
152
AC_ARG_WITH(java-platform,
153
[ --with-java-platform[=2] Force the Java platorm
154
(value is 1 for 1.1.x or 2 for 1.2.x or greater)],
158
JAVA_PLATFORM=${withval}
161
AC_MSG_ERROR(invalid java platform provided)
166
if ${TEST} -n "${JAVA_PLATFORM}"; then
167
AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
169
AC_MSG_CHECKING(Java platform)
173
AC_MSG_RESULT(${JAVA_PLATFORM})
177
# no jni, then make sure JAVA_HOME is not picked up from env
187
if ${TEST} "${use_jni}" = "true"; then
191
[ --with-os-type[=SUBDIR] Location of JDK os-type subdirectory.],
195
if ${TEST} ! -d "${JAVA_HOME}/${tempval}" ; then
196
AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
202
AC_MSG_CHECKING(os_type directory)
203
if ${TEST} -f ${JAVA_HOME}/include/jni_md.h; then
206
for f in ${JAVA_HOME}/include/*/jni_md.h; do
207
if ${TEST} -f $f; then
213
if ${TEST} -z "${OS}"; then
214
AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
215
AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
222
dnl vi:set sts=2 sw=2 autoindent: