You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Eric Gillespie <ep...@pretzelnet.org> on 2002/07/21 05:46:59 UTC

[PATCH] Find libiconv

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

Re: [PATCH] Find libiconv

Posted by Eric Gillespie <ep...@pretzelnet.org>.
Actually, ignore this patch; it doesn't work, i only got lucky.
albert chin's (china@thewrittenword.com) suggestion to get the test
from libxml is much better.

BTW, i know what was wrong with my patch now.  Instead of 'iconv;'
it should have had 'void (*p)() = (void (*)())iconv;'.  But ignore
that :).

--  
Eric Gillespie <*> epg@pretzelnet.org

Build a fire for a man, and he'll be warm for a day.  Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett