* 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>
+
+ 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.
_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
# 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.
#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)
{
TRY_MSVC_INVAL
{
- result = close (fd);
+ result = _close (fd);
}
CATCH_MSVC_INVAL
{
return result;
}
+# else
+# define close_nothrow _close
+# endif
#else
# define close_nothrow close
#endif
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. */
#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)
{
TRY_MSVC_INVAL
{
- result = dup (fd);
+ result = _dup (fd);
}
CATCH_MSVC_INVAL
{
return result;
}
+# else
+# define dup_nothrow _dup
+# endif
#elif defined __KLIBC__
# include <fcntl.h>
# include <sys/stat.h>
TRY_MSVC_INVAL
{
- result = dup2 (fd, desired_fd);
+ result = _dup2 (fd, desired_fd);
}
CATCH_MSVC_INVAL
{
return result;
}
# else
-# define dup2_nothrow dup2
+# define dup2_nothrow _dup2
# endif
static int
_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
/* 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@
_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
/* 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@
#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)
{
TRY_MSVC_INVAL
{
- result = fdopen (fd, mode);
+ result = _fdopen (fd, mode);
}
CATCH_MSVC_INVAL
{
return result;
}
+# else
+# define fdopen_nothrow _fdopen
+# endif
#else
# define fdopen_nothrow fdopen
#endif
necessary. */
# undef getcwd
+# if defined _WIN32 && !defined __CYGWIN__
+# define getcwd _getcwd
+# endif
+
char *
rpl_getcwd (char *buf, size_t size)
{
# 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)
#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@
#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. */
# 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)
# 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)
# 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)
# 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)
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. */
TRY_MSVC_INVAL
{
- result = read (fd, buf, count);
+ result = _read (fd, buf, count);
}
CATCH_MSVC_INVAL
{
return result;
}
# else
-# define read_nothrow read
+# define read_nothrow _read
# endif
ssize_t
#include "filename.h"
#undef rmdir
+#if defined _WIN32 && !defined __CYGWIN__
+# define rmdir _rmdir
+#endif
/* Remove directory DIR.
Return 0 if successful, -1 if not. */
/* 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)
"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)
_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
/* 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@
# 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)
_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
# 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)
"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)
# 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
# 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. */
# 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@
#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@
# 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. */
_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. */
# 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
# 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
#endif
+#if defined _WIN32 && !defined __CYGWIN__
+# undef chmod
+# define chmod _chmod
+#endif
+
+
#if @GNULIB_FCHMODAT@
# if @REPLACE_FCHMODAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#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
# 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
# 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. */
_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
"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
_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
# 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
/* 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
# 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
_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
# 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
_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
#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)
# 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. */
_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
#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. */
# 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
_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
# 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
_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
_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
_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
# 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
_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
#endif
+#if defined _WIN32 && !defined __CYGWIN__
+# undef swab
+# define swab _swab
+#endif
+
+
#if @GNULIB_SYMLINK@
# if @REPLACE_SYMLINK@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# 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
_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
_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
_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
#include "filename.h"
#undef unlink
+#if defined _WIN32 && !defined __CYGWIN__
+# define unlink _unlink
+#endif
/* Remove file NAME.
Return 0 if successful, -1 if not. */
_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)
"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@
/* 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
_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
TRY_MSVC_INVAL
{
- result = write (fd, buf, count);
+ result = _write (fd, buf, count);
}
CATCH_MSVC_INVAL
{
return result;
}
# else
-# define write_nothrow write
+# define write_nothrow _write
# endif
ssize_t
-# canonicalize.m4 serial 31
+# canonicalize.m4 serial 32
dnl Copyright (C) 2003-2007, 2009-2020 Free Software Foundation, Inc.
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])
-# serial 34
+# serial 35
# Determine whether we need the chown wrapper.
dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2020 Free Software
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT
[#include <fcntl.h>
- ]],
+ ]GL_MDA_DEFINES],
[[
char *f = "conftest.chown";
struct stat before, after;
#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],
#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);
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
-
+]GL_MDA_DEFINES[
int
main ()
{
-# 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,
[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;
-#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,
#include <limits.h>
#include <sys/resource.h>
#include <unistd.h>
+ ]GL_MDA_DEFINES[
#ifndef RLIM_SAVED_CUR
# define RLIM_SAVED_CUR RLIM_INFINITY
#endif
-# 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,
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) ;;
*)
-# 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,
#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;
-# 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,
#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)
-# 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,
# defined sleep(n) _sleep ((n) * 1000)
#endif
#include <fcntl.h>
+ ]GL_MDA_DEFINES[
#ifndef O_NOATIME
#define O_NOATIME 0
#endif
-# 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,
#include <limits.h>
#include <sys/resource.h>
#include <unistd.h>
+ ]GL_MDA_DEFINES[
#ifndef RLIM_SAVED_CUR
# define RLIM_SAVED_CUR RLIM_INFINITY
#endif
-# 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,
[AC_LANG_SOURCE([[
#include <stdio.h>
#include <errno.h>
+]GL_MDA_DEFINES[
int
main (void)
{
-# serial 12
+# serial 13
# See if we need to provide fdopendir.
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
+]GL_MDA_DEFINES[
#if !HAVE_DECL_FDOPENDIR
extern
# ifdef __cplusplus
-# 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
#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;
-# 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,
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
+]GL_MDA_DEFINES[
int main ()
{
FILE *fp = fopen ("conftest.x", "re");
-# 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,
[AC_LANG_PROGRAM(
[[#include <stdio.h>
#include <unistd.h>
- ]],
+ ]GL_MDA_DEFINES],
[[close (0);
return !(freopen ("/dev/null", "r", stdin)
&& getchar () == EOF
-# serial 8
+# serial 9
# See if we need to provide futimens replacement.
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
#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;
-# 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.
#include <sys/stat.h>
]gl_PATHMAX_SNIPPET[
+]GL_MDA_DEFINES[
#ifndef S_IRWXU
# define S_IRWXU 0700
-# serial 24
+# serial 25
# Check for several getcwd bugs with long file names.
# If so, arrange to compile the wrapper function.
/* Use the getcwd function, not any macro. */
#undef getcwd
+]GL_MDA_DEFINES[
+
#ifndef S_IRWXU
# define S_IRWXU 0700
#endif
# 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],
[
# 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)
[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"
-# 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,
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
-# 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,
# 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
+'
+])
-# serial 11
+# serial 12
# See if we need to provide linkat replacement.
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
- ]],
+ ]GL_MDA_DEFINES],
[[int result;
int fd;
/* Create a regular file. */
-# 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,
#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;
]])],
-# 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
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) ;;
*)
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
-#serial 27
+#serial 28
# Copyright (C) 2001, 2003-2007, 2009-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
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;
-# 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
# include <signal.h>
#endif
+]GL_MDA_DEFINES[
+
#ifndef TIME_T_IS_SIGNED
# define TIME_T_IS_SIGNED 0
#endif
-# 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,
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
+]GL_MDA_DEFINES[
int main ()
{
int result = 0;
-# 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,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <fcntl.h>
#include <poll.h>
+]GL_MDA_DEFINES[
int main()
{
int result = 0;
-# 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,
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+]GL_MDA_DEFINES[
extern char **environ;
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
+]GL_MDA_DEFINES[
extern char **environ;
-# 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,
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
- ]],
+ ]GL_MDA_DEFINES],
[[
{
int result = 0;
-# 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,
#endif
#include <unistd.h>
#include <errno.h>
-]],[[
+]GL_MDA_DEFINES],
+[[
fd_set set;
dup2(0, 16);
FD_ZERO(&set);
-# 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,
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+]GL_MDA_DEFINES[
static volatile int sigint_occurred;
static void
sigint_handler (int sig)
-# 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,
#else
# include <unistd.h>
#endif
- ]],
+ ]GL_MDA_DEFINES],
[[errno = 0;
isatty (-1);
return errno == 0;
-# 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,
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) ;;
*)
-# 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,
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
- ]],
+ ]GL_MDA_DEFINES],
[[
{
/* This test fails on HP-UX 11.00..11.11. */
-# 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
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
- ]],
+ ]GL_MDA_DEFINES],
[[int result = 0;
if (rename ("conftest.f", "conftest.f1"))
result |= 1;
-# 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
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+]GL_MDA_DEFINES[
int main ()
{
FILE *s;
-# 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,
#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.
-# 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,
#endif
#include <unistd.h>
#include <errno.h>
-]],[[
+]GL_MDA_DEFINES],
+[[
fd_set set;
dup2(0, 16);
FD_ZERO(&set);
-# 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,
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) ;;
*)
-# 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,
# define MAP_FILE 0
# endif
#endif
-]], [[
+]GL_MDA_DEFINES],
+[[
char *fence = NULL;
#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
# if HAVE_MAP_ANONYMOUS
-# 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,
[AC_LANG_SOURCE([[
#include <errno.h>
#include <unistd.h>
+]GL_MDA_DEFINES[
int
main (void)
{
[AC_LANG_SOURCE([[
#include <fcntl.h>
#include <unistd.h>
+]GL_MDA_DEFINES[
int
main (void)
{
-#serial 14
+#serial 15
dnl From J. David Anglin.
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE(
- [AC_INCLUDES_DEFAULT[
+ [AC_INCLUDES_DEFAULT
+ GL_MDA_DEFINES[
int
main (int argc, char **argv)
{
-# 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,
# include <io.h>
#endif
#include <errno.h>
- ]],
+ ]GL_MDA_DEFINES],
[[int result = 0;
if (!unlink ("conftest.file/"))
result |= 1;
# include <direct.h>
# include <io.h>
#endif
+ ]GL_MDA_DEFINES[
int main ()
{
int result = 0;
-# 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,
[
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.
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],
[
#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;
]])],
-# serial 6
+# serial 7
# See if we need to provide utimensat replacement.
dnl Copyright (C) 2009-2020 Free Software Foundation, Inc.
#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;
# 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
#include <stdio.h>
#include <utime.h>
#include <errno.h>
+]GL_MDA_DEFINES[
static int
inorder (time_t a, time_t b, time_t c)
-# 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,
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
])
#undef fprintf
#undef read
#undef write
+#if defined _WIN32 && !defined __CYGWIN__
+# define fdopen _fdopen
+#endif
/* Return non-zero if FD is open. */
static int