From 4efc7a246273b1eea301df39d74e3983a2869126 Mon Sep 17 00:00:00 2001 From: Roumen Petrov Date: Sat, 23 Feb 2013 19:54:17 +0200 Subject: [PATCH 10/16] MINGW: detect REPARSE_DATA_BUFFER --- Modules/posixmodule.c | 13 +++++++++++++ configure.ac | 21 +++++++++++++++++++++ pyconfig.h.in | 3 +++ 3 files changed, 37 insertions(+) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 284c5ee..81d97ab 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1016,6 +1016,15 @@ _PyVerify_fd_dup2(int fd1, int fd2) http://msdn.microsoft.com/en-us/library/ms791514.aspx as the required include doesn't seem to be present in the Windows SDK (at least as included with Visual Studio Express). */ +#ifndef HAVE_REPARSE_DATA_BUFFER +/* + * REPARSE_DATA_BUFFER is defined in on mingw.org w32api + * instead as is documented in . The mingw-w64 API define + * it in but we can not include as header like + * is required instead , i.e. to use mingw-w64 + * headers user must specify explicitly path to ddk :(. + * So lest check at configure time and use MSC hack if not found. + */ typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -1046,7 +1055,11 @@ typedef struct _REPARSE_DATA_BUFFER { #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,\ GenericReparseBuffer) +#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) +#endif + +#endif /*ndef HAVE_REPARSE_DATA_BUFFER*/ static int win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) diff --git a/configure.ac b/configure.ac index f32c549..d000a62 100644 --- a/configure.ac +++ b/configure.ac @@ -3455,6 +3455,27 @@ if test $ac_cv_struct_sockaddr_storage = yes; then AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)]) fi +case $host in + *-*-mingw*) + dnl See Modules/posixmodule.c for details. + dnl Also check below distinguish wingw and mingw-w64 + AC_MSG_CHECKING([for REPARSE_DATA_BUFFER]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +#include +#include +], [ + REPARSE_DATA_BUFFER rdb +])], + [py_reparse_data_buffer=yes], + [py_reparse_data_buffer=no] + ) + AC_MSG_RESULT([$py_reparse_data_buffer]) + if test yes = $py_reparse_data_buffer; then + AC_DEFINE([HAVE_REPARSE_DATA_BUFFER],[1],[Define to 1 if you have the 'REPARSE_DATA_BUFFER' structure.]) + fi + ;; +esac + # checks for compiler characteristics AC_C_CHAR_UNSIGNED diff --git a/pyconfig.h.in b/pyconfig.h.in index c9fdecd..2341b16 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -672,6 +672,9 @@ /* Define to 1 if you have the `renameat' function. */ #undef HAVE_RENAMEAT +/* Define to 1 if you have the 'REPARSE_DATA_BUFFER' structure. */ +#undef HAVE_REPARSE_DATA_BUFFER + /* Define if you have readline 2.1 */ #undef HAVE_RL_CALLBACK -- 1.7.12.1