libiconv-1.8 installs a library with libiconv_open and friends
instead of iconv_open, and then uses iconv.h to #define iconv_open
to libiconv_open. Because of this bizarre behavior, the standard
autoconf AC_CHECK_LIB can't find iconv. This patch uses AC_TRY_LINK
instead.
I have tested it on NetBSD 1.5.2 with libiconv-1.8 straight from
ftp.gnu.org. However, i'm neither an autoconf nor apr expert, so
this solution may not be correct. I'm particularly unsure if LIBS
should be restored or not.
Index: build/apu-iconv.m4
===================================================================
RCS file: /home/cvspublic/apr-util/build/apu-iconv.m4,v
retrieving revision 1.4
diff -a -u -r1.4 apu-iconv.m4
--- build/apu-iconv.m4 20 Jul 2002 08:06:33 -0000 1.4
+++ build/apu-iconv.m4 21 Jul 2002 01:25:52 -0000
@@ -15,13 +15,17 @@
AC_CHECK_FUNCS(iconv, [
have_iconv="1"
], [
- AC_CHECK_LIB(iconv, iconv, [
+ oldLIBS="$LIBS"
+ LIBS="$LIBS -iconv"
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv;], [
APR_ADDTO(APRUTIL_LIBS,[-liconv])
APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
have_iconv="1"
], [
have_iconv="0"
])
+ LIBS="$oldLIBS"
])
if test "$have_iconv" = "1"; then