From: Roumen Petrov Date: Sat, 23 Feb 2013 13:54:02 +0200 Issue #17592: MINGW: configure MACHDEP and platform for build diff -r 3f921c3b1e87 Python/getplatform.c --- a/Python/getplatform.c Fri Mar 11 22:53:15 2016 +0100 +++ b/Python/getplatform.c Sun Mar 13 02:26:06 2016 +0000 @@ -1,6 +1,12 @@ #include "Python.h" +#ifdef __MINGW32__ +# undef PLATFORM +/* see PC/pyconfig.h */ +# define PLATFORM "win32" +#endif + #ifndef PLATFORM #define PLATFORM "unknown" #endif diff -r 3f921c3b1e87 configure.ac --- a/configure.ac Fri Mar 11 22:53:15 2016 +0100 +++ b/configure.ac Sun Mar 13 02:26:06 2016 +0000 @@ -355,17 +355,28 @@ ##AC_ARG_WITH(dyld, ## AS_HELP_STRING([--with-dyld], ## [Use (OpenStep|Rhapsody) dynamic linker])) -## -# Set name for machine-dependent library files + +# Set name for machine-dependent library files. +# Variables ac_sys_system and ac_sys_release are used for setting +# a lot of different things including 'define_xopen_source' +# in a case statement below. AC_ARG_VAR([MACHDEP], [name for machine-dependent library files]) AC_MSG_CHECKING(MACHDEP) +case "$host" in +*-*-mingw*) + # On those hosts MACHDEP is 'win', as platform-specific files + # go in plat-$(MACHDEP), but runtime platform is 'win32' + test -z "$MACHDEP" && MACHDEP=win + + dnl Configuration will be based only on "host triplet" as build + dnl must not depend from posix-compatible environment. + ac_sys_system=ignore + ;; +esac if test -z "$MACHDEP" then # avoid using uname for cross builds if test "$cross_compiling" = yes; then - # ac_sys_system and ac_sys_release are used for setting - # a lot of different things including 'define_xopen_source' - # in the case statement below. case "$host" in *-*-linux*) ac_sys_system=Linux @@ -405,25 +416,34 @@ AC_SUBST(_PYTHON_HOST_PLATFORM) if test "$cross_compiling" = yes; then - case "$host" in - *-*-linux*) - case "$host_cpu" in - arm*) - _host_cpu=arm + case "$host_os" in + mingw*) + # As sys.platform() returns 'win32' to build python and + # extensions, we will use 'mingw' (in setup.py etc.) + _PYTHON_HOST_PLATFORM=mingw + ;; + *) + case "$host" in + *-*-linux*) + case "$host_cpu" in + arm*) + _host_cpu=arm + ;; + *) + _host_cpu=$host_cpu + esac + ;; + *-*-cygwin* | *-*-mingw*) + _host_cpu= ;; *) - _host_cpu=$host_cpu + # for now, limit cross builds to known configurations + MACHDEP="unknown" + AC_MSG_ERROR([cross build not supported for $host]) esac + _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" ;; - *-*-cygwin*) - _host_cpu= - ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - AC_MSG_ERROR([cross build not supported for $host]) esac - _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" fi # Some systems cannot stand _XOPEN_SOURCE being defined at all; they