From 6880819db5f2bcda3b5c9f1bd14f4002eb8f2022 Mon Sep 17 00:00:00 2001 From: Roumen Petrov Date: Sat, 23 Feb 2013 19:54:17 +0200 Subject: [PATCH 09/15] MINGW: detect REPARSE_DATA_BUFFER --- Modules/winreparse.h | 15 ++++++++++++++- configure.ac | 21 +++++++++++++++++++++ pyconfig.h.in | 3 +++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Modules/winreparse.h b/Modules/winreparse.h index 66f7775..f0bf6c4 100644 --- a/Modules/winreparse.h +++ b/Modules/winreparse.h @@ -2,7 +2,7 @@ #define Py_WINREPARSE_H #ifdef MS_WINDOWS -#include +#include #ifdef __cplusplus extern "C" { @@ -12,6 +12,15 @@ extern "C" { http://msdn.microsoft.com/en-us/library/ff552012.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; @@ -42,7 +51,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*/ #ifdef __cplusplus } diff --git a/configure.ac b/configure.ac index 2a60d59..01d13de 100644 --- a/configure.ac +++ b/configure.ac @@ -3664,6 +3664,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 d81b899..2a1e91f 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -690,6 +690,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.8.4