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.
19 dnl apache.m4: autoconf macro for Apache/apxs
26 AC_DEFUN(JTC_CHECK_APXS,[
32 [ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
33 pathname to the apxs tool; defaults to finding
37 y | yes | true) find_apxs=true ;;
38 n | no | false) find_apxs=false ;;
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
46 if ${TEST} ${find_apxs} ; then
49 AC_PATH_PROG(APXS,apxs,$PATH)dnl
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}')
58 $APXS -q PREFIX >/dev/null 2>/dev/null || apxs_support=false
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)
65 dnl test apache version
68 APA=`grep STANDARD20 test/mod_test.c`
70 if ${TEST} -z "$APA" ; then
71 WEBSERVER="apache-1.3"
73 WEBSERVER="apache-2.0"
75 AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
79 dnl apache_dir and apache_include are also needed.
80 apache_dir=`$APXS -q PREFIX`
81 apache_include="-I`$APXS -q INCLUDEDIR`"
86 AC_MSG_RESULT(no apxs given)
91 dnl check for apache (static link).
94 AC_DEFUN(JTC_CHECK_APACHE,[
96 dnl it is copied from the configure of JServ ;=)
99 apache_dir_is_src="false"
101 [ --with-apache=DIR Build static Apache module. DIR is the pathname
102 to the Apache source directory.],
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])
108 AC_MSG_CHECKING([for Apache source directory (assume static build)])
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}
121 apache_dir=${withval}
122 apache_dir_is_src="true"
123 AC_MSG_RESULT(${apache_dir})
125 AC_MSG_CHECKING(for Apache include directory)
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
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])
138 AC_MSG_ERROR([Sorry Apache 1.2.x is no longer supported.])
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})
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])
156 # VT: Now, which one I'm supposed to use? Let's figure it out later
158 configure_apache=true
161 AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
164 AC_MSG_RESULT(no apache given)
166 AC_SUBST(apache_include)
167 APACHE_DIR=${apache_dir}
172 dnl check for EAPI (static link only).
175 AC_DEFUN(JTC_CHECK_EAPI,[
177 dnl CFLAGS for EAPI mod_ssl (Apache 1.3)
178 dnl it also allows the CFLAGS environment variable.
182 [ --enable-EAPI Enable EAPI support (mod_ssl, Apache 1.3)],
184 case "${enableval}" in
185 y | Y | YES | yes | TRUE | true )
186 CFLAGS="${CFLAGS} -DEAPI"
187 AC_MSG_RESULT([...Enabling EAPI Support...])
196 dnl set flags for apxs.
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).
204 if ${TEST} -n "${CFLAGS}" ; then
205 APXSCFLAGS="${CFLAGS}"
207 dnl the APXSLDFLAGS is normaly empty but APXSCFLAGS is not.
208 if ${TEST} -n "${LDFLAGS}" ; then
209 APXSLDFLAGS="-Wl,${LDFLAGS}"
212 AC_SUBST(APXSLDFLAGS)