diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2005-02-24 16:53:07 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2005-02-24 16:53:07 +0000 |
commit | ebe071866d8098f1975e3b90dc4f6d81a6b38b31 (patch) | |
tree | 964a0ad5c689652b40133a8c364d838292d074d7 /configure.ac | |
parent | 691dd7e5294d232a7ab8327e2038f9779732fa3c (diff) | |
download | zsh-ebe071866d8098f1975e3b90dc4f6d81a6b38b31.tar.gz zsh-ebe071866d8098f1975e3b90dc4f6d81a6b38b31.tar.xz zsh-ebe071866d8098f1975e3b90dc4f6d81a6b38b31.zip |
20862: attempt to fix configure scripts to detect iconv properly
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index f7a731b08..471b8893d 100644 --- a/configure.ac +++ b/configure.ac @@ -728,13 +728,45 @@ fi AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(iconv, iconv) +dnl --------------- +dnl CHECK FOR ICONV +dnl --------------- -case "$host_os" in - cygwin | darwin*) - dnl cygwin iconv() is really libiconv() - AC_CHECK_LIB(iconv, libiconv) ;; -esac +dnl Find iconv. It may be in libiconv and may be iconv() or libiconv() +if test "x$ac_cv_header_iconv_h" = "xyes"; then + AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no) + if test "x$ac_found_iconv" = "xno"; then + AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes) + if test "x$ac_found_iconv" = "xno"; then + AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes) + fi + if test "x$ac_found_iconv" != "xno"; then + LIBS="-liconv $LIBS" + fi + fi +fi +if test "x$ac_found_iconv" = xyes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) +fi + +dnl Check if iconv uses const in prototype declaration +if test "x$ac_found_iconv" = "xyes"; then + AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> + #include <iconv.h>]], + [[#ifdef __cplusplus + "C" + #endif + #if defined(__STDC__) || defined(__cplusplus) + size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + #else + size_t iconv(); + #endif]])], + [ac_cv_iconv_const=], + [ac_cv_iconv_const=const])]) + AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const, + [Define as const if the declaration of iconv() needs const.]) +fi if test x$enable_pcre = xyes; then dnl pcre-config should probably be employed here |