guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-5-9-gc3b1


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-5-9-gc3b16a5
Date: Mon, 23 Nov 2009 22:53:44 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=c3b16a5d8e31b78b69a6937ff6024d0ff5dbfd8c

The branch, master has been updated
       via  c3b16a5d8e31b78b69a6937ff6024d0ff5dbfd8c (commit)
       via  414e44412c2ebea80028d56bc80559e854524c6b (commit)
       via  a270e133f390169b4d621ef139128a2b7ed30372 (commit)
      from  9a5ee564fab678cacda3a2d8ab4cec613768e1e4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c3b16a5d8e31b78b69a6937ff6024d0ff5dbfd8c
Author: Ludovic Courtès <address@hidden>
Date:   Mon Nov 23 23:47:20 2009 +0100

    Use Gnulib's `duplocale' module.
    
    * libguile/i18n.c (scm_make_locale): Simplify global locale handling,
      using duplocale(3) for all kinds of locales.
      (scm_init_i18n): Comment on why we don't just use `LC_GLOBAL_LOCALE'
      for `global_locale_smob'.
    
    * m4/gnulib-cache.m4: Add `duplocale'.

commit 414e44412c2ebea80028d56bc80559e854524c6b
Author: Ludovic Courtès <address@hidden>
Date:   Mon Nov 23 22:50:34 2009 +0100

    Use Gnulib's `locale' module.
    
    * configure.ac: Remove test for <xlocale.h>.
    
    * libguile/i18n.c: Remove conditional <xlocale.h> inclusion on
      `HAVE_XLOCALE_H'.
    
    * m4/gnulib-cache.m4: Add `locale' module.

commit a270e133f390169b4d621ef139128a2b7ed30372
Author: Ludovic Courtès <address@hidden>
Date:   Mon Nov 23 18:51:25 2009 +0100

    Correct manual wrt. encoding names.
    
    * doc/ref/api-evaluation.texi (Character Encoding of Source Files):
      Don't suggest `latin1' as a good encoding name since Emacs cannot deal
      with it.
    
    * libguile/read.c (scm_file_encoding): Fix "Emacs" spelling.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                  |    1 +
 build-aux/announce-gen      |    7 ++-
 configure.ac                |    3 +-
 doc/ref/api-evaluation.texi |    5 +-
 lib/Makefile.am             |   39 ++++++++++++++-
 lib/duplocale.c             |  115 +++++++++++++++++++++++++++++++++++++++++++
 lib/locale.in.h             |   58 ++++++++++++++++++++++
 lib/unistd.in.h             |   27 ++++++++++-
 lib/vasnprintf.c            |    8 ++--
 libguile/i18n.c             |   30 +++---------
 libguile/read.c             |    2 +-
 m4/duplocale.m4             |   56 +++++++++++++++++++++
 m4/gnulib-cache.m4          |    4 +-
 m4/gnulib-comp.m4           |    7 +++
 m4/iconv_h.m4               |    7 ++-
 m4/locale_h.m4              |   82 ++++++++++++++++++++++++++++++
 m4/unistd_h.m4              |    6 ++-
 m4/wchar.m4                 |    4 +-
 maint.mk                    |   25 +++++++++-
 19 files changed, 445 insertions(+), 41 deletions(-)
 create mode 100644 lib/duplocale.c
 create mode 100644 lib/locale.in.h
 create mode 100644 m4/duplocale.m4
 create mode 100644 m4/locale_h.m4

diff --git a/.gitignore b/.gitignore
index 27680d6..42a200e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,3 +117,4 @@ INSTALL
 /GTAGS
 /meta/guile-tools
 /meta/guile-config
+/lib/locale.h
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index e6be9f8..5fbb9cd 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
     if 0;
 # Generate a release announcement message.
 
-my $VERSION = '2009-10-30 15:59'; # UTC
+my $VERSION = '2009-11-20 13:36'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -442,6 +442,11 @@ EOF
   my @sig_files = map { "$_.sig" } @tarballs;
   print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
                   @sig_files);
+  if ($url_dir_list[0] =~ "gnu\.org")
+    {
+      print "To reduce load on the main server, use a mirror listed at:\n";
+      print "  http://www.gnu.org/order/ftp.html\n\n";;
+    }
 
   $print_checksums_p
     and print_checksums (@sizable);
diff --git a/configure.ac b/configure.ac
index fc9479d..bbf9e42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -730,13 +730,12 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 
ctermid fesetround ftime
 #       check this specifically, we need it for the timespec test below.
 #   sethostname - the function itself check because it's not in mingw,
 #       the DECL is checked because Solaris 10 doens't have in any header
-#   xlocale.h - needed on Darwin for the `locale_t' API
 #   hstrerror - on Tru64 5.1b the symbol is available in libc but the
 #       declaration isn't anywhere.
 #   cuserid - on Tru64 5.1b the declaration is documented to be available
 #       only with `_XOPEN_SOURCE' or some such.
 #
-AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h 
sys/file.h xlocale.h)
+AC_CHECK_HEADERS([crypt.h netdb.h pthread.h sys/param.h sys/resource.h 
sys/file.h])
 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass 
sethostname gethostname)
 AC_CHECK_DECLS([sethostname, hstrerror, cuserid])
 
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index c2c3a4a..fda0291 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -664,8 +664,9 @@ However, there are some differences in encoding names 
recognized by
 Emacs and encoding names defined by IANA, the latter being essentially a
 subset of the former.  For instance, @code{latin-1} is a valid encoding
 name for Emacs, but it's not according to the IANA standard, which Guile
-follows; instead, you should use @code{latin1}, which is both understood
-by Emacs and dubbed by IANA.
+follows; instead, you should use @code{iso-8859-1}, which is both
+understood by Emacs and dubbed by IANA (IANA writes it uppercase but
+Emacs wants it lowercase and Guile is case insensitive.)
 
 For source code, only a subset of all possible character encodings can
 be interpreted by the built-in source code reader.  Only those
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 14a6613..6c75b75 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read 
full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib 
iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility 
libunistring maintainer-makefile putenv stdlib strcase strftime striconveh 
string verify version-etc-fsf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload 
havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions 
lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib 
strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
 
@@ -205,6 +205,15 @@ CLEANFILES += configmake.h configmake.h-t
 
 ## end   gnulib module configmake
 
+## begin gnulib module duplocale
+
+
+EXTRA_DIST += duplocale.c
+
+EXTRA_libgnu_la_SOURCES += duplocale.c
+
+## end   gnulib module duplocale
+
 ## begin gnulib module errno
 
 BUILT_SOURCES += $(ERRNO_H)
@@ -497,6 +506,30 @@ EXTRA_DIST += config.charset ref-add.sin ref-del.sin
 
 ## end   gnulib module localcharset
 
+## begin gnulib module locale
+
+BUILT_SOURCES += $(LOCALE_H)
+
+# We need the following in order to create <locale.h> when the system
+# doesn't have one that provides all definitions.
+locale.h: locale.in.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
+             -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
+             -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
+             -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+             < $(srcdir)/locale.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += locale.h locale.h-t
+
+EXTRA_DIST += locale.in.h
+
+## end   gnulib module locale
+
 ## begin gnulib module lstat
 
 
@@ -1279,6 +1312,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' 
\
              -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
+             -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
              -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
@@ -1304,6 +1338,7 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
+             -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
@@ -1323,9 +1358,11 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
              -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
              -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
+             -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
              -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
              -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
              -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
+             -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g'
 \
diff --git a/lib/duplocale.c b/lib/duplocale.c
new file mode 100644
index 0000000..e7618b8
--- /dev/null
+++ b/lib/duplocale.c
@@ -0,0 +1,115 @@
+/* Duplicate a locale object.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <address@hidden>, 2007.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <locale.h>
+
+#include <errno.h>
+#include <langinfo.h>
+#include <string.h>
+
+/* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
+   glibc < 2.12.
+   See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>.  */
+#undef _NL_LOCALE_NAME
+#define _NL_LOCALE_NAME(category) _NL_ITEM ((category), _NL_ITEM_INDEX (-1))
+
+#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+
+#undef duplocale
+
+locale_t
+rpl_duplocale (locale_t locale)
+{
+  /* Work around crash in the duplocale function in glibc < 2.12.
+     See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.  */
+  if (locale == LC_GLOBAL_LOCALE)
+    {
+      /* Create a copy of the locale by fetching the name of each locale
+        category, starting with LC_CTYPE.  */
+      static struct { int cat; int mask; } categories[] =
+       {
+           { LC_NUMERIC,        LC_NUMERIC_MASK },
+           { LC_TIME,           LC_TIME_MASK },
+           { LC_COLLATE,        LC_COLLATE_MASK },
+           { LC_MONETARY,       LC_MONETARY_MASK },
+           { LC_MESSAGES,       LC_MESSAGES_MASK }
+#ifdef LC_PAPER
+         , { LC_PAPER,          LC_PAPER_MASK }
+#endif
+#ifdef LC_NAME
+         , { LC_NAME,           LC_NAME_MASK }
+#endif
+#ifdef LC_ADDRESS
+         , { LC_ADDRESS,        LC_ADDRESS_MASK }
+#endif
+#ifdef LC_TELEPHONE
+         , { LC_TELEPHONE,      LC_TELEPHONE_MASK }
+#endif
+#ifdef LC_MEASUREMENT
+         , { LC_MEASUREMENT,    LC_MEASUREMENT_MASK }
+#endif
+#ifdef LC_IDENTIFICATION
+         , { LC_IDENTIFICATION, LC_IDENTIFICATION_MASK }
+#endif
+       };
+      const char *base_name;
+      locale_t base_copy;
+      unsigned int i;
+
+      base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE));
+      if (base_name[0] == '\0')
+       /* Fallback code for glibc < 2.4, which did not implement
+          nl_langinfo (_NL_LOCALE_NAME (category)).  */
+       base_name = setlocale (LC_CTYPE, NULL);
+      base_copy = newlocale (LC_ALL_MASK, base_name, NULL);
+      if (base_copy == NULL)
+       return NULL;
+
+      for (i = 0; i < SIZEOF (categories); i++)
+       {
+         int category = categories[i].cat;
+         int category_mask = categories[i].mask;
+         const char *name = nl_langinfo (_NL_LOCALE_NAME (category));
+         if (name[0] == '\0')
+           /* Fallback code for glibc < 2.4, which did not implement
+              nl_langinfo (_NL_LOCALE_NAME (category)).  */
+           name = setlocale (category, NULL);
+         if (strcmp (name, base_name) != 0)
+           {
+             locale_t copy = newlocale (category_mask, name, base_copy);
+             if (copy == NULL)
+               {
+                 int saved_errno = errno;
+                 freelocale (base_copy);
+                 errno = saved_errno;
+                 return NULL;
+               }
+             /* No need to call freelocale (base_copy) if copy != base_copy;
+                the newlocale function already takes care of doing it.  */
+             base_copy = copy;
+           }
+       }
+
+      return base_copy;
+    }
+
+  return duplocale (locale);
+}
diff --git a/lib/locale.in.h b/lib/locale.in.h
new file mode 100644
index 0000000..6d7ab48
--- /dev/null
+++ b/lib/locale.in.h
@@ -0,0 +1,58 @@
+/* A POSIX <locale.h>.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_LOCALE_H
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_LOCALE_H@
+
+#ifndef _GL_LOCALE_H
+#define _GL_LOCALE_H
+
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MacOS X 10.5 defines the locale_t type in <xlocale.h>.  */
+#if @HAVE_XLOCALE_H@
+# include <xlocale.h>
+#endif
+
+/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
+   On systems that don't define it, use the same value as GNU libintl.  */
+#if !defined LC_MESSAGES
+# define LC_MESSAGES 1729
+#endif
+
+#if @GNULIB_DUPLOCALE@
+# if @REPLACE_DUPLOCALE@
+#  undef duplocale
+#  define duplocale rpl_duplocale
+extern locale_t duplocale (locale_t locale);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef duplocale
+# define duplocale(l) \
+   (GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
+                     "use gnulib module duplocale for portability"), \
+    duplocale (l))
+#endif
+
+#endif /* _GL_LOCALE_H */
+#endif /* _GL_LOCALE_H */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 01b81c8..7cbf58d 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -714,11 +714,15 @@ extern int rmdir (char const *name);
 
 
 #if @GNULIB_SLEEP@
+# if @REPLACE_SLEEP@
+#  undef sleep
+#  define sleep rpl_sleep
+# endif
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if address@hidden@
+# if address@hidden@ || @REPLACE_SLEEP@
 extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -792,6 +796,27 @@ extern int unlinkat (int fd, char const *file, int flag);
 #endif
 
 
+#if @GNULIB_USLEEP@
+# if @REPLACE_USLEEP@
+#  undef usleep
+#  define usleep rpl_usleep
+# endif
+# if address@hidden@ || @REPLACE_USLEEP@
+/* Pause the execution of the current thread for N microseconds.
+   Returns 0 on completion, or -1 on range error.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+extern int usleep (useconds_t n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef usleep
+# define usleep(n) \
+    (GL_LINK_WARNING ("usleep is unportable - " \
+                      "use gnulib module usleep for portability"), \
+     usleep (n))
+#endif
+
+
 #if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
    See the POSIX:2001 specification
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 6495c7c..aa790ad 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -261,10 +261,10 @@ decimal_point_char (void)
 {
   const char *point;
   /* Determine it in a multithread-safe way.  We know nl_langinfo is
-     multithread-safe on glibc systems, but is not required to be multithread-
-     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
-     is rarely multithread-safe.  */
-#  if HAVE_NL_LANGINFO && __GLIBC__
+     multithread-safe on glibc systems and MacOS X systems, but is not required
+     to be multithread-safe by POSIX.  sprintf(), however, is multithread-safe.
+     localeconv() is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined 
__MACH__))
   point = nl_langinfo (RADIXCHAR);
 #  elif 1
   char pointbuf[5];
diff --git a/libguile/i18n.c b/libguile/i18n.c
index 5c1e4b5..3a6cb06 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -57,10 +57,6 @@
 # define USE_GNU_LOCALE_API
 #endif
 
-#if (defined USE_GNU_LOCALE_API) && (defined HAVE_XLOCALE_H)
-# include <xlocale.h>
-#endif
-
 #include "libguile/posix.h"  /* for `scm_i_locale_mutex' */
 
 #if (defined HAVE_LANGINFO_H) && (defined HAVE_NL_TYPES_H)
@@ -618,27 +614,14 @@ SCM_DEFINE (scm_make_locale, "make-locale", 2, 1, 0,
 #ifdef USE_GNU_LOCALE_API
 
   if (scm_is_eq (base_locale, SCM_VARIABLE_REF (scm_global_locale)))
-    {
-      /* Fetch the current locale and turn in into a `locale_t'.  Don't
-        duplicate the resulting `locale_t' because we want it to be consumed
-        by `newlocale ()'.  */
-      char *current_locale;
+    c_base_locale = LC_GLOBAL_LOCALE;
 
-      scm_i_pthread_mutex_lock (&scm_i_locale_mutex);
-
-      current_locale = setlocale (LC_ALL, NULL);
-      c_base_locale = newlocale (LC_ALL_MASK, current_locale, NULL);
-
-      scm_i_pthread_mutex_unlock (&scm_i_locale_mutex);
-
-      if (c_base_locale == (locale_t) 0)
-       scm_locale_error (FUNC_NAME, errno);
-    }
-  else if (c_base_locale != (locale_t) 0)
+  if (c_base_locale != (locale_t) 0)
     {
       /* C_BASE_LOCALE is to be consumed by `newlocale ()' so it needs to be
         duplicated before.  */
       c_base_locale = duplocale (c_base_locale);
+
       if (c_base_locale == (locale_t) 0)
        {
          err = errno;
@@ -652,10 +635,8 @@ SCM_DEFINE (scm_make_locale, "make-locale", 2, 1, 0,
 
   if (c_locale == (locale_t) 0)
     {
-      if (scm_is_eq (base_locale, SCM_VARIABLE_REF (scm_global_locale)))
-       /* The base locale object was created lazily and must be freed.  */
+      if (c_base_locale != (locale_t) 0)
        freelocale (c_base_locale);
-
       scm_locale_error (FUNC_NAME, errno);
     }
   else
@@ -1816,6 +1797,9 @@ scm_init_i18n ()
 #include "libguile/i18n.x"
 
   /* Initialize the global locale object with a special `locale' SMOB.  */
+  /* XXX: We don't define it as `LC_GLOBAL_LOCALE' because of bugs as of
+     glibc <= 2.11 not (yet) worked around by Gnulib.  See
+     http://sourceware.org/bugzilla/show_bug.cgi?id=11009 for details.  */
   SCM_NEWSMOB (global_locale_smob, scm_tc16_locale_smob_type, NULL);
   SCM_VARIABLE_SET (scm_global_locale, global_locale_smob);
 }
diff --git a/libguile/read.c b/libguile/read.c
index a81189f..4772c32 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1554,7 +1554,7 @@ scm_i_scan_for_encoding (SCM port)
 
 SCM_DEFINE (scm_file_encoding, "file-encoding", 1, 0, 0,
             (SCM port),
-            "Scans the port for an EMACS-like character coding declaration\n"
+            "Scans the port for an Emacs-like character coding declaration\n"
             "near the top of the contents of a port with random-acessible 
contents.\n"
             "The coding declaration is of the form\n"
             "@code{coding: XXXXX} and must appear in a scheme comment.\n"
diff --git a/m4/duplocale.m4 b/m4/duplocale.m4
new file mode 100644
index 0000000..7e0a071
--- /dev/null
+++ b/m4/duplocale.m4
@@ -0,0 +1,56 @@
+# duplocale.m4 serial 1
+dnl Copyright (C) 2009 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_FUNC_DUPLOCALE],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([duplocale])
+  if test $ac_cv_func_duplocale = yes; then
+    dnl Check against glibc bug where duplocale crashes.
+    dnl See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.
+    AC_REQUIRE([gl_LOCALE_H])
+    AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
+      [gl_cv_func_duplocale_works],
+      [AC_TRY_RUN([
+#include <locale.h>
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+int main ()
+{
+  (void) duplocale (LC_GLOBAL_LOCALE);
+  return 0;
+}], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
+         [dnl Guess it works except on glibc < 2.12.
+          AC_EGREP_CPP([Unlucky GNU user], [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
+  Unlucky GNU user
+ #endif
+#endif
+            ],
+            [gl_cv_func_duplocale_works="guessing no"],
+            [gl_cv_func_duplocale_works="guessing yes"])
+         ])
+      ])
+    case "$gl_cv_func_duplocale_works" in
+      *no) REPLACE_DUPLOCALE=1 ;;
+    esac
+  fi
+  if test $REPLACE_DUPLOCALE = 1; then
+    gl_REPLACE_LOCALE_H
+    AC_LIBOBJ([duplocale])
+    gl_PREREQ_DUPLOCALE
+  fi
+])
+
+# Prerequisites of lib/duplocale.c.
+AC_DEFUN([gl_PREREQ_DUPLOCALE],
+[
+  :
+])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index ea13933..d9dfab0 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
 
 
 # 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 --libtool 
--macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild 
byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write 
gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf 
inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring 
maintainer-makefile putenv stdlib strcase strftime striconveh string verify 
version-etc-fsf vsnprintf warnings
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool 
--macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild 
byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read 
full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib 
iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility 
libunistring locale maintainer-makefile putenv stdlib strcase strftime 
striconveh string verify version-etc-fsf vsnprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -26,6 +26,7 @@ gl_MODULES([
   autobuild
   byteswap
   canonicalize-lgpl
+  duplocale
   environ
   extensions
   flock
@@ -43,6 +44,7 @@ gl_MODULES([
   lib-symbol-versions
   lib-symbol-visibility
   libunistring
+  locale
   maintainer-makefile
   putenv
   stdlib
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 1e6e0a2..e66388b 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -57,6 +57,8 @@ AC_DEFUN([gl_INIT],
   gl_MODULE_INDICATOR([canonicalize-lgpl])
   gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
   gl_STDLIB_MODULE_INDICATOR([realpath])
+  gl_FUNC_DUPLOCALE
+  gl_LOCALE_MODULE_INDICATOR([duplocale])
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
   gl_HEADER_ERRNO_H
@@ -90,6 +92,7 @@ AC_DEFUN([gl_INIT],
   gl_LOCALCHARSET
   
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
   AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
+  gl_LOCALE_H
   gl_FUNC_LSTAT
   gl_SYS_STAT_MODULE_INDICATOR([lstat])
   gl_FUNC_MALLOC_POSIX
@@ -305,6 +308,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/c-strncasecmp.c
   lib/canonicalize-lgpl.c
   lib/config.charset
+  lib/duplocale.c
   lib/errno.in.h
   lib/float+.h
   lib/float.in.h
@@ -328,6 +332,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/inet_pton.c
   lib/localcharset.c
   lib/localcharset.h
+  lib/locale.in.h
   lib/lstat.c
   lib/malloc.c
   lib/malloca.c
@@ -405,6 +410,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/codeset.m4
   m4/dos.m4
   m4/double-slash-root.m4
+  m4/duplocale.m4
   m4/eealloc.m4
   m4/environ.m4
   m4/errno_h.m4
@@ -433,6 +439,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/locale-fr.m4
   m4/locale-ja.m4
   m4/locale-zh.m4
+  m4/locale_h.m4
   m4/longlong.m4
   m4/lstat.m4
   m4/malloc.m4
diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4
index bc05b05..c56a489 100644
--- a/m4/iconv_h.m4
+++ b/m4/iconv_h.m4
@@ -1,5 +1,5 @@
-# iconv_h.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# iconv_h.m4 serial 5
+dnl Copyright (C) 2007-2009 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.
@@ -7,6 +7,9 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_ICONV_H],
 [
   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+
+  dnl Execute this unconditionally, because ICONV_H may be set by other
+  dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([iconv.h])
 ])
 
diff --git a/m4/locale_h.m4 b/m4/locale_h.m4
new file mode 100644
index 0000000..35b8b32
--- /dev/null
+++ b/m4/locale_h.m4
@@ -0,0 +1,82 @@
+# locale_h.m4 serial 5
+dnl Copyright (C) 2007, 2009 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_LOCALE_H],
+[
+  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+  dnl once only, before all statements that occur in other macros.
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+
+  dnl Persuade glibc <locale.h> to define locale_t.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
+  AC_REQUIRE([gl_STDDEF_H])
+
+  AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
+    [gl_cv_header_locale_h_posix2001],
+    [AC_TRY_COMPILE([#include <locale.h>
+int x = LC_MESSAGES;], [],
+       [gl_cv_header_locale_h_posix2001=yes],
+       [gl_cv_header_locale_h_posix2001=no])])
+
+  dnl Check for <xlocale.h>.
+  AC_CHECK_HEADERS_ONCE([xlocale.h])
+  if test $ac_cv_header_xlocale_h = yes; then
+    HAVE_XLOCALE_H=1
+    dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
+    dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by
+    dnl itself, we assume that <xlocale.h> will do so.
+    AC_CACHE_CHECK([whether locale.h defines locale_t],
+      [gl_cv_header_locale_has_locale_t],
+      [AC_TRY_COMPILE([#include <locale.h>
+locale_t x;], [],
+         [gl_cv_header_locale_has_locale_t=yes],
+         [gl_cv_header_locale_has_locale_t=no])
+      ])
+    if test $gl_cv_header_locale_has_locale_t = yes; then
+      gl_cv_header_locale_h_needs_xlocale_h=no
+    else
+      gl_cv_header_locale_h_needs_xlocale_h=yes
+    fi
+  else
+    HAVE_XLOCALE_H=0
+    gl_cv_header_locale_h_needs_xlocale_h=no
+  fi
+  AC_SUBST([HAVE_XLOCALE_H])
+
+  dnl Execute this unconditionally, because LOCALE_H may be set by other
+  dnl modules, after this code is executed.
+  gl_CHECK_NEXT_HEADERS([locale.h])
+
+  if test -n "$STDDEF_H" \
+     || test $gl_cv_header_locale_h_posix2001 = no \
+     || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
+    gl_REPLACE_LOCALE_H
+  fi
+])
+
+dnl Unconditionally enables the replacement of <locale.h>.
+AC_DEFUN([gl_REPLACE_LOCALE_H],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  LOCALE_H=locale.h
+])
+
+AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_LOCALE_H_DEFAULTS],
+[
+  GNULIB_DUPLOCALE=0;  AC_SUBST([GNULIB_DUPLOCALE])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
+  LOCALE_H='';         AC_SUBST([LOCALE_H])
+])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 88e60a0..0a5b5d5 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 34
+# unistd_h.m4 serial 36
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -66,6 +66,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
   GNULIB_UNLINK=0;           AC_SUBST([GNULIB_UNLINK])
   GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
+  GNULIB_USLEEP=0;           AC_SUBST([GNULIB_USLEEP])
   GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
@@ -96,6 +97,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
@@ -111,9 +113,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
   REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
   REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
   REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
   REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
   REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
   REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
   UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
diff --git a/m4/wchar.m4 b/m4/wchar.m4
index ce53a45..9f22e33 100644
--- a/m4/wchar.m4
+++ b/m4/wchar.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 25
+# wchar.m4 serial 26
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -45,6 +45,8 @@ wchar_t w;]],
     HAVE_WCHAR_H=0
   fi
   AC_SUBST([HAVE_WCHAR_H])
+  dnl Execute this unconditionally, because WCHAR_H may be set by other
+  dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
diff --git a/maint.mk b/maint.mk
index 34d66e1..c3fab9a 100644
--- a/maint.mk
+++ b/maint.mk
@@ -63,6 +63,20 @@ my_distdir = $(PACKAGE)-$(VERSION)
 # Old releases are stored here.
 release_archive_dir ?= ../release
 
+# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for stable releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-stable = ftp.gnu.org
+gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
+
+ifeq ($(gnu_rel_host),ftp.gnu.org)
+url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
+else
+url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
+endif
+
 # Prevent programs like 'sort' from considering distinct strings to be equal.
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C
@@ -157,8 +171,17 @@ sc_prohibit_strcmp:
                1>&2; exit 1; } || :
 
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+# Convert all uses automatically, via these two commands:
+# git grep -l '\<exit *(1)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/'
+# git grep -l '\<exit *(0)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
 sc_prohibit_magic_number_exit:
-       @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'           \
+       @re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'   \
        msg='use EXIT_* values rather than magic number'                \
          $(_prohibit_regexp)
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]