2 dnl Licensed to the Apache Software Foundation (ASF) under one or more
3 dnl contributor license agreements. See the NOTICE file distributed with
4 dnl this work for additional information regarding copyright ownership.
5 dnl The ASF licenses this file to You under the Apache License, Version 2.0
6 dnl (the "License"); you may not use this file except in compliance with
7 dnl the License. You may obtain a copy of the License at
9 dnl http://www.apache.org/licenses/LICENSE-2.0
11 dnl Unless required by applicable law or agreed to in writing, software
12 dnl distributed under the License is distributed on an "AS IS" BASIS,
13 dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 dnl See the License for the specific language governing permissions and
15 dnl limitations under the License.
18 dnl --------------------------------------------------------------------------
19 dnl Author Henri Gomez <hgomez@apache.org>
21 dnl Inspired by Pier works on webapp m4 macros :)
23 dnl Version $Id: jk_apr.m4 466585 2006-10-21 22:16:34Z markt $
24 dnl --------------------------------------------------------------------------
26 dnl --------------------------------------------------------------------------
28 dnl Configure APR threading for use with --with-apr.
29 dnl Result goes into APR_CONFIGURE_ARGS
30 dnl --------------------------------------------------------------------------
36 [ --enable-apr-threads Configure APR threading for use with --with-apr ],
38 case "${enableval}" in
39 ""|"yes"|"YES"|"true"|"TRUE")
40 APR_CONFIGURE_ARGS="--enable-threads ${APR_CONFIGURE_ARGS}"
42 "no"|"NO"|"false"|"FALSE")
43 APR_CONFIGURE_ARGS="--disable-threads ${APR_CONFIGURE_ARGS}"
46 APR_CONFIGURE_ARGS="--enable-threads=${enableval} ${APR_CONFIGURE_ARGS}"
51 dnl --------------------------------------------------------------------------
53 dnl Set the APR source dir.
54 dnl $1 => File which should be present
55 dnl --------------------------------------------------------------------------
62 [ --with-apr=DIR Location of APR source dir ],
65 ""|"yes"|"YES"|"true"|"TRUE")
66 AC_MSG_ERROR(valid apr source dir location required)
68 "no"|"NO"|"false"|"FALSE")
69 AC_MSG_ERROR(valid apr source dir location required)
74 if ${TEST} ! -d ${tempval} ; then
75 AC_MSG_ERROR(Not a directory: ${tempval})
78 if ${TEST} ! -f ${tempval}/$1; then
79 AC_MSG_ERROR(can't locate ${tempval}/$1)
82 if ${TEST} ! -z "$tempval" ; then
84 APR_CFLAGS="-I ${tempval}/include"
87 APR_INCDIR="${tempval}/include"
88 AC_MSG_RESULT(configuring apr...)
92 [${SHELL} ./configure --prefix=${APR_DIR} --with-installbuilddir=${APR_DIR}/instbuild --disable-shared ${APR_CONFIGURE_ARGS}],
95 if ${TEST} "${tempret}" = "0"; then
96 AC_MSG_RESULT(apr configure ok)
98 AC_MSG_ERROR(apr configure failed with ${tempret})
100 JK_APR_LIBNAME(apr_libname,${APR_DIR})
101 APR_LDFLAGS="${APR_DIR}/lib/${apr_libname}"
104 COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
115 dnl --------------------------------------------------------------------------
117 dnl Set the APR-UTIL source dir.
118 dnl $1 => File which should be present
119 dnl --------------------------------------------------------------------------
126 [ --with-apr-util=DIR Location of APR-UTIL source dir ],
129 ""|"yes"|"YES"|"true"|"TRUE")
130 AC_MSG_ERROR(valid apr-util source dir location required)
132 "no"|"NO"|"false"|"FALSE")
133 AC_MSG_ERROR(valid apr-util source dir location required)
138 if ${TEST} ! -d ${tempval} ; then
139 AC_MSG_ERROR(Not a directory: ${tempval})
142 if ${TEST} ! -f ${tempval}/$1; then
143 AC_MSG_ERROR(can't locate ${tempval}/$1)
146 if ${TEST} -z "${APR_BUILD}"; then
147 AC_MSG_ERROR([--with-apr and --with-apr-util must be used together])
150 if ${TEST} ! -z "$tempval" ; then
151 APR_UTIL_DIR=${tempval}
152 APR_CFLAGS="${APR_CFLAGS} -I ${APR_UTIL_DIR}/include"
153 APR_UTIL_INCDIR="${APR_UTIL_DIR}/include"
154 AC_MSG_RESULT(configuring apr-util...)
158 [${SHELL} ./configure --prefix=${APR_UTIL_DIR} --with-apr=${APR_DIR}],
161 if ${TEST} "${tempret}" = "0"; then
162 AC_MSG_RESULT(apr-util configure ok)
164 AC_MSG_ERROR(apr-util configure failed with ${tempret})
166 JK_APR_UTIL_LIBNAME(apr_util_libname,${APR_UTIL_DIR})
167 APR_LDFLAGS="${APR_LDFLAGS} ${APR_UTIL_DIR}/lib/${apr_util_libname}"
170 COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
178 unset apr_util_libname
182 dnl --------------------------------------------------------------------------
184 dnl Set the APR include dir.
185 dnl $1 => File which should be present
186 dnl --------------------------------------------------------------------------
193 [ --with-apr-include=DIR Location of APR include dir ],
196 ""|"yes"|"YES"|"true"|"TRUE")
198 "no"|"NO"|"false"|"FALSE")
199 AC_MSG_ERROR(valid apr include dir location required)
203 if ${TEST} ! -d ${tempval} ; then
204 AC_MSG_ERROR(Not a directory: ${tempval})
207 if ${TEST} ! -f ${tempval}/$1; then
208 AC_MSG_ERROR(can't locate ${tempval}/$1)
211 if ${TEST} ! -z "$tempval" ; then
213 APR_CFLAGS="-I${tempval}"
216 APR_INCDIR=${tempval}
217 COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
229 dnl --------------------------------------------------------------------------
231 dnl Set the APR library dir.
232 dnl --------------------------------------------------------------------------
239 [ --with-apr-lib=DIR Location of APR lib dir ],
242 ""|"yes"|"YES"|"true"|"TRUE")
244 "no"|"NO"|"false"|"FALSE")
245 AC_MSG_ERROR(valid apr lib dir location required)
250 if ${TEST} ! -d ${tempval} ; then
251 AC_MSG_ERROR(Not a directory: ${tempval})
254 if ${TEST} ! -z "$tempval" ; then
258 APR_LIBDIR=${tempval}
259 APR_LDFLAGS="`apr-config --link-ld` -L${tempval}"
260 COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
272 dnl --------------------------------------------------------------------------
274 dnl Retrieve the complete name of the library.
275 dnl $1 => Environment variable name for the returned value
276 dnl $2 => APR sources directory
277 dnl --------------------------------------------------------------------------
281 AC_MSG_CHECKING([for apr APR_LIBNAME])
282 if ${TEST} ! -f "$2/apr-config" ; then
283 AC_MSG_ERROR([cannot find apr-config file in $2])
285 jk_apr_get_tempval=`$2/apr-config --link-libtool 2> /dev/null`
286 if ${TEST} -z "${jk_apr_get_tempval}" ; then
287 AC_MSG_ERROR([$2/apr-config --link-libtool failed])
289 jk_apr_get_tempval=`basename ${jk_apr_get_tempval}`
290 $1="${jk_apr_get_tempval}"
291 AC_MSG_RESULT([${jk_apr_get_tempval}])
292 unset jk_apr_get_tempval
296 dnl --------------------------------------------------------------------------
297 dnl JK_APR_UTIL_LIBNAME
298 dnl Retrieve the complete name of the library.
299 dnl $1 => Environment variable name for the returned value
300 dnl $2 => APR_UTIL sources directory
301 dnl --------------------------------------------------------------------------
303 [JK_APR_UTIL_LIBNAME],
305 AC_MSG_CHECKING([for apr-util APR_UTIL_LIBNAME])
306 if ${TEST} ! -f "$2/apu-config" ; then
307 AC_MSG_ERROR([cannot find apu-config file in $2])
309 jk_apu_get_tempval=`$2/apu-config --link-libtool 2> /dev/null`
310 if ${TEST} -z "${jk_apu_get_tempval}" ; then
311 AC_MSG_ERROR([$2/apu-config --link-libtool failed])
313 jk_apu_get_tempval=`basename ${jk_apu_get_tempval}`
314 $1="${jk_apu_get_tempval}"
315 AC_MSG_RESULT([${jk_apu_get_tempval}])
316 unset jk_apu_get_tempval
319 dnl vi:set sts=2 sw=2 autoindent: