2 dnl custom autoconf rules for APRUTIL
6 dnl APU_TRY_ICONV[ IF-SUCCESS, IF-FAILURE ]: try to compile for iconv.
8 AC_DEFUN(APU_TRY_ICONV,[
14 iconv_t cd = iconv_open("", "");
15 iconv(cd, NULL, NULL, NULL, NULL);
20 dnl APU_FIND_ICONV: find an iconv library
22 AC_DEFUN(APU_FIND_ICONV,[
24 apu_iconv_dir="unknown"
25 AC_ARG_WITH(iconv,[ --with-iconv[=DIR] path to iconv installation],
26 [ apu_iconv_dir="$withval"
27 if test "$apu_iconv_dir" != "yes"; then
28 APR_ADDTO(CPPFLAGS,[-I$apu_iconv_dir/include])
29 APR_ADDTO(LDFLAGS,[-L$apu_iconv_dir/lib])
33 AC_CHECK_HEADER(iconv.h, [
34 APU_TRY_ICONV([ have_iconv="1" ], [
36 APR_ADDTO(LIBS,[-liconv])
39 APR_ADDTO(APRUTIL_LIBS,[-liconv])
40 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
44 APR_REMOVEFROM(LIBS,[-liconv])
47 ], [ have_iconv="0" ])
49 if test "$apu_iconv_dir" != "unknown"; then
50 if test "$have_iconv" != "1"; then
51 AC_MSG_ERROR([iconv support requested, but not found])
53 APR_REMOVEFROM(CPPFLAGS,[-I$apu_iconv_dir/include])
54 APR_REMOVEFROM(LDFLAGS,[-L$apu_iconv_dir/lib])
55 APR_ADDTO(APRUTIL_INCLUDES,[-I$apu_iconv_dir/include])
56 APR_ADDTO(APRUTIL_LDFLAGS,[-L$apu_iconv_dir/lib])
59 if test "$have_iconv" = "1"; then
63 APR_FLAG_HEADERS(iconv.h langinfo.h)
64 APR_FLAG_FUNCS(nl_langinfo)
65 APR_CHECK_DEFINE(CODESET, langinfo.h, [CODESET defined in langinfo.h])
71 dnl APU_CHECK_ICONV_INBUF
73 dnl Decide whether or not the inbuf parameter to iconv() is const.
75 dnl We try to compile something without const. If it fails to
76 dnl compile, we assume that the system's iconv() has const.
77 dnl Unfortunately, we won't realize when there was a compile
78 dnl warning, so we allow a variable -- apu_iconv_inbuf_const -- to
79 dnl be set in hints.m4 to specify whether or not iconv() has const
80 dnl on this parameter.
82 AC_DEFUN(APU_CHECK_ICONV_INBUF,[
83 AC_MSG_CHECKING(for type of inbuf parameter to iconv)
84 if test "x$apu_iconv_inbuf_const" = "x"; then
85 APR_TRY_COMPILE_NO_WARNING([
89 iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0);
90 ], apu_iconv_inbuf_const="0", apu_iconv_inbuf_const="1")
92 if test "$apu_iconv_inbuf_const" = "1"; then
93 AC_DEFINE(APU_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **])