on some systems (openbsd, solaris, freebsd) the iconv was not really well
recognized and/or added to the LIBS .. i tested this version on a lot of different platforms and it SHOULD work propperly, even if it looks a bit strange.
This commit is contained in:
parent
87212dd249
commit
c55dce44fa
1 changed files with 63 additions and 30 deletions
71
configure.in
71
configure.in
|
@ -72,42 +72,75 @@ size_t x = strftime(s, 5, "%a", localtime(&t));
|
||||||
dnl ---------------
|
dnl ---------------
|
||||||
dnl CHECK FOR ICONV
|
dnl CHECK FOR ICONV
|
||||||
dnl ---------------
|
dnl ---------------
|
||||||
|
|
||||||
dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
|
dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
|
||||||
if test "x$ac_cv_header_iconv_h" = "xyes"; then
|
if test "x$ac_cv_header_iconv_h" = "xyes"; then
|
||||||
AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
|
ac_found_iconv=no
|
||||||
if test "x$ac_found_iconv" = "xno"; then
|
AC_COMPILE_IFELSE(
|
||||||
AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
|
[AC_LANG_PROGRAM(
|
||||||
if test "x$ac_found_iconv" = "xno"; then
|
[[#include <stdlib.h>
|
||||||
AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
|
#include <iconv.h>]],
|
||||||
fi
|
[[
|
||||||
if test "x$ac_found_iconv" != "xno"; then
|
iconv_open(NULL, NULL);
|
||||||
LIBS="-liconv $LIBS"
|
return 0;
|
||||||
fi
|
]]
|
||||||
fi
|
)],
|
||||||
fi
|
[
|
||||||
|
ac_found_iconv=yes
|
||||||
|
],
|
||||||
|
[ ])
|
||||||
|
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[#include <stdlib.h>
|
||||||
|
#include <iconv.h>]],
|
||||||
|
[[
|
||||||
|
libiconv_open(NULL, NULL);
|
||||||
|
return 0;
|
||||||
|
]]
|
||||||
|
)],
|
||||||
|
[
|
||||||
|
ac_found_iconv=yes
|
||||||
|
],
|
||||||
|
[ ])
|
||||||
|
|
||||||
if test "x$ac_found_iconv" = xyes; then
|
if test "x$ac_found_iconv" = xyes; then
|
||||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||||
fi
|
AC_CHECK_LIB([iconv],
|
||||||
|
[iconv_open],
|
||||||
|
[
|
||||||
|
LIBS="$LIBS -liconv"
|
||||||
|
],
|
||||||
|
[])
|
||||||
|
AC_CHECK_LIB([iconv],
|
||||||
|
[libiconv_open],
|
||||||
|
[
|
||||||
|
LIBS="$LIBS -liconv"
|
||||||
|
],
|
||||||
|
[])
|
||||||
|
|
||||||
dnl Check if iconv uses const in prototype declaration
|
dnl Check if iconv uses const in prototype declaration
|
||||||
if test "x$ac_found_iconv" = "xyes"; then
|
AC_CACHE_CHECK(for iconv declaration,
|
||||||
AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
|
ac_cv_iconv_const,
|
||||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
|
[AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[#include <stdlib.h>
|
||||||
#include <iconv.h>]],
|
#include <iconv.h>]],
|
||||||
[[
|
[[
|
||||||
char **msg, **new_msg;
|
char **msg, **new_msg;
|
||||||
size_t result, inleft, outleft;
|
size_t result, inleft, outleft;
|
||||||
result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft);
|
result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft);
|
||||||
return 0;
|
return 0;
|
||||||
]])],
|
]]
|
||||||
|
)],
|
||||||
[ac_cv_iconv_const=no],
|
[ac_cv_iconv_const=no],
|
||||||
[ac_cv_iconv_const=yes])])
|
[ac_cv_iconv_const=yes])
|
||||||
|
])
|
||||||
if test "x$ac_cv_iconv_const" = xyes; then
|
if test "x$ac_cv_iconv_const" = xyes; then
|
||||||
AC_DEFINE(HAVE_CONST_ICONV, 1, [Define if you have the iconv() function.])
|
AC_DEFINE(HAVE_CONST_ICONV, 1, [Define if you have the iconv() function.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
|
AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
|
||||||
|
|
Loading…
Reference in a new issue