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_apxs.m4 466585 2006-10-21 22:16:34Z markt $
24 dnl --------------------------------------------------------------------------
26 dnl --------------------------------------------------------------------------
29 dnl Get APXS to be used, determine if Apache 1.3 or 2.0 are target
30 dnl $1 => blank/2 if you want to detect Apache 1.3 & 2.0
31 dnl $2 => comment for --with-apxs
32 dnl --------------------------------------------------------------------------
38 [ --with-apxs$1[=FILE] $2],
41 y | yes | true) find_apxs=true ;;
42 n | no | false) find_apxs=false ;;
46 if ${TEST} ${find_apxs} ; then
47 AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
48 AC_PATH_PROG(PERL,perl,$PATH)dnl
50 if ${TEST} ${find_apxs} ; then
53 AC_PATH_PROG(APXS$1,apxs$1,$PATH)dnl
58 if ${TEST} -n "${APXS$1}" ; then
59 dnl Seems that we have it, but have to check if it is OK first
60 if ${TEST} ! -x "${APXS$1}" ; then
61 AC_MSG_ERROR(Invalid location for apxs: '${APXS$1}')
64 ${APXS$1} -q PREFIX >/dev/null 2>/dev/null || apxs_support=false
66 if ${TEST} "${apxs_support}" = "false" ; then
67 AC_MSG_RESULT(could not find ${APXS$1})
68 AC_MSG_ERROR(You must specify a valid --with-apxs$1 path)
71 dnl apache_dir and apache_include are also needed.
72 APACHE$1_HOME=`${APXS$1} -q PREFIX`
73 APACHE$1_INCL="-I`${APXS$1} -q INCLUDEDIR`"
74 APACHE$1_INCDIR="`${APXS$1} -q INCLUDEDIR`"
75 APACHE$1_LIBEXEC="`${APXS$1} -q LIBEXECDIR`"
76 APACHE$1_CC="`${APXS$1} -q CC`"
78 dnl test apache version
79 APA=`${GREP} STANDARD20 ${APXS$1}`
81 dnl check if we have an apxs for Apache 1.3 or 2.0
82 if ${TEST} -z "$APA" ; then
83 if ${TEST} ! -z "$1" ; then
84 AC_MSG_ERROR(Do not use --with-apxs$1 but --with-apxs)
86 WEBSERVERS="${WEBSERVERS} server/apache13"
87 RWEBSERVER="apache-1.3"
88 APXS$1_CFLAGS="`${APXS$1} -q CFLAGS`"
91 if ${TEST} -z "$1" ; then
92 AC_MSG_ERROR(Do not use --with-apxs but --with-apxs2)
94 WEBSERVERS="${WEBSERVERS} server/apache2"
95 RWEBSERVER="apache-2.0"
96 APACHE2_CONFIG_VARS=${apache_dir}/build/config_vars.mk
97 JK_CHANNEL_APR_SOCKET="\${JK}jk_channel_apr_socket\${OEXT}"
98 JK_POOL_APR="\${JK}jk_pool_apr\${OEXT}"
99 APXS$1_CFLAGS="`${APXS$1} -q CFLAGS` `${APXS$1} -q EXTRA_CFLAGS`"
100 APXS$1_CPPFLAGS="`${APXS$1} -q EXTRA_CPPFLAGS`"
101 APR_INCDIR="-I`${APXS$1} -q APR_INCLUDEDIR`"
102 APR_UTIL_INCDIR="-I`${APXS$1} -q APU_INCLUDEDIR`"
103 APACHE2_LIBDIR="`${APXS$1} -q LIBDIR`"
104 LIBTOOL=`${APXS$1} -q LIBTOOL`
105 if ${TEST} -f ${APACHE2_LIBDIR}/libapr-1.so \
106 -o -f ${APACHE2_LIBDIR}/libapr-1.sl \
107 -o -f ${APACHE2_LIBDIR}/libapr-1.dylib; then
108 APR_LIBS="-L${APACHE2_LIBDIR} -lapr-1"
109 elif ${TEST} -f ${APACHE2_LIBDIR}/libapr-0.so \
110 -o -f ${APACHE2_LIBDIR}/libapr-0.sl \
111 -o -f ${APACHE2_LIBDIR}/libapr-0.dylib; then
112 APR_LIBS="-L${APACHE2_LIBDIR} -lapr-0"
113 elif ${TEST} -f ${APACHE2_LIBDIR}/libapr.so \
114 -o -f ${APACHE2_LIBDIR}/libapr.sl \
115 -o -f ${APACHE2_LIBDIR}/libapr.dylib; then
116 APR_LIBS="-L${APACHE2_LIBDIR} -lapr"
118 AC_MSG_ERROR(can't locate libapr)
122 AC_MSG_RESULT([building connector for \"$RWEBSERVER\"])
128 AC_MSG_RESULT(no apxs$1 given)
134 AC_SUBST(APXS$1_CFLAGS)
135 AC_SUBST(APACHE$1_CONFIG_VARS)
136 AC_SUBST(APXS$1_CPPFLAGS)
137 AC_SUBST(APACHE$1_DIR)
138 AC_SUBST(APACHE$1_HOME)
139 AC_SUBST(APACHE$1_INCDIR)
140 AC_SUBST(APACHE$1_INCL)
141 AC_SUBST(APACHE$1_LIBEXEC)
142 AC_SUBST(APACHE$1_LIBDIR)
143 AC_SUBST(APACHE$1_CC)
144 AC_SUBST(APXS$1_LDFLAGS)
149 dnl vi:set sts=2 sw=2 autoindent: