From 6fa76a219900bbd5a9f15265ee1e5fff43328185 Mon Sep 17 00:00:00 2001 From: Peter Verthez Date: Sun, 13 Oct 2002 14:20:03 +0000 Subject: [PATCH] Use of libcharset (for portability). --- acinclude.m4 | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 8 +++++++- utf8/Makefile.am | 5 +++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7eb2ce3..e50ed92 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,5 +1,56 @@ dnl $Id$ dnl $Name$ + +dnl From codeset.m4 (in libcharset): +#serial 2 + +dnl From Bruno Haible. + +AC_DEFUN(jm_LANGINFO_CODESET, +[ + AC_CHECK_HEADERS(langinfo.h) + AC_CHECK_FUNCS(nl_langinfo) + + AC_CACHE_CHECK([for nl_langinfo and CODESET], jm_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + jm_cv_langinfo_codeset=yes, + jm_cv_langinfo_codeset=no) + ]) + if test $jm_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) + +dnl From glibc21.m4 (in libcharset): +#serial 2 + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN(jm_GLIBC21, + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) + dnl From iconv.m4: #serial AM2 diff --git a/configure.in b/configure.in index ef83cc9..c85d285 100644 --- a/configure.in +++ b/configure.in @@ -28,6 +28,8 @@ AM_INIT_AUTOMAKE(${NAME},${VERSION}) AM_CONFIG_HEADER(config.h) ALL_LINGUAS="nl" +AC_CANONICAL_HOST + dnl ============================================================= dnl Checks for programs. AC_PROG_CC @@ -65,7 +67,10 @@ AC_TYPE_SIZE_T dnl ========================================================== dnl Checks for library functions. -AC_CHECK_FUNCS(vsnprintf vsprintf) +AC_CHECK_HEADERS(stddef.h stdlib.h string.h) +AC_CHECK_FUNCS(setlocale vsnprintf vsprintf) +jm_LANGINFO_CODESET +jm_GLIBC21 dnl ========================================================== dnl My local stuff @@ -114,6 +119,7 @@ AC_OUTPUT(Makefile iconv/glibc/Makefile iconv/libiconv/Makefile utf8/Makefile + utf8/libcharset/Makefile t/Makefile t/src/Makefile t/input/Makefile diff --git a/utf8/Makefile.am b/utf8/Makefile.am index 2a237be..bcf29c2 100644 --- a/utf8/Makefile.am +++ b/utf8/Makefile.am @@ -2,7 +2,12 @@ # $Id$ # $Name$ +SUBDIRS = libcharset . + +INCLUDES = -I $(srcdir)/libcharset + noinst_LTLIBRARIES = libutf8.la libutf8_la_SOURCES = utf8-locale.c libutf8_la_LDFLAGS = $(LIBICONV) +libutf8_la_LIBADD = libcharset/libcharset.la noinst_HEADERS = utf8-locale.h -- 2.30.2