mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-18 10:16:51 +00:00
5745a7df2b
* admin/merge-gnulib (GNULIB_MODULES): Add putenv, unsetenv. * lib/putenv.c, lib/unsetenv.c, m4/putenv.m4, m4/setenv.m4: New files, copied automatically from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/alloc.c (xputenv): New function. * src/dbusbind.c (Fdbus_init_bus): * src/emacs.c (main): * src/xterm.c (x_term_init): Use xputenv instead of setenv or putenv, to detect memory exhaustion. * src/editfns.c (initial_tz): Move static var decl up. (tzvalbuf_in_environ): New static var. (init_editfns): Initialize these two static vars. (Fencode_time): Don't assume arbitrary limit on EMACS_INT width. Save old TZ value on stack, if it's small. (Fencode_time, set_time_zone_rule): Don't modify 'environ' directly; instead, use xputenv+unsetenv to set and restore TZ. (environbuf): Remove static var. All uses removed. (Fset_time_zone_rule): Do not save TZ and environ; no longer needed here. (set_time_zone_rule_tz1, set_time_zone_rule_tz2) [LOCALTIME_CACHE]: Move to inside set_time_zone_rule; they don't need file scope any more. (set_time_zone_rule): Maintain the TZ=value string separately. (syms_of_editfns): Don't initialize initial_tz; init_editfns now does it. * src/emacs.c (dump_tz) [HAVE_TZSET]: Now const. * src/lisp.h (xputenv): New decl. Fixes: debbugs:13070
51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
# putenv.m4 serial 19
|
|
dnl Copyright (C) 2002-2012 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 Jim Meyering.
|
|
dnl
|
|
dnl Check whether putenv ("FOO") removes FOO from the environment.
|
|
dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
|
|
|
|
AC_DEFUN([gl_FUNC_PUTENV],
|
|
[
|
|
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([for putenv compatible with GNU and SVID],
|
|
[gl_cv_func_svid_putenv],
|
|
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[
|
|
/* Put it in env. */
|
|
if (putenv ("CONFTEST_putenv=val"))
|
|
return 1;
|
|
|
|
/* Try to remove it. */
|
|
if (putenv ("CONFTEST_putenv"))
|
|
return 2;
|
|
|
|
/* Make sure it was deleted. */
|
|
if (getenv ("CONFTEST_putenv") != 0)
|
|
return 3;
|
|
|
|
return 0;
|
|
]])],
|
|
gl_cv_func_svid_putenv=yes,
|
|
gl_cv_func_svid_putenv=no,
|
|
dnl When crosscompiling, assume putenv is broken.
|
|
[case "$host_os" in
|
|
# Guess yes on glibc systems.
|
|
*-gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
|
|
# If we don't know, assume the worst.
|
|
*) gl_cv_func_svid_putenv="guessing no" ;;
|
|
esac
|
|
])
|
|
])
|
|
case "$gl_cv_func_svid_putenv" in
|
|
*yes) ;;
|
|
*)
|
|
REPLACE_PUTENV=1
|
|
;;
|
|
esac
|
|
])
|