Added configure check for libiconv.

This commit is contained in:
Moritz Bunkus 2003-05-23 17:37:20 +00:00
parent 06047ed75c
commit 9d1152423a
2 changed files with 74 additions and 2 deletions

View File

@ -557,14 +557,85 @@ AC_DEFUN(PATH_CYGWIN,
CYGWIN="`uname -s`"
case "$CYGWIN" in
CYGWIN*)
ICONV_LIBS="-liconv"
dnl ICONV_LIBS="-liconv"
AC_MSG_RESULT(yes)
CXXVER_CFLAGS="$CXXVER_CFLAGS -DNO_WSTRING"
;;
*)
ICONV_LIBS=""
dnl ICONV_LIBS=""
AC_MSG_RESULT(no)
;;
esac
dnl AC_SUBST(ICONV_LIBS)
])
dnl This macros shamelessly stolen from
dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
dnl Written by Bruno Haible.
AC_DEFUN(PATH_ICONV,
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
AC_ARG_WITH([libiconv-prefix],
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
for dir in `echo "$withval" | tr : ' '`; do
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
done
])
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_func_iconv=yes)
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(am_cv_proto_iconv, [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#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
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:-
}[$]am_cv_proto_iconv)
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
[Define as const if the declaration of iconv() needs const.])
fi
ICONV_LIBS=
if test "$am_cv_lib_iconv" = yes; then
ICONV_LIBS="-liconv"
fi
AC_SUBST(ICONV_LIBS)
])

View File

@ -11,6 +11,7 @@ AC_PROG_RANLIB
PATH_CXXVERSION()
PATH_CYGWIN()
PATH_ICONV()
XIPH_PATH_OGG()
XIPH_PATH_VORBIS()
PATH_AVILIB()