]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add the autoconfiguration infrastructure needed for using nl_langinfo(CODESET)
authorBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 22:12:14 +0000 (22:12 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 22:12:14 +0000 (22:12 +0000)
and iconv. Mostly taken from fileutils/sh-utils/textutils.

m4/ChangeLog
m4/codeset.m4 [new file with mode: 0644]
m4/gettext.m4
m4/iconv.m4 [new file with mode: 0644]

index a36f9333da3164f13caef34e968f6f23884aa666..cabd55bbfcfe7875ffb4c547a24a7fddb809af22 100644 (file)
@@ -1,5 +1,12 @@
 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.
diff --git a/m4/codeset.m4 b/m4/codeset.m4
new file mode 100644 (file)
index 0000000..8e8e3ec
--- /dev/null
@@ -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 <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
+])
index f5923658a96e96fde67e259502fd2e3b63e0b776..d16262506fec8cf6e8945d46df0babfcf5c11c6d 100644 (file)
@@ -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 (file)
index 0000000..a23a320
--- /dev/null
@@ -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 <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)
+])