1
dnl -------------------------------------------------------- -*- autoconf -*-
2
dnl Copyright 2002-2005 The Apache Software Foundation, or its licensors, as
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
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 APU_TRY_ICONV[ IF-SUCCESS, IF-FAILURE ]: try to compile for iconv.
20
AC_DEFUN([APU_TRY_ICONV], [
26
iconv_t cd = iconv_open("", "");
27
iconv(cd, NULL, NULL, NULL, NULL);
32
dnl APU_FIND_ICONV: find an iconv library
34
AC_DEFUN([APU_FIND_ICONV], [
36
apu_iconv_dir="unknown"
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])
44
if test -f "$apu_iconv_dir/include/api_version.h"; then
47
APR_REMOVEFROM(LIBS,[-lapriconv])
48
AC_MSG_RESULT("Using apr-iconv")
52
if test "$have_apr_iconv" != "1"; then
53
AC_CHECK_HEADER(iconv.h, [
54
APU_TRY_ICONV([ have_iconv="1" ], [
56
APR_ADDTO(LIBS,[-liconv])
59
APR_ADDTO(APRUTIL_LIBS,[-liconv])
60
APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
64
APR_REMOVEFROM(LIBS,[-liconv])
67
], [ have_iconv="0" ])
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])
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])
82
if test "$have_iconv" = "1"; then
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])
91
AC_SUBST(have_apr_iconv)
95
dnl APU_CHECK_ICONV_INBUF
97
dnl Decide whether or not the inbuf parameter to iconv() is const.
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.
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([
113
iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0);
114
], apu_iconv_inbuf_const="0", apu_iconv_inbuf_const="1")
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 **])
122
AC_MSG_RESULT([$msg])