and iconv. Mostly taken from fileutils/sh-utils/textutils.
2000-06-16 Bruno Haible <haible@clisp.cons.org>
+ * 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 <stddef.h>,
+ <stdlib.h>. 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.
--- /dev/null
+#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 <langinfo.h>],
+ [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 <langinfo.h> and nl_langinfo(CODESET).])
+ fi
+])
# 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
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
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])
--- /dev/null
+#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 <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.])
+ fi
+ LIBICONV=
+ if test "$am_cv_lib_iconv" = yes; then
+ LIBICONV="-liconv"
+ fi
+ AC_SUBST(LIBICONV)
+])