bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / support / apache.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 apache.m4: autoconf macro for Apache/apxs
20 dnl
21
22 dnl
23 dnl check for apxs.
24 dnl
25
26 AC_DEFUN(JTC_CHECK_APXS,[
27 WEBSERVER=""
28 apache_dir=""
29 apache_include=""
30 APXS="apxs"
31 AC_ARG_WITH(apxs,
32 [  --with-apxs[=FILE]      Build shared Apache module. FILE is the optional
33                         pathname to the apxs tool; defaults to finding
34                         apxs in your PATH.],
35 [
36     case "${withval}" in 
37         y | yes | true) find_apxs=true ;;
38         n | no | false) find_apxs=false ;;
39         *) find_apxs=false ;;
40     esac
41
42     if ${TEST} ${find_apxs} ; then    
43         AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
44         AC_PATH_PROG(PERL,perl,$PATH)dnl
45     
46         if ${TEST} ${find_apxs} ; then
47             APXS=${withval}
48         else
49             AC_PATH_PROG(APXS,apxs,$PATH)dnl
50         fi
51     
52         if ${TEST} -n "${APXS}" ; then
53             dnl Seems that we have it, but have to check if it is OK first        
54             if ${TEST} ! -x "${APXS}" ; then
55                 AC_MSG_ERROR(Invalid location for apxs: '${APXS}')
56             fi
57             
58             $APXS -q PREFIX >/dev/null 2>/dev/null || apxs_support=false
59     
60             if ${TEST} "${apxs_support}" = "false" ; then
61                 AC_MSG_RESULT(could not find apxs)
62                 AC_MSG_ERROR(You must specify a valid --with-apxs path)
63             fi
64
65             dnl test apache version
66             $RM -rf test
67             $APXS -n test -g
68             APA=`grep STANDARD20 test/mod_test.c`
69             $RM -rf test
70             if ${TEST} -z "$APA" ; then
71                 WEBSERVER="apache-1.3"
72             else
73                 WEBSERVER="apache-2.0"
74             fi
75             AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
76     
77             AC_SUBST(APXS)
78
79             dnl apache_dir and apache_include are also needed.
80             apache_dir=`$APXS -q PREFIX`
81             apache_include="-I`$APXS -q INCLUDEDIR`"
82         fi
83     fi
84 ],
85 [
86         AC_MSG_RESULT(no apxs given)
87 ])
88 ])dnl
89
90 dnl
91 dnl check for apache (static link).
92 dnl
93
94 AC_DEFUN(JTC_CHECK_APACHE,[
95
96 dnl it is copied from the configure of JServ ;=)
97 dnl and adapted. 
98
99 apache_dir_is_src="false"
100 AC_ARG_WITH(apache,
101 [  --with-apache=DIR      Build static Apache module. DIR is the pathname 
102                         to the Apache source directory.],
103 [
104     if ${TEST} ! -z "$WEBSERVER" ; then
105         AC_MSG_ERROR([Sorry cannot use --with-apxs=${APXS} and --with-apache=${withval} togother, please choose one of both])
106     fi
107
108     AC_MSG_CHECKING([for Apache source directory (assume static build)])
109
110     if ${TEST} -n "${withval}" && ${TEST} -d "${withval}" ; then
111         if ${TEST} -d "${withval}/src" ; then
112            # handle the case where people use relative paths to 
113            # the apache source directory by pre-pending the current
114            # build directory to the path. there are probably 
115            # errors with this if configure is run while in a 
116            # different directory than what you are in at the time
117            if ${TEST} -n "`${ECHO} ${withval}|${GREP} \"^\.\.\"`" ; then
118                withval=`pwd`/${withval}
119            fi
120
121            apache_dir=${withval}
122            apache_dir_is_src="true"
123            AC_MSG_RESULT(${apache_dir})
124         
125            AC_MSG_CHECKING(for Apache include directory)
126
127            if ${TEST} -d "${withval}/src/include" ; then
128                # read osdir from the existing apache.
129                osdir=`${GREP} '^OSDIR=' ${withval}/src/Makefile.config | ${SED} -e 's:^OSDIR=.*/os:os:'`
130                if ${TEST} -z "${osdir}" ; then
131                    osdir=os/unix
132                fi
133                apache_include="-I${withval}/src/include \
134                    -I${withval}/src/${osdir}"
135                WEBSERVER="apache-1.3"
136                AC_MSG_RESULT([${apache_include}, version 1.3])
137            else
138                AC_MSG_ERROR([Sorry Apache 1.2.x is no longer supported.])
139            fi
140         else
141            if ${TEST} -d "${withval}/include" ; then
142               # osdir for Apache20.
143               WEBSERVER="apache-2.0"
144               apache_dir=${withval}
145               apache_dir_is_src="true"
146               AC_MSG_RESULT(${apache_dir})
147            fi
148         fi
149     fi
150
151     dnl Make sure we have a result.
152     if ${TEST} -z "$WEBSERVER" ; then
153         AC_MSG_ERROR([Directory $apache_dir is not a valid Apache source distribution])
154     fi
155
156 # VT: Now, which one I'm supposed to use? Let's figure it out later
157
158     configure_apache=true
159     configure_src=true
160     
161     AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
162 ],
163 [
164         AC_MSG_RESULT(no apache given)
165 ])
166 AC_SUBST(apache_include)
167 APACHE_DIR=${apache_dir}
168 AC_SUBST(APACHE_DIR)
169 ])
170
171 dnl
172 dnl check for EAPI (static link only).
173 dnl
174
175 AC_DEFUN(JTC_CHECK_EAPI,[
176
177 dnl CFLAGS for EAPI mod_ssl (Apache 1.3)
178 dnl it also allows the CFLAGS environment variable.
179 CFLAGS="${CFLAGS}"
180 AC_ARG_ENABLE(
181 EAPI,
182 [  --enable-EAPI           Enable EAPI support (mod_ssl, Apache 1.3)],
183 [
184 case "${enableval}" in
185     y | Y | YES | yes | TRUE | true )
186         CFLAGS="${CFLAGS} -DEAPI"
187         AC_MSG_RESULT([...Enabling EAPI Support...])
188         ;;
189 esac
190 ])
191 AC_SUBST(CFLAGS)
192 ])
193
194
195 dnl
196 dnl set flags for apxs.
197 dnl
198
199 AC_DEFUN(JTC_SET_APXS_FLAGS,[
200 dnl the APXSCFLAGS is given by apxs to the C compiler
201 dnl the APXSLDFLAGS is given to the linker (for APRVARS).
202 APXSLDFLAGS=""
203 APXSCFLAGS=""
204 if ${TEST} -n "${CFLAGS}" ; then
205         APXSCFLAGS="${CFLAGS}"
206 fi
207 dnl the APXSLDFLAGS is normaly empty but APXSCFLAGS is not.
208 if ${TEST} -n "${LDFLAGS}" ; then
209         APXSLDFLAGS="-Wl,${LDFLAGS}"
210 fi
211 AC_SUBST(APXSCFLAGS)
212 AC_SUBST(APXSLDFLAGS)
213 ])