2
# Licensed to the Apache Software Foundation (ASF) under one or more
3
# contributor license agreements. See the NOTICE file distributed with
4
# this work for additional information regarding copyright ownership.
5
# The ASF licenses this file to You under the Apache License, Version 2.0
6
# (the "License"); you may not use this file except in compliance with
7
# the License. You may obtain a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
19
dnl TCN_FIND_APR: figure out where APR is located
21
AC_DEFUN(TCN_FIND_APR,[
23
dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config
25
if test "$apr_found" = "no"; then
26
AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
29
sapr_pversion="`$apr_config --version`"
30
if test -z "$sapr_pversion"; then
31
AC_MSG_ERROR(APR config could not be located. Please use the --with-apr option.)
33
sapr_version="`echo $sapr_pversion|sed -e 's/\([a-z]*\)$/.\1/'`"
34
tc_save_IFS=$IFS; IFS=.; set $sapr_version; IFS=$tc_save_IFS
35
if test "${1}" -lt "1"; then
36
AC_MSG_ERROR(You need APR version 1.2.1 or newer installed.)
38
if test "${2}" -lt "2"; then
39
AC_MSG_ERROR(You need APR version 1.2.1 or newer installed.)
43
APR_BUILD_DIR="`$apr_config --installbuilddir`"
45
dnl make APR_BUILD_DIR an absolute directory (we'll need it in the
46
dnl sub-projects in some cases)
47
APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`"
49
APR_INCLUDES="`$apr_config --includes`"
50
APR_LIBS="`$apr_config --link-libtool --libs`"
51
APR_SO_EXT="`$apr_config --apr-so-ext`"
52
APR_LIB_TARGET="`$apr_config --apr-lib-target`"
54
AC_SUBST(APR_INCLUDES)
56
AC_SUBST(APR_BUILD_DIR)
59
dnl --------------------------------------------------------------------------
62
dnl Detection of JDK location and Java Platform (1.2, 1.3, 1.4, 1.5, 1.6)
63
dnl result goes in JAVA_HOME / JAVA_PLATFORM (2 -> 1.2 and higher)
65
dnl --------------------------------------------------------------------------
70
AC_MSG_CHECKING([for JDK location (please wait)])
71
if test -n "${JAVA_HOME}" ; then
72
JAVA_HOME_ENV="${JAVA_HOME}"
82
[ --with-java-home=DIR Location of JDK directory.],
85
# This stuff works if the command line parameter --with-java-home was
86
# specified, so it takes priority rightfully.
90
if test ! -d "${tempval}" ; then
91
AC_MSG_ERROR(Not a directory: ${tempval})
95
AC_MSG_RESULT(${JAVA_HOME})
98
# This works if the parameter was NOT specified, so it's a good time
99
# to see what the enviroment says.
100
# Since Sun uses JAVA_HOME a lot, we check it first and ignore the
101
# JAVA_HOME, otherwise just use whatever JAVA_HOME was specified.
103
if test -n "${JAVA_HOME_ENV}" ; then
104
JAVA_HOME=${JAVA_HOME_ENV}
105
AC_MSG_RESULT(${JAVA_HOME_ENV} from environment)
109
if test -z "${JAVA_HOME}" ; then
111
# Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess
112
# The following code is based on the code submitted by Henner Zeller
113
# for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec
114
# Two variables will be set as a result:
118
AC_MSG_CHECKING([Try to guess JDK location])
120
for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt /usr/java ; do
122
for JAVA_PLATFORM in 6 5 4 3 2 ; do
124
for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
126
for VARIANT in IBMJava2- java java- jdk jdk-; do
127
GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
128
dnl AC_MSG_CHECKING([${GUESS}])
129
if test -d "${GUESS}/bin" & test -d "${GUESS}/include" ; then
131
AC_MSG_RESULT([${GUESS}])
136
if test -n "${JAVA_HOME}" ; then
142
if test -n "${JAVA_HOME}" ; then
148
if test -n "${JAVA_HOME}" ; then
154
if test ! -n "${JAVA_HOME}" ; then
155
AC_MSG_ERROR(can't locate a valid JDK location)
160
if test -n "${JAVA_PLATFORM}"; then
161
AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
163
AC_MSG_CHECKING(Java platform)
166
AC_ARG_WITH(java-platform,
167
[ --with-java-platform[=2] Force the Java platorm
168
(value is 1 for 1.1.x or 2 for 1.2.x or greater)],
172
JAVA_PLATFORM=${withval}
175
AC_MSG_ERROR(invalid java platform provided)
180
if test -n "${JAVA_PLATFORM}"; then
181
AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
183
AC_MSG_CHECKING(Java platform)
187
AC_MSG_RESULT(${JAVA_PLATFORM})
199
[ --with-os-type[=SUBDIR] Location of JDK os-type subdirectory.],
203
if test ! -d "${JAVA_HOME}/${tempval}" ; then
204
AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
210
AC_MSG_CHECKING(os_type directory)
212
if test -f ${JAVA_HOME}/${JAVA_INC}/jni_md.h; then
215
for f in ${JAVA_HOME}/${JAVA_INC}/*/jni_md.h; do
217
JAVA_OS=`dirname ${f}`
218
JAVA_OS=`basename ${JAVA_OS}`
222
if test "${JAVA_OS}" = "NONE"; then
223
AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
224
AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
230
dnl check for sableVM
231
dnl (copied from daemon/src/native/unix/support/apjava.m4)
235
if test x"$JAVA_HOME" != x
237
AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin)
238
if test "$SABLEVM" != "NONE"
240
AC_MSG_RESULT([Using sableVM: $SABLEVM])
241
CFLAGS="$CFLAGS -DHAVE_SABLEVM"
246
dnl check for IBM J9VM
250
if test x"$JAVA_HOME" != x
252
J9VM=`$JAVA_HOME/bin/java -version 2>&1 | grep J9VM`
253
if test x"$J9VM" != x
255
AC_MSG_RESULT([Using J9VM: $J9VM])
261
dnl TCN_HELP_STRING(LHS, RHS)
262
dnl Autoconf 2.50 can not handle substr correctly. It does have
263
dnl AC_HELP_STRING, so let's try to call it if we can.
264
dnl Note: this define must be on one line so that it can be properly returned
265
dnl as the help string.
266
AC_DEFUN(TCN_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[ ]$1 substr([ ],len($1))$2)])dnl
269
dnl TCN_CHECK_SSL_TOOLKIT
271
dnl Configure for the detected openssl toolkit installation, giving
272
dnl preference to "--with-ssl=<path>" if it was specified.
274
AC_DEFUN(TCN_CHECK_SSL_TOOLKIT,[
276
AC_MSG_CHECKING(for OpenSSL library)
278
[ --with-ssl[=PATH] Build with OpenSSL [yes|no|path]],
279
use_openssl="$withval", use_openssl="auto")
281
openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
282
if test "$use_openssl" = "auto"
284
for d in $openssldirs
286
if test -f $d/include/openssl/opensslv.h
293
case "$use_openssl" in
302
AC_MSG_RESULT(not found)
305
if test "$use_openssl" = "yes"
307
# User did not specify a path - guess it
308
for d in $openssldirs
310
if test -f $d/include/openssl/opensslv.h
316
if test "$use_openssl" = "yes"
318
AC_MSG_RESULT(not found)
320
[OpenSSL was not found in any of $openssldirs; use --with-ssl=/path])
323
USE_OPENSSL='-DOPENSSL'
325
if test "$use_openssl" = "/usr"
328
TCN_OPENSSL_LIBS="-lssl -lcrypto"
330
TCN_OPENSSL_INC="-I$use_openssl/include"
333
TCN_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lssl -lcrypto"
336
TCN_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lssl -lcrypto"
339
TCN_OPENSSL_LIBS="-L$use_openssl/lib -Wl,-rpath,$use_openssl/lib -lssl -lcrypto"
342
TCN_OPENSSL_LIBS="-L$use_openssl/lib -lssl -lcrypto"
346
AC_MSG_RESULT(using openssl from $use_openssl/lib and $use_openssl/include)
348
saved_cflags="$CFLAGS"
350
CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
351
LIBS="$LIBS $TCN_OPENSSL_LIBS"
353
AC_ARG_ENABLE(openssl-version-check,
354
[AC_HELP_STRING([--enable-openssl-version-check],
355
[Check OpenSSL Version @<:@default=yes@:>@])])
356
case "$enable_openssl_version_check" in
358
AC_MSG_CHECKING(OpenSSL library version)
361
#include <openssl/opensslv.h>
363
if ((OPENSSL_VERSION_NUMBER >= 0x0090701fL &&
364
OPENSSL_VERSION_NUMBER < 0x00908000L) ||
365
OPENSSL_VERSION_NUMBER >= 0x0090801fL)
367
printf("\n\nFound OPENSSL_VERSION_NUMBER %#010x\n",
368
OPENSSL_VERSION_NUMBER);
369
printf("Require OPENSSL_VERSION_NUMBER 0x0090701f or greater (0.9.7a)\n"
370
"Require OPENSSL_VERSION_NUMBER 0x0090801f or greater (0.9.8a)\n\n");
375
[AC_MSG_RESULT(not compatible)
378
[AC_MSG_RESULT(assuming target platform has compatible version)])
381
AC_MSG_RESULT(Skipped OpenSSL version check)
385
AC_MSG_CHECKING(for OpenSSL DSA support)
386
if test -f $use_openssl/include/openssl/dsa.h
388
AC_DEFINE(HAVE_OPENSSL_DSA)
393
CFLAGS="$saved_cflags"
397
if test "x$USE_OPENSSL" != "x"
399
APR_ADDTO(TCNATIVE_PRIV_INCLUDES, [$TCN_OPENSSL_INC])
400
APR_ADDTO(TCNATIVE_LDFLAGS, [$TCN_OPENSSL_LIBS])
401
APR_ADDTO(CFLAGS, [-DHAVE_OPENSSL])