~ubuntu-branches/ubuntu/oneiric/libapache-mod-jk/oneiric

« back to all changes in this revision

Viewing changes to support/jk_apxs.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2006-08-05 16:30:53 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060805163053-myf66gm6j1a21ps6
Tags: 1:1.2.18-1ubuntu1
Merge from Debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl
 
2
dnl Copyright 1999-2004 The Apache Software Foundation
 
3
dnl
 
4
dnl Licensed under the Apache License, Version 2.0 (the "License");
 
5
dnl you may not use this file except in compliance with the License.
 
6
dnl You may obtain a copy of the License at
 
7
dnl
 
8
dnl     http://www.apache.org/licenses/LICENSE-2.0
 
9
dnl
 
10
dnl Unless required by applicable law or agreed to in writing, software
 
11
dnl distributed under the License is distributed on an "AS IS" BASIS,
 
12
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
dnl See the License for the specific language governing permissions and
 
14
dnl limitations under the License.
 
15
dnl
 
16
 
 
17
dnl --------------------------------------------------------------------------
 
18
dnl Author Henri Gomez <hgomez@apache.org>
 
19
dnl
 
20
dnl Inspired by Pier works on webapp m4 macros :)
 
21
dnl 
 
22
dnl Version $Id: jk_apxs.m4 300131 2005-01-31 08:14:03Z jfclere $
 
23
dnl --------------------------------------------------------------------------
 
24
 
 
25
dnl --------------------------------------------------------------------------
 
26
dnl JK_APXS
 
27
dnl
 
28
dnl Get APXS to be used, determine if Apache 1.3 or 2.0 are target
 
29
dnl $1 => blank/2 if you want to detect Apache 1.3 & 2.0 
 
30
dnl $2 => comment for --with-apxs
 
31
dnl --------------------------------------------------------------------------
 
32
AC_DEFUN(
 
33
  [JK_APXS],
 
34
  [
 
35
    tempval=""
 
36
    AC_ARG_WITH(apxs$1,
 
37
    [  --with-apxs$1[=FILE]      $2],
 
38
    [
 
39
      case "${withval}" in 
 
40
        y | yes | true) find_apxs=true ;;
 
41
        n | no | false) find_apxs=false ;;
 
42
        *) find_apxs=false ;;
 
43
      esac
 
44
 
 
45
      if ${TEST} ${find_apxs} ; then    
 
46
        AC_MSG_RESULT([need to check for Perl first, apxs depends on it...])
 
47
        AC_PATH_PROG(PERL,perl,$PATH)dnl
 
48
    
 
49
        if ${TEST} ${find_apxs} ; then
 
50
            APXS$1=${withval}
 
51
        else
 
52
            AC_PATH_PROG(APXS$1,apxs$1,$PATH)dnl
 
53
        fi
 
54
    
 
55
                use_apxs$1=true;
 
56
                
 
57
        if ${TEST} -n "${APXS$1}" ; then
 
58
            dnl Seems that we have it, but have to check if it is OK first        
 
59
            if ${TEST} ! -x "${APXS$1}" ; then
 
60
                AC_MSG_ERROR(Invalid location for apxs: '${APXS$1}')
 
61
            fi
 
62
            
 
63
            ${APXS$1} -q PREFIX >/dev/null 2>/dev/null || apxs_support=false
 
64
    
 
65
            if ${TEST} "${apxs_support}" = "false" ; then
 
66
                AC_MSG_RESULT(could not find ${APXS$1})
 
67
                AC_MSG_ERROR(You must specify a valid --with-apxs$1 path)
 
68
            fi
 
69
 
 
70
            dnl apache_dir and apache_include are also needed.
 
71
            APACHE$1_HOME=`${APXS$1} -q PREFIX`
 
72
            APACHE$1_INCL="-I`${APXS$1} -q INCLUDEDIR`"
 
73
            APACHE$1_INCDIR="`${APXS$1} -q INCLUDEDIR`"
 
74
            APACHE$1_LIBEXEC="`${APXS$1} -q LIBEXECDIR`"
 
75
            APACHE$1_CC="`${APXS$1} -q CC`"
 
76
 
 
77
            dnl test apache version
 
78
            APA=`${GREP} STANDARD20 ${APXS$1}`
 
79
 
 
80
            dnl check if we have an apxs for Apache 1.3 or 2.0
 
81
            if ${TEST} -z "$APA" ; then
 
82
              if ${TEST} ! -z "$1" ; then
 
83
                AC_MSG_ERROR(Do not use --with-apxs$1 but --with-apxs)
 
84
              fi
 
85
              WEBSERVERS="${WEBSERVERS} server/apache13"
 
86
              RWEBSERVER="apache-1.3"
 
87
              APXS$1_CFLAGS="`${APXS$1} -q CFLAGS`"
 
88
              APXS$1_CPPFLAGS=""
 
89
            else
 
90
              if ${TEST} -z "$1" ; then
 
91
                AC_MSG_ERROR(Do not use --with-apxs but --with-apxs2)
 
92
              fi
 
93
              WEBSERVERS="${WEBSERVERS} server/apache2"
 
94
              RWEBSERVER="apache-2.0"
 
95
              APACHE2_CONFIG_VARS=${apache_dir}/build/config_vars.mk
 
96
              JK_CHANNEL_APR_SOCKET="\${JK}jk_channel_apr_socket\${OEXT}"
 
97
              JK_POOL_APR="\${JK}jk_pool_apr\${OEXT}"
 
98
              APXS$1_CFLAGS="`${APXS$1} -q CFLAGS` `${APXS$1} -q EXTRA_CFLAGS`"
 
99
              APXS$1_CPPFLAGS="`${APXS$1} -q EXTRA_CPPFLAGS`"
 
100
              APR_INCDIR="-I`${APXS$1} -q APR_INCLUDEDIR`"
 
101
                          APR_UTIL_INCDIR="-I`${APXS$1} -q APU_INCLUDEDIR`"
 
102
              APACHE2_LIBDIR="`${APXS$1} -q LIBDIR`"
 
103
              LIBTOOL=`${APXS$1} -q LIBTOOL`
 
104
              if ${TEST} -f ${APACHE2_LIBDIR}/libapr-1.so \
 
105
                      -o -f ${APACHE2_LIBDIR}/libapr-1.sl \
 
106
                      -o -f ${APACHE2_LIBDIR}/libapr-1.dylib; then
 
107
                APR_LIBS="-L${APACHE2_LIBDIR} -lapr-1"
 
108
              elif ${TEST} -f ${APACHE2_LIBDIR}/libapr-0.so \
 
109
                        -o -f ${APACHE2_LIBDIR}/libapr-0.sl \
 
110
                        -o -f ${APACHE2_LIBDIR}/libapr-0.dylib; then
 
111
                APR_LIBS="-L${APACHE2_LIBDIR} -lapr-0"
 
112
              elif ${TEST} -f ${APACHE2_LIBDIR}/libapr.so \
 
113
                        -o -f ${APACHE2_LIBDIR}/libapr.sl \
 
114
                        -o -f ${APACHE2_LIBDIR}/libapr.dylib; then
 
115
                APR_LIBS="-L${APACHE2_LIBDIR} -lapr"
 
116
              else
 
117
                AC_MSG_ERROR(can't locate libapr)
 
118
              fi
 
119
            fi
 
120
            
 
121
            AC_MSG_RESULT([building connector for \"$RWEBSERVER\"])
 
122
        fi
 
123
 
 
124
      fi
 
125
  ],
 
126
  [
 
127
          AC_MSG_RESULT(no apxs$1 given)
 
128
  ])
 
129
 
 
130
  unset tempval
 
131
 
 
132
  AC_SUBST(APXS$1)
 
133
  AC_SUBST(APXS$1_CFLAGS)
 
134
  AC_SUBST(APACHE$1_CONFIG_VARS)
 
135
  AC_SUBST(APXS$1_CPPFLAGS)
 
136
  AC_SUBST(APACHE$1_DIR)
 
137
  AC_SUBST(APACHE$1_HOME)
 
138
  AC_SUBST(APACHE$1_INCDIR)
 
139
  AC_SUBST(APACHE$1_INCL)
 
140
  AC_SUBST(APACHE$1_LIBEXEC)
 
141
  AC_SUBST(APACHE$1_LIBDIR)
 
142
  AC_SUBST(APACHE$1_CC)
 
143
  AC_SUBST(APXS$1_LDFLAGS)
 
144
  AC_SUBST(APR_LIBS)
 
145
 
 
146
])
 
147
 
 
148
dnl vi:set sts=2 sw=2 autoindent:
 
149