]> Savannah Git Hosting - gnulib.git/commitdiff
Support compiling without -loldnames on native Windows.
authorBruno Haible <bruno@clisp.org>
Sat, 15 Aug 2020 14:54:17 +0000 (16:54 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 15 Aug 2020 14:54:17 +0000 (16:54 +0200)
* m4/gnulib-common.m4 (GL_MDA_DEFINES, _GL_MDA_DEFINES): New macros.
* m4/chown.m4 (AC_FUNC_CHOWN): In the test programs, use GL_MDA_DEFINES.
(gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise.
* m4/dup.m4 (gl_FUNC_DUP): Likewise.
* m4/dup2.m4 (gl_FUNC_DUP2): Likewise.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Likewise.
* m4/fchownat.m4 (gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Likewise.
* m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise.
* m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise.
* m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise.
* m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Likewise.
* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise.
* m4/freopen.m4 (gl_FUNC_FREOPEN): Likewise.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Likewise.
* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise.
* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise.
* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL, gl_FUNC_GETCWD_SIGNATURE):
Likewise.
* m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/lseek.m4 (gl_FUNC_LSEEK): Likewise.
* m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Likewise.
* m4/open-slash.m4 (gl_OPEN_TRAILING_SLASH_BUG): Likewise.
* m4/poll.m4 (gl_FUNC_POLL): Likewise.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise.
* m4/pread.m4 (gl_FUNC_PREAD): Likewise.
* m4/pselect.m4 (gl_FUNC_PSELECT): Likewise.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Likewise.
* m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise.
* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
* m4/pwrite.m4 (gl_FUNC_PWRITE): Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/select.m4 (gl_FUNC_SELECT): Likewise.
* m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise.
* m4/strncat.m4 (gl_FUNC_STRNCAT): Likewise.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise.
* m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/utimens.m4 (gl_UTIMENS): Likewise.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
* m4/utimes.m4 (gl_FUNC_UTIMES): Likewise.
* m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): On native Windows, don't
test for getcwd.
* m4/utime.m4 (gl_FUNC_UTIME): On native Windows, don't test for utime.
* m4/wcsdup.m4 (gl_FUNC_WCSDUP): To test for wcsdup, use a test program
with GL_MDA_DEFINES.
* lib/c++defs.h (_GL_CXXALIAS_MDA): New macro.
* lib/fcntl.in.h (creat, open):  On native Windows, use the underscore-
prefixed symbol.
* lib/search.in.h (lfind, lsearch): Likewise.
* lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
Likewise.
* lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
* lib/string.in.h (memccpy, strdup): Likewise.
* lib/sys_stat.in.h (chmod, umask): Likewise.
* lib/time.in.h (tzset): Likewise.
* lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
read, rmdir, swab, unlink, write): Likewise.
* lib/utime.in.h (utime): Likewise.
* lib/wchar.in.h (wcsdup): Likewise.
* lib/math.in.h (j0, j1, jn, y0, y1, yn):  Likewise.
(isfinite, isinf, isnan, signbit): On native Windows, don't define as an
rpl_-prefixed macro.
* lib/canonicalize-lgpl.c (__getcwd): On native Windows, use _getcwd.
* lib/close.c (close_nothrow): On native Windows, use _close.
* lib/creat.c (orig_creat): On native Windows, use _creat.
* lib/dup.c (dup_nothrow): On native Windows, use _dup.
* lib/dup2.c (dup2_nothrow): Use _dup2.
* lib/fdopen.c (fdopen_nothrow): On native Windows, use _fdopen.
* lib/getcwd-lgpl.c: On native Windows, use _getcwd.
* lib/getcwd.c (getcwd_nothrow): Use _getcwd also on mingw.
* lib/open.c (orig_open): On native Windows, use _open.
* lib/read.c (read_nothrow): Use _read.
* lib/rmdir.c: On native Windows, use _rmdir.
* lib/unlink.c: On native Windows, use _unlink.
* lib/write.c (write_nothrow): Use _write.
* lib/sys_select.in.h (close): With clang, don't attach a warning on an
undefined symbol.
* lib/sys_socket.in.h (close): Likewise.
* lib/sys_time.in.h (close): Likewise.
* tests/test-spawn-pipe-child.c: On native Windows, use _fdopen.

78 files changed:
ChangeLog
lib/c++defs.h
lib/canonicalize-lgpl.c
lib/close.c
lib/creat.c
lib/dup.c
lib/dup2.c
lib/fcntl.in.h
lib/fdopen.c
lib/getcwd-lgpl.c
lib/getcwd.c
lib/math.in.h
lib/open.c
lib/read.c
lib/rmdir.c
lib/search.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/string.in.h
lib/sys_select.in.h
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/sys_time.in.h
lib/time.in.h
lib/unistd.in.h
lib/unlink.c
lib/utime.in.h
lib/wchar.in.h
lib/write.c
m4/canonicalize.m4
m4/chown.m4
m4/dup.m4
m4/dup2.m4
m4/fchdir.m4
m4/fchmodat.m4
m4/fchownat.m4
m4/fcntl-o.m4
m4/fcntl.m4
m4/fdopen.m4
m4/fdopendir.m4
m4/fflush.m4
m4/fopen.m4
m4/freopen.m4
m4/futimens.m4
m4/getcwd-abort-bug.m4
m4/getcwd-path-max.m4
m4/getcwd.m4
m4/getdtablesize.m4
m4/gnulib-common.m4
m4/linkat.m4
m4/lseek.m4
m4/mkdir.m4
m4/mkstemp.m4
m4/mktime.m4
m4/open-slash.m4
m4/poll.m4
m4/posix_spawn.m4
m4/pread.m4
m4/pselect.m4
m4/pthread_sigmask.m4
m4/ptsname_r.m4
m4/putenv.m4
m4/pwrite.m4
m4/rename.m4
m4/rmdir-errno.m4
m4/rmdir.m4
m4/select.m4
m4/setenv.m4
m4/strncat.m4
m4/ttyname_r.m4
m4/unlink-busy.m4
m4/unlink.m4
m4/utime.m4
m4/utimens.m4
m4/utimensat.m4
m4/utimes.m4
m4/wcsdup.m4
tests/test-spawn-pipe-child.c

index d84d53fb19b5b82438e9da228bc8b2a76ad1b329..9b08d6f76e56da4d1dd6f4458d2174fffe88df54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,95 @@
+2020-08-15  Bruno Haible  <bruno@clisp.org>
+
+       Support compiling without -loldnames on native Windows.
+       * m4/gnulib-common.m4 (GL_MDA_DEFINES, _GL_MDA_DEFINES): New macros.
+       * m4/chown.m4 (AC_FUNC_CHOWN): In the test programs, use GL_MDA_DEFINES.
+       (gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise.
+       * m4/dup.m4 (gl_FUNC_DUP): Likewise.
+       * m4/dup2.m4 (gl_FUNC_DUP2): Likewise.
+       * m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise.
+       * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Likewise.
+       * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Likewise.
+       * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise.
+       * m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise.
+       * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise.
+       * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise.
+       * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Likewise.
+       * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise.
+       * m4/freopen.m4 (gl_FUNC_FREOPEN): Likewise.
+       * m4/futimens.m4 (gl_FUNC_FUTIMENS): Likewise.
+       * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise.
+       * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise.
+       * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL, gl_FUNC_GETCWD_SIGNATURE):
+       Likewise.
+       * m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Likewise.
+       * m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
+       * m4/lseek.m4 (gl_FUNC_LSEEK): Likewise.
+       * m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
+       * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
+       * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Likewise.
+       * m4/open-slash.m4 (gl_OPEN_TRAILING_SLASH_BUG): Likewise.
+       * m4/poll.m4 (gl_FUNC_POLL): Likewise.
+       * m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise.
+       * m4/pread.m4 (gl_FUNC_PREAD): Likewise.
+       * m4/pselect.m4 (gl_FUNC_PSELECT): Likewise.
+       * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Likewise.
+       * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise.
+       * m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
+       * m4/pwrite.m4 (gl_FUNC_PWRITE): Likewise.
+       * m4/rename.m4 (gl_FUNC_RENAME): Likewise.
+       * m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
+       * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
+       * m4/select.m4 (gl_FUNC_SELECT): Likewise.
+       * m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise.
+       * m4/strncat.m4 (gl_FUNC_STRNCAT): Likewise.
+       * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise.
+       * m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise.
+       * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
+       * m4/utimens.m4 (gl_UTIMENS): Likewise.
+       * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
+       * m4/utimes.m4 (gl_FUNC_UTIMES): Likewise.
+       * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): On native Windows, don't
+       test for getcwd.
+       * m4/utime.m4 (gl_FUNC_UTIME): On native Windows, don't test for utime.
+       * m4/wcsdup.m4 (gl_FUNC_WCSDUP): To test for wcsdup, use a test program
+       with GL_MDA_DEFINES.
+       * lib/c++defs.h (_GL_CXXALIAS_MDA): New macro.
+       * lib/fcntl.in.h (creat, open):  On native Windows, use the underscore-
+       prefixed symbol.
+       * lib/search.in.h (lfind, lsearch): Likewise.
+       * lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
+       Likewise.
+       * lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
+       * lib/string.in.h (memccpy, strdup): Likewise.
+       * lib/sys_stat.in.h (chmod, umask): Likewise.
+       * lib/time.in.h (tzset): Likewise.
+       * lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
+       execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
+       read, rmdir, swab, unlink, write): Likewise.
+       * lib/utime.in.h (utime): Likewise.
+       * lib/wchar.in.h (wcsdup): Likewise.
+       * lib/math.in.h (j0, j1, jn, y0, y1, yn):  Likewise.
+       (isfinite, isinf, isnan, signbit): On native Windows, don't define as an
+       rpl_-prefixed macro.
+       * lib/canonicalize-lgpl.c (__getcwd): On native Windows, use _getcwd.
+       * lib/close.c (close_nothrow): On native Windows, use _close.
+       * lib/creat.c (orig_creat): On native Windows, use _creat.
+       * lib/dup.c (dup_nothrow): On native Windows, use _dup.
+       * lib/dup2.c (dup2_nothrow): Use _dup2.
+       * lib/fdopen.c (fdopen_nothrow): On native Windows, use _fdopen.
+       * lib/getcwd-lgpl.c: On native Windows, use _getcwd.
+       * lib/getcwd.c (getcwd_nothrow): Use _getcwd also on mingw.
+       * lib/open.c (orig_open): On native Windows, use _open.
+       * lib/read.c (read_nothrow): Use _read.
+       * lib/rmdir.c: On native Windows, use _rmdir.
+       * lib/unlink.c: On native Windows, use _unlink.
+       * lib/write.c (write_nothrow): Use _write.
+       * lib/sys_select.in.h (close): With clang, don't attach a warning on an
+       undefined symbol.
+       * lib/sys_socket.in.h (close): Likewise.
+       * lib/sys_time.in.h (close): Likewise.
+       * tests/test-spawn-pipe-child.c: On native Windows, use _fdopen.
+
 2020-08-15  Bruno Haible  <bruno@clisp.org>
 
        Fix "unknown pragma ignored" warnings with clang on native Windows.
index cd56ea2c5c6c854e06b94f6285241c2608d7d7f6..de956d2eac8aea47f64b117121ab391a3b022305 100644 (file)
     _GL_EXTERN_C int _gl_cxxalias_dummy
 #endif
 
+/* _GL_CXXALIAS_MDA (func, rettype, parameters);
+   is to be used when func is a Microsoft deprecated alias, on native Windows.
+   It declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to _func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
+
 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
    except that the C function rpl_func may have a slightly different
index 9f990988393d77601b3ae67ef77f0e7898baae97..0b89d2a18426761c42a82f8fa074a79918fb948a 100644 (file)
@@ -52,7 +52,9 @@
 # include "pathmax.h"
 # include "malloca.h"
 # include "filename.h"
-# if HAVE_GETCWD
+# if defined _WIN32 && !defined __CYGWIN__
+#  define __getcwd _getcwd
+# elif HAVE_GETCWD
 #  if IN_RELOCWRAPPER
     /* When building the relocatable program wrapper, use the system's getcwd
        function, not the gnulib override, otherwise we would get a link error.
index 0c8780dc24abba7f58f0d8e9f9fbf10152362905..32503c03135f99f4b17b965e2f25f7b9a5abaf5f 100644 (file)
@@ -28,7 +28,8 @@
 
 #undef close
 
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static int
 close_nothrow (int fd)
 {
@@ -36,7 +37,7 @@ close_nothrow (int fd)
 
   TRY_MSVC_INVAL
     {
-      result = close (fd);
+      result = _close (fd);
     }
   CATCH_MSVC_INVAL
     {
@@ -47,6 +48,9 @@ close_nothrow (int fd)
 
   return result;
 }
+# else
+#  define close_nothrow _close
+# endif
 #else
 # define close_nothrow close
 #endif
index dcab4aa6655d95d8bb945a1f7c3caee6b8328cfa..a530828f146aced39375e65d98e455ff59c416f3 100644 (file)
 static int
 orig_creat (const char *filename, mode_t mode)
 {
+#if defined _WIN32 && !defined __CYGWIN__
+  return _creat (filename, mode);
+#else
   return creat (filename, mode);
+#endif
 }
 
 /* Specification.  */
index 974d4462ab9dce1217639ddfac79d4ba414a375b..0e38348a49fd1a7f1a24dc420f180aa5f05c672d 100644 (file)
--- a/lib/dup.c
+++ b/lib/dup.c
@@ -28,7 +28,8 @@
 
 #undef dup
 
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static int
 dup_nothrow (int fd)
 {
@@ -36,7 +37,7 @@ dup_nothrow (int fd)
 
   TRY_MSVC_INVAL
     {
-      result = dup (fd);
+      result = _dup (fd);
     }
   CATCH_MSVC_INVAL
     {
@@ -47,6 +48,9 @@ dup_nothrow (int fd)
 
   return result;
 }
+# else
+#  define dup_nothrow _dup
+# endif
 #elif defined __KLIBC__
 # include <fcntl.h>
 # include <sys/stat.h>
index 9bc3951f3d2cd71236b65b46b4022561c7ec1011..323e19b25ecd863e8661778919a6928ee2f3dfe0 100644 (file)
@@ -52,7 +52,7 @@ dup2_nothrow (int fd, int desired_fd)
 
   TRY_MSVC_INVAL
     {
-      result = dup2 (fd, desired_fd);
+      result = _dup2 (fd, desired_fd);
     }
   CATCH_MSVC_INVAL
     {
@@ -64,7 +64,7 @@ dup2_nothrow (int fd, int desired_fd)
   return result;
 }
 # else
-#  define dup2_nothrow dup2
+#  define dup2_nothrow _dup2
 # endif
 
 static int
index 0a21c957baf0850b6453a14dab7db93b3e8c9b6f..6f16bc6692150a23a36696b43012e6970b80c4fb 100644 (file)
 _GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
                              _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
 # else
 _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
 # endif
@@ -106,6 +112,9 @@ _GL_CXXALIASWARN (creat);
 /* Assume creat is always declared.  */
 _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
                  "use gnulib module creat for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef creat
+# define creat _creat
 #endif
 
 #if @GNULIB_FCNTL@
@@ -146,6 +155,12 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
                              _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
 # else
 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
 # endif
@@ -159,6 +174,9 @@ _GL_CXXALIASWARN (open);
 /* Assume open is always declared.  */
 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
                  "use gnulib module open for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef open
+# define open _open
 #endif
 
 #if @GNULIB_OPENAT@
index b0f13fa37dfd61b0b649b492ed824c5df7ea90ca..16ee6073cacb591c53fa02d596e623fb49ec9672 100644 (file)
@@ -27,7 +27,8 @@
 
 #undef fdopen
 
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static FILE *
 fdopen_nothrow (int fd, const char *mode)
 {
@@ -35,7 +36,7 @@ fdopen_nothrow (int fd, const char *mode)
 
   TRY_MSVC_INVAL
     {
-      result = fdopen (fd, mode);
+      result = _fdopen (fd, mode);
     }
   CATCH_MSVC_INVAL
     {
@@ -45,6 +46,9 @@ fdopen_nothrow (int fd, const char *mode)
 
   return result;
 }
+# else
+#  define fdopen_nothrow _fdopen
+# endif
 #else
 # define fdopen_nothrow fdopen
 #endif
index fca6bdefd347aa412ca96f9f46efef89a3e7cc23..90cfa0fe4d5bc472eb7c900dbbd073dda11242c7 100644 (file)
@@ -38,6 +38,10 @@ typedef int dummy;
    necessary.  */
 
 # undef getcwd
+# if defined _WIN32 && !defined __CYGWIN__
+#  define getcwd _getcwd
+# endif
+
 char *
 rpl_getcwd (char *buf, size_t size)
 {
index 1a42ef1bfa3300aec0b38afbf4392d8064c4593e..07c7927e48d84feb6c2178e086dcc2f4ab2b9e05 100644 (file)
 # undef closedir
 #endif
 \f
-#ifdef _MSC_VER
+#if defined _WIN32 && !defined __CYGWIN__
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
 static char *
 getcwd_nothrow (char *buf, size_t size)
index 4654a46a79eef04524cb7210613ddcafdf0fcd18..5dd162e0dec4b7a19e22a579fb23372c91e6f3d8 100644 (file)
@@ -1293,6 +1293,22 @@ _GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef j0
+# define j0 _j0
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef j1
+# define j1 _j1
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef jn
+# define jn _jn
+#endif
+
+
 /* Return x * 2^exp.  */
 #if @GNULIB_LDEXPF@
 # if !@HAVE_LDEXPF@
@@ -2241,6 +2257,22 @@ _GL_WARN_ON_USE (truncl, "truncl is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef y0
+# define y0 _y0
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef y1
+# define y1 _y1
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef yn
+# define yn _yn
+#endif
+
+
 /* Definitions of function-like macros come here, after the function
    declarations.  */
 
@@ -2260,7 +2292,7 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
 #  if defined isfinite || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
 #   undef isfinite
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isfinite through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
@@ -2294,7 +2326,7 @@ _GL_EXTERN_C int gl_isinfl (long double x);
 #  if defined isinf || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
 #   undef isinf
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isinf through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
@@ -2421,7 +2453,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
 #  if defined isnan || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
 #   undef isnan
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isnan through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
@@ -2504,7 +2536,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
 #  if defined signbit || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
 #   undef signbit
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines signbit through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
index 751b42d7dcf6489653ef2a0a892f5e42d965e6f0..0f7c6e9b9d304063b607b5724e54c5229e510d74 100644 (file)
 static int
 orig_open (const char *filename, int flags, mode_t mode)
 {
+#if defined _WIN32 && !defined __CYGWIN__
+  return _open (filename, flags, mode);
+#else
   return open (filename, flags, mode);
+#endif
 }
 
 /* Specification.  */
index 90d1053052a34d1f5879aabddc88970cd045737b..0fc60ea022b79199da2705721ae46a4ed0fca450 100644 (file)
@@ -51,7 +51,7 @@ read_nothrow (int fd, void *buf, size_t count)
 
   TRY_MSVC_INVAL
     {
-      result = read (fd, buf, count);
+      result = _read (fd, buf, count);
     }
   CATCH_MSVC_INVAL
     {
@@ -63,7 +63,7 @@ read_nothrow (int fd, void *buf, size_t count)
   return result;
 }
 # else
-#  define read_nothrow read
+#  define read_nothrow _read
 # endif
 
 ssize_t
index 2155224bd64c89964a807d2597a605cdabe2d9bd..18c386b26aab98ba1224bb205e29e0db6505302b 100644 (file)
@@ -26,6 +26,9 @@
 #include "filename.h"
 
 #undef rmdir
+#if defined _WIN32 && !defined __CYGWIN__
+# define rmdir _rmdir
+#endif
 
 /* Remove directory DIR.
    Return 0 if successful, -1 if not.  */
index 61116ed6723e1633b31b04e96c23172d182fdf17..d991dc71d51b0da545818b9166d6da23d86a5330 100644 (file)
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef lfind
+# define lfind _lfind
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef lsearch
+# define lsearch _lsearch
+#endif
+
+
 #if @GNULIB_TSEARCH@
 # if @REPLACE_TSEARCH@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
index f050e1024e4dbaedc729f7c602713a15c01621de..7308f401c81a7ee6c243156d28cddfff1cfdb4fc 100644 (file)
@@ -215,6 +215,11 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
                  "use gnulib module fclose for portable POSIX compliance");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fcloseall
+# define fcloseall _fcloseall
+#endif
+
 #if @GNULIB_FDOPEN@
 # if @REPLACE_FDOPEN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -224,6 +229,12 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
 _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
                                   _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen _fdopen
+#  endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
 # else
 _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
 # endif
@@ -233,6 +244,9 @@ _GL_CXXALIASWARN (fdopen);
 /* Assume fdopen is always declared.  */
 _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
                  "use gnulib module fdopen for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef fdopen
+# define fdopen _fdopen
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -297,6 +311,11 @@ _GL_CXXALIASWARN (fgets);
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fileno
+# define fileno _fileno
+#endif
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -824,6 +843,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef getw
+# define getw _getw
+#endif
+
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 struct obstack;
 /* Grow an obstack with formatted output.  Return the number of
@@ -1037,6 +1061,11 @@ _GL_CXXALIASWARN (puts);
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef putw
+# define putw _putw
+#endif
+
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1214,6 +1243,11 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
                  "POSIX compliance");
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef tempnam
+# define tempnam _tempnam
+#endif
+
 #if @GNULIB_TMPFILE@
 # if @REPLACE_TMPFILE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
index 5c598a275d1af51b0128f2f76d37d7458fa08ce0..47a1309e633dceddb9490698dba0e5855936e84c 100644 (file)
@@ -217,6 +217,21 @@ _GL_WARN_ON_USE (canonicalize_file_name,
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef ecvt
+# define ecvt _ecvt
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef fcvt
+# define fcvt _fcvt
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef gcvt
+# define gcvt _gcvt
+#endif
+
 #if @GNULIB_GETLOADAVG@
 /* Store max(NELEM,3) load average numbers in LOADAVG[].
    The three numbers are the load average of the last 1 minute, the last 5
@@ -468,6 +483,11 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
 # endif
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef mktemp
+# define mktemp _mktemp
+#endif
+
 #if @GNULIB_POSIX_OPENPT@
 /* Return an FD open to the master side of a pseudo-terminal.  Flags should
    include O_RDWR, and may also include O_NOCTTY.  */
@@ -546,10 +566,19 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
 #  endif
 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (putenv, int, (char *string));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+_GL_CXXALIAS_MDA (putenv, int, (char *string));
 # else
 _GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
 _GL_CXXALIASWARN (putenv);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef putenv
+# define putenv _putenv
 #endif
 
 #if @GNULIB_QSORT_R@
index 34b64cbfde6fdfeb4ad1732fa1c59bd16fa7aa08..4c88a373f82c3852fd55e5871fb11f5a03ce8895 100644 (file)
@@ -123,6 +123,12 @@ _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef memccpy
+# define memccpy _memccpy
+#endif
+
+
 /* Return the first instance of C within N bytes of S, or NULL.  */
 #if @GNULIB_MEMCHR@
 # if @REPLACE_MEMCHR@
@@ -384,6 +390,12 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup _strdup
+#  endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
 # else
 #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
     /* strdup exists as a function and as a macro.  Get rid of the macro.  */
@@ -401,6 +413,9 @@ _GL_CXXALIASWARN (strdup);
 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
                  "use gnulib module strdup for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef strdup
+# define strdup _strdup
 #endif
 
 /* Append no more than N characters from SRC onto DEST.  */
index 40212d232038505e00f4130ae48725b690f261bd..90bd540a3ecf0d0ed63854e0c8045d967e0e64c6 100644 (file)
@@ -177,7 +177,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef close
 #   define close close_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
     _GL_WARN_ON_USE (close,
                      "close() used without including <unistd.h>");
 #  endif
index 577947dc88de1f86ce04ce8aa77661cab89ddd7b..813fb3b4a14b1920f470f8e01c17c89403e081b7 100644 (file)
@@ -256,7 +256,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef close
 #   define close close_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
     _GL_WARN_ON_USE (close,
                      "close() used without including <unistd.h>");
 #  endif
index c1618a6597cb80b13e456731f376ed2839f0c706..68b9cf4b78a989d1f62fa253cdde71361d7637fd 100644 (file)
@@ -391,6 +391,12 @@ struct stat
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef chmod
+# define chmod _chmod
+#endif
+
+
 #if @GNULIB_FCHMODAT@
 # if @REPLACE_FCHMODAT@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -800,6 +806,12 @@ _GL_WARN_ON_USE (stat, "stat is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef umask
+# define umask _umask
+#endif
+
+
 #if @GNULIB_UTIMENSAT@
 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
    implementation relies on futimesat, which on Solaris 10 makes an invocation
index 65fa753ae30531d0223ec1d7a42a5aa84c1f696c..712b9896086028db1c1710a0d1072e79895855aa 100644 (file)
@@ -135,7 +135,7 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef close
 #   define close close_used_without_including_unistd_h
-#  else
+#  elif !defined __clang__
      _GL_WARN_ON_USE (close,
                       "close() used without including <unistd.h>");
 #  endif
index 7ad7d002a9ef6817cfbf3eb4dd179f4712842250..3b539c25664773f95c052900613d38acedfd6e7b 100644 (file)
@@ -135,10 +135,19 @@ _GL_CXXALIASWARN (nanosleep);
 #   endif
 _GL_FUNCDECL_RPL (tzset, void, (void));
 _GL_CXXALIAS_RPL (tzset, void, (void));
+#  elif defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
+#   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
 #  else
 _GL_CXXALIAS_SYS (tzset, void, (void));
 #  endif
 _GL_CXXALIASWARN (tzset);
+# elif defined _WIN32 && !defined __CYGWIN__
+#  undef tzset
+#  define tzset _tzset
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
index 3a4981391139b0e018becc9af87c088ba3d1e6eb..efe237fb2f4fc4e2a6124ee50e9198bcea3d046a 100644 (file)
@@ -273,6 +273,12 @@ _GL_INLINE_HEADER_BEGIN
 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
                                _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
 # else
 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
 # endif
@@ -286,11 +292,22 @@ _GL_WARN_ON_USE (access, "access does not always support X_OK - "
                  "also, this function is a security risk - "
                  "use the gnulib module faccessat instead");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef access
+# define access _access
 #endif
 
 
 #if @GNULIB_CHDIR@
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
 _GL_CXXALIASWARN (chdir);
 #elif defined GNULIB_POSIXCHECK
 # undef chdir
@@ -298,6 +315,9 @@ _GL_CXXALIASWARN (chdir);
 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
                  "use gnulib module chdir for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef chdir
+# define chdir _chdir
 #endif
 
 
@@ -342,6 +362,12 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
 #  endif
 _GL_FUNCDECL_RPL (close, int, (int fd));
 _GL_CXXALIAS_RPL (close, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
 # else
 _GL_CXXALIAS_SYS (close, int, (int fd));
 # endif
@@ -354,6 +380,9 @@ _GL_CXXALIASWARN (close);
 /* Assume close is always declared.  */
 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
                  "use gnulib module close for portability");
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef close
+# define close _close
 #endif
 
 
@@ -382,6 +411,12 @@ _GL_WARN_ON_USE (copy_file_range,
 #  endif
 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
 # else
 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
 # endif
@@ -392,6 +427,9 @@ _GL_CXXALIASWARN (dup);
 _GL_WARN_ON_USE (dup, "dup is unportable - "
                  "use gnulib module dup for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef dup
+# define dup _dup
 #endif
 
 
@@ -407,6 +445,12 @@ _GL_WARN_ON_USE (dup, "dup is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
 # else
 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
 # endif
@@ -417,6 +461,9 @@ _GL_CXXALIASWARN (dup2);
 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
                  "use gnulib module dup2 for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef dup2
+# define dup2 _dup2
 #endif
 
 
@@ -517,6 +564,43 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execl
+# define execl _execl
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execle
+# define execle _execle
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execlp
+# define execlp _execlp
+#endif
+
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execv
+# define execv _execv
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execve
+# define execve _execve
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execvp
+# define execvp _execvp
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# undef execvpe
+# define execvpe _execvpe
+#endif
+
+
 #if @GNULIB_FACCESSAT@
 # if @REPLACE_FACCESSAT@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -692,6 +776,12 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
 # else
 /* Need to cast, because on mingw, the second parameter is
                                                    int size.  */
@@ -704,6 +794,9 @@ _GL_CXXALIASWARN (getcwd);
 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
                  "use gnulib module getcwd for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef getcwd
+# define getcwd _getcwd
 #endif
 
 
@@ -1038,6 +1131,12 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef getpid
+# define getpid _getpid
+#endif
+
+
 #if @GNULIB_GETUSERSHELL@
 /* Return the next valid login shell on the system, or NULL when the end of
    the list has been reached.  */
@@ -1110,6 +1209,12 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (isatty, int, (int fd));
 _GL_CXXALIAS_RPL (isatty, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
 # else
 _GL_CXXALIAS_SYS (isatty, int, (int fd));
 # endif
@@ -1120,6 +1225,9 @@ _GL_CXXALIASWARN (isatty);
 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
                  "use gnulib module isatty for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef isatty
+# define isatty _isatty
 #endif
 
 
@@ -1231,6 +1339,12 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
 #  endif
 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
 # else
 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
 # endif
@@ -1241,6 +1355,9 @@ _GL_CXXALIASWARN (lseek);
 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
                  "systems - use gnulib module lseek for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef lseek
+# define lseek _lseek
 #endif
 
 
@@ -1373,6 +1490,12 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
                                  _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
 # else
 /* Need to cast, because on mingw, the third parameter is
                                                           unsigned int count
@@ -1380,6 +1503,9 @@ _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (read);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef read
+# define read _read
 #endif
 
 
@@ -1462,6 +1588,12 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
 #  endif
 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
 # else
 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
 # endif
@@ -1472,6 +1604,9 @@ _GL_CXXALIASWARN (rmdir);
 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
                  "use gnulib module rmdir for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef rmdir
+# define rmdir _rmdir
 #endif
 
 
@@ -1530,6 +1665,12 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #endif
 
 
+#if defined _WIN32 && !defined __CYGWIN__
+# undef swab
+# define swab _swab
+#endif
+
+
 #if @GNULIB_SYMLINK@
 # if @REPLACE_SYMLINK@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1654,6 +1795,12 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
 #  endif
 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
 # else
 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
 # endif
@@ -1664,6 +1811,9 @@ _GL_CXXALIASWARN (unlink);
 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
                  "use gnulib module unlink for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef unlink
+# define unlink _unlink
 #endif
 
 
@@ -1735,6 +1885,12 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
                                   _GL_ARG_NONNULL ((2)));
 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
 # else
 /* Need to cast, because on mingw, the third parameter is
                                                              unsigned int count
@@ -1742,6 +1898,9 @@ _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
 # endif
 _GL_CXXALIASWARN (write);
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef write
+# define write _write
 #endif
 
 _GL_INLINE_HEADER_END
index 35463fd102be4577427ea75aeaa85c794f24280e..ba5f6269c3ac0269ec68ae353aecead5b2f0b538 100644 (file)
@@ -27,6 +27,9 @@
 #include "filename.h"
 
 #undef unlink
+#if defined _WIN32 && !defined __CYGWIN__
+# define unlink _unlink
+#endif
 
 /* Remove file NAME.
    Return 0 if successful, -1 if not.  */
index 8ae44ed0585c48bbd15453dddfafbeecfc4f14d8..923826e20c6bf7d351c6fe446c84d336e897f358 100644 (file)
 _GL_FUNCDECL_RPL (utime, int, (const char *filename, const struct utimbuf *ts)
                               _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (utime, int, (const char *filename, const struct utimbuf *ts));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utime
+#   define utime _utime
+#  endif
+_GL_CXXALIAS_MDA (utime, int, (const char *filename, const struct utimbuf *ts));
 # else
 #  if !@HAVE_UTIME@
 _GL_FUNCDECL_SYS (utime, int, (const char *filename, const struct utimbuf *ts)
@@ -77,6 +83,9 @@ _GL_WARN_ON_USE (utime,
                  "utime is unportable - "
                  "use gnulib module canonicalize-lgpl for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef utime
+# define utime _utime
 #endif
 
 #if @GNULIB_UTIME@
index e52453359f89abbdae38a856b964bd8cfced5294..d09c2cb33c579dbe319c55ba849e8ec779b9cf14 100644 (file)
@@ -942,10 +942,18 @@ _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
 
 /* Duplicate S, returning an identical malloc'd string.  */
 #if @GNULIB_WCSDUP@
-# if !@HAVE_WCSDUP@
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsdup
+#   define wcsdup _wcsdup
+#  endif
+_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
+# else
+#  if !@HAVE_WCSDUP@
 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# endif
 _GL_CXXALIASWARN (wcsdup);
 #elif defined GNULIB_POSIXCHECK
 # undef wcsdup
@@ -953,6 +961,9 @@ _GL_CXXALIASWARN (wcsdup);
 _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
                  "use gnulib module wcsdup for portability");
 # endif
+#elif defined _WIN32 && !defined __CYGWIN__
+# undef wcsdup
+# define wcsdup _wcsdup
 #endif
 
 
index 581e674b40a8768390a1ea3ba5f28ba75309b878..deafb2ac0932f99cc507c4a91c05c2d0daf895a9 100644 (file)
@@ -57,7 +57,7 @@ write_nothrow (int fd, const void *buf, size_t count)
 
   TRY_MSVC_INVAL
     {
-      result = write (fd, buf, count);
+      result = _write (fd, buf, count);
     }
   CATCH_MSVC_INVAL
     {
@@ -69,7 +69,7 @@ write_nothrow (int fd, const void *buf, size_t count)
   return result;
 }
 # else
-#  define write_nothrow write
+#  define write_nothrow _write
 # endif
 
 ssize_t
index bdc5c8f71a76aba1de010432c80026131667375f..de64cf7ab067f23809f7b6629504cfb7ffef93f2 100644 (file)
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 31
+# canonicalize.m4 serial 32
 
 dnl Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc.
 
@@ -56,7 +56,16 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
 AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 [
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([canonicalize_file_name getcwd readlink])
+  AC_CHECK_FUNCS_ONCE([canonicalize_file_name readlink])
+
+  dnl On native Windows, we use _getcwd(), regardless whether getcwd() is
+  dnl available through the linker option '-loldnames'.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*) ;;
+    *)      AC_CHECK_FUNCS([getcwd]) ;;
+  esac
+
   AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
   AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
   AC_CHECK_HEADERS_ONCE([sys/param.h])
index 3638187aac20e743bd8c6202b5764a7d3350180e..e28750395d7c36da0f3a6bc78437d3b11bc4883a 100644 (file)
@@ -1,4 +1,4 @@
-# serial 34
+# serial 35
 # Determine whether we need the chown wrapper.
 
 dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2020 Free Software
@@ -27,7 +27,7 @@ AC_DEFUN([AC_FUNC_CHOWN],
        [AC_LANG_PROGRAM(
           [AC_INCLUDES_DEFAULT
            [#include <fcntl.h>
-          ]],
+          ]GL_MDA_DEFINES],
           [[
             char *f = "conftest.chown";
             struct stat before, after;
@@ -104,7 +104,8 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
-]], [[    if (symlink ("conftest.file", "conftest.link")) return 1;
+]GL_MDA_DEFINES],
+        [[if (symlink ("conftest.file", "conftest.link")) return 1;
           if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
         ]])],
         [gl_cv_func_chown_slash_works=yes],
@@ -137,7 +138,8 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-]], [[    struct stat st1, st2;
+]GL_MDA_DEFINES],
+        [[struct stat st1, st2;
           if (close (creat ("conftest.file", 0600))) return 1;
           if (stat ("conftest.file", &st1)) return 2;
           sleep (1);
@@ -179,7 +181,7 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK],
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
-
+]GL_MDA_DEFINES[
         int
         main ()
         {
index 1bf02347aff54f5d20e27832573ad84828db8842..892de99f4adcdc740ff4b889de965c3523c4228c 100644 (file)
--- a/m4/dup.m4
+++ b/m4/dup.m4
@@ -1,4 +1,4 @@
-# dup.m4 serial 6
+# dup.m4 serial 7
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,8 @@ AC_DEFUN([gl_FUNC_DUP],
     [AC_RUN_IFELSE(
       [AC_LANG_PROGRAM([[#include <unistd.h>
                          #include <fcntl.h>
-                         #include <errno.h>]],
+                         #include <errno.h>
+                       ]GL_MDA_DEFINES],
          [[/* On OS/2 kLIBC, dup does not work on a directory fd.  */
            int fd = open (".", O_RDONLY);
            return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0;
index 462bfd0e526956f2e4e88ebdd038f40e65657343..a82798d6bba898f299c3023ab24c5ab18895a302 100644 (file)
@@ -1,4 +1,4 @@
-#serial 26
+#serial 27
 dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_DUP2],
            #include <limits.h>
            #include <sys/resource.h>
            #include <unistd.h>
+           ]GL_MDA_DEFINES[
            #ifndef RLIM_SAVED_CUR
            # define RLIM_SAVED_CUR RLIM_INFINITY
            #endif
index dc2ba25183a664a22810dd9f5e724bdc5a4b3d7c..8e894e05cae5325902e403cf00aedfad98da320f 100644 (file)
@@ -1,4 +1,4 @@
-# fchdir.m4 serial 25
+# fchdir.m4 serial 26
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,21 +26,24 @@ AC_DEFUN([gl_FUNC_FCHDIR],
     dnl fstatat, since no platform has fstatat but lacks fchdir.
     AC_CACHE_CHECK([whether open can visit directories],
       [gl_cv_func_open_directory_works],
-      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
-]], [return open(".", O_RDONLY) < 0;])],
-        [gl_cv_func_open_directory_works=yes],
-        [gl_cv_func_open_directory_works=no],
-        [case "$host_os" in
-                            # Guess yes on Linux systems.
-           linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;;
-                            # Guess yes on glibc systems.
-           *-gnu* | gnu*)   gl_cv_func_open_directory_works="guessing yes" ;;
-                            # Guess no on native Windows.
-           mingw*)          gl_cv_func_open_directory_works="guessing no" ;;
-                            # If we don't know, obey --enable-cross-guesses.
-           *)               gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;;
-         esac
-        ])])
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <fcntl.h>
+            ]GL_MDA_DEFINES],
+            [[return open(".", O_RDONLY) < 0;]])],
+         [gl_cv_func_open_directory_works=yes],
+         [gl_cv_func_open_directory_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_open_directory_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_open_directory_works="guessing yes" ;;
+                             # Guess no on native Windows.
+            mingw*)          gl_cv_func_open_directory_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;;
+          esac
+         ])])
     case "$gl_cv_func_open_directory_works" in
       *yes) ;;
       *)
index e3f2f048162074f1c3e4ff7d7397a9f22ac3901a..cf5c87999c5e907c713a3121acad4731a2228851 100644 (file)
@@ -1,4 +1,4 @@
-# fchmodat.m4 serial 4
+# fchmodat.m4 serial 5
 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,7 +40,7 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
               #ifndef S_IRWXO
                #define S_IRWXO 0007
               #endif
-            ]],
+            ]GL_MDA_DEFINES],
             [[
               int permissive = S_IRWXU | S_IRWXG | S_IRWXO;
               int desired = S_IRUSR | S_IWUSR;
index 0a5d6370308cd1f9cfd7fcafc9e8530723500313..ea49906a543e5156fb903a605b1b24fc5ebf666e 100644 (file)
@@ -1,4 +1,4 @@
-# fchownat.m4 serial 6
+# fchownat.m4 serial 7
 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -90,7 +90,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
             #include <fcntl.h>
             /* Android 4.3 declares fchownat() in <sys/stat.h> instead.  */
             #include <sys/stat.h>
-          ]],
+          ]GL_MDA_DEFINES],
           [[int fd;
             int ret;
             if (mkdir ("conftestdir", 0700) < 0)
index 747b865759e566cc81766871c5e3c114081a1313..3ef061d84875f0a01b39876dc8a7061ec6efa3d3 100644 (file)
@@ -1,4 +1,4 @@
-# fcntl-o.m4 serial 6
+# fcntl-o.m4 serial 7
 dnl Copyright (C) 2006, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,6 +32,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
            # defined sleep(n) _sleep ((n) * 1000)
            #endif
            #include <fcntl.h>
+           ]GL_MDA_DEFINES[
            #ifndef O_NOATIME
             #define O_NOATIME 0
            #endif
index 562ae2395df12271a69ffd6032a9f6b5d8bd2b8f..ea24f3d64ef6234855fa5141315801eeccc57ff1 100644 (file)
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 9
+# fcntl.m4 serial 10
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_FCNTL],
               #include <limits.h>
               #include <sys/resource.h>
               #include <unistd.h>
+              ]GL_MDA_DEFINES[
               #ifndef RLIM_SAVED_CUR
               # define RLIM_SAVED_CUR RLIM_INFINITY
               #endif
index b1909dba0bf5ebb2f6b3ef961155a24f5f28b30f..f4d44259706163b61f563cbb7b9233b9e71c79cb 100644 (file)
@@ -1,4 +1,4 @@
-# fdopen.m4 serial 4
+# fdopen.m4 serial 5
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,6 +22,7 @@ AC_DEFUN([gl_FUNC_FDOPEN],
           [AC_LANG_SOURCE([[
 #include <stdio.h>
 #include <errno.h>
+]GL_MDA_DEFINES[
 int
 main (void)
 {
index d9cc1a0017311c87c610927c709cbdf779ef6d68..454e9adf9811da256f886c5dd4c3c8d24293f278 100644 (file)
@@ -1,4 +1,4 @@
-# serial 12
+# serial 13
 # See if we need to provide fdopendir.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -29,6 +29,7 @@ AC_DEFUN([gl_FUNC_FDOPENDIR],
 #include <dirent.h>
 #include <fcntl.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 #if !HAVE_DECL_FDOPENDIR
 extern
 # ifdef __cplusplus
index 620d1a70ed7432f57549fcb35d052c52e55d7fea..8f63c254a716ec7b18a4641ee140aa05cee073b5 100644 (file)
@@ -1,4 +1,4 @@
-# fflush.m4 serial 17
+# fflush.m4 serial 18
 
 # Copyright (C) 2007-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -38,7 +38,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
 #else /* on Windows with MSVC */
 # include <io.h>
 #endif
-       ]], [[FILE *f = fopen ("conftest.txt", "r");
+       ]GL_MDA_DEFINES],
+       [[FILE *f = fopen ("conftest.txt", "r");
          char buffer[10];
          int fd;
          int c;
index 8eab4a699e297a4de944652f648ab57b695a41b5..a5d687ab9eb94be77c3d3db2221f7ddb6155e969 100644 (file)
@@ -1,4 +1,4 @@
-# fopen.m4 serial 11
+# fopen.m4 serial 12
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -104,6 +104,7 @@ int main ()
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
+]GL_MDA_DEFINES[
 int main ()
 {
   FILE *fp = fopen ("conftest.x", "re");
index c088aadf3151248800d2381f02a6948cec81917b..24235aa4979bd16748d30aebb694c2cba5c4709c 100644 (file)
@@ -1,4 +1,4 @@
-# freopen.m4 serial 6
+# freopen.m4 serial 7
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_FREOPEN],
            [AC_LANG_PROGRAM(
               [[#include <stdio.h>
                 #include <unistd.h>
-              ]],
+              ]GL_MDA_DEFINES],
               [[close (0);
                 return !(freopen ("/dev/null", "r", stdin)
                          && getchar () == EOF
index dc5cfa94119b851b73141d5cc43607050d3c7f92..145b8ff0d51bafd2386bb1d862fdeb3f5669d71e 100644 (file)
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
 # See if we need to provide futimens replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -24,7 +24,8 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
-]], [[struct timespec ts[2];
+]GL_MDA_DEFINES],
+     [[struct timespec ts[2];
       int fd = creat ("conftest.file", 0600);
       struct stat st;
       if (fd < 0) return 1;
index d89dddf3650dcba7f0cd38ed3da76169ae93b3b0..d50648d1cb57b08fdaf8dff59f89865dbb5f7966 100644 (file)
@@ -1,4 +1,4 @@
-# serial 12
+# serial 13
 # Determine whether getcwd aborts when the length of the working directory
 # name is unusually large.  Any length between 4k and 16k trigger the bug
 # when using glibc-2.4.90-9 or older.
@@ -45,6 +45,7 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
 #include <sys/stat.h>
 
 ]gl_PATHMAX_SNIPPET[
+]GL_MDA_DEFINES[
 
 #ifndef S_IRWXU
 # define S_IRWXU 0700
index b0eea695c532d8f0a40b5ca7915e37675461cf77..859c7de820882791d44d380cf0e53d42516473d7 100644 (file)
@@ -1,4 +1,4 @@
-# serial 24
+# serial 25
 # Check for several getcwd bugs with long file names.
 # If so, arrange to compile the wrapper function.
 
@@ -55,6 +55,8 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
 /* Use the getcwd function, not any macro.  */
 #undef getcwd
 
+]GL_MDA_DEFINES[
+
 #ifndef S_IRWXU
 # define S_IRWXU 0700
 #endif
index ba68c5fb0af87d89b3192b29ab6dfe153b5b8d94..a646b90a32bfebd962434b1eb36d3529799b0440 100644 (file)
@@ -6,7 +6,7 @@
 # with or without modifications, as long as this notice is preserved.
 
 # Written by Paul Eggert.
-# serial 18
+# serial 19
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
@@ -21,12 +21,13 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
 #        else /* on Windows with MSVC */
 #         include <direct.h>
 #        endif
+         ]GL_MDA_DEFINES[
 #        ifndef getcwd
          char *getcwd ();
 #        endif
 ]], [[
 #if defined _WIN32 && ! defined __CYGWIN__
-/* mingw cwd does not start with '/', but getcwd does allocate.
+/* mingw cwd does not start with '/', but _getcwd does allocate.
    However, mingw fails to honor non-zero size.  */
 #else
            if (chdir ("/") != 0)
@@ -66,7 +67,8 @@ AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
     [gl_cv_func_getcwd_posix_signature],
     [AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
-         [[#include <unistd.h>]],
+         [[#include <unistd.h>
+         ]GL_MDA_DEFINES],
          [[extern
            #ifdef __cplusplus
            "C"
index ab2e3feb37ba4357de2d40e5d3b306e61917b3ec..af328644adb91a7a2253d7defc1905481639e09a 100644 (file)
@@ -1,4 +1,4 @@
-# getdtablesize.m4 serial 7
+# getdtablesize.m4 serial 8
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,13 +29,16 @@ AC_DEFUN([gl_FUNC_GETDTABLESIZE],
            dnl correctly require setrlimit before getdtablesize() can report
            dnl a larger value.
            AC_RUN_IFELSE([
-             AC_LANG_PROGRAM([[#include <unistd.h>]],
-               [int size = getdtablesize();
-                if (dup2 (0, getdtablesize()) != -1)
-                  return 1;
-                if (size != getdtablesize())
-                  return 2;
-               ])],
+             AC_LANG_PROGRAM(
+               [[#include <unistd.h>]
+                GL_MDA_DEFINES
+               ],
+               [[int size = getdtablesize();
+                 if (dup2 (0, getdtablesize()) != -1)
+                   return 1;
+                 if (size != getdtablesize())
+                   return 2;
+               ]])],
              [gl_cv_func_getdtablesize_works=yes],
              [gl_cv_func_getdtablesize_works=no],
              [case "$host_os" in
index 03da2287d48ad91609d4b92c90174b7710172430..c7d1e34f6a96356a6ecce5c48fab523e3e79540f 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 55
+# gnulib-common.m4 serial 56
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -663,3 +663,73 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
 # AS_VAR_COPY was added in autoconf 2.63b
 m4_define_default([AS_VAR_COPY],
 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
+
+dnl Expands to some code for use in .c programs that, on native Windows, defines
+dnl the Microsoft deprecated alias function names to the underscore-prefixed
+dnl actual function names. With this macro, these function names are available
+dnl without linking with '-loldnames' and without generating warnings.
+dnl Usage: Use it after all system header files are included.
+dnl          #include <...>
+dnl          #include <...>
+dnl          ]GL_MDA_DEFINES[
+dnl          ...
+AC_DEFUN([GL_MDA_DEFINES],[
+AC_REQUIRE([_GL_MDA_DEFINES])
+[$gl_mda_defines]
+])
+AC_DEFUN([_GL_MDA_DEFINES],
+[gl_mda_defines='
+#if defined _WIN32 && !defined __CYGWIN__
+#define access    _access
+#define chdir     _chdir
+#define chmod     _chmod
+#define close     _close
+#define creat     _creat
+#define dup       _dup
+#define dup2      _dup2
+#define ecvt      _ecvt
+#define execl     _execl
+#define execle    _execle
+#define execlp    _execlp
+#define execv     _execv
+#define execve    _execve
+#define execvp    _execvp
+#define execvpe   _execvpe
+#define fcloseall _fcloseall
+#define fcvt      _fcvt
+#define fdopen    _fdopen
+#define fileno    _fileno
+#define gcvt      _gcvt
+#define getcwd    _getcwd
+#define getpid    _getpid
+#define getw      _getw
+#define isatty    _isatty
+#define j0        _j0
+#define j1        _j1
+#define jn        _jn
+#define lfind     _lfind
+#define lsearch   _lsearch
+#define lseek     _lseek
+#define memccpy   _memccpy
+#define mkdir     _mkdir
+#define mktemp    _mktemp
+#define open      _open
+#define putenv    _putenv
+#define putw      _putw
+#define read      _read
+#define rmdir     _rmdir
+#define strdup    _strdup
+#define swab      _swab
+#define tempnam   _tempnam
+#define tzset     _tzset
+#define umask     _umask
+#define unlink    _unlink
+#define utime     _utime
+#define wcsdup    _wcsdup
+#define write     _write
+#define y0        _y0
+#define y1        _y1
+#define yn        _yn
+#endif
+'
+])
index 346e88e5f14b9e0c914b2508dc810ab556555b62..de1bf288b3577fb44e0fd990725e38a1cae941ef 100644 (file)
@@ -1,4 +1,4 @@
-# serial 11
+# serial 12
 # See if we need to provide linkat replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -58,7 +58,7 @@ AC_DEFUN([gl_FUNC_LINKAT],
               #include <fcntl.h>
               #include <errno.h>
               #include <stdio.h>
-            ]],
+            ]GL_MDA_DEFINES],
             [[int result;
               int fd;
               /* Create a regular file.  */
index 609c19a0fb660bc1fdddb0a1542164a30f5428db..472a1cbba088e5538c764f0653c43a30b4cab5bd 100644 (file)
@@ -1,4 +1,4 @@
-# lseek.m4 serial 10
+# lseek.m4 serial 11
 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,7 +32,8 @@ AC_DEFUN([gl_FUNC_LSEEK],
 #else /* on Windows with MSVC */
 # include <io.h>
 #endif
-]], [[
+]GL_MDA_DEFINES],
+[[
   /* Exit with success only if stdin is seekable.  */
   return lseek (0, (off_t)0, SEEK_CUR) < 0;
 ]])],
index 99212d914bb658a4bafcf05e536fcbcc72a7f6fe..bd9e0885912a6250e20d39290f46393c4076b40f 100644 (file)
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
 
 # Copyright (C) 2001, 2003-2004, 2006, 2008-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -16,33 +16,34 @@ AC_DEFUN([gl_FUNC_MKDIR],
   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 Linux systems.
-         linux-* | linux) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
-                          # Guess yes on glibc systems.
-         *-gnu* | gnu*)   gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
-                          # Guess yes on MSVC, no on mingw.
-         mingw*)          AC_EGREP_CPP([Known], [
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <sys/types.h>
+          #include <sys/stat.h>
+          ]GL_MDA_DEFINES],
+          [[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 Linux systems.
+          linux-* | linux) gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                           # Guess yes on glibc systems.
+          *-gnu* | gnu*)   gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                           # Guess yes on MSVC, no on mingw.
+          mingw*)          AC_EGREP_CPP([Known], [
 #ifdef _MSC_VER
  Known
 #endif
-                            ],
-                            [gl_cv_func_mkdir_trailing_slash_works="guessing yes"],
-                            [gl_cv_func_mkdir_trailing_slash_works="guessing no"])
-                          ;;
-                          # If we don't know, obey --enable-cross-guesses.
-         *)               gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;;
-       esac
-      ])
-    rm -rf conftest.dir
-    ]
-  )
+                             ],
+                             [gl_cv_func_mkdir_trailing_slash_works="guessing yes"],
+                             [gl_cv_func_mkdir_trailing_slash_works="guessing no"])
+                           ;;
+                           # If we don't know, obey --enable-cross-guesses.
+          *)               gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -rf conftest.dir
+    ])
   case "$gl_cv_func_mkdir_trailing_slash_works" in
     *yes) ;;
     *)
@@ -53,24 +54,26 @@ AC_DEFUN([gl_FUNC_MKDIR],
   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* | gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
-                        # Guess yes on musl systems.
-         *-musl*)       gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
-                        # Guess no on native Windows.
-         mingw*)        gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
-                        # If we don't know, obey --enable-cross-guesses.
-         *)             gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;;
-       esac
-      ])
-    rm -rf conftest.dir
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <sys/types.h>
+          #include <sys/stat.h>
+          ]GL_MDA_DEFINES],
+          [[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* | gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                         # Guess yes on musl systems.
+          *-musl*)       gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                         # Guess no on native Windows.
+          mingw*)        gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
+                         # If we don't know, obey --enable-cross-guesses.
+          *)             gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -rf conftest.dir
     ]
   )
   case "$gl_cv_func_mkdir_trailing_dot_works" in
index 28b788955a872a9f070b2e727b61a84e860b70ed..392f97cff5ca0bb4493924fa8725d72aa68fef8e 100644 (file)
@@ -1,4 +1,4 @@
-#serial 27
+#serial 28
 
 # Copyright (C) 2001, 2003-2007, 2009-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -26,7 +26,8 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
         mkdir conftest.mkstemp
         AC_RUN_IFELSE(
           [AC_LANG_PROGRAM(
-            [AC_INCLUDES_DEFAULT],
+            [AC_INCLUDES_DEFAULT
+             GL_MDA_DEFINES],
             [[int result = 0;
               int i;
               off_t large = (off_t) 4294967295u;
index 917e759dcbf073f557aa499521fbcdfe8daa88ca..4e7e423fa54c641e9d0226e6c5139ed1ce9abc4a 100644 (file)
@@ -1,4 +1,4 @@
-# serial 34
+# serial 35
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -54,6 +54,8 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
 # include <signal.h>
 #endif
 
+]GL_MDA_DEFINES[
+
 #ifndef TIME_T_IS_SIGNED
 # define TIME_T_IS_SIGNED 0
 #endif
index 1e57c96960e59f4418f0f6c8894f549325ad6780..5d84f2b548a1863d71db3bfdcc54fea43e9f4e77 100644 (file)
@@ -1,4 +1,4 @@
-# open-slash.m4 serial 1
+# open-slash.m4 serial 2
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,7 @@ AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG],
 #if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+]GL_MDA_DEFINES[
 int main ()
 {
   int result = 0;
index b47f2c30507d21545213511c5a5f03617dc54074..1a720d6385147fcd9b19ac17f9b0f53af261e8cc 100644 (file)
@@ -1,4 +1,4 @@
-# poll.m4 serial 19
+# poll.m4 serial 20
 dnl Copyright (c) 2003, 2005-2007, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,7 @@ AC_DEFUN([gl_FUNC_POLL],
        AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <fcntl.h>
 #include <poll.h>
+]GL_MDA_DEFINES[
          int main()
          {
            int result = 0;
index e97be557de22290f3916b38beceec50b8d1f07fa..625b2ad0e8a5089bc9be732a35cf1eff412a29ad 100644 (file)
@@ -1,4 +1,4 @@
-# posix_spawn.m4 serial 17
+# posix_spawn.m4 serial 18
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -123,6 +123,7 @@ AC_DEFUN([gl_POSIX_SPAWN_WORKS],
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+]GL_MDA_DEFINES[
 
 extern char **environ;
 
@@ -266,6 +267,7 @@ main ()
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+]GL_MDA_DEFINES[
 
 extern char **environ;
 
index 6b31fbaca7620d0e745de8c32e6a4adfc934c2a1..9e43dd6a4e98f54054ab1fb28d52d32dc9201f98 100644 (file)
@@ -1,4 +1,4 @@
-# pread.m4 serial 5
+# pread.m4 serial 6
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,7 @@ changequote([,])dnl
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdio.h>
-             ]],
+             ]GL_MDA_DEFINES],
              [[
 {
   int result = 0;
index f3e5afe0b388a9b9f1b42572007a458b63914084..08a5823c6f90c4224883a7f4ade52e5a77d9f41e 100644 (file)
@@ -1,4 +1,4 @@
-# pselect.m4 serial 8
+# pselect.m4 serial 9
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
 #endif
 #include <unistd.h>
 #include <errno.h>
-]],[[
+]GL_MDA_DEFINES],
+[[
   fd_set set;
   dup2(0, 16);
   FD_ZERO(&set);
index d67511f73dd214b452289463266c7550ccb375d2..030862de015af8c663c21f7aecfe8ea18c2e6920 100644 (file)
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 18
+# pthread_sigmask.m4 serial 19
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -220,6 +220,7 @@ int main ()
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 static volatile int sigint_occurred;
 static void
 sigint_handler (int sig)
index 181bfa1adb80220263938ee3978fb1fdeee6bf93..b77fd73c76906fe41f2cb9224d35ec325e3db9cc 100644 (file)
@@ -1,4 +1,4 @@
-# ptsname_r.m4 serial 6
+# ptsname_r.m4 serial 7
 dnl Copyright (C) 2010-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -90,7 +90,7 @@ AC_DEFUN([gl_PREREQ_PTSNAME_R], [
             #else
             # include <unistd.h>
             #endif
-          ]],
+          ]GL_MDA_DEFINES],
           [[errno = 0;
             isatty (-1);
             return errno == 0;
index e38f8c56940b4022a0c149fdf86c9839d6cdac3d..3799fb5f13419f0071178dab27db66f01535bab8 100644 (file)
@@ -1,4 +1,4 @@
-# putenv.m4 serial 24
+# putenv.m4 serial 25
 dnl Copyright (C) 2002-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,37 +14,41 @@ 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;
+    [gl_cv_func_svid_putenv],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [AC_INCLUDES_DEFAULT
+           GL_MDA_DEFINES],
+          [[
+            /* Put it in env.  */
+            if (putenv ("CONFTEST_putenv=val"))
+              return 1;
 
-    /* Try to remove it.  */
-    if (putenv ("CONFTEST_putenv"))
-      return 2;
+            /* Try to remove it.  */
+            if (putenv ("CONFTEST_putenv"))
+              return 2;
 
-    /* Make sure it was deleted.  */
-    if (getenv ("CONFTEST_putenv") != 0)
-      return 3;
+            /* 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* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
-                               # Guess yes on musl systems.
-                *-musl*)       gl_cv_func_svid_putenv="guessing yes" ;;
-                               # Guess no on native Windows.
-                mingw*)        gl_cv_func_svid_putenv="guessing no" ;;
-                               # If we don't know, obey --enable-cross-guesses.
-                *)             gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;;
-              esac
-             ])
-   ])
+            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* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
+                         # Guess yes on musl systems.
+          *-musl*)       gl_cv_func_svid_putenv="guessing yes" ;;
+                         # Guess no on native Windows.
+          mingw*)        gl_cv_func_svid_putenv="guessing no" ;;
+                         # If we don't know, obey --enable-cross-guesses.
+          *)             gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
   case "$gl_cv_func_svid_putenv" in
     *yes) ;;
     *)
index f8b5dbc2493d972a412c88980c69e509684c31c6..4c75676ff7ad59ac634d053d08c91edbbbbb4c55 100644 (file)
@@ -1,4 +1,4 @@
-# pwrite.m4 serial 5
+# pwrite.m4 serial 6
 dnl Copyright (C) 2010-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,7 @@ changequote([,])dnl
 #include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
-             ]],
+             ]GL_MDA_DEFINES],
              [[
 {
   /* This test fails on HP-UX 11.00..11.11.  */
index a1bd705728d124ee479732ca60d76d6f954b48b9..4c19f6125df4944595593a907c897b8596ce7ec8 100644 (file)
@@ -1,4 +1,4 @@
-# serial 32
+# serial 33
 
 # Copyright (C) 2001, 2003, 2005-2006, 2009-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -150,7 +150,7 @@ AC_DEFUN([gl_FUNC_RENAME],
 #               include <stdio.h>
 #               include <stdlib.h>
 #               include <unistd.h>
-                ]],
+                ]GL_MDA_DEFINES],
                 [[int result = 0;
                   if (rename ("conftest.f", "conftest.f1"))
                     result |= 1;
index d03206221dd8ac2c2dfa5b7585affecb5d5acb54..6eb4f10098e05f1cc2f93ed5462bba2674e72a99 100644 (file)
@@ -1,4 +1,4 @@
-# serial 13
+# serial 14
 
 # Copyright (C) 2000-2001, 2005-2006, 2009-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -26,6 +26,7 @@ AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY],
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+]GL_MDA_DEFINES[
         int main ()
         {
           FILE *s;
index ad1b192098682a2bfa4bfd6c6766ef09e9ad51fe..06aaf31e5ee7d35e33a636ea372259a84451555a 100644 (file)
@@ -1,4 +1,4 @@
-# rmdir.m4 serial 17
+# rmdir.m4 serial 18
 dnl Copyright (C) 2002, 2005, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,15 +22,16 @@ AC_DEFUN([gl_FUNC_RMDIR],
            #else /* on Windows with MSVC */
            # include <direct.h>
            #endif
-]], [[int result = 0;
-      if (!rmdir ("conftest.file/"))
-        result |= 1;
-      else if (errno != ENOTDIR)
-        result |= 2;
-      if (!rmdir ("conftest.dir/./"))
-        result |= 4;
-      return result;
-    ]])],
+         ]GL_MDA_DEFINES],
+         [[int result = 0;
+           if (!rmdir ("conftest.file/"))
+             result |= 1;
+           else if (errno != ENOTDIR)
+             result |= 2;
+           if (!rmdir ("conftest.dir/./"))
+             result |= 4;
+           return result;
+         ]])],
        [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
        [case "$host_os" in
                            # Guess yes on Linux systems.
index d950460bdaeb7d6c070c8052554629ac622ea8d8..90d2bb9492271181dd144d36fc34196d71cb7782 100644 (file)
@@ -1,4 +1,4 @@
-# select.m4 serial 11
+# select.m4 serial 12
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -60,7 +60,8 @@ changequote([,])dnl
 #endif
 #include <unistd.h>
 #include <errno.h>
-]],[[
+]GL_MDA_DEFINES],
+[[
   fd_set set;
   dup2(0, 16);
   FD_ZERO(&set);
index ef03673dce57483bd2361efbc0dead7723ea2faa..5dbf91306633d83fe54d4a656f8eadd298c2bafe 100644 (file)
@@ -1,4 +1,4 @@
-# setenv.m4 serial 29
+# setenv.m4 serial 30
 dnl Copyright (C) 2001-2004, 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -106,35 +106,39 @@ int unsetenv (const char *name);
     dnl OpenBSD 4.7 unsetenv("") does not fail.
     AC_CACHE_CHECK([whether unsetenv obeys POSIX],
       [gl_cv_func_unsetenv_works],
-      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-       #include <stdlib.h>
-       #include <errno.h>
-       extern char **environ;
-      ]], [[
-       char entry1[] = "a=1";
-       char entry2[] = "b=2";
-       char *env[] = { entry1, entry2, NULL };
-       if (putenv ((char *) "a=1")) return 1;
-       if (putenv (entry2)) return 2;
-       entry2[0] = 'a';
-       unsetenv ("a");
-       if (getenv ("a")) return 3;
-       if (!unsetenv ("") || errno != EINVAL) return 4;
-       entry2[0] = 'b';
-       environ = env;
-       if (!getenv ("a")) return 5;
-       entry2[0] = 'a';
-       unsetenv ("a");
-       if (getenv ("a")) return 6;
-      ]])],
-      [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
-      [case "$host_os" in
-                 # Guess yes on glibc systems.
-         *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
-                 # If we don't know, obey --enable-cross-guesses.
-         *)      gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
-       esac
-      ])])
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+            #include <stdlib.h>
+            #include <errno.h>
+            extern char **environ;
+           ]GL_MDA_DEFINES],
+           [[
+            char entry1[] = "a=1";
+            char entry2[] = "b=2";
+            char *env[] = { entry1, entry2, NULL };
+            if (putenv ((char *) "a=1")) return 1;
+            if (putenv (entry2)) return 2;
+            entry2[0] = 'a';
+            unsetenv ("a");
+            if (getenv ("a")) return 3;
+            if (!unsetenv ("") || errno != EINVAL) return 4;
+            entry2[0] = 'b';
+            environ = env;
+            if (!getenv ("a")) return 5;
+            entry2[0] = 'a';
+            unsetenv ("a");
+            if (getenv ("a")) return 6;
+           ]])],
+         [gl_cv_func_unsetenv_works=yes],
+         [gl_cv_func_unsetenv_works=no],
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+            *)      gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
     case "$gl_cv_func_unsetenv_works" in
       *yes) ;;
       *)
index b38ade6c9e18baaf4b4042d6ed06f7ec00162a66..16aefa6623889cb7beb55bfb1f52866116fca5ff 100644 (file)
@@ -1,4 +1,4 @@
-# strncat.m4 serial 4
+# strncat.m4 serial 5
 dnl Copyright (C) 2002-2004, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,7 +31,8 @@ AC_DEFUN_ONCE([gl_FUNC_STRNCAT],
 #  define MAP_FILE 0
 # endif
 #endif
-]], [[
+]GL_MDA_DEFINES],
+[[
   char *fence = NULL;
 #if HAVE_SYS_MMAN_H && HAVE_MPROTECT
 # if HAVE_MAP_ANONYMOUS
index 80514d8f1d52f82993997b1bf29eb43bf11920d1..869edc87de3c3136fa37aa69be86ea849b47c1c7 100644 (file)
@@ -1,4 +1,4 @@
-# ttyname_r.m4 serial 10
+# ttyname_r.m4 serial 11
 dnl Copyright (C) 2010-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -57,6 +57,7 @@ AC_DEFUN([gl_FUNC_TTYNAME_R],
                [AC_LANG_SOURCE([[
 #include <errno.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 int
 main (void)
 {
@@ -96,6 +97,7 @@ changequote([,])dnl
               [AC_LANG_SOURCE([[
 #include <fcntl.h>
 #include <unistd.h>
+]GL_MDA_DEFINES[
 int
 main (void)
 {
index 7bf6c91a5df65610a5b60d5a1d238f649e650482..7753f6a1a05b70c022e8086f72eb689f5682404a 100644 (file)
@@ -1,4 +1,4 @@
-#serial 14
+#serial 15
 
 dnl From J. David Anglin.
 
@@ -16,7 +16,8 @@ AC_DEFUN([gl_FUNC_UNLINK_BUSY_TEXT],
     [
       AC_RUN_IFELSE(
         [AC_LANG_SOURCE(
-           [AC_INCLUDES_DEFAULT[
+           [AC_INCLUDES_DEFAULT
+            GL_MDA_DEFINES[
             int
             main (int argc, char **argv)
             {
index b0bb731dc1794d2cc9e6260e9440e828fbacfd38..69d8ba5cd089293a9dcdc12c6625ff7a39924c9b 100644 (file)
@@ -1,4 +1,4 @@
-# unlink.m4 serial 14
+# unlink.m4 serial 15
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,7 @@ AC_DEFUN([gl_FUNC_UNLINK],
            # include <io.h>
            #endif
            #include <errno.h>
-         ]],
+         ]GL_MDA_DEFINES],
          [[int result = 0;
            if (!unlink ("conftest.file/"))
              result |= 1;
@@ -98,6 +98,7 @@ AC_DEFUN([gl_FUNC_UNLINK],
                 # include <direct.h>
                 # include <io.h>
                 #endif
+                ]GL_MDA_DEFINES[
                 int main ()
                 {
                   int result = 0;
index 25d6243da2c3d979b61f8ab57b4f3e903a9bb056..f0a82355523507578c6924197e340b32250e6518 100644 (file)
@@ -1,4 +1,4 @@
-# utime.m4 serial 1
+# utime.m4 serial 2
 dnl Copyright (C) 2017-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,18 +8,22 @@ AC_DEFUN([gl_FUNC_UTIME],
 [
   AC_REQUIRE([gl_UTIME_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_CHECK_FUNCS_ONCE([utime])
-  if test $ac_cv_func_utime = no; then
-    HAVE_UTIME=0
-  else
-    case "$host_os" in
-      mingw*)
-        dnl On this platform, the original utime() or _utime() produces
-        dnl timestamps that are affected by the time zone.
-        REPLACE_UTIME=1
-        ;;
-    esac
-  fi
+  case "$host_os" in
+    mingw*)
+      dnl On this platform, the original utime() or _utime() produces
+      dnl timestamps that are affected by the time zone.
+      dnl Use the function name 'rpl_utime' always, in order to avoid a
+      dnl possible conflict with the function name 'utime' from oldnames.lib
+      dnl (MSVC) or liboldnames.a (mingw).
+      REPLACE_UTIME=1
+      ;;
+    *)
+      AC_CHECK_FUNCS([utime])
+      if test $ac_cv_func_utime = no; then
+        HAVE_UTIME=0
+      fi
+      ;;
+  esac
 ])
 
 # Prerequisites of lib/utime.c.
index 65617ac862c8bf41bbfb24b0958c2145439f9c5c..3d31085fc6d5291194098505879c340beda7be91 100644 (file)
@@ -3,7 +3,7 @@ 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 serial 10
+dnl serial 11
 
 AC_DEFUN([gl_UTIMENS],
 [
@@ -24,7 +24,8 @@ AC_DEFUN([gl_UTIMENS],
 #include <stddef.h>
 #include <sys/times.h>
 #include <fcntl.h>
-]], [[    int fd = open ("conftest.file", O_RDWR);
+]GL_MDA_DEFINES],
+        [[int fd = open ("conftest.file", O_RDWR);
           if (fd < 0) return 1;
           if (futimesat (fd, NULL, NULL)) return 2;
         ]])],
index 2bc1bfebb5d714c0871eecb9e36d9b65d98a9c28..e9e4f26b1c19fffd916e43e6a3ed9ee83db56b63 100644 (file)
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
 # See if we need to provide utimensat replacement.
 
 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
@@ -23,7 +23,8 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <unistd.h>
-]],         [[int result = 0;
+]GL_MDA_DEFINES],
+            [[int result = 0;
               const char *f = "conftest.file";
               if (close (creat (f, 0600)))
                 return 1;
index e1056bbba4e5c7baa127b4fea585b320e08f83fe..877bfd2a735715869120fa6425719141120b1778 100644 (file)
@@ -1,5 +1,5 @@
 # Detect some bugs in glibc's implementation of utimes.
-# serial 7
+# serial 8
 
 dnl Copyright (C) 2003-2005, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -34,6 +34,7 @@ AC_DEFUN([gl_FUNC_UTIMES],
 #include <stdio.h>
 #include <utime.h>
 #include <errno.h>
+]GL_MDA_DEFINES[
 
 static int
 inorder (time_t a, time_t b, time_t c)
index 662f65a527b5066bdcea4e822e16f7dbf2785254..d0dde1cdefb6ef7ce287a8ac5a3aa8b0c2799c5b 100644 (file)
@@ -1,4 +1,4 @@
-# wcsdup.m4 serial 2
+# wcsdup.m4 serial 3
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,8 +7,26 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_WCSDUP],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([wcsdup])
-  if test $ac_cv_func_wcsdup = no; then
+  AC_CACHE_CHECK([for wcsdup],
+    [gl_cv_func_wcsdup],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
+   before <wchar.h>.  */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+          ]GL_MDA_DEFINES],
+          [[return wcsdup (L"hello") != NULL;]])
+       ],
+       [gl_cv_func_wcsdup=yes],
+       [gl_cv_func_wcsdup=no])
+    ])
+  if test $gl_cv_func_wcsdup = no; then
     HAVE_WCSDUP=0
   fi
 ])
index 36abb83d122d8794849f03e9d4b0309e42819c2c..2767d1e71b52e498b5e6eec0d1b3a6e6cdb65539 100644 (file)
@@ -48,6 +48,9 @@ static FILE *myerr;
 #undef fprintf
 #undef read
 #undef write
+#if defined _WIN32 && !defined __CYGWIN__
+# define fdopen _fdopen
+#endif
 
 /* Return non-zero if FD is open.  */
 static int