Subject: bug#19874: 25.0.50; encode-time not working as expected

From: Paul Eggert <[email-masked]>
Date: Fri, 27 Feb 2015 00:09:21 -0800

Ashish SHUKLA wrote:
> So, looks like you're right it only happens with X11 (Gtk3) build

Please try the attached patch, which I've installed in the Emacs master.  It 
should work around the bug in FreeBSD 10.1 getenv that was identified in 
<http://bugs.gnu.org/19874#68>.
>From 1556eb079d0ce8207b17faad9861e52e07fd92f8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Fri, 27 Feb 2015 00:04:39 -0800
Subject: [PATCH] Don't require GNU putenv

* configure.ac: Use system putenv even if it lacks GNU features, as
we don't need them.  This works around a bug in FreeBSD 10.1 getenv.
Fixes: bug#19874
---
 ChangeLog    | 7 +++++++
 configure.ac | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 47ef578..0bfdfbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-27  Paul Eggert  <[email-masked]>
+
+	Don't require GNU putenv
+	* configure.ac: Use system putenv even if it lacks GNU features, as
+	we don't need them.  This works around a bug in FreeBSD 10.1 getenv.
+	Fixes: bug#19874
+
 2015-02-25  Paul Eggert  <[email-masked]>
 
 	Merge from gnulib
diff --git a/configure.ac b/configure.ac
index 0bcc55c..e7408f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -780,6 +780,11 @@ AC_DEFUN([gl_CRYPTO_CHECK])
 # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
 # as we don't use them.
 AC_DEFUN([gl_FCNTL_O_FLAGS])
+# Use the system putenv even if it lacks GNU features, as we don't need them,
+# and the gnulib replacement runs afoul of a FreeBSD 10.1 bug; see Bug#19874.
+AC_CHECK_FUNCS_ONCE([putenv])
+AC_DEFUN([gl_FUNC_PUTENV],
+  [test "$ac_cv_func_putenv" = yes || REPLACE_PUTENV=1])
 
 # Initialize gnulib right after choosing the compiler.
 dnl Amongst other things, this sets AR and ARFLAGS.
-- 
2.1.0