Re: Another configuration error



On Sun, 15 July 15:46 Pawel Salek wrote:
> On 2001.07.15 06:43 Joseph Crail wrote:
> > Apparently, during the check for iconv_open in the configure script, it
> > is assumed that iconv_open is defined in libiconv.a.  However, on my
> > Debian system, the iconv_open and iconv_close functions are defined in
> > libc.a.  Is anyone aware of this issue?
> 
> On my redhat system, iconv_open and iconv_close functions are defined in
> libc.so and they get detected properly. I don't even have libiconv. I have
> not heard yet anyone complaining on the configure script in this respect
> (but it obviously proves nothing).

I can't remember if I submitted a patch or not, but my configure.in (from
this morning's CVS) has the following :-

AC_CHECK_LIB(iconv, iconv_open, , [
        AC_CHECK_FUNC(iconv_open, , [
                        AC_MSG_ERROR([*** You need iconv for libmutt.])
                        ])
        ])


The first check looks for libiconv.  If not found, it tries again with libc.

I've had this problem with gnome-xml and libiconv.  I submitted a patch to
configure.in along the lines above, which turned out to be very controversial.
Basically I got told I didn't know what I was talking about and that the
patch was wrong because it broke the autoconf model for doing things.
Eventually, it was acknowledged that I was right about libiconv and that
it was something of a special case.

Another gnome-xml contributor submitted a more comprehensive patch which allowed
the location to libiconv to optionally be specified.  The trick is to ensure
that
if libiconv is installed at all, it must be used, otherwise linking will fail.
I've included the test below, but I would assume that one should approach the
gnome-xml authors for permission to use it in Balsa's configure.in  Some
rewriting
of the following will be required for Balsa.

WITH_ICONV=0
AC_ARG_WITH(iconv, [  --with-iconv[=DIR]      Add ICONV support (on)])
if test "$with_iconv" = "no" ; then
    echo Disabling ICONV support
else
    if test "$with_iconv" != "yes" ; then
        CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
        ICONV_LIBS="-L$with_iconv/lib"
    fi

    AC_CHECK_HEADER(iconv.h,
        AC_MSG_CHECKING(for iconv)
        AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
            AC_MSG_RESULT(yes)
            WITH_ICONV=1],[
            AC_MSG_RESULT(no)
            AC_MSG_CHECKING(for iconv in -liconv)

            _ldflags="${LDFLAGS}"
            _libs="${LIBS}"
            LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
            LIBS="${LIBS} -liconv"

            AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
                AC_MSG_RESULT(yes)
                WITH_ICONV=1
                ICONV_LIBS="${ICONV_LIBS} -liconv"
                LIBS="${_libs}"
                LDFLAGS="${_ldflags}"],[
                AC_MSG_RESULT(no)
                LIBS="${_libs}"
                LDFLAGS="${_ldflags}"])]))
fi
XML_LIBS="-lxml2 $Z_LIBS $ICONV_LIBS -lm $LIBS"
AC_SUBST(WITH_ICONV)

Regards
Brian Stafford




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