Author: cazfi
Date: Sat May 14 16:15:38 2016
New Revision: 32709

URL: http://svn.gna.org/viewcvs/freeciv?rev=32709&view=rev
Log:
Added configure test for setenv() availability and fallback to putenv() when 
it's not
available.

See bug #24658

Modified:
    trunk/configure.ac
    trunk/utility/shared.c

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=32709&r1=32708&r2=32709&view=diff
==============================================================================
--- trunk/configure.ac  (original)
+++ trunk/configure.ac  Sat May 14 16:15:38 2016
@@ -1356,7 +1356,7 @@
                getpwuid inet_aton select snooze strcasestr \
                strerror strlcat strlcpy strstr uname usleep \
                 getline _strcoll stricoll _stricoll strcasecoll \
-                backtrace])
+                backtrace setenv putenv])
 
 AC_MSG_CHECKING(for working gettimeofday)
   FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],

Modified: trunk/utility/shared.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.c?rev=32709&r1=32708&r2=32709&view=diff
==============================================================================
--- trunk/utility/shared.c      (original)
+++ trunk/utility/shared.c      Sat May 14 16:15:38 2016
@@ -1589,7 +1589,16 @@
 void switch_lang(const char *lang)
 {
 #ifdef FREECIV_ENABLE_NLS
+#ifdef HAVE_SETENV
   setenv("LANG", lang, TRUE);
+#else  /* HAVE_SETENV */
+  if (lang != NULL) {
+    static char envstr[40];
+
+    fc_snprintf(envstr, sizeof(envstr), "LANG=%s", lang);
+    putenv(envstr);
+  }
+#endif /* HAVE_SETENV */
 
   (void) setlocale(LC_ALL, "");
   (void) bindtextdomain("freeciv-core", get_locale_dir());


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to