~ubuntu-branches/ubuntu/maverick/tomcat6/maverick

« back to all changes in this revision

Viewing changes to native/connector/build/tcnative.m4

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2010-01-23 19:40:38 UTC
  • mfrom: (2.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100123194038-0tnrf6kiy0wrjrw9
Tags: 6.0.20-dfsg1-1
* Fix debian/orig-tar.sh to exclude binary only standard.jar and jstl.jar.
  (Closes: #528119)
* Upload a cleaned tarball.
* Add ${misc:Depends} in debian/control.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Licensed to the Apache Software Foundation (ASF) under one or more
3
 
# contributor license agreements.  See the NOTICE file distributed with
4
 
# this work for additional information regarding copyright ownership.
5
 
# The ASF licenses this file to You under the Apache License, Version 2.0
6
 
# (the "License"); you may not use this file except in compliance with
7
 
# the License.  You may obtain a copy of the License at
8
 
#
9
 
#     http://www.apache.org/licenses/LICENSE-2.0
10
 
#
11
 
# Unless required by applicable law or agreed to in writing, software
12
 
# distributed under the License is distributed on an "AS IS" BASIS,
13
 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 
# See the License for the specific language governing permissions and
15
 
# limitations under the License.
16
 
#
17
 
 
18
 
dnl
19
 
dnl TCN_FIND_APR: figure out where APR is located
20
 
dnl
21
 
AC_DEFUN(TCN_FIND_APR,[
22
 
 
23
 
  dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config
24
 
  APR_FIND_APR(,,,[1])
25
 
  if test "$apr_found" = "no"; then
26
 
    AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
27
 
  fi
28
 
 
29
 
  sapr_pversion="`$apr_config --version`"
30
 
  if test -z "$sapr_pversion"; then
31
 
    AC_MSG_ERROR(APR config could not be located. Please use the --with-apr option.)
32
 
  fi
33
 
  sapr_version="`echo $sapr_pversion|sed -e 's/\([a-z]*\)$/.\1/'`"
34
 
  tc_save_IFS=$IFS; IFS=.; set $sapr_version; IFS=$tc_save_IFS
35
 
  if test "${1}" -lt "1"; then
36
 
    AC_MSG_ERROR(You need APR version 1.2.1 or newer installed.)
37
 
  else
38
 
    if test "${2}" -lt "2"; then
39
 
      AC_MSG_ERROR(You need APR version 1.2.1 or newer installed.)
40
 
    fi
41
 
  fi
42
 
 
43
 
  APR_BUILD_DIR="`$apr_config --installbuilddir`"
44
 
 
45
 
  dnl make APR_BUILD_DIR an absolute directory (we'll need it in the
46
 
  dnl sub-projects in some cases)
47
 
  APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`"
48
 
 
49
 
  APR_INCLUDES="`$apr_config --includes`"
50
 
  APR_LIBS="`$apr_config --link-libtool --libs`"
51
 
  APR_SO_EXT="`$apr_config --apr-so-ext`"
52
 
  APR_LIB_TARGET="`$apr_config --apr-lib-target`"
53
 
 
54
 
  AC_SUBST(APR_INCLUDES)
55
 
  AC_SUBST(APR_LIBS)
56
 
  AC_SUBST(APR_BUILD_DIR)
57
 
])
58
 
 
59
 
dnl --------------------------------------------------------------------------
60
 
dnl TCN_JDK
61
 
dnl
62
 
dnl Detection of JDK location and Java Platform (1.2, 1.3, 1.4, 1.5, 1.6)
63
 
dnl result goes in JAVA_HOME / JAVA_PLATFORM (2 -> 1.2 and higher)
64
 
dnl 
65
 
dnl --------------------------------------------------------------------------
66
 
AC_DEFUN(
67
 
  [TCN_FIND_JDK],
68
 
  [
69
 
    tempval=""
70
 
    AC_MSG_CHECKING([for JDK location (please wait)])
71
 
    if test -n "${JAVA_HOME}" ; then
72
 
      JAVA_HOME_ENV="${JAVA_HOME}"
73
 
    else
74
 
      JAVA_HOME_ENV=""
75
 
    fi
76
 
 
77
 
    JAVA_HOME=""
78
 
    JAVA_PLATFORM=""
79
 
 
80
 
    AC_ARG_WITH(
81
 
      [java-home],
82
 
      [  --with-java-home=DIR     Location of JDK directory.],
83
 
      [
84
 
 
85
 
      # This stuff works if the command line parameter --with-java-home was
86
 
      # specified, so it takes priority rightfully.
87
 
  
88
 
      tempval=${withval}
89
 
 
90
 
      if test ! -d "${tempval}" ; then
91
 
          AC_MSG_ERROR(Not a directory: ${tempval})
92
 
      fi
93
 
  
94
 
      JAVA_HOME=${tempval}
95
 
      AC_MSG_RESULT(${JAVA_HOME})
96
 
    ],
97
 
    [
98
 
      # This works if the parameter was NOT specified, so it's a good time
99
 
      # to see what the enviroment says.
100
 
      # Since Sun uses JAVA_HOME a lot, we check it first and ignore the
101
 
      # JAVA_HOME, otherwise just use whatever JAVA_HOME was specified.
102
 
 
103
 
      if test -n "${JAVA_HOME_ENV}" ; then
104
 
        JAVA_HOME=${JAVA_HOME_ENV}
105
 
        AC_MSG_RESULT(${JAVA_HOME_ENV} from environment)
106
 
      fi
107
 
    ])
108
 
 
109
 
    if test -z "${JAVA_HOME}" ; then
110
 
 
111
 
      # Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess
112
 
      # The following code is based on the code submitted by Henner Zeller
113
 
      # for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec
114
 
      # Two variables will be set as a result:
115
 
      #
116
 
      # JAVA_HOME
117
 
      # JAVA_PLATFORM
118
 
      AC_MSG_CHECKING([Try to guess JDK location])
119
 
 
120
 
      for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt /usr/java ; do
121
 
 
122
 
        for JAVA_PLATFORM in 6 5 4 3 2 ; do
123
 
 
124
 
          for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
125
 
 
126
 
            for VARIANT in IBMJava2- java java- jdk jdk-; do
127
 
              GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
128
 
dnl           AC_MSG_CHECKING([${GUESS}])
129
 
              if test -d "${GUESS}/bin" & test -d "${GUESS}/include" ; then
130
 
                JAVA_HOME="${GUESS}"
131
 
                AC_MSG_RESULT([${GUESS}])
132
 
                break
133
 
              fi
134
 
            done
135
 
 
136
 
            if test -n "${JAVA_HOME}" ; then
137
 
              break;
138
 
            fi
139
 
 
140
 
          done
141
 
 
142
 
          if test -n "${JAVA_HOME}" ; then
143
 
            break;
144
 
          fi
145
 
 
146
 
        done
147
 
 
148
 
        if test -n "${JAVA_HOME}" ; then
149
 
          break;
150
 
        fi
151
 
 
152
 
      done
153
 
 
154
 
      if test ! -n "${JAVA_HOME}" ; then
155
 
        AC_MSG_ERROR(can't locate a valid JDK location)
156
 
      fi
157
 
 
158
 
    fi
159
 
 
160
 
    if test -n "${JAVA_PLATFORM}"; then
161
 
      AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
162
 
    else
163
 
      AC_MSG_CHECKING(Java platform)
164
 
    fi
165
 
 
166
 
    AC_ARG_WITH(java-platform,
167
 
     [  --with-java-platform[=2] Force the Java platorm
168
 
                                 (value is 1 for 1.1.x or 2 for 1.2.x or greater)],
169
 
     [
170
 
        case "${withval}" in
171
 
          "1"|"2")
172
 
            JAVA_PLATFORM=${withval}
173
 
            ;;
174
 
          *)
175
 
            AC_MSG_ERROR(invalid java platform provided)
176
 
            ;;
177
 
        esac
178
 
     ],
179
 
     [
180
 
        if test -n "${JAVA_PLATFORM}"; then
181
 
          AC_MSG_RESULT(Java Platform detected - 1.${JAVA_PLATFORM})
182
 
        else
183
 
          AC_MSG_CHECKING(Java platform)
184
 
        fi
185
 
     ])
186
 
 
187
 
     AC_MSG_RESULT(${JAVA_PLATFORM})
188
 
 
189
 
    unset tempval
190
 
  ])
191
 
 
192
 
 
193
 
AC_DEFUN(
194
 
  [TCN_FIND_JDK_OS],
195
 
  [
196
 
    tempval=""
197
 
    JAVA_OS=""
198
 
    AC_ARG_WITH(os-type,
199
 
      [  --with-os-type[=SUBDIR]  Location of JDK os-type subdirectory.],
200
 
      [
201
 
        tempval=${withval}
202
 
 
203
 
        if test ! -d "${JAVA_HOME}/${tempval}" ; then
204
 
          AC_MSG_ERROR(Not a directory: ${JAVA_HOME}/${tempval})
205
 
        fi
206
 
 
207
 
        JAVA_OS = ${tempval}
208
 
      ],
209
 
      [   
210
 
        AC_MSG_CHECKING(os_type directory)
211
 
        JAVA_OS=NONE
212
 
        if test -f ${JAVA_HOME}/${JAVA_INC}/jni_md.h; then
213
 
          JAVA_OS=""
214
 
        else
215
 
          for f in ${JAVA_HOME}/${JAVA_INC}/*/jni_md.h; do
216
 
            if test -f $f; then
217
 
              JAVA_OS=`dirname ${f}`
218
 
              JAVA_OS=`basename ${JAVA_OS}`
219
 
              echo " ${JAVA_OS}"
220
 
            fi
221
 
          done
222
 
          if test "${JAVA_OS}" = "NONE"; then
223
 
            AC_MSG_RESULT(Cannot find jni_md.h in ${JAVA_HOME}/${OS})
224
 
            AC_MSG_ERROR(You should retry --with-os-type=SUBDIR)
225
 
          fi
226
 
        fi
227
 
      ])
228
 
  ])
229
 
 
230
 
dnl check for sableVM
231
 
dnl (copied from daemon/src/native/unix/support/apjava.m4)
232
 
AC_DEFUN(
233
 
  [TCN_SABLEVM],
234
 
  [
235
 
  if test x"$JAVA_HOME" != x
236
 
  then
237
 
    AC_PATH_PROG(SABLEVM,sablevm,NONE,$JAVA_HOME/bin)
238
 
    if test "$SABLEVM" != "NONE"
239
 
    then
240
 
      AC_MSG_RESULT([Using sableVM: $SABLEVM])
241
 
      CFLAGS="$CFLAGS -DHAVE_SABLEVM"
242
 
      NEED_JNI_MD=no
243
 
    fi
244
 
  fi
245
 
  ])
246
 
dnl check for IBM J9VM
247
 
AC_DEFUN(
248
 
  [TCN_J9VM],
249
 
  [
250
 
  if test x"$JAVA_HOME" != x
251
 
  then
252
 
    J9VM=`$JAVA_HOME/bin/java -version 2>&1 | grep J9VM`
253
 
    if test x"$J9VM" != x
254
 
    then
255
 
      AC_MSG_RESULT([Using J9VM: $J9VM])
256
 
      NEED_JNI_MD=no
257
 
    fi
258
 
  fi
259
 
  ])
260
 
 
261
 
dnl TCN_HELP_STRING(LHS, RHS)
262
 
dnl Autoconf 2.50 can not handle substr correctly.  It does have 
263
 
dnl AC_HELP_STRING, so let's try to call it if we can.
264
 
dnl Note: this define must be on one line so that it can be properly returned
265
 
dnl as the help string.
266
 
AC_DEFUN(TCN_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[  ]$1 substr([                       ],len($1))$2)])dnl
267
 
 
268
 
dnl
269
 
dnl TCN_CHECK_SSL_TOOLKIT
270
 
dnl
271
 
dnl Configure for the detected openssl toolkit installation, giving
272
 
dnl preference to "--with-ssl=<path>" if it was specified.
273
 
dnl
274
 
AC_DEFUN(TCN_CHECK_SSL_TOOLKIT,[
275
 
OPENSSL_WARNING=
276
 
AC_MSG_CHECKING(for OpenSSL library)
277
 
AC_ARG_WITH(ssl,
278
 
[  --with-ssl[=PATH]   Build with OpenSSL [yes|no|path]],
279
 
    use_openssl="$withval", use_openssl="auto")
280
 
 
281
 
openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
282
 
if test "$use_openssl" = "auto"
283
 
then
284
 
    for d in $openssldirs
285
 
    do
286
 
        if test -f $d/include/openssl/opensslv.h
287
 
        then
288
 
            use_openssl=$d
289
 
            break
290
 
        fi
291
 
    done
292
 
fi
293
 
case "$use_openssl" in
294
 
    no)
295
 
        AC_MSG_RESULT(no)
296
 
        TCN_OPENSSL_INC=""
297
 
        USE_OPENSSL=""
298
 
        ;;
299
 
    auto)
300
 
        TCN_OPENSSL_INC=""
301
 
        USE_OPENSSL=""
302
 
        AC_MSG_RESULT(not found)
303
 
        ;;
304
 
    *)
305
 
        if test "$use_openssl" = "yes"
306
 
        then
307
 
            # User did not specify a path - guess it
308
 
            for d in $openssldirs
309
 
            do
310
 
                if test -f $d/include/openssl/opensslv.h
311
 
                then
312
 
                    use_openssl=$d
313
 
                    break
314
 
                fi
315
 
            done
316
 
            if test "$use_openssl" = "yes"
317
 
            then
318
 
                AC_MSG_RESULT(not found)
319
 
                AC_MSG_ERROR(
320
 
[OpenSSL was not found in any of $openssldirs; use --with-ssl=/path])
321
 
            fi
322
 
        fi
323
 
        USE_OPENSSL='-DOPENSSL'
324
 
 
325
 
        if test "$use_openssl" = "/usr"
326
 
        then
327
 
            TCN_OPENSSL_INC=""
328
 
            TCN_OPENSSL_LIBS="-lssl -lcrypto"
329
 
        else
330
 
            TCN_OPENSSL_INC="-I$use_openssl/include"
331
 
            case $host in
332
 
            *-solaris*)
333
 
                TCN_OPENSSL_LIBS="-L$use_openssl/lib -R$use_openssl/lib -lssl -lcrypto"
334
 
                ;;
335
 
            *-hp-hpux*)
336
 
                TCN_OPENSSL_LIBS="-L$use_openssl/lib -Wl,+b: -lssl -lcrypto"
337
 
                ;;
338
 
            *linux*)
339
 
                TCN_OPENSSL_LIBS="-L$use_openssl/lib -Wl,-rpath,$use_openssl/lib -lssl -lcrypto"
340
 
                ;;
341
 
            *)
342
 
                TCN_OPENSSL_LIBS="-L$use_openssl/lib -lssl -lcrypto"
343
 
                ;;
344
 
            esac
345
 
        fi
346
 
        AC_MSG_RESULT(using openssl from $use_openssl/lib and $use_openssl/include)
347
 
 
348
 
        saved_cflags="$CFLAGS"
349
 
        saved_libs="$LIBS"
350
 
        CFLAGS="$CFLAGS $TCN_OPENSSL_INC"
351
 
        LIBS="$LIBS $TCN_OPENSSL_LIBS"
352
 
         
353
 
AC_ARG_ENABLE(openssl-version-check,
354
 
[AC_HELP_STRING([--enable-openssl-version-check],
355
 
        [Check OpenSSL Version @<:@default=yes@:>@])])
356
 
case "$enable_openssl_version_check" in
357
 
yes|'')
358
 
        AC_MSG_CHECKING(OpenSSL library version)
359
 
        AC_TRY_RUN([
360
 
#include <stdio.h>
361
 
#include <openssl/opensslv.h>
362
 
int main() {
363
 
        if ((OPENSSL_VERSION_NUMBER >= 0x0090701fL &&
364
 
         OPENSSL_VERSION_NUMBER < 0x00908000L) ||
365
 
         OPENSSL_VERSION_NUMBER >= 0x0090801fL)
366
 
            return (0);
367
 
    printf("\n\nFound   OPENSSL_VERSION_NUMBER %#010x\n",
368
 
        OPENSSL_VERSION_NUMBER);
369
 
    printf("Require OPENSSL_VERSION_NUMBER 0x0090701f or greater (0.9.7a)\n"
370
 
           "Require OPENSSL_VERSION_NUMBER 0x0090801f or greater (0.9.8a)\n\n");
371
 
        return (1);
372
 
}
373
 
        ],
374
 
        [AC_MSG_RESULT(ok)],
375
 
        [AC_MSG_RESULT(not compatible)
376
 
            OPENSSL_WARNING=yes
377
 
        ],
378
 
        [AC_MSG_RESULT(assuming target platform has compatible version)])
379
 
;;
380
 
no)
381
 
    AC_MSG_RESULT(Skipped OpenSSL version check)
382
 
;;
383
 
esac
384
 
 
385
 
        AC_MSG_CHECKING(for OpenSSL DSA support)
386
 
        if test -f $use_openssl/include/openssl/dsa.h
387
 
        then
388
 
            AC_DEFINE(HAVE_OPENSSL_DSA)
389
 
            AC_MSG_RESULT(yes)
390
 
        else
391
 
            AC_MSG_RESULT(no)
392
 
        fi
393
 
        CFLAGS="$saved_cflags"
394
 
        LIBS="$saved_libs"
395
 
        ;;
396
 
esac
397
 
if test "x$USE_OPENSSL" != "x"
398
 
then
399
 
    APR_ADDTO(TCNATIVE_PRIV_INCLUDES, [$TCN_OPENSSL_INC])
400
 
    APR_ADDTO(TCNATIVE_LDFLAGS, [$TCN_OPENSSL_LIBS])
401
 
    APR_ADDTO(CFLAGS, [-DHAVE_OPENSSL])
402
 
fi
403
 
])