~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr-util/build/apu-iconv.m4

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -------------------------------------------------------- -*- autoconf -*-
 
2
dnl Copyright 2002-2005 The Apache Software Foundation, or its licensors, as
 
3
dnl applicable.
 
4
dnl
 
5
dnl Licensed under the Apache License, Version 2.0 (the "License");
 
6
dnl you may not use this file except in compliance with the License.
 
7
dnl You may obtain a copy of the License at
 
8
dnl
 
9
dnl     http://www.apache.org/licenses/LICENSE-2.0
 
10
dnl
 
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.
 
16
 
 
17
dnl
 
18
dnl APU_TRY_ICONV[ IF-SUCCESS, IF-FAILURE ]: try to compile for iconv.
 
19
dnl
 
20
AC_DEFUN([APU_TRY_ICONV], [
 
21
  AC_TRY_LINK([
 
22
#include <stdlib.h>
 
23
#include <iconv.h>
 
24
],
 
25
[
 
26
  iconv_t cd = iconv_open("", "");
 
27
  iconv(cd, NULL, NULL, NULL, NULL);
 
28
], [$1], [$2])
 
29
])
 
30
 
 
31
dnl
 
32
dnl APU_FIND_ICONV: find an iconv library
 
33
dnl
 
34
AC_DEFUN([APU_FIND_ICONV], [
 
35
 
 
36
apu_iconv_dir="unknown"
 
37
have_apr_iconv="0"
 
38
AC_ARG_WITH(iconv,[  --with-iconv[=DIR]        path to iconv installation],
 
39
  [ apu_iconv_dir="$withval"
 
40
    if test "$apu_iconv_dir" != "yes"; then
 
41
      APR_ADDTO(CPPFLAGS,[-I$apu_iconv_dir/include])
 
42
      APR_ADDTO(LDFLAGS,[-L$apu_iconv_dir/lib])
 
43
    fi
 
44
    if test -f "$apu_iconv_dir/include/api_version.h"; then
 
45
      have_apr_iconv="1"
 
46
      have_iconv="0"
 
47
      APR_REMOVEFROM(LIBS,[-lapriconv])
 
48
      AC_MSG_RESULT("Using apr-iconv")
 
49
    fi
 
50
  ])
 
51
 
 
52
if test "$have_apr_iconv" != "1"; then
 
53
  AC_CHECK_HEADER(iconv.h, [
 
54
    APU_TRY_ICONV([ have_iconv="1" ], [
 
55
 
 
56
    APR_ADDTO(LIBS,[-liconv])
 
57
 
 
58
    APU_TRY_ICONV([
 
59
      APR_ADDTO(APRUTIL_LIBS,[-liconv])
 
60
      APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
 
61
      have_iconv="1" ],
 
62
      [ have_iconv="0" ])
 
63
 
 
64
    APR_REMOVEFROM(LIBS,[-liconv])
 
65
 
 
66
    ])
 
67
  ], [ have_iconv="0" ])
 
68
fi
 
69
 
 
70
if test "$apu_iconv_dir" != "unknown"; then
 
71
  if test "$have_iconv" != "1"; then
 
72
    if test "$have_apr_iconv" != "1"; then 
 
73
      AC_MSG_ERROR([iconv support requested, but not found])
 
74
    fi
 
75
  fi
 
76
  APR_REMOVEFROM(CPPFLAGS,[-I$apu_iconv_dir/include])
 
77
  APR_REMOVEFROM(LDFLAGS,[-L$apu_iconv_dir/lib])
 
78
  APR_ADDTO(APRUTIL_INCLUDES,[-I$apu_iconv_dir/include])
 
79
  APR_ADDTO(APRUTIL_LDFLAGS,[-L$apu_iconv_dir/lib])
 
80
fi
 
81
 
 
82
if test "$have_iconv" = "1"; then
 
83
  APU_CHECK_ICONV_INBUF
 
84
fi
 
85
 
 
86
APR_FLAG_HEADERS(iconv.h langinfo.h)
 
87
APR_FLAG_FUNCS(nl_langinfo)
 
88
APR_CHECK_DEFINE(CODESET, langinfo.h, [CODESET defined in langinfo.h])
 
89
 
 
90
AC_SUBST(have_iconv)
 
91
AC_SUBST(have_apr_iconv)
 
92
])dnl
 
93
 
 
94
dnl
 
95
dnl APU_CHECK_ICONV_INBUF
 
96
dnl
 
97
dnl  Decide whether or not the inbuf parameter to iconv() is const.
 
98
dnl
 
99
dnl  We try to compile something without const.  If it fails to 
 
100
dnl  compile, we assume that the system's iconv() has const.  
 
101
dnl  Unfortunately, we won't realize when there was a compile
 
102
dnl  warning, so we allow a variable -- apu_iconv_inbuf_const -- to
 
103
dnl  be set in hints.m4 to specify whether or not iconv() has const
 
104
dnl  on this parameter.
 
105
dnl
 
106
AC_DEFUN([APU_CHECK_ICONV_INBUF], [
 
107
AC_MSG_CHECKING(for type of inbuf parameter to iconv)
 
108
if test "x$apu_iconv_inbuf_const" = "x"; then
 
109
    APR_TRY_COMPILE_NO_WARNING([
 
110
    #include <stddef.h>
 
111
    #include <iconv.h>
 
112
    ],[
 
113
    iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0);
 
114
    ], apu_iconv_inbuf_const="0", apu_iconv_inbuf_const="1")
 
115
fi
 
116
if test "$apu_iconv_inbuf_const" = "1"; then
 
117
    AC_DEFINE(APU_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **])
 
118
    msg="const char **"
 
119
else
 
120
    msg="char **"
 
121
fi
 
122
AC_MSG_RESULT([$msg])
 
123
])dnl