summaryrefslogtreecommitdiff
path: root/lib/wchar.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-15 16:54:17 +0200
committerBruno Haible <bruno@clisp.org>2020-08-15 16:54:17 +0200
commitd4c637e577594532fb45781b4cac79c9a50a4c1e (patch)
tree58bf1f408907dd5a38248ea01d5632225dcf8e4f /lib/wchar.in.h
parente6edf5094bd304779b3dc6a7948c56e002c4286c (diff)
downloadgnulib-d4c637e577594532fb45781b4cac79c9a50a4c1e.tar.gz
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.
Diffstat (limited to 'lib/wchar.in.h')
-rw-r--r--lib/wchar.in.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index e52453359f..d09c2cb33c 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -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