There are some ideas here previously described by Mo DeJong. Additionally: . there is a way to avoid a warning for a certain platform: set apr_iconv_inbuf_const to "1" in hints.m4 for platforms where the parm is "const char **" but the autoconf logic doesn't detect . we *know* that versions of glibc < 2.2 have "const char **" instead of "char **" so make that work without any hints.m4 stuff (which would have to look at the glibc version) This should get RedHat 7.0 compiling cleanly, but I don't have such a system to test with. My RedHat 6.0 system ("const char **") now compiles xlate.c cleanly for the first time in a while. A Tru64 system ("char **") still compiles xlate.c cleanly. To get AIX compiling xlate.c cleanly (it hasn't done so in a while) I'd expect to have to add apr_iconv_inbuf_const=1 to the AIX stanza in hints.m4. I haven't tested that though. The same is true for Solaris, which is "const char **" like AIX. Comments? Index: apr_common.m4 =================================================================== RCS file: /home/cvspublic/apr/apr_common.m4,v retrieving revision 1.11 diff -u -r1.11 apr_common.m4 --- apr_common.m4 2001/01/11 13:55:58 1.11 +++ apr_common.m4 2001/02/08 00:01:57 @@ -285,3 +285,36 @@ $1="$$1 $2"; export $1 ]) +dnl +dnl APR_CHECK_ICONV_INBUF +dnl +dnl Decide whether or not the inbuf parameter to iconv() is const. +dnl +dnl We try to compile something without const. If it fails to +dnl compile, we assume that the system's iconv() has const. +dnl Unfortunately, we won't realize when there was a compile +dnl warning, so we allow a variable -- apr_iconv_inbuf_const -- to +dnl be set in hints.m4 to specify whether or not iconv() has const +dnl on this parameter. +dnl +AC_DEFUN(APR_CHECK_ICONV_INBUF,[ +AC_MSG_CHECKING(for type of inbuf parameter to iconv) +if test "x$apr_iconv_inbuf_const" = "x"; then + AC_TRY_COMPILE([ + #include + #include + ],[ + #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR < 2 + #error We know this version of glibc has const char **, so fail this compile + #endif + iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0); + ], apr_iconv_inbuf_const="0", apr_iconv_inbuf_const="1") +fi +if test "$apr_iconv_inbuf_const" = "1"; then + AC_DEFINE(APR_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **]) + msg="const char **" +else + msg="char **" +fi +AC_MSG_RESULT([$msg]) +]) Index: configure.in =================================================================== RCS file: /home/cvspublic/apr/configure.in,v retrieving revision 1.220 diff -u -r1.220 configure.in --- configure.in 2001/01/28 12:18:38 1.220 +++ configure.in 2001/02/08 00:02:07 @@ -245,6 +245,9 @@ AC_CHECK_FUNC(_getch) AC_CHECK_FUNCS(gmtime_r localtime_r) AC_CHECK_FUNCS(iconv, [ iconv="1" ], [ iconv="0" ]) +if test "$iconv" = "1"; then + APR_CHECK_ICONV_INBUF +fi AC_CHECK_FUNCS(mmap, [ mmap="1" ], [ mmap="0" ]) if test "$native_mmap_emul" = "1"; then mmap="1" Index: i18n/unix/xlate.c =================================================================== RCS file: /home/cvspublic/apr/i18n/unix/xlate.c,v retrieving revision 1.18 diff -u -r1.18 xlate.c --- i18n/unix/xlate.c 2001/01/28 11:33:52 1.18 +++ i18n/unix/xlate.c 2001/02/08 00:02:33 @@ -80,6 +80,12 @@ #include #endif +#ifdef APR_ICONV_INBUF_CONST +#define ICONV_INBUF_TYPE const char ** +#else +#define ICONV_INBUF_TYPE char ** +#endif + #ifndef min #define min(x,y) ((x) <= (y) ? (x) : (y)) #endif @@ -194,7 +200,7 @@ } inbytes_left = outbytes_left = sizeof(inbuf); - translated = iconv(convset->ich, &inbufptr, + translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr, &inbytes_left, &outbufptr, &outbytes_left); if (translated != (size_t) -1 && inbytes_left == 0 && @@ -288,7 +294,7 @@ char *inbufptr = (char *)inbuf; char *outbufptr = outbuf; - translated = iconv(convset->ich, &inbufptr, + translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr, inbytes_left, &outbufptr, outbytes_left); /* If everything went fine but we ran out of buffer, don't * report it as an error. Caller needs to look at the two -- Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site: http://www.geocities.com/SiliconValley/Park/9289/ Born in Roswell... married an alien...