From: Bruno Haible Date: Fri, 16 Jun 2000 22:12:14 +0000 (+0000) Subject: Add the autoconfiguration infrastructure needed for using nl_langinfo(CODESET) X-Git-Tag: v0.10.36~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab8b45f5656ba70971a8495cc446f26aba543cf5;p=thirdparty%2Fgettext.git Add the autoconfiguration infrastructure needed for using nl_langinfo(CODESET) and iconv. Mostly taken from fileutils/sh-utils/textutils. --- diff --git a/m4/ChangeLog b/m4/ChangeLog index a36f9333d..cabd55bbf 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,5 +1,12 @@ 2000-06-16 Bruno Haible + * codeset.m4: New file, taken from fileutils-4.0u, with prefix AM. + * iconv.m4: New file, taken from fileutils-4.0u, with prefix AM. + * gettext.m4 (AM_GNU_GETTEXT): Add check for headers , + . Add check for functions feof_unlocked, fgets_unlocked. + Invoke AM_ICONV and AM_LANGINFO_CODESET. Require AC_CANONICAL_HOST. + Bump to serial 7. + * isc-posix.m4: Undefine the macro before calling AC_DEFUN, otherwise with autoconf-2.13 we get lots of ***BUG in Autoconf--please report*** errors. diff --git a/m4/codeset.m4 b/m4/codeset.m4 new file mode 100644 index 000000000..8e8e3ec85 --- /dev/null +++ b/m4/codeset.m4 @@ -0,0 +1,17 @@ +#serial AM1 + +dnl From Bruno Haible. + +AC_DEFUN(AM_LANGINFO_CODESET, +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 index f5923658a..d16262506 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -6,7 +6,7 @@ # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. -# serial 6 +# serial 7 dnl Usage: AM_WITH_NLS([SYMBOL], [LIBDIR], [INCDIR]). dnl If SYMBOL is specified and is `no-catgets', then the catgets checks @@ -208,6 +208,7 @@ dnl Usage: Just like AM_WITH_NLS, which see. AC_DEFUN(AM_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl @@ -218,11 +219,14 @@ AC_DEFUN(AM_GNU_GETTEXT, AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next tsearch iconv stpcpy mempcpy]) + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd mempcpy munmap putenv \ +setenv setlocale stpcpy strchr strcasecmp strdup tsearch \ +__argz_count __argz_stringify __argz_next]) + AM_ICONV + AM_LANGINFO_CODESET AM_LC_MESSAGES AM_WITH_NLS([$1],[$2],[$3]) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 000000000..a23a320c9 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,39 @@ +#serial AM1 + +dnl From Bruno Haible. + +AC_DEFUN(AM_ICONV, +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable libiconv installed). + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [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 +#include ], + [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.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +])