Files
MINGW-packages/mingw-w64-python3/0190-MINGW-detect-REPARSE_DATA_BUFFER.patch
2014-10-11 14:46:25 +01:00

76 lines
2.6 KiB
Diff

diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2014-10-11 14:19:04.201542400 +0100
+++ b/configure.ac 2014-10-11 14:19:06.918697800 +0100
@@ -3602,6 +3602,27 @@
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 <windows.h>
+#include <winnt.h>
+], [
+ 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 -urN a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c 2014-10-11 14:19:04.768574800 +0100
+++ b/Modules/posixmodule.c 2014-10-11 14:19:06.923698100 +0100
@@ -1132,6 +1132,15 @@
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 <winnt.h> on mingw.org w32api
+ * instead as is documented in <ntifs.h>. The mingw-w64 API define
+ * it in <ddk/ntifs.h> but we can not include as header like
+ * <ntddk.h> is required instead <ddk/ntddk.h>, 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;
@@ -1162,7 +1171,11 @@
#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 -urN a/pyconfig.h.in b/pyconfig.h.in
--- a/pyconfig.h.in 2014-10-11 14:19:04.201542400 +0100
+++ b/pyconfig.h.in 2014-10-11 14:19:06.925698200 +0100
@@ -687,6 +687,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