summaryrefslogtreecommitdiffstats
path: root/rubbos/app/tomcat-connectors-1.2.32-src/support/jk_apr.m4
blob: 884502f51763e2a7e76c6e69ec4c9ea8250e7a0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
dnl
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements.  See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License.  You may obtain a copy of the License at
dnl
dnl     http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl

dnl --------------------------------------------------------------------------
dnl Author Henri Gomez <hgomez@apache.org>
dnl
dnl Inspired by Pier works on webapp m4 macros :)
dnl 
dnl Version $Id: jk_apr.m4 466585 2006-10-21 22:16:34Z markt $
dnl --------------------------------------------------------------------------

dnl --------------------------------------------------------------------------
dnl JK_APR_THREADS
dnl   Configure APR threading for use with --with-apr.
dnl   Result goes into APR_CONFIGURE_ARGS
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_THREADS],
  [
    AC_ARG_ENABLE(
      [apr-threads],
      [  --enable-apr-threads        Configure APR threading for use with --with-apr ],
      [
        case "${enableval}" in
          ""|"yes"|"YES"|"true"|"TRUE")
            APR_CONFIGURE_ARGS="--enable-threads ${APR_CONFIGURE_ARGS}"
          ;;
          "no"|"NO"|"false"|"FALSE")
            APR_CONFIGURE_ARGS="--disable-threads ${APR_CONFIGURE_ARGS}"
          ;;
        *)
          APR_CONFIGURE_ARGS="--enable-threads=${enableval} ${APR_CONFIGURE_ARGS}"
         esac
      ])
  ])

dnl --------------------------------------------------------------------------
dnl JK_APR
dnl   Set the APR source dir.
dnl   $1 => File which should be present
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR],
  [
    tempval=""
    AC_ARG_WITH(
      [apr],
      [  --with-apr=DIR           Location of APR source dir ],
      [
        case "${withval}" in
          ""|"yes"|"YES"|"true"|"TRUE")
            AC_MSG_ERROR(valid apr source dir location required)
          ;;
          "no"|"NO"|"false"|"FALSE")
            AC_MSG_ERROR(valid apr source dir location required)
          ;;
        *)
          tempval="${withval}"

          if ${TEST} ! -d ${tempval} ; then
            AC_MSG_ERROR(Not a directory: ${tempval})
          fi

          if ${TEST} ! -f ${tempval}/$1; then
            AC_MSG_ERROR(can't locate ${tempval}/$1)
          fi

          if ${TEST} ! -z "$tempval" ; then
            APR_BUILD="apr-build"
            APR_CFLAGS="-I ${tempval}/include"
            APR_CLEAN="apr-clean"
            APR_DIR=${tempval}
            APR_INCDIR="${tempval}/include"
            AC_MSG_RESULT(configuring apr...)
            tempret="0"
            JK_EXEC(
              [tempret],
              [${SHELL} ./configure --prefix=${APR_DIR} --with-installbuilddir=${APR_DIR}/instbuild --disable-shared ${APR_CONFIGURE_ARGS}],
              [apr],
              [${APR_DIR}])
            if ${TEST} "${tempret}" = "0"; then
              AC_MSG_RESULT(apr configure ok)
            else
              AC_MSG_ERROR(apr configure failed with ${tempret})
            fi
            JK_APR_LIBNAME(apr_libname,${APR_DIR})
            APR_LDFLAGS="${APR_DIR}/lib/${apr_libname}"
            APR_LIBDIR=""
			use_apr=true
            COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
          fi
          ;;
        esac
      ])

      unset tempret
      unset tempval
      unset apr_libname
  ])

dnl --------------------------------------------------------------------------
dnl JK_APR_UTIL
dnl   Set the APR-UTIL source dir.
dnl   $1 => File which should be present
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_UTIL],
  [
    tempval=""
    AC_ARG_WITH(
      [apr-util],
      [  --with-apr-util=DIR      Location of APR-UTIL source dir ],
      [
        case "${withval}" in
          ""|"yes"|"YES"|"true"|"TRUE")
            AC_MSG_ERROR(valid apr-util source dir location required)
          ;;
          "no"|"NO"|"false"|"FALSE")
            AC_MSG_ERROR(valid apr-util source dir location required)
          ;;
        *)
          tempval="${withval}"

          if ${TEST} ! -d ${tempval} ; then
            AC_MSG_ERROR(Not a directory: ${tempval})
          fi

          if ${TEST} ! -f ${tempval}/$1; then
            AC_MSG_ERROR(can't locate ${tempval}/$1)
          fi

          if ${TEST} -z "${APR_BUILD}"; then
            AC_MSG_ERROR([--with-apr and --with-apr-util must be used together])
          fi

          if ${TEST} ! -z "$tempval" ; then
            APR_UTIL_DIR=${tempval}
            APR_CFLAGS="${APR_CFLAGS} -I ${APR_UTIL_DIR}/include"
            APR_UTIL_INCDIR="${APR_UTIL_DIR}/include"
            AC_MSG_RESULT(configuring apr-util...)
            tempret="0"
            JK_EXEC(
              [tempret],
              [${SHELL} ./configure --prefix=${APR_UTIL_DIR} --with-apr=${APR_DIR}],
              [apr-util],
              [${APR_UTIL_DIR}])
            if ${TEST} "${tempret}" = "0"; then
              AC_MSG_RESULT(apr-util configure ok)
            else
              AC_MSG_ERROR(apr-util configure failed with ${tempret})
            fi
            JK_APR_UTIL_LIBNAME(apr_util_libname,${APR_UTIL_DIR})
            APR_LDFLAGS="${APR_LDFLAGS} ${APR_UTIL_DIR}/lib/${apr_util_libname}"
            APR_UTIL_LIBDIR=""
			use_apr=true
            COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
          fi
          ;;
        esac
      ])

      unset tempret
      unset tempval
      unset apr_util_libname
  ])


dnl --------------------------------------------------------------------------
dnl JK_APR_INCDIR
dnl   Set the APR include dir.
dnl   $1 => File which should be present
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_INCDIR],
  [
    tempval=""
    AC_ARG_WITH(
      [apr-include],
      [  --with-apr-include=DIR   Location of APR include dir ],
      [  
        case "${withval}" in
          ""|"yes"|"YES"|"true"|"TRUE")
          ;;
          "no"|"NO"|"false"|"FALSE")
            AC_MSG_ERROR(valid apr include dir location required)
          ;;
        *)
          tempval="${withval}"
          if ${TEST} ! -d ${tempval} ; then
            AC_MSG_ERROR(Not a directory: ${tempval})
          fi

          if ${TEST} ! -f ${tempval}/$1; then
            AC_MSG_ERROR(can't locate ${tempval}/$1)
          fi

          if ${TEST} ! -z "$tempval" ; then
            APR_BUILD=""
            APR_CFLAGS="-I${tempval}"
            APR_CLEAN=""
            APR_DIR=""
            APR_INCDIR=${tempval}
            COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
			use_apr=true
          fi
          ;;

        esac
      ])

      unset tempval
  ])


dnl --------------------------------------------------------------------------
dnl JK_APR_LIBDIR
dnl   Set the APR library dir.
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_LIBDIR],
  [
    tempval=""
    AC_ARG_WITH(
      [apr-lib],
      [  --with-apr-lib=DIR       Location of APR lib dir ],
      [
        case "${withval}" in
          ""|"yes"|"YES"|"true"|"TRUE")
          ;;
          "no"|"NO"|"false"|"FALSE")
            AC_MSG_ERROR(valid apr lib dir location required)
          ;;
          *)
            tempval="${withval}"

            if ${TEST} ! -d ${tempval} ; then
              AC_MSG_ERROR(Not a directory: ${tempval})
            fi

            if ${TEST} ! -z "$tempval" ; then
              APR_BUILD=""
              APR_CLEAN=""
              APR_DIR=""
              APR_LIBDIR=${tempval}
              APR_LDFLAGS="`apr-config --link-ld` -L${tempval}"
              COMMON_APR_OBJECTS="\${COMMON_APR_OBJECTS}"
			  use_apr=true
            fi

            ;;
            esac
      ])

      unset tempval
  ])


dnl --------------------------------------------------------------------------
dnl JK_APR_LIBNAME
dnl   Retrieve the complete name of the library.
dnl   $1 => Environment variable name for the returned value
dnl   $2 => APR sources directory
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_LIBNAME],
  [
    AC_MSG_CHECKING([for apr APR_LIBNAME])
    if ${TEST} ! -f "$2/apr-config" ; then
      AC_MSG_ERROR([cannot find apr-config file in $2])
    fi
    jk_apr_get_tempval=`$2/apr-config --link-libtool 2> /dev/null`
    if ${TEST} -z "${jk_apr_get_tempval}" ; then
      AC_MSG_ERROR([$2/apr-config --link-libtool failed])
    fi
    jk_apr_get_tempval=`basename ${jk_apr_get_tempval}`
    $1="${jk_apr_get_tempval}"
    AC_MSG_RESULT([${jk_apr_get_tempval}])
    unset jk_apr_get_tempval
  ])


dnl --------------------------------------------------------------------------
dnl JK_APR_UTIL_LIBNAME
dnl   Retrieve the complete name of the library.
dnl   $1 => Environment variable name for the returned value
dnl   $2 => APR_UTIL sources directory
dnl --------------------------------------------------------------------------
AC_DEFUN(
  [JK_APR_UTIL_LIBNAME],
  [
    AC_MSG_CHECKING([for apr-util APR_UTIL_LIBNAME])
    if ${TEST} ! -f "$2/apu-config" ; then
      AC_MSG_ERROR([cannot find apu-config file in $2])
    fi
    jk_apu_get_tempval=`$2/apu-config --link-libtool 2> /dev/null`
    if ${TEST} -z "${jk_apu_get_tempval}" ; then
      AC_MSG_ERROR([$2/apu-config --link-libtool failed])
    fi
    jk_apu_get_tempval=`basename ${jk_apu_get_tempval}`
    $1="${jk_apu_get_tempval}"
    AC_MSG_RESULT([${jk_apu_get_tempval}])
    unset jk_apu_get_tempval
  ])

dnl vi:set sts=2 sw=2 autoindent: