bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / support / jk_ws.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_ws.m4 466585 2006-10-21 22:16:34Z markt $
24 dnl --------------------------------------------------------------------------
25
26 dnl --------------------------------------------------------------------------
27 dnl JK_WS_DIR
28 dnl   Set the WebServer source dir.
29 dnl   $1 => Webserver name
30 dnl   $2 => Webserver vars prefix name
31 dnl   $3 => File which should be present
32 dnl   $4 => Server specific source directory 
33 dnl --------------------------------------------------------------------------
34 AC_DEFUN(
35   [JK_WS_DIR],
36   [
37     tempval=""
38     AC_ARG_WITH(
39       [$1],
40       [  --with-$1=DIR           Location of $1 source dir ],
41       [
42         case "${withval}" in
43           ""|"yes"|"YES"|"true"|"TRUE")
44           AC_MSG_ERROR(valid $1 source dir location required)
45           ;;
46           "no"|"NO"|"false"|"FALSE")
47           AC_MSG_ERROR(Don't use with/without $1 if you don't have $1)
48           ;;
49           *)
50           tempval="${withval}"
51
52           if ${TEST} ! -d ${tempval} ; then
53             AC_MSG_ERROR(Not a directory: ${tempval})
54           fi
55
56           if ${TEST} ! -f ${tempval}/$3; then
57             AC_MSG_ERROR(can't locate ${tempval}/$3)
58           fi
59
60           if ${TEST} ! -z "$tempval" ; then
61             $2_BUILD="true"
62             $2_CFLAGS="-I ${tempval}/include"
63             $2_DIR=${tempval}
64             $2_HOME="${tempval}"
65             $2_LIBDIR=""
66             if ${TEST} -d ${withval}/include ; then
67               $2_INCL="-I${tempval}/include"
68               $2_INCDIR="${tempval}/include"
69             fi
70             if ${TEST} -d ${withval}/src/include ; then
71               # read osdir from the existing apache.
72               osdir=`${GREP} '^OSDIR=' ${withval}/src/Makefile.config | ${SED} -e 's:^OSDIR=.*/os:os:'`
73               if ${TEST} -z "${osdir}" ; then
74                 osdir=os/unix
75               fi
76               $2_INCL="-I${tempval}/src/include -I${withval}/src/${osdir}"
77               $2_INCDIR="${tempval}/src/include"
78             fi
79             if ${TEST} -d ${tempval}/srclib/apr ; then
80               # Apache 2 contains apr.
81               if ${TEST} ! -f ${tempval}/srclib/apr/config.status ; then
82                 AC_MSG_ERROR(configure Apache2 before mod_jk2)
83               fi
84               osdir=`${GREP} @OSDIR@ ${tempval}/srclib/apr/config.status | sed 's:s,@OSDIR@,::' | sed 's:,;t t::'`
85               $2_INCL="-I${tempval}/include -I${withval}/os/${osdir}"
86               $2_LIBEXEC=`${GREP} "^exp_libexecdir =" ${tempval}/build/config_vars.mk | sed 's:exp_libexecdir = ::'`
87               LIBTOOL=${tempval}/srclib/apr/libtool
88               APR_INCDIR=-I${tempval}/srclib/apr/include
89               APR_CFLAGS=`${tempval}/srclib/apr/apr-config --cflags`
90               APR_UTIL_INCDIR=-I${tempval}/srclib/apr-util/include
91               APR_LIBDIR_LA=`${tempval}/srclib/apr/apr-config --apr-la-file`
92               $2_LIBDIR=${tempval}/lib
93
94               AC_SUBST(APR_INCDIR)
95               AC_SUBST(APR_CFLAGS)
96               AC_SUBST(APR_INCDIR)
97               AC_SUBST(APR_UTIL_INCDIR)
98             fi
99             $2_LDFLAGS=""
100             WEBSERVERS="${WEBSERVERS} $4"
101
102             AC_SUBST($2_BUILD)
103             AC_SUBST($2_CFLAGS)
104             AC_SUBST($2_DIR)
105             AC_SUBST($2_HOME)
106             AC_SUBST($2_INCL)
107             AC_SUBST($2_INCDIR)
108             AC_SUBST($2_LDFLAGS)
109             AC_SUBST($2_LIBDIR)
110
111           fi
112           ;;
113         esac
114       ])
115
116       if ${TEST} -z "$tempval" ; then
117         AC_MSG_RESULT(not provided)
118       else      
119         AC_MSG_RESULT(${tempval})
120       fi
121
122       unset tempval
123   ])
124
125
126 dnl --------------------------------------------------------------------------
127 dnl JK_WS_INCDIR
128 dnl   Set the WebServer include dir.
129 dnl   $1 => Webserver name
130 dnl   $2 => Webserver vars prefix name
131 dnl   $3 => File which should be present
132 dnl --------------------------------------------------------------------------
133 AC_DEFUN(
134   [JK_WS_INCDIR],
135   [
136     tempval=""
137     AC_ARG_WITH(
138       [$1-include],
139       [  --with-$1-include=DIR   Location of $1 include dir ],
140       [  
141         case "${withval}" in
142           ""|"yes"|"YES"|"true"|"TRUE")
143           ;;
144           "no"|"NO"|"false"|"FALSE")
145           AC_MSG_ERROR(valid $1 include dir location required)
146           ;;
147           *)
148           tempval="${withval}"
149           if ${TEST} ! -d ${tempval} ; then
150             AC_MSG_ERROR(Not a directory: ${tempval})
151           fi
152
153           if ${TEST} ! -f ${tempval}/$3; then
154             AC_MSG_ERROR(can't locate ${tempval}/$3)
155           fi
156
157           if ${TEST} ! -z "$tempval" ; then
158             $2_BUILD=""
159             $2_CFLAGS="-I${tempval}"
160             $2_CLEAN=""
161             $2_DIR=""
162             $2_INCDIR=${tempval}
163             AC_MSG_RESULT($2_INCDIR)
164             
165             AC_SUBST($2_BUILD)
166             AC_SUBST($2_CFLAGS)
167             AC_SUBST($2_CLEAN)
168             AC_SUBST($2_DIR)
169             AC_SUBST($2_INCDIR)
170           fi
171           ;;
172         esac
173       ])
174
175       unset tempval
176   ])
177
178
179 dnl --------------------------------------------------------------------------
180 dnl JK_WS_LIBDIR
181 dnl   Set the WebServer library dir.
182 dnl   $1 => Webserver name
183 dnl   $2 => Webserver vars prefix name
184 dnl --------------------------------------------------------------------------
185 AC_DEFUN(
186   [JK_WS_LIBDIR],
187   [
188     tempval=""
189     AC_ARG_WITH(
190       [$1-lib],
191       [  --with-$1-lib=DIR       Location of $1 lib dir ],
192       [
193         case "${withval}" in
194           ""|"yes"|"YES"|"true"|"TRUE")
195           ;;
196           "no"|"NO"|"false"|"FALSE")
197           AC_MSG_ERROR(valid $1 lib directory location required)
198           ;;
199         *)
200           tempval="${withval}"
201
202           if ${TEST} ! -d ${tempval} ; then
203             AC_MSG_ERROR(Not a directory: ${tempval})
204           fi
205
206           if ${TEST} ! -z "$tempval" ; then
207             $2_BUILD=""
208             $2_CLEAN=""
209             $2_DIR=""
210             $2_LIBDIR=${tempval}
211             $2_LDFLAGS=""
212             AC_MSG_RESULT($2_LIBDIR)
213
214             AC_SUBST($2_BUILD)
215             AC_SUBST($2_CLEAN)
216             AC_SUBST($2_DIR)
217             AC_SUBST($2_LIBDIR)
218             AC_SUBST($2_LDFLAGS)
219           fi
220
221           ;;
222           esac
223       ])
224
225       unset tempval
226   ])
227
228 dnl vi:set sts=2 sw=2 autoindent:
229