guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-218-g6587b


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-218-g6587bcf
Date: Fri, 28 Feb 2014 05:19:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=6587bcfa53f620142e4f712ad347a25e3c33a9bc

The branch, stable-2.0 has been updated
       via  6587bcfa53f620142e4f712ad347a25e3c33a9bc (commit)
       via  bc8e6d7d8ca602c86591466f5e9d816a614700f5 (commit)
       via  ca6adcc6df462f325dfa7b099295fd6212d02b43 (commit)
       via  3243fffcc19144fc0b30e983c3e50d1d1fc19ef4 (commit)
       via  caa3d99be9932077230303a5571697f7d45f3da2 (commit)
      from  a8b80d6b29b33ea39c96e5e366a0365886b31dc8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6587bcfa53f620142e4f712ad347a25e3c33a9bc
Author: Mark H Weaver <address@hidden>
Date:   Thu Feb 27 21:31:57 2014 -0500

    SRFI-18: Export 'current-thread'.
    
    Fixes <http://debbugs.gnu.org/16890>.
    Reported by Xin Wang <address@hidden>.
    
    * module/srfi/srfi-18.scm: Reexport 'current-thread'.
    * THANKS: Add "Xin Wang" to fixes section.

commit bc8e6d7d8ca602c86591466f5e9d816a614700f5
Author: Mark H Weaver <address@hidden>
Date:   Thu Feb 27 22:04:39 2014 -0500

    Rely on Gnulib for <unistd.h>.
    
    * libguile/async.c:
    * libguile/backtrace.c:
    * libguile/error.c:
    * libguile/filesys.c:
    * libguile/fports.c:
    * libguile/gc-malloc.c:
    * libguile/gc.c:
    * libguile/gdbint.c:
    * libguile/init.c:
    * libguile/ioext.c:
    * libguile/load.c:
    * libguile/mallocs.c:
    * libguile/mkstemp.c:
    * libguile/ports.c:
    * libguile/posix.c:
    * libguile/r6rs-ports.c:
    * libguile/random.c:
    * libguile/rw.c:
    * libguile/scmsigs.c:
    * libguile/script.c:
    * libguile/simpos.c:
    * libguile/socket.c:
    * libguile/stime.c:
    * libguile/strports.c:
    * libguile/threads.c: Unconditionally include <unistd.h>.

commit ca6adcc6df462f325dfa7b099295fd6212d02b43
Author: Mark H Weaver <address@hidden>
Date:   Thu Feb 27 21:24:40 2014 -0500

    Rely on Gnulib for fsync, link, readlink, mkdir, rmdir, and rename.
    
    * libguile/filesys.c: Remove 'fsync' wrapper for MinGW.
      (scm_link, scm_readlink, scm_mkdir, scm_rmdir): Define these
      unconditionally.
      (my_rename): Remove.
      (scm_rename): Use 'rename' instead of 'my_rename'.

commit 3243fffcc19144fc0b30e983c3e50d1d1fc19ef4
Author: Mark H Weaver <address@hidden>
Date:   Wed Feb 26 22:15:13 2014 -0500

    Import Gnulib modules: link, fsync, readlink, rename, mkdir, rmdir, unistd.
    
    * lib/fsync.c:
    * lib/link.c:
    * lib/mkdir.c:
    * lib/strdup.c:
    * m4/fsync.m4:
    * m4/link.m4:
    * m4/mkdir.m4:
    * m4/strdup.m4: New files.
    
    * lib/Makefile.am
    * m4/gnulib-cache.m4
    * m4/gnulib-comp.m4: Add modules.

commit caa3d99be9932077230303a5571697f7d45f3da2
Author: Mark H Weaver <address@hidden>
Date:   Tue Feb 25 17:38:34 2014 -0500

    Fix typo in manual.
    
    * doc/ref/api-foreign.texi (Void Pointers and Byte Access):
      (rnrs bytevector) --> (rnrs bytevectors).

-----------------------------------------------------------------------

Summary of changes:
 THANKS                      |    1 +
 doc/ref/api-foreign.texi    |    2 +-
 lib/Makefile.am             |   38 ++++++++-
 lib/fsync.c                 |   83 +++++++++++++++++
 lib/link.c                  |  211 +++++++++++++++++++++++++++++++++++++++++++
 lib/mkdir.c                 |   93 +++++++++++++++++++
 lib/strdup.c                |   54 +++++++++++
 libguile/async.c            |    5 +-
 libguile/backtrace.c        |    5 +-
 libguile/error.c            |    4 +-
 libguile/filesys.c          |   40 +--------
 libguile/fports.c           |    2 -
 libguile/gc-malloc.c        |    5 +-
 libguile/gc.c               |    4 +-
 libguile/gdbint.c           |    6 +-
 libguile/init.c             |    5 +-
 libguile/ioext.c            |    5 +-
 libguile/load.c             |    5 +-
 libguile/mallocs.c          |    5 +-
 libguile/mkstemp.c          |    6 +-
 libguile/ports.c            |    5 +-
 libguile/posix.c            |    5 +-
 libguile/r6rs-ports.c       |    5 +-
 libguile/random.c           |    6 +-
 libguile/rw.c               |    4 +-
 libguile/scmsigs.c          |    5 +-
 libguile/script.c           |    4 +-
 libguile/simpos.c           |    4 +-
 libguile/socket.c           |    2 -
 libguile/stime.c            |    5 +-
 libguile/strports.c         |    4 +-
 libguile/threads.c          |    6 +-
 m4/{sockets.m4 => fsync.m4} |   18 ++--
 m4/gnulib-cache.m4          |    8 ++-
 m4/gnulib-comp.m4           |   33 +++++++
 m4/link.m4                  |   55 +++++++++++
 m4/mkdir.m4                 |   69 ++++++++++++++
 m4/strdup.m4                |   36 ++++++++
 module/srfi/srfi-18.scm     |    6 +-
 39 files changed, 731 insertions(+), 128 deletions(-)
 create mode 100644 lib/fsync.c
 create mode 100644 lib/link.c
 create mode 100644 lib/mkdir.c
 create mode 100644 lib/strdup.c
 copy m4/{sockets.m4 => fsync.m4} (52%)
 create mode 100644 m4/link.m4
 create mode 100644 m4/mkdir.m4
 create mode 100644 m4/strdup.m4

diff --git a/THANKS b/THANKS
index ddb11c1..faef9b6 100644
--- a/THANKS
+++ b/THANKS
@@ -183,6 +183,7 @@ For fixes or providing information which led to a fix:
        Andreas Vögele
         Michael Talbot-Wilson
         Michael Tuexen
+            Xin Wang
          Thomas Wawrzinek
         Mark H. Weaver
           Göran Weinholt
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 381c10d..c2c49ec 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -604,7 +604,7 @@ Unpack the pointer value from a pointer object.
 Wrapped pointers are untyped, so they are essentially equivalent to C
 @code{void} pointers.  As in C, the memory region pointed to by a
 pointer can be accessed at the byte level.  This is achieved using
address@hidden (@pxref{Bytevectors}).  The @code{(rnrs bytevector)}
address@hidden (@pxref{Bytevectors}).  The @code{(rnrs bytevectors)}
 module contains procedures that can be used to convert byte sequences to
 Scheme objects such as strings, floating point numbers, or integers.
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 18cb5e3..8b643c7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local 
--lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool 
--macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen 
autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close 
connect copysign dirfd duplocale environ extensions flock floor fpieee frexp 
fstat full-read full-write func gendocs getaddrinfo getlogin getpeername 
getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update 
gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp 
lib-symbol-versions lib-symbol-visibility libunistring listen localcharset 
locale log1p lstat maintainer-makefile malloc-gnu malloca mkstemp nl_langinfo 
nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send 
sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh 
string sys_stat time times trunc verify vsnprintf warnings wchar
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local 
--lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool 
--macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen 
autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close 
connect copysign dirfd duplocale environ extensions flock floor fpieee frexp 
fstat fsync full-read full-write func gendocs getaddrinfo getlogin getpeername 
getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update 
gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp 
lib-symbol-versions lib-symbol-visibility libunistring link listen localcharset 
locale log1p lstat maintainer-makefile malloc-gnu malloca mkdir mkstemp 
nl_langinfo nproc open pipe-posix pipe2 poll putenv readlink recv recvfrom 
regex rename rmdir select send sendto setenv setsockopt shutdown socket 
stat-time stdlib strftime striconveh string sys_stat time times trunc unistd 
verify vsnprintf warnings wchar
 
 AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects
 
@@ -567,6 +567,15 @@ EXTRA_libgnu_la_SOURCES += fstat.c
 
 ## end   gnulib module fstat
 
+## begin gnulib module fsync
+
+
+EXTRA_DIST += fsync.c
+
+EXTRA_libgnu_la_SOURCES += fsync.c
+
+## end   gnulib module fsync
+
 ## begin gnulib module full-read
 
 libgnu_la_SOURCES += full-read.h full-read.c
@@ -905,6 +914,15 @@ EXTRA_DIST += libunistring.valgrind
 
 ## end   gnulib module libunistring
 
+## begin gnulib module link
+
+
+EXTRA_DIST += link.c
+
+EXTRA_libgnu_la_SOURCES += link.c
+
+## end   gnulib module link
+
 ## begin gnulib module listen
 
 
@@ -1417,6 +1435,15 @@ EXTRA_libgnu_la_SOURCES += memchr.c
 
 ## end   gnulib module memchr
 
+## begin gnulib module mkdir
+
+
+EXTRA_DIST += mkdir.c
+
+EXTRA_libgnu_la_SOURCES += mkdir.c
+
+## end   gnulib module mkdir
+
 ## begin gnulib module mkstemp
 
 
@@ -2336,6 +2363,15 @@ EXTRA_DIST += stdlib.in.h
 
 ## end   gnulib module stdlib
 
+## begin gnulib module strdup-posix
+
+
+EXTRA_DIST += strdup.c
+
+EXTRA_libgnu_la_SOURCES += strdup.c
+
+## end   gnulib module strdup-posix
+
 ## begin gnulib module streq
 
 
diff --git a/lib/fsync.c b/lib/fsync.c
new file mode 100644
index 0000000..99475ff
--- /dev/null
+++ b/lib/fsync.c
@@ -0,0 +1,83 @@
+/* Emulate fsync on platforms that lack it, primarily Windows and
+   cross-compilers like MinGW.
+
+   This is derived from sqlite3 sources.
+   http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/os_win.c
+   http://www.sqlite.org/copyright.html
+
+   Written by Richard W.M. Jones <rjones.at.redhat.com>
+
+   Copyright (C) 2008-2014 Free Software Foundation, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+/* FlushFileBuffers */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# include <errno.h>
+
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
+
+int
+fsync (int fd)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD err;
+
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  if (!FlushFileBuffers (h))
+    {
+      /* Translate some Windows errors into rough approximations of Unix
+       * errors.  MSDN is useless as usual - in this case it doesn't
+       * document the full range of errors.
+       */
+      err = GetLastError ();
+      switch (err)
+        {
+        case ERROR_ACCESS_DENIED:
+          /* For a read-only handle, fsync should succeed, even though we have
+             no way to sync the access-time changes.  */
+          return 0;
+
+          /* eg. Trying to fsync a tty. */
+        case ERROR_INVALID_HANDLE:
+          errno = EINVAL;
+          break;
+
+        default:
+          errno = EIO;
+        }
+      return -1;
+    }
+
+  return 0;
+}
+
+#else /* !Windows */
+
+# error "This platform lacks fsync function, and Gnulib doesn't provide a 
replacement. This is a bug in Gnulib."
+
+#endif /* !Windows */
diff --git a/lib/link.c b/lib/link.c
new file mode 100644
index 0000000..9db1f8c
--- /dev/null
+++ b/lib/link.c
@@ -0,0 +1,211 @@
+/* Emulate link on platforms that lack it, namely native Windows platforms.
+
+   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_LINK
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+
+/* CreateHardLink was introduced only in Windows 2000.  */
+typedef BOOL (WINAPI * CreateHardLinkFuncType) (LPCTSTR lpFileName,
+                                                LPCTSTR lpExistingFileName,
+                                                LPSECURITY_ATTRIBUTES 
lpSecurityAttributes);
+static CreateHardLinkFuncType CreateHardLinkFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE kernel32 = GetModuleHandle ("kernel32.dll");
+  if (kernel32 != NULL)
+    {
+      CreateHardLinkFunc =
+        (CreateHardLinkFuncType) GetProcAddress (kernel32, "CreateHardLinkA");
+    }
+  initialized = TRUE;
+}
+
+int
+link (const char *file1, const char *file2)
+{
+  char *dir;
+  size_t len1 = strlen (file1);
+  size_t len2 = strlen (file2);
+  if (!initialized)
+    initialize ();
+  if (CreateHardLinkFunc == NULL)
+    {
+      /* System does not support hard links.  */
+      errno = EPERM;
+      return -1;
+    }
+  /* Reject trailing slashes on non-directories; mingw does not
+     support hard-linking directories.  */
+  if ((len1 && (file1[len1 - 1] == '/' || file1[len1 - 1] == '\\'))
+      || (len2 && (file2[len2 - 1] == '/' || file2[len2 - 1] == '\\')))
+    {
+      struct stat st;
+      if (stat (file1, &st) == 0 && S_ISDIR (st.st_mode))
+        errno = EPERM;
+      else
+        errno = ENOTDIR;
+      return -1;
+    }
+  /* CreateHardLink("b/.","a",NULL) creates file "b", so we must check
+     that dirname(file2) exists.  */
+  dir = strdup (file2);
+  if (!dir)
+    return -1;
+  {
+    struct stat st;
+    char *p = strchr (dir, '\0');
+    while (dir < p && (*--p != '/' && *p != '\\'));
+    *p = '\0';
+    if (p != dir && stat (dir, &st) == -1)
+      {
+        int saved_errno = errno;
+        free (dir);
+        errno = saved_errno;
+        return -1;
+      }
+    free (dir);
+  }
+  /* Now create the link.  */
+  if (CreateHardLinkFunc (file2, file1, NULL) == 0)
+    {
+      /* It is not documented which errors CreateHardLink() can produce.
+       * The following conversions are based on tests on a Windows XP SP2
+       * system. */
+      DWORD err = GetLastError ();
+      switch (err)
+        {
+        case ERROR_ACCESS_DENIED:
+          errno = EACCES;
+          break;
+
+        case ERROR_INVALID_FUNCTION:    /* fs does not support hard links */
+          errno = EPERM;
+          break;
+
+        case ERROR_NOT_SAME_DEVICE:
+          errno = EXDEV;
+          break;
+
+        case ERROR_PATH_NOT_FOUND:
+        case ERROR_FILE_NOT_FOUND:
+          errno = ENOENT;
+          break;
+
+        case ERROR_INVALID_PARAMETER:
+          errno = ENAMETOOLONG;
+          break;
+
+        case ERROR_TOO_MANY_LINKS:
+          errno = EMLINK;
+          break;
+
+        case ERROR_ALREADY_EXISTS:
+          errno = EEXIST;
+          break;
+
+        default:
+          errno = EIO;
+        }
+      return -1;
+    }
+
+  return 0;
+}
+
+# else /* !Windows */
+
+#  error "This platform lacks a link function, and Gnulib doesn't provide a 
replacement. This is a bug in Gnulib."
+
+# endif /* !Windows */
+#else /* HAVE_LINK */
+
+# undef link
+
+/* Create a hard link from FILE1 to FILE2, working around platform bugs.  */
+int
+rpl_link (char const *file1, char const *file2)
+{
+  size_t len1;
+  size_t len2;
+  struct stat st;
+
+  /* Don't allow IRIX to dereference dangling file2 symlink.  */
+  if (!lstat (file2, &st))
+    {
+      errno = EEXIST;
+      return -1;
+    }
+
+  /* Reject trailing slashes on non-directories.  */
+  len1 = strlen (file1);
+  len2 = strlen (file2);
+  if ((len1 && file1[len1 - 1] == '/')
+      || (len2 && file2[len2 - 1] == '/'))
+    {
+      /* Let link() decide whether hard-linking directories is legal.
+         If stat() fails, then link() should fail for the same reason
+         (although on Solaris 9, link("file/","oops") mistakenly
+         succeeds); if stat() succeeds, require a directory.  */
+      if (stat (file1, &st))
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+  else
+    {
+      /* Fix Cygwin 1.5.x bug where link("a","b/.") creates file "b".  */
+      char *dir = strdup (file2);
+      char *p;
+      if (!dir)
+        return -1;
+      /* We already know file2 does not end in slash.  Strip off the
+         basename, then check that the dirname exists.  */
+      p = strrchr (dir, '/');
+      if (p)
+        {
+          *p = '\0';
+          if (stat (dir, &st) == -1)
+            {
+              int saved_errno = errno;
+              free (dir);
+              errno = saved_errno;
+              return -1;
+            }
+        }
+      free (dir);
+    }
+  return link (file1, file2);
+}
+#endif /* HAVE_LINK */
diff --git a/lib/mkdir.c b/lib/mkdir.c
new file mode 100644
index 0000000..f1b802b
--- /dev/null
+++ b/lib/mkdir.c
@@ -0,0 +1,93 @@
+/* On some systems, mkdir ("foo/", 0700) fails because of the trailing
+   slash.  On those systems, this wrapper removes the trailing slash.
+
+   Copyright (C) 2001, 2003, 2006, 2008-2014 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "dirname.h"
+
+/* Disable the definition of mkdir to rpl_mkdir (from the <sys/stat.h>
+   substitute) in this file.  Otherwise, we'd get an endless recursion.  */
+#undef mkdir
+
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
+   which are included in the <sys/stat.h> override.  */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# define mkdir(name,mode) _mkdir (name)
+# define maybe_unused _GL_UNUSED
+#else
+# define maybe_unused /* empty */
+#endif
+
+/* This function is required at least for NetBSD 1.5.2.  */
+
+int
+rpl_mkdir (char const *dir, mode_t mode maybe_unused)
+{
+  int ret_val;
+  char *tmp_dir;
+  size_t len = strlen (dir);
+
+  if (len && dir[len - 1] == '/')
+    {
+      tmp_dir = strdup (dir);
+      if (!tmp_dir)
+        {
+          /* Rather than rely on strdup-posix, we set errno ourselves.  */
+          errno = ENOMEM;
+          return -1;
+        }
+      strip_trailing_slashes (tmp_dir);
+    }
+  else
+    {
+      tmp_dir = (char *) dir;
+    }
+#if FUNC_MKDIR_DOT_BUG
+  /* Additionally, cygwin 1.5 mistakenly creates a directory "d/./".  */
+  {
+    char *last = last_component (tmp_dir);
+    if (*last == '.' && (last[1] == '\0'
+                         || (last[1] == '.' && last[2] == '\0')))
+      {
+        struct stat st;
+        if (stat (tmp_dir, &st) == 0)
+          errno = EEXIST;
+        return -1;
+      }
+  }
+#endif /* FUNC_MKDIR_DOT_BUG */
+
+  ret_val = mkdir (tmp_dir, mode);
+
+  if (tmp_dir != dir)
+    free (tmp_dir);
+
+  return ret_val;
+}
diff --git a/lib/strdup.c b/lib/strdup.c
new file mode 100644
index 0000000..bde5829
--- /dev/null
+++ b/lib/strdup.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2014 Free Software
+   Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License 
along
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Get specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#undef __strdup
+#ifdef _LIBC
+# undef strdup
+#endif
+
+#ifndef weak_alias
+# define __strdup strdup
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+char *
+__strdup (const char *s)
+{
+  size_t len = strlen (s) + 1;
+  void *new = malloc (len);
+
+  if (new == NULL)
+    return NULL;
+
+  return (char *) memcpy (new, s, len);
+}
+#ifdef libc_hidden_def
+libc_hidden_def (__strdup)
+#endif
+#ifdef weak_alias
+weak_alias (__strdup, strdup)
+#endif
diff --git a/libguile/async.c b/libguile/async.c
index 66f0b04..419bf9b 100644
--- a/libguile/async.c
+++ b/libguile/async.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008, 2009, 
2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008,
+ *   2009, 2010, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -38,9 +39,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include <full-write.h>
 
diff --git a/libguile/backtrace.c b/libguile/backtrace.c
index b0dc0f1..f8283ab 100644
--- a/libguile/backtrace.c
+++ b/libguile/backtrace.c
@@ -1,5 +1,6 @@
 /* Printing of backtraces and error messages
- * Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2009, 2010, 
2011 Free Software Foundation
+ * Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2009,
+ *   2010, 2011, 2014 Free Software Foundation
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -26,9 +27,7 @@
 
 #include "libguile/_scm.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
diff --git a/libguile/error.c b/libguile/error.c
index 26cf5b6..b5565a0 100644
--- a/libguile/error.c
+++ b/libguile/error.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2010,
- *   2012, 2013 Free Software Foundation, Inc.
+ *   2012, 2013, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -40,9 +40,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 /* For Windows... */
 #ifdef HAVE_IO_H
diff --git a/libguile/filesys.c b/libguile/filesys.c
index c261928..09f6cf9 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006,
- *   2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ *   2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -72,9 +72,7 @@
 # endif
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef LIBC_H_WITH_UNISTD_H
 #include <libc.h>
@@ -110,12 +108,6 @@
 #include <full-write.h>
 
 
-/* Some more definitions for the native Windows port. */
-#ifdef __MINGW32__
-# define fsync(fd) _commit (fd)
-#endif /* __MINGW32__ */
-
-
 
 
 /* Two helper macros for an often used pattern */
@@ -590,7 +582,6 @@ SCM_DEFINE (scm_lstat, "lstat", 1, 0, 0,
 /* {Modifying Directories}
  */
 
-#ifdef HAVE_LINK
 SCM_DEFINE (scm_link, "link", 2, 0, 0,
             (SCM oldpath, SCM newpath),
            "Creates a new name @var{newpath} in the file system for the\n"
@@ -609,7 +600,6 @@ SCM_DEFINE (scm_link, "link", 2, 0, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif /* HAVE_LINK */
 
 
 /* {Navigating Directories}
@@ -1012,7 +1002,6 @@ SCM_DEFINE (scm_symlink, "symlink", 2, 0, 0,
 #undef FUNC_NAME
 #endif /* HAVE_SYMLINK */
 
-#ifdef HAVE_READLINK
 SCM_DEFINE (scm_readlink, "readlink", 1, 0, 0, 
             (SCM path),
            "Return the value of the symbolic link named by @var{path} (a\n"
@@ -1051,7 +1040,6 @@ SCM_DEFINE (scm_readlink, "readlink", 1, 0, 0,
   return result;
 }
 #undef FUNC_NAME
-#endif /* HAVE_READLINK */
 
 SCM_DEFINE (scm_copy_file, "copy-file", 2, 0, 0,
             (SCM oldfile, SCM newfile),
@@ -1254,7 +1242,6 @@ SCM_DEFINE (scm_getcwd, "getcwd", 0, 0, 0,
 #undef FUNC_NAME
 #endif /* HAVE_GETCWD */
 
-#ifdef HAVE_MKDIR
 SCM_DEFINE (scm_mkdir, "mkdir", 1, 1, 0,
             (SCM path, SCM mode),
            "Create a new directory named by @var{path}.  If @var{mode} is 
omitted\n"
@@ -1281,9 +1268,7 @@ SCM_DEFINE (scm_mkdir, "mkdir", 1, 1, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif /* HAVE_MKDIR */
 
-#ifdef HAVE_RMDIR
 SCM_DEFINE (scm_rmdir, "rmdir", 1, 0, 0, 
             (SCM path),
            "Remove the existing directory named by @var{path}.  The directory 
must\n"
@@ -1298,27 +1283,6 @@ SCM_DEFINE (scm_rmdir, "rmdir", 1, 0, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif
-
-#ifdef HAVE_RENAME
-#define my_rename rename
-#else
-static int
-my_rename (const char *oldname, const char *newname)
-{
-  int rv;
-
-  SCM_SYSCALL (rv = link (oldname, newname));
-  if (rv == 0)
-    {
-      SCM_SYSCALL (rv = unlink (oldname));
-      if (rv != 0)
-       /* unlink failed.  remove new name */
-       SCM_SYSCALL (unlink (newname)); 
-    }
-  return rv;
-}
-#endif
 
 SCM_DEFINE (scm_rename, "rename-file", 2, 0, 0,
             (SCM oldname, SCM newname),
@@ -1330,7 +1294,7 @@ SCM_DEFINE (scm_rename, "rename-file", 2, 0, 0,
 
   STRING2_SYSCALL (oldname, c_oldname,
                   newname, c_newname,
-                  rv = my_rename (c_oldname, c_newname));
+                  rv = rename (c_oldname, c_newname));
   if (rv != 0)
     SCM_SYSERROR;
   return SCM_UNSPECIFIED;
diff --git a/libguile/fports.c b/libguile/fports.c
index 365d3ff..5549bb1 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -33,9 +33,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 2aff4c3..12f52cd 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -1,5 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- *   2004, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ *   2004, 2006, 2008, 2009, 2010, 2011, 2012,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -59,9 +60,7 @@ extern unsigned long * 
__libc_ia64_register_backing_store_base;
 #include "libguile/debug-malloc.h"
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 /*
   INIT_MALLOC_LIMIT is the initial amount of malloc usage which will
diff --git a/libguile/gc.c b/libguile/gc.c
index 01e1ace..097cb3d 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006,
- *   2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ *   2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -69,9 +69,7 @@ extern unsigned long * 
__libc_ia64_register_backing_store_base;
 #include "libguile/debug-malloc.h"
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 /* Set this to != 0 if every cell that is accessed shall be checked:
  */
diff --git a/libguile/gdbint.c b/libguile/gdbint.c
index 7a0ebc9..0628c98 100644
--- a/libguile/gdbint.c
+++ b/libguile/gdbint.c
@@ -1,6 +1,6 @@
 /* GDB interface for Guile
- * Copyright (C) 1996,1997,1999,2000,2001,2002,2004,2009,2011,2012
- * Free Software Foundation, Inc.
+ * Copyright (C) 1996,1997,1999,2000,2001,2002,2004,2009,2011,2012,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -26,9 +26,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include "libguile/strports.h"
 #include "libguile/read.h"
diff --git a/libguile/init.c b/libguile/init.c
index 455a772..b320360 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -1,5 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- *   2004, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ *   2004, 2006, 2009, 2010, 2011, 2012, 2013,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -146,9 +147,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 
 
diff --git a/libguile/ioext.c b/libguile/ioext.c
index 089ef1a..d324cc2 100644
--- a/libguile/ioext.c
+++ b/libguile/ioext.c
@@ -1,4 +1,5 @@
-/*     Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2006 Free 
Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2006,
+ *   2014 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -41,9 +42,7 @@
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 
 SCM_DEFINE (scm_ftell, "ftell", 1, 0, 0, 
diff --git a/libguile/load.c b/libguile/load.c
index fbbbae4..50b3180 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2008,
- *   2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ *   2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -50,10 +50,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* HAVE_UNISTD_H */
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
diff --git a/libguile/mallocs.c b/libguile/mallocs.c
index 05c6a85..de11972 100644
--- a/libguile/mallocs.c
+++ b/libguile/mallocs.c
@@ -1,5 +1,6 @@
 /* classes: src_files 
- * Copyright (C) 1995,1997,1998,2000,2001, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 1995,1997,1998,2000,2001, 2006,
+ *   2014 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -32,9 +33,7 @@
 
 #include "libguile/mallocs.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 
 
diff --git a/libguile/mkstemp.c b/libguile/mkstemp.c
index a7eaf10..d752d07 100644
--- a/libguile/mkstemp.c
+++ b/libguile/mkstemp.c
@@ -1,4 +1,6 @@
-/* Copyright (C) 1991, 1992, 1996, 1998, 2001, 2006, 2013 Free Software 
Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1998, 2001, 2006, 2013,
+     2014 Free Software Foundation, Inc.
+
    This file is derived from mkstemps.c from the GNU Libiberty Library
    which in turn is derived from the GNU C Library.
 
@@ -33,9 +35,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
diff --git a/libguile/ports.c b/libguile/ports.c
index 720ffc1..be12a8d 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1,5 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006,
- *   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, 
Inc.
+ *   2007, 2008, 2009, 2010, 2011, 2012, 2013,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -71,9 +72,7 @@
 #include <io.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
diff --git a/libguile/posix.c b/libguile/posix.c
index 3e03c86..6a940e4 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1,5 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- *   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software 
Foundation, Inc.
+ *   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -46,9 +47,7 @@
 # endif
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef LIBC_H_WITH_UNISTD_H
 #include <libc.h>
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index 5f3b156..83f8996 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -20,10 +20,7 @@
 # include <config.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
+#include <unistd.h>
 #include <string.h>
 #include <stdio.h>
 #include <assert.h>
diff --git a/libguile/random.c b/libguile/random.c
index c0b04bc..18737aa 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -1,5 +1,6 @@
 /* Copyright (C) 1999, 2000, 2001, 2003, 2005, 2006, 2009, 2010,
- *    2012, 2013 Free Software Foundation, Inc.
+ *    2012, 2013, 2014 Free Software Foundation, Inc.
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; either version 3 of
@@ -31,10 +32,7 @@
 #include <math.h>
 #include <string.h>
 #include <sys/types.h>
-
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include "libguile/smob.h"
 #include "libguile/numbers.h"
diff --git a/libguile/rw.c b/libguile/rw.c
index a9b4a32..a64e6f8 100644
--- a/libguile/rw.c
+++ b/libguile/rw.c
@@ -1,4 +1,4 @@
-/*     Copyright (C) 2001, 2006, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2009, 2014 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -37,9 +37,7 @@
 #include "libguile/modules.h"
 #include "libguile/strports.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index 97435f4..f404b6a 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007, 
2008, 2009, 2011, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006,
+ *   2007, 2008, 2009, 2011, 2013, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -32,9 +33,7 @@
 #include <process.h>    /* for mingw */
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
diff --git a/libguile/script.c b/libguile/script.c
index 83daf8a..0d7b28f 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-1998, 2000-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1994-1998, 2000-2011, 2014 Free Software Foundation, Inc.
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; either version 3 of
@@ -46,9 +46,7 @@
 #include <string.h>
 #endif
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>            /* for X_OK define */
-#endif
 
 #ifdef HAVE_IO_H
 #include <io.h>
diff --git a/libguile/simpos.c b/libguile/simpos.c
index 8859d4f..6b3f51b 100644
--- a/libguile/simpos.c
+++ b/libguile/simpos.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2004, 2009,
- *   2010, 2012 Free Software Foundation, Inc.
+ *   2010, 2012, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -40,9 +40,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #if HAVE_SYS_WAIT_H
 # include <sys/wait.h>
 #endif
diff --git a/libguile/socket.c b/libguile/socket.c
index 09f4831..c0faae1 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -33,9 +33,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <sys/types.h>
 #include <sys/socket.h>
 #ifdef HAVE_UNIX_DOMAIN_SOCKETS
diff --git a/libguile/stime.c b/libguile/stime.c
index 78539d9..f430ca4 100644
--- a/libguile/stime.c
+++ b/libguile/stime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006, 
2007, 2008, 2009, 2011, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006,
+ *   2007, 2008, 2009, 2011, 2013, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -59,9 +60,7 @@
 #include "libguile/validate.h"
 #include "libguile/stime.h"
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 
 #ifdef HAVE_CLOCK_GETTIME
diff --git a/libguile/strports.c b/libguile/strports.c
index 582b5e9..f306019 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
- *   2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ *   2009, 2010, 2011, 2012, 2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -27,9 +27,7 @@
 #include "libguile/_scm.h"
 
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include "libguile/bytevectors.h"
 #include "libguile/eval.h"
diff --git a/libguile/threads.c b/libguile/threads.c
index 8fddbce..15e4919 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1,6 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004,
- *   2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
- *   Free Software Foundation, Inc.
+ *   2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
+ *   2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -28,9 +28,7 @@
 #include "libguile/_scm.h"
 
 #include <stdlib.h>
-#if HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdio.h>
 
 #ifdef HAVE_STRING_H
diff --git a/m4/sockets.m4 b/m4/fsync.m4
similarity index 52%
copy from m4/sockets.m4
copy to m4/fsync.m4
index da6ff74..888a65d 100644
--- a/m4/sockets.m4
+++ b/m4/fsync.m4
@@ -1,17 +1,17 @@
-# sockets.m4 serial 7
+# fsync.m4 serial 2
 dnl Copyright (C) 2008-2014 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.
 
-AC_DEFUN([gl_SOCKETS],
+AC_DEFUN([gl_FUNC_FSYNC],
 [
-  AC_REQUIRE([AC_C_INLINE])
-  AC_REQUIRE([gl_SOCKETLIB])
-  gl_PREREQ_SOCKETS
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fsync])
+  if test $ac_cv_func_fsync = no; then
+    HAVE_FSYNC=0
+  fi
 ])
 
-# Prerequisites of lib/sockets.c.
-AC_DEFUN([gl_PREREQ_SOCKETS], [
-  :
-])
+# Prerequisites of lib/fsync.c.
+AC_DEFUN([gl_PREREQ_FSYNC], [:])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 3c3c65d..fc7391c 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool 
--macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen 
autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close 
connect copysign dirfd duplocale environ extensions flock floor fpieee frexp 
fstat full-read full-write func gendocs getaddrinfo getlogin getpeername 
getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update 
gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp 
lib-symbol-versions lib-symbol-visibility libunistring listen localcharset 
locale log1p lstat maintainer-makefile malloc-gnu malloca mkstemp nl_langinfo 
nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send 
sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh 
string sys_stat time times trunc verify vsnprintf warnings wchar
+#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool 
--macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen 
autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close 
connect copysign dirfd duplocale environ extensions flock floor fpieee frexp 
fstat fsync full-read full-write func gendocs getaddrinfo getlogin getpeername 
getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update 
gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp 
lib-symbol-versions lib-symbol-visibility libunistring link listen localcharset 
locale log1p lstat maintainer-makefile malloc-gnu malloca mkdir mkstemp 
nl_langinfo nproc open pipe-posix pipe2 poll putenv readlink recv recvfrom 
regex rename rmdir select send sendto setenv setsockopt shutdown socket 
stat-time stdlib strftime striconveh string sys_stat time times trunc unistd 
verify vsnprintf warnings wchar
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gnulib-local])
@@ -55,6 +55,7 @@ gl_MODULES([
   fpieee
   frexp
   fstat
+  fsync
   full-read
   full-write
   func
@@ -79,6 +80,7 @@ gl_MODULES([
   lib-symbol-versions
   lib-symbol-visibility
   libunistring
+  link
   listen
   localcharset
   locale
@@ -87,6 +89,7 @@ gl_MODULES([
   maintainer-makefile
   malloc-gnu
   malloca
+  mkdir
   mkstemp
   nl_langinfo
   nproc
@@ -95,10 +98,12 @@ gl_MODULES([
   pipe2
   poll
   putenv
+  readlink
   recv
   recvfrom
   regex
   rename
+  rmdir
   select
   send
   sendto
@@ -115,6 +120,7 @@ gl_MODULES([
   time
   times
   trunc
+  unistd
   verify
   vsnprintf
   warnings
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 74a51f7..b333d6a 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -84,6 +84,7 @@ AC_DEFUN([gl_EARLY],
   AC_REQUIRE([gl_FP_IEEE])
   # Code from module frexp:
   # Code from module fstat:
+  # Code from module fsync:
   # Code from module full-read:
   # Code from module full-write:
   # Code from module func:
@@ -127,6 +128,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module lib-symbol-versions:
   # Code from module lib-symbol-visibility:
   # Code from module libunistring:
+  # Code from module link:
   # Code from module listen:
   # Code from module localcharset:
   # Code from module locale:
@@ -144,6 +146,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module mbsinit:
   # Code from module mbtowc:
   # Code from module memchr:
+  # Code from module mkdir:
   # Code from module mkstemp:
   # Code from module msvc-inval:
   # Code from module msvc-nothrow:
@@ -202,6 +205,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module stdint:
   # Code from module stdio:
   # Code from module stdlib:
+  # Code from module strdup-posix:
   # Code from module streq:
   # Code from module strftime:
   # Code from module striconveh:
@@ -365,6 +369,12 @@ AC_SUBST([LTALLOCA])
     gl_PREREQ_FSTAT
   fi
   gl_SYS_STAT_MODULE_INDICATOR([fstat])
+  gl_FUNC_FSYNC
+  if test $HAVE_FSYNC = 0; then
+    AC_LIBOBJ([fsync])
+    gl_PREREQ_FSYNC
+  fi
+  gl_UNISTD_MODULE_INDICATOR([fsync])
   gl_FUNC
   gl_GETADDRINFO
   if test $HAVE_GETADDRINFO = 0; then
@@ -499,6 +509,11 @@ AC_SUBST([LTALLOCA])
   gl_LD_VERSION_SCRIPT
   gl_VISIBILITY
   gl_LIBUNISTRING
+  gl_FUNC_LINK
+  if test $HAVE_LINK = 0 || test $REPLACE_LINK = 1; then
+    AC_LIBOBJ([link])
+  fi
+  gl_UNISTD_MODULE_INDICATOR([link])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([listen])
@@ -570,6 +585,10 @@ AC_SUBST([LTALLOCA])
     gl_PREREQ_MEMCHR
   fi
   gl_STRING_MODULE_INDICATOR([memchr])
+  gl_FUNC_MKDIR
+  if test $REPLACE_MKDIR = 1; then
+    AC_LIBOBJ([mkdir])
+  fi
   gl_FUNC_MKSTEMP
   if test $HAVE_MKSTEMP = 0 || test $REPLACE_MKSTEMP = 1; then
     AC_LIBOBJ([mkstemp])
@@ -752,6 +771,12 @@ AC_SUBST([LTALLOCA])
   gl_STDINT_H
   gl_STDIO_H
   gl_STDLIB_H
+  gl_FUNC_STRDUP_POSIX
+  if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+    AC_LIBOBJ([strdup])
+    gl_PREREQ_STRDUP
+  fi
+  gl_STRING_MODULE_INDICATOR([strdup])
   gl_FUNC_GNU_STRFTIME
   if test $gl_cond_libtool = false; then
     gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV"
@@ -1016,6 +1041,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/floor.c
   lib/frexp.c
   lib/fstat.c
+  lib/fsync.c
   lib/full-read.c
   lib/full-read.h
   lib/full-write.c
@@ -1055,6 +1081,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/itold.c
   lib/langinfo.in.h
   lib/libunistring.valgrind
+  lib/link.c
   lib/listen.c
   lib/localcharset.c
   lib/localcharset.h
@@ -1075,6 +1102,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/mbtowc.c
   lib/memchr.c
   lib/memchr.valgrind
+  lib/mkdir.c
   lib/mkstemp.c
   lib/msvc-inval.c
   lib/msvc-inval.h
@@ -1142,6 +1170,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/stdint.in.h
   lib/stdio.in.h
   lib/stdlib.in.h
+  lib/strdup.c
   lib/streq.h
   lib/strftime.c
   lib/strftime.h
@@ -1225,6 +1254,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/fpieee.m4
   m4/frexp.m4
   m4/fstat.m4
+  m4/fsync.m4
   m4/func.m4
   m4/getaddrinfo.m4
   m4/getlogin.m4
@@ -1257,6 +1287,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/lib-prefix.m4
   m4/libunistring-base.m4
   m4/libunistring.m4
+  m4/link.m4
   m4/localcharset.m4
   m4/locale-fr.m4
   m4/locale-ja.m4
@@ -1277,6 +1308,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/mbstate_t.m4
   m4/mbtowc.m4
   m4/memchr.m4
+  m4/mkdir.m4
   m4/mkstemp.m4
   m4/mmap-anon.m4
   m4/mode_t.m4
@@ -1328,6 +1360,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/stdint_h.m4
   m4/stdio_h.m4
   m4/stdlib_h.m4
+  m4/strdup.m4
   m4/strftime.m4
   m4/string_h.m4
   m4/sys_file_h.m4
diff --git a/m4/link.m4 b/m4/link.m4
new file mode 100644
index 0000000..e923d0d
--- /dev/null
+++ b/m4/link.m4
@@ -0,0 +1,55 @@
+# link.m4 serial 8
+dnl Copyright (C) 2009-2014 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.
+
+AC_DEFUN([gl_FUNC_LINK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([link])
+  if test $ac_cv_func_link = no; then
+    HAVE_LINK=0
+  else
+    AC_CACHE_CHECK([whether link obeys POSIX],
+      [gl_cv_func_link_works],
+      [touch conftest.a
+       # Assume that if we have lstat, we can also check symlinks.
+       if test $ac_cv_func_lstat = yes; then
+         ln -s conftest.a conftest.lnk
+       fi
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+           ]],
+           [[int result = 0;
+             if (!link ("conftest.a", "conftest.b/"))
+               result |= 1;
+#if HAVE_LSTAT
+             if (!link ("conftest.lnk/", "conftest.b"))
+               result |= 2;
+             if (rename ("conftest.a", "conftest.b"))
+               result |= 4;
+             if (!link ("conftest.b", "conftest.lnk"))
+               result |= 8;
+#endif
+             return result;
+           ]])],
+         [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no],
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_link_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_link_works="guessing no" ;;
+          esac
+         ])
+       rm -f conftest.a conftest.b conftest.lnk])
+    case "$gl_cv_func_link_works" in
+      *yes) ;;
+      *)
+        REPLACE_LINK=1
+        ;;
+    esac
+  fi
+])
diff --git a/m4/mkdir.m4 b/m4/mkdir.m4
new file mode 100644
index 0000000..51e78c1
--- /dev/null
+++ b/m4/mkdir.m4
@@ -0,0 +1,69 @@
+# serial 11
+
+# Copyright (C) 2001, 2003-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
+# On others, mkdir ("foo/./", 0700) mistakenly succeeds.
+# On such systems, arrange to use a wrapper function.
+AC_DEFUN([gl_FUNC_MKDIR],
+[dnl
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether mkdir handles trailing slash],
+    [gl_cv_func_mkdir_trailing_slash_works],
+    [rm -rf conftest.dir
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#       include <sys/types.h>
+#       include <sys/stat.h>
+]], [return mkdir ("conftest.dir/", 0700);])],
+      [gl_cv_func_mkdir_trailing_slash_works=yes],
+      [gl_cv_func_mkdir_trailing_slash_works=no],
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_mkdir_trailing_slash_works="guessing no" ;;
+       esac
+      ])
+    rm -rf conftest.dir
+    ]
+  )
+  case "$gl_cv_func_mkdir_trailing_slash_works" in
+    *yes) ;;
+    *)
+      REPLACE_MKDIR=1
+      ;;
+  esac
+
+  AC_CACHE_CHECK([whether mkdir handles trailing dot],
+    [gl_cv_func_mkdir_trailing_dot_works],
+    [rm -rf conftest.dir
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#       include <sys/types.h>
+#       include <sys/stat.h>
+]], [return !mkdir ("conftest.dir/./", 0700);])],
+      [gl_cv_func_mkdir_trailing_dot_works=yes],
+      [gl_cv_func_mkdir_trailing_dot_works=no],
+      [case "$host_os" in
+                 # Guess yes on glibc systems.
+         *-gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                 # If we don't know, assume the worst.
+         *)      gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
+       esac
+      ])
+    rm -rf conftest.dir
+    ]
+  )
+  case "$gl_cv_func_mkdir_trailing_dot_works" in
+    *yes) ;;
+    *)
+      REPLACE_MKDIR=1
+      AC_DEFINE([FUNC_MKDIR_DOT_BUG], [1], [Define to 1 if mkdir mistakenly
+        creates a directory given with a trailing dot component.])
+      ;;
+  esac
+])
diff --git a/m4/strdup.m4 b/m4/strdup.m4
new file mode 100644
index 0000000..1681a30
--- /dev/null
+++ b/m4/strdup.m4
@@ -0,0 +1,36 @@
+# strdup.m4 serial 13
+
+dnl Copyright (C) 2002-2014 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.
+
+AC_DEFUN([gl_FUNC_STRDUP],
+[
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([strdup])
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+AC_DEFUN([gl_FUNC_STRDUP_POSIX],
+[
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+  AC_CHECK_FUNCS_ONCE([strdup])
+  if test $ac_cv_func_strdup = yes; then
+    if test $gl_cv_func_malloc_posix != yes; then
+      REPLACE_STRDUP=1
+    fi
+  fi
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+# Prerequisites of lib/strdup.c.
+AC_DEFUN([gl_PREREQ_STRDUP], [:])
diff --git a/module/srfi/srfi-18.scm b/module/srfi/srfi-18.scm
index 4921a95..5b5b2a6 100644
--- a/module/srfi/srfi-18.scm
+++ b/module/srfi/srfi-18.scm
@@ -1,6 +1,6 @@
 ;;; srfi-18.scm --- Multithreading support
 
-;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2009, 2010, 2014 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -82,7 +82,7 @@
  uncaught-exception?
  uncaught-exception-reason
  )
-  :re-export (thread? mutex? condition-variable?)
+  :re-export (current-thread thread? mutex? condition-variable?)
   :replace (current-time 
            make-thread 
            make-mutex 
@@ -380,4 +380,4 @@
         (cons (inexact->exact fx)
               (inexact->exact (truncate (* (- x fx) 1000000)))))))
 
-;; srfi-18.scm ends here
\ No newline at end of file
+;; srfi-18.scm ends here


hooks/post-receive
-- 
GNU Guile



reply via email to

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