summaryrefslogtreecommitdiff
path: root/gnulib-local
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-local')
-rw-r--r--gnulib-local/build-aux/git-version-gen.diff49
-rw-r--r--gnulib-local/lib/localcharset.c.diff81
-rw-r--r--gnulib-local/lib/localcharset.h.diff22
-rw-r--r--gnulib-local/m4/clock_time.m4.diff28
4 files changed, 180 insertions, 0 deletions
diff --git a/gnulib-local/build-aux/git-version-gen.diff b/gnulib-local/build-aux/git-version-gen.diff
new file mode 100644
index 000000000..8451701d5
--- /dev/null
+++ b/gnulib-local/build-aux/git-version-gen.diff
@@ -0,0 +1,49 @@
+This patch is being discussed
+at <http://lists.gnu.org/archive/html/bug-gnulib/2012-07/msg00079.html>.
+Remove when integrated in Gnulib.
+
+diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
+index bd2c4b6..4458d7d 100755
+--- a/build-aux/git-version-gen
++++ b/build-aux/git-version-gen
+@@ -86,6 +86,7 @@ Print a version string.
+ Options:
+
+ --prefix PREFIX prefix of git tags (default 'v')
++ --match pattern for git tags to match (default: '\$prefix*')
+ --fallback VERSION
+ fallback version to use if \"git --version\" fails
+
+@@ -97,11 +98,15 @@ Running without arguments will suffice in most cases."
+ prefix=v
+ fallback=
+
++unset match
++unset tag_sed_script
++
+ while test $# -gt 0; do
+ case $1 in
+ --help) echo "$usage"; exit 0;;
+ --version) echo "$version"; exit 0;;
+ --prefix) shift; prefix=${1?};;
++ --match) shift; match="$1";;
+ --fallback) shift; fallback=${1?};;
+ -*)
+ echo "$0: Unknown option '$1'." >&2
+@@ -125,6 +130,7 @@ if test "x$tarball_version_file" = x; then
+ exit 1
+ fi
+
++match="${match:-$prefix*}"
+ tag_sed_script="${tag_sed_script:-s/x/x/}"
+
+ nl='
+@@ -155,7 +161,7 @@ then
+ # directory, and "git describe" output looks sensible, use that to
+ # derive a version string.
+ elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
+- && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
++ && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \
+ || git describe --abbrev=4 HEAD 2>/dev/null` \
+ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
+ && case $v in
diff --git a/gnulib-local/lib/localcharset.c.diff b/gnulib-local/lib/localcharset.c.diff
new file mode 100644
index 000000000..b1c249c19
--- /dev/null
+++ b/gnulib-local/lib/localcharset.c.diff
@@ -0,0 +1,81 @@
+Add a variant of `locale_charset' that returns its result based solely on
+information from the environment. See
+http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html for the
+rationale.
+
+--- a/lib/localcharset.c
++++ b/lib/localcharset.c
+@@ -544,3 +544,73 @@ locale_charset (void)
+
+ return codeset;
+ }
++
++/* A variant of the above, without calls to `setlocale', `nl_langinfo',
++ etc. */
++const char *
++environ_locale_charset (void)
++{
++ static char buf[2 + 10 + 1];
++ const char *codeset, *aliases;
++ const char *locale = NULL;
++
++ locale = getenv ("LC_ALL");
++ if (locale == NULL || locale[0] == '\0')
++ {
++ locale = getenv ("LC_CTYPE");
++ if (locale == NULL || locale[0] == '\0')
++ locale = getenv ("LANG");
++ }
++
++ if (locale != NULL && locale[0] != '\0')
++ {
++ /* If the locale name contains an encoding after the dot, return it. */
++ const char *dot = strchr (locale, '.');
++
++ if (dot != NULL)
++ {
++ const char *modifier;
++
++ dot++;
++ /* Look for the possible @... trailer and remove it, if any. */
++ modifier = strchr (dot, '@');
++ if (modifier == NULL)
++ return dot;
++ if (modifier - dot < sizeof (buf))
++ {
++ memcpy (buf, dot, modifier - dot);
++ buf [modifier - dot] = '\0';
++ return buf;
++ }
++ }
++ else if (strcmp (locale, "C") == 0)
++ {
++ strcpy (buf, "ASCII");
++ return buf;
++ }
++ else
++ codeset = "";
++ }
++ else
++ codeset = "";
++
++ /* Resolve alias. */
++ for (aliases = get_charset_aliases ();
++ *aliases != '\0';
++ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
++ if (strcmp (codeset, aliases) == 0
++ || (aliases[0] == '*' && aliases[1] == '\0'))
++ {
++ codeset = aliases + strlen (aliases) + 1;
++ break;
++ }
++
++ /* Don't return an empty string. GNU libc and GNU libiconv interpret
++ the empty string as denoting "the locale's character encoding",
++ thus GNU libiconv would call this function a second time. */
++ if (codeset[0] == '\0')
++ /* Default to Latin-1, for backward compatibility with Guile 1.8. */
++ codeset = "ISO-8859-1";
++
++ return codeset;
++}
diff --git a/gnulib-local/lib/localcharset.h.diff b/gnulib-local/lib/localcharset.h.diff
new file mode 100644
index 000000000..9e0b74b69
--- /dev/null
+++ b/gnulib-local/lib/localcharset.h.diff
@@ -0,0 +1,22 @@
+Add a variant of `locale_charset' that returns its result based solely on
+information from the environment. See
+http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html for the
+rationale.
+
+diff --git a/lib/localcharset.h b/lib/localcharset.h
+index 8907ccd..43e976f 100644
+--- a/lib/localcharset.h
++++ b/lib/localcharset.h
+@@ -32,6 +32,12 @@ extern "C" {
+ name. */
+ extern const char * locale_charset (void);
+
++/* Same as above, but only look at environment variables, avoiding calls to
++ `setlocale', `nl_langinfo', etc. See
++ <http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html> for
++ the rationale. */
++extern const char * environ_locale_charset (void);
++
+
+ #ifdef __cplusplus
+ }
diff --git a/gnulib-local/m4/clock_time.m4.diff b/gnulib-local/m4/clock_time.m4.diff
new file mode 100644
index 000000000..57d34e19c
--- /dev/null
+++ b/gnulib-local/m4/clock_time.m4.diff
@@ -0,0 +1,28 @@
+Remove when clock-gettime is fixed for clock_getcpuclockid.
+
+See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00227.html>
+for details.
+
+diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
+index 0bec0ef..fb3a17a 100644
+--- a/m4/clock_time.m4
++++ b/m4/clock_time.m4
+@@ -24,8 +24,15 @@ AC_DEFUN([gl_CLOCK_TIME],
+ AC_SUBST([LIB_CLOCK_GETTIME])
+ gl_saved_libs=$LIBS
+ AC_SEARCH_LIBS([clock_gettime], [rt posix4],
+- [test "$ac_cv_search_clock_gettime" = "none required" ||
+- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+- AC_CHECK_FUNCS([clock_gettime clock_settime])
++ [if test "$ac_cv_search_clock_gettime" = "none required"; then
++ AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
++ [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
++ || LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
++ [test "$ac_cv_search_clock_gettime" = "none required" \
++ || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
++ else
++ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
++ fi])
++ AC_CHECK_FUNCS([clock_gettime clock_settime clock_getcpuclockid])
+ LIBS=$gl_saved_libs
+ ])