Re: [xml] Using libiconv



On Tue, Jul 03, 2001 at 12:06:16PM +0100, Brian Stafford wrote:
On Mon,  2 July 20:06 xml thewrittenword com wrote:

I also think the patches address different problems.

I believe http://mail.gnome.org/archives/xml/2001-July/msg00002.html
is wrong for the following reasons (I have not tried it):
  1. Using AC_CHECK_LIB before AC_TRY_FUNC is just wrong. The
     fact that the library exists doesn't mean it should be used.

A very sweeping statement.  You are not allowing for the fact that
libiconv is something of a special case.

I have yet to run across a configure.in where AC_CHECK_LIB before
AC_CHECK_FUNC was correct. AC_CHECK_LIB before AC_CHECK_FUNC makes
assumptions about the system and autoconf is not about making
assumptions.

  2. If you have both libiconv in /usr/lib and /usr/local/lib
     and you wish the one in /usr/local/lib to win, set
     LDFLAGS="-L/usr/local/lib" before running configure.

I know this but this has nothing to do with the point.  You have
misunderstood the problem.  libiconv *replaces* the iconv.h from glibc.
The replacement iconv.h redefines the iconv_xxx functions to libiconv_xxx.  
Since AC_TRY_FUNC finds iconv in glibc but the compiler includes
the replacement iconv.h linking is guaranteed to fail.  But as you say,
you haven't tried it so you wouldn't know.

So then wouldn't:
  CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" \
  ./configure ...

solve your problem?

Personally I'd prefer a pragmatic approach to a philosophical one
on this one.

Then how about we add --with-iconv=DIR which allows you to specify the
parent include/lib directory for iconv? All this would really do is
add DIR/include to $CPPFLAGS and DIR/lib to $LDFLAGS.

BTW, this would mimic how --with-zlib works. Solaris 8/SPARC has libz
in /usr/lib and zlib.h and zconf.h in /usr/include. We have our own
zlib in /opt somewhere. We use --with-zlib=/opt/zlib to use *our* zlib
which completely *replaces* the system zlib. Same situation as your
libiconv problem. Note though that we could just have well have solved
our problem by setting CPPFLAGS/LDFLAGS but I added the
--with-zlib[=DIR] option to help us out. Something similar should be
done for you.

-- 
albert chin (china thewrittenword com)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]