libtool-patches
[Top][All Lists]
Advanced

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

Fix the locale issue


From: Ralf Wildenhues
Subject: Fix the locale issue
Date: Wed, 22 Feb 2006 22:17:22 +0100
User-agent: Mutt/1.5.9i

This patch restores the environment for mode=execute.  Unfortunately,
it also means more overhead for every libtool invocation.  :-(
(At least no fork&exec.)

OK to apply?

I think sometime post-2.0 I will want to throw out AS_SHELL_SANITIZE
again, trade that in for AS_BOURNE_COMPATIBLE and some hand-written
parts: most of the overhead is lost in this initialization. :(

And we really have the chance to do that portably: we can detect $unset,
basename, and dirname and such all at configure time, not needing this
at runtime.  And then we can go back to saving/restoring only those
locale variables that we care about: now AS_SHELL_SANITIZE overwrites
them all, so we _have_ to store them all.

I am thinking a bit, though, whether there is something we could get
Autoconf to do, before their next release (so we don't have to wait
three years until we can use features from their next but one release).

Cheers,
Ralf

        * libltdl/config/ltmain.m4sh (startup): save all locale specific
        environment, variables:, LANG, LANGUAGE, LC_ADDRESS, LC_ALL
        LC_COLLATE, LC_CTYPE, LC_IDENTIFICATION, LC_MEASUREMENT,
        LC_MESSAGES LC_MONETARY, LC_NAME, LC_NUMERIC, LC_PAPER,
        LC_TELEPHONE, LC_TIME.
        (func_mode_execute): Restore them.

Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.38
diff -u -r1.38 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  15 Feb 2006 09:33:47 -0000      1.38
+++ libltdl/config/ltmain.m4sh  22 Feb 2006 16:40:00 -0000
@@ -77,6 +77,16 @@
 TIMESTAMP="@TIMESTAMP@"
 address@hidden@
 
+# NLS nuisances: We save the old values to restore during execute mode.
+# AS_SHELL_SANITIZE will take care of unsetting.
+for lt_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  eval "test \"\${$lt_var+set}\" = set && save_$lt_var=\$$lt_var"
+done
+
 AS_SHELL_SANITIZE
 $as_unset CDPATH
 
@@ -1628,12 +1682,17 @@
       fi
 
       # Restore saved environment variables
-      if test "${save_LC_ALL+set}" = set; then
-       LC_ALL="$save_LC_ALL"; export LC_ALL
-      fi
-      if test "${save_LANG+set}" = set; then
-       LANG="$save_LANG"; export LANG
-      fi
+      for lt_var in \
+       LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+       LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+       LC_TELEPHONE LC_TIME
+      do
+       eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var
+             else
+               $as_unset $lt_var
+             fi"
+      done
 
       # Now prepare to actually exec the command.
       exec_cmd="\$cmd$args"




reply via email to

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