Portability fixes.

This commit is contained in:
Moritz Bunkus 2005-03-01 14:52:36 +00:00
parent 9139ced877
commit b7fd7bd916
4 changed files with 53 additions and 10 deletions

View File

@ -369,7 +369,8 @@ size_t iconv();
[Define as const if the declaration of iconv() needs const.])
else
echo '*** The iconv library is needed but could not be found.'
echo '*** Please install it and re-run configure.'
echo '*** Please install it and re-run configure. You can find iconv'
echo '*** at http://www.gnu.org/software/libiconv/'
exit 1
fi
ICONV_LIBS=
@ -380,6 +381,43 @@ size_t iconv();
AC_SUBST(ICONV_LIBS)
dnl
dnl Check for nl_langinfo or at least locale_charset
dnl
if test x"$MINGW" != "x1" ; then
AC_MSG_CHECKING(for nl_langinfo)
AC_CACHE_VAL(ac_cv_has_nl_langinfo,[
AC_TRY_COMPILE([
#include <langinfo.h>
],
[nl_langinfo(CODESET);],
ac_cv_has_nl_langinfo=yes,
ac_cv_has_nl_langinfo=no)
])
AC_MSG_RESULT($ac_cv_has_nl_langinfo)
if test x"$ac_cv_has_nl_langinfo" = "xyes" ; then
AC_DEFINE(HAVE_NL_LANGINFO, 1, [nl_langinfo is available])
else
AC_MSG_CHECKING(for locale_charset)
AC_CACHE_VAL(ac_cv_has_locale_charset,[
AC_TRY_COMPILE([
#include <libcharset.h>
],
[locale_charset();],
ac_cv_has_locale_charset=yes,
ac_cv_has_locale_charset=no)
])
AC_MSG_RESULT($ac_cv_has_locale_charset)
if test x"$ac_cv_has_locale_charset" = "xyes" ; then
AC_DEFINE(HAVE_LOCALE_CHARSET, 1, [locale_charset is available])
else
echo '*** Your system has neither nl_langinfo nor locale_charset.'
echo '*** Please install libcharset which is part of libiconv'
echo '*** available at http://www.gnu.org/software/libiconv/'
exit 1
fi
fi
fi
dnl
dnl Check for libogg

View File

@ -21,9 +21,11 @@
#include <errno.h>
#include <iconv.h>
#if defined(COMP_MSC)
#include <libcharset.h>
#elif !defined(COMP_MINGW)
#include <langinfo.h>
# include <libcharset.h>
#elif HAVE_NL_LANGINFO
# include <langinfo.h>
#elif HAVE_LOCALE_CHARSET
# include <libcharset.h>
#endif
#include <locale.h>
#include <stdarg.h>
@ -40,8 +42,8 @@
#include <sys/time.h>
#endif
#include <time.h>
#include <wchar.h>
#if defined(SYS_WINDOWS)
#include <wchar.h>
#include <windows.h>
#endif
@ -466,8 +468,10 @@ get_local_charset() {
lc_charset = nl_langinfo(CODESET);
if (parse_int(lc_charset, i))
lc_charset = string("ISO") + lc_charset + string("-US");
#else
#elif HAVE_NL_LANGINFO
lc_charset = nl_langinfo(CODESET);
#elif HAVE_LOCALE_CHARSET
lc_charset = locale_charset();
#endif
return lc_charset;

View File

@ -16,9 +16,11 @@
#include "os.h"
#if defined(COMP_MSC)
#include <libcharset.h>
#elif !defined(COMP_MINGW)
#include <langinfo.h>
# include <libcharset.h>
#elif HAVE_NL_LANGINFO
# include <langinfo.h>
#elif HAVE_LOCALE_CHARSET
# include <libcharset.h>
#endif
#if defined(SYS_WINDOWS)
#include <windows.h>

View File

@ -21,7 +21,6 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#if defined(COMP_MSC)
#include <assert.h>