Checking for a working iconv in configure.in with Samba 3.0.0
Richard Sharpe
rsharpe at richardsharpe.com
Sat Jul 5 00:27:24 GMT 2003
Hi,
currently in Samba 3.0.0, configure.in checks for an iconv library in a
number of places, and then checks for a working iconv. Here is the code:
############
# check for iconv in libc
AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
AC_TRY_RUN([
#include <iconv.h>
main() {
iconv_t cd = iconv_open("ASCII", "UCS-2LE");
if (cd == 0 || cd == (iconv_t)-1) return -1;
return 0;
}
],
samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
fi
Now, the problem is that the comment says checking for it in libc, while
the AC_CACHE_CHECK message says it is checking for a working iconv.
Further, all over the actual code that needs iconv, there are
#ifdef HAVE_NATIVE_ICONV
checks.
So, if iconv is found in some other library than libc, it will still not
get used because of these things.
I propose to change the test above to check for a working iconv where ever
it was found on the system.
I have such a small change that works on FreeBSD (which has two different
ways to get iconv, GNU libiconv and iconv from the ports collection, which
both install different libraries).
However, there is also the problem with that define, which should probably
HAVE_WORKING_ICONV ...
Does anyone have any issues with me applying the changes?
It also works on Linux (RedHat 9.0). I haven't tested on slowaris yet.
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org,
sharpe[at]ethereal.com, http://www.richardsharpe.com
More information about the samba-technical
mailing list