bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / support / jk_apr.m4
1 dnl
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
8 dnl
9 dnl     http://www.apache.org/licenses/LICENSE-2.0
10 dnl
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.
16 dnl
17
18 dnl --------------------------------------------------------------------------
19 dnl Author Henri Gomez <hgomez@apache.org>
20 dnl
21 dnl Inspired by Pier works on webapp m4 macros :)
22 dnl 
23 dnl Version $Id: jk_apr.m4 466585 2006-10-21 22:16:34Z markt $
24 dnl --------------------------------------------------------------------------
25
26 dnl --------------------------------------------------------------------------
27 dnl JK_APR_THREADS
28 dnl   Configure APR threading for use with --with-apr.
29 dnl   Result goes into APR_CONFIGURE_ARGS
30 dnl --------------------------------------------------------------------------
31 AC_DEFUN(
32   [JK_APR_THREADS],
33   [
34     AC_ARG_ENABLE(
35       [apr-threads],
36       [  --enable-apr-threads        Configure APR threading for use with --with-apr ],
37       [
38         case "${enableval}" in
39           ""|"yes"|"YES"|"true"|"TRUE")
40             APR_CONFIGURE_ARGS="--enable-threads ${APR_CONFIGURE_ARGS}"
41           ;;
42           "no"|"NO"|"false"|"FALSE")
43             APR_CONFIGURE_ARGS="--disable-threads ${APR_CONFIGURE_ARGS}"
44           ;;
45         *)
46           APR_CONFIGURE_ARGS="--enable-threads=${enableval} ${APR_CONFIGURE_ARGS}"
47          esac
48       ])
49   ])
50
51 dnl --------------------------------------------------------------------------
52 dnl JK_APR
53 dnl   Set the APR source dir.
54 dnl   $1 => File which should be present
55 dnl --------------------------------------------------------------------------
56 AC_DEFUN(
57   [JK_APR],
58   [
59     tempval=""
60     AC_ARG_WITH(
61       [apr],
62       [  --with-apr=DIR           Location of APR source dir ],
63       [
64         case "${withval}" in
65           ""|"yes"|"YES"|"true"|"TRUE")
66             AC_MSG_ERROR(valid apr source dir location required)
67           ;;
68           "no"|"NO"|"false"|"FALSE")
69             AC_MSG_ERROR(valid apr source dir location required)
70           ;;
71         *)
72           tempval="${withval}"
73
74           if ${TEST} ! -d ${tempval} ; then
75             AC_MSG_ERROR(Not a directory: ${tempval})
76           fi
77
78           if ${TEST} ! -f ${tempval}/$1; then
79             AC_MSG_ERROR(can't locate ${tempval}/$1)
80           fi
81
82           if ${TEST} ! -z "$tempval" ; then
83             APR_BUILD="apr-build"
84             APR_CFLAGS="-I ${tempval}/include"
85             APR_CLEAN="apr-clean"
86             APR_DIR=${tempval}
87             APR_INCDIR="${tempval}/include"
88             AC_MSG_RESULT(configuring apr...)
89             tempret="0"
90             JK_EXEC(
91               [tempret],
92               [${SHELL} ./configure --prefix=${APR_DIR} --with-installbuilddir=${APR_DIR}/instbuild --disable-shared ${APR_CONFIGURE_ARGS}],
93               [apr],
94               [${APR_DIR}])
95             if ${TEST} "${tempret}" = "0"; then
96               AC_MSG_RESULT(apr configure ok)
97             else
98               AC_MSG_ERROR(apr configure failed with ${tempret})
99             fi
100             JK_APR_LIBNAME(apr_libname,${APR_DIR})
101             APR_LDFLAGS="${APR_DIR}/lib/${apr_libname}"
102             APR_LIBDIR=""
103                         use_apr=true
104             COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
105           fi
106           ;;
107         esac
108       ])
109
110       unset tempret
111       unset tempval
112       unset apr_libname
113   ])
114
115 dnl --------------------------------------------------------------------------
116 dnl JK_APR_UTIL
117 dnl   Set the APR-UTIL source dir.
118 dnl   $1 => File which should be present
119 dnl --------------------------------------------------------------------------
120 AC_DEFUN(
121   [JK_APR_UTIL],
122   [
123     tempval=""
124     AC_ARG_WITH(
125       [apr-util],
126       [  --with-apr-util=DIR      Location of APR-UTIL source dir ],
127       [
128         case "${withval}" in
129           ""|"yes"|"YES"|"true"|"TRUE")
130             AC_MSG_ERROR(valid apr-util source dir location required)
131           ;;
132           "no"|"NO"|"false"|"FALSE")
133             AC_MSG_ERROR(valid apr-util source dir location required)
134           ;;
135         *)
136           tempval="${withval}"
137
138           if ${TEST} ! -d ${tempval} ; then
139             AC_MSG_ERROR(Not a directory: ${tempval})
140           fi
141
142           if ${TEST} ! -f ${tempval}/$1; then
143             AC_MSG_ERROR(can't locate ${tempval}/$1)
144           fi
145
146           if ${TEST} -z "${APR_BUILD}"; then
147             AC_MSG_ERROR([--with-apr and --with-apr-util must be used together])
148           fi
149
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...)
155             tempret="0"
156             JK_EXEC(
157               [tempret],
158               [${SHELL} ./configure --prefix=${APR_UTIL_DIR} --with-apr=${APR_DIR}],
159               [apr-util],
160               [${APR_UTIL_DIR}])
161             if ${TEST} "${tempret}" = "0"; then
162               AC_MSG_RESULT(apr-util configure ok)
163             else
164               AC_MSG_ERROR(apr-util configure failed with ${tempret})
165             fi
166             JK_APR_UTIL_LIBNAME(apr_util_libname,${APR_UTIL_DIR})
167             APR_LDFLAGS="${APR_LDFLAGS} ${APR_UTIL_DIR}/lib/${apr_util_libname}"
168             APR_UTIL_LIBDIR=""
169                         use_apr=true
170             COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
171           fi
172           ;;
173         esac
174       ])
175
176       unset tempret
177       unset tempval
178       unset apr_util_libname
179   ])
180
181
182 dnl --------------------------------------------------------------------------
183 dnl JK_APR_INCDIR
184 dnl   Set the APR include dir.
185 dnl   $1 => File which should be present
186 dnl --------------------------------------------------------------------------
187 AC_DEFUN(
188   [JK_APR_INCDIR],
189   [
190     tempval=""
191     AC_ARG_WITH(
192       [apr-include],
193       [  --with-apr-include=DIR   Location of APR include dir ],
194       [  
195         case "${withval}" in
196           ""|"yes"|"YES"|"true"|"TRUE")
197           ;;
198           "no"|"NO"|"false"|"FALSE")
199             AC_MSG_ERROR(valid apr include dir location required)
200           ;;
201         *)
202           tempval="${withval}"
203           if ${TEST} ! -d ${tempval} ; then
204             AC_MSG_ERROR(Not a directory: ${tempval})
205           fi
206
207           if ${TEST} ! -f ${tempval}/$1; then
208             AC_MSG_ERROR(can't locate ${tempval}/$1)
209           fi
210
211           if ${TEST} ! -z "$tempval" ; then
212             APR_BUILD=""
213             APR_CFLAGS="-I${tempval}"
214             APR_CLEAN=""
215             APR_DIR=""
216             APR_INCDIR=${tempval}
217             COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
218                         use_apr=true
219           fi
220           ;;
221
222         esac
223       ])
224
225       unset tempval
226   ])
227
228
229 dnl --------------------------------------------------------------------------
230 dnl JK_APR_LIBDIR
231 dnl   Set the APR library dir.
232 dnl --------------------------------------------------------------------------
233 AC_DEFUN(
234   [JK_APR_LIBDIR],
235   [
236     tempval=""
237     AC_ARG_WITH(
238       [apr-lib],
239       [  --with-apr-lib=DIR       Location of APR lib dir ],
240       [
241         case "${withval}" in
242           ""|"yes"|"YES"|"true"|"TRUE")
243           ;;
244           "no"|"NO"|"false"|"FALSE")
245             AC_MSG_ERROR(valid apr lib dir location required)
246           ;;
247           *)
248             tempval="${withval}"
249
250             if ${TEST} ! -d ${tempval} ; then
251               AC_MSG_ERROR(Not a directory: ${tempval})
252             fi
253
254             if ${TEST} ! -z "$tempval" ; then
255               APR_BUILD=""
256               APR_CLEAN=""
257               APR_DIR=""
258               APR_LIBDIR=${tempval}
259               APR_LDFLAGS="`apr-config --link-ld` -L${tempval}"
260               COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
261                           use_apr=true
262             fi
263
264             ;;
265             esac
266       ])
267
268       unset tempval
269   ])
270
271
272 dnl --------------------------------------------------------------------------
273 dnl JK_APR_LIBNAME
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 --------------------------------------------------------------------------
278 AC_DEFUN(
279   [JK_APR_LIBNAME],
280   [
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])
284     fi
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])
288     fi
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
293   ])
294
295
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 --------------------------------------------------------------------------
302 AC_DEFUN(
303   [JK_APR_UTIL_LIBNAME],
304   [
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])
308     fi
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])
312     fi
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
317   ])
318
319 dnl vi:set sts=2 sw=2 autoindent:
320