diff options
author | Ludovic Courtès <ludo@gnu.org> | 2011-12-15 01:31:16 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-12-15 01:31:16 +0100 |
commit | c2c2b5a49b1ce37a42417037c3515864a808e53b (patch) | |
tree | 2fd5ace5f7ac7d306b53c7b81dd075241e8d43f4 /m4 | |
parent | a00c31bc46b639828d0decc33380c16d256f7986 (diff) |
Use Gnulib's `localcharset', with local patches.
This follows Bruno Haible's suggestion at
<http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00055.html>.
* m4/gnulib-cache.m4: Add `gl_LOCAL_DIR'; use `localcharset'.
* Makefile.am (EXTRA_DIST): Add gnulib-local/lib/localcharset.[ch].diff.
(TESTS_ENVIRONMENT): New variable.
* gnulib-local/lib/localcharset.c.diff,
gnulib-local/lib/localcharset.h.diff: New files.
* test-suite/Makefile.am (TESTS_ENVIRONMENT): Add
@LOCALCHARSET_TESTS_ENVIRONMENT@.
* test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Likewise.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/codeset.m4 | 23 | ||||
-rw-r--r-- | m4/configmake.m4 | 50 | ||||
-rw-r--r-- | m4/glibc21.m4 | 34 | ||||
-rw-r--r-- | m4/gnulib-cache.m4 | 5 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 15 | ||||
-rw-r--r-- | m4/localcharset.m4 | 17 |
6 files changed, 142 insertions, 2 deletions
diff --git a/m4/codeset.m4 b/m4/codeset.m4 new file mode 100644 index 000000000..da7355223 --- /dev/null +++ b/m4/codeset.m4 @@ -0,0 +1,23 @@ +# codeset.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2006, 2008-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <langinfo.h>]], + [[char* cs = nl_langinfo(CODESET); return !cs;]])], + [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 +]) diff --git a/m4/configmake.m4 b/m4/configmake.m4 new file mode 100644 index 000000000..a02982356 --- /dev/null +++ b/m4/configmake.m4 @@ -0,0 +1,50 @@ +# configmake.m4 serial 1 +dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_CONFIGMAKE_PREP +# ------------------ +# Guarantee all of the standard directory variables, even when used with +# autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake +# 1.9.6 (pkglibexecdir wasn't supported until 1.10b.). +AC_DEFUN([gl_CONFIGMAKE_PREP], +[ + dnl Technically, datadir should default to datarootdir. But if + dnl autoconf is too old to provide datarootdir, then reversing the + dnl definition is a reasonable compromise. Only AC_SUBST a variable + dnl if it was not already defined earlier by autoconf. + if test "x$datarootdir" = x; then + AC_SUBST([datarootdir], ['${datadir}']) + fi + dnl Copy the approach used in autoconf 2.60. + if test "x$docdir" = x; then + AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) + fi + dnl The remaining variables missing from autoconf 2.59 are easier. + if test "x$htmldir" = x; then + AC_SUBST([htmldir], ['${docdir}']) + fi + if test "x$dvidir" = x; then + AC_SUBST([dvidir], ['${docdir}']) + fi + if test "x$pdfdir" = x; then + AC_SUBST([pdfdir], ['${docdir}']) + fi + if test "x$psdir" = x; then + AC_SUBST([psdir], ['${docdir}']) + fi + if test "x$lispdir" = x; then + AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) + fi + if test "x$localedir" = x; then + AC_SUBST([localedir], ['${datarootdir}/locale']) + fi + + dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely + dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. + AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) +]) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 new file mode 100644 index 000000000..bc81c110b --- /dev/null +++ b/m4/glibc21.m4 @@ -0,0 +1,34 @@ +# glibc21.m4 serial 5 +dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2011 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Test for the GNU C Library, version 2.1 or newer, or uClibc. +# From Bruno Haible. + +AC_DEFUN([gl_GLIBC21], + [ + AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], + [ac_cv_gnu_library_2_1], + [AC_EGREP_CPP([Lucky], + [ +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif +#ifdef __UCLIBC__ + Lucky user +#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" + ] +) diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 2bc144435..f706f0e68 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -27,10 +27,10 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar +# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar # Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_LOCAL_DIR([]) +gl_LOCAL_DIR([gnulib-local]) gl_MODULES([ accept alignof @@ -73,6 +73,7 @@ gl_MODULES([ lib-symbol-visibility libunistring listen + localcharset locale log1p maintainer-makefile diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 1a007e6b6..e6e68dc67 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -56,6 +56,7 @@ AC_DEFUN([gl_EARLY], # Code from module ceil: # Code from module chdir: # Code from module close: + # Code from module configmake: # Code from module connect: # Code from module dirname-lgpl: # Code from module dosname: @@ -112,6 +113,7 @@ AC_DEFUN([gl_EARLY], # Code from module lib-symbol-visibility: # Code from module libunistring: # Code from module listen: + # Code from module localcharset: # Code from module locale: # Code from module log1p: # Code from module lstat: @@ -245,6 +247,7 @@ if test $REPLACE_CLOSE = 1; then AC_LIBOBJ([close]) fi gl_UNISTD_MODULE_INDICATOR([close]) +gl_CONFIGMAKE_PREP AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([connect]) @@ -402,6 +405,9 @@ if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([listen]) fi gl_SYS_SOCKET_MODULE_INDICATOR([listen]) +gl_LOCALCHARSET +LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" +AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) gl_LOCALE_H gl_COMMON_DOUBLE_MATHFUNC([log1p]) gl_FUNC_LSTAT @@ -778,6 +784,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/canonicalize-lgpl.c lib/ceil.c lib/close.c + lib/config.charset lib/connect.c lib/dirname-lgpl.c lib/dirname.h @@ -825,6 +832,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/itold.c lib/libunistring.valgrind lib/listen.c + lib/localcharset.c + lib/localcharset.h lib/locale.in.h lib/lstat.c lib/malloc.c @@ -855,6 +864,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/readlink.c lib/recv.c lib/recvfrom.c + lib/ref-add.sin + lib/ref-del.sin lib/rename.c lib/rmdir.c lib/safe-read.c @@ -924,6 +935,8 @@ AC_DEFUN([gl_FILE_LIST], [ m4/ceil.m4 m4/check-math-lib.m4 m4/close.m4 + m4/codeset.m4 + m4/configmake.m4 m4/dirname.m4 m4/double-slash-root.m4 m4/duplocale.m4 @@ -944,6 +957,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/fstat.m4 m4/func.m4 m4/getaddrinfo.m4 + m4/glibc21.m4 m4/gnulib-common.m4 m4/hostent.m4 m4/iconv.m4 @@ -969,6 +983,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/lib-prefix.m4 m4/libunistring-base.m4 m4/libunistring.m4 + m4/localcharset.m4 m4/locale_h.m4 m4/longlong.m4 m4/lstat.m4 diff --git a/m4/localcharset.m4 b/m4/localcharset.m4 new file mode 100644 index 000000000..6801ca955 --- /dev/null +++ b/m4/localcharset.m4 @@ -0,0 +1,17 @@ +# localcharset.m4 serial 7 +dnl Copyright (C) 2002, 2004, 2006, 2009-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_LOCALCHARSET], +[ + dnl Prerequisites of lib/localcharset.c. + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) + AC_CHECK_DECLS_ONCE([getc_unlocked]) + + dnl Prerequisites of the lib/Makefile.am snippet. + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_GLIBC21]) +]) |