From 598b1626679a2e6793343fe701c4d975aec30390 Mon Sep 17 00:00:00 2001 From: Roumen Petrov Date: Sat, 23 Feb 2013 13:54:02 +0200 Subject: [PATCH 04/16] MINGW: configure MACHDEP and platform for build --- Python/getplatform.c | 6 ++++++ configure.ac | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Python/getplatform.c b/Python/getplatform.c index 6899140..d3e1538 100644 --- a/Python/getplatform.c +++ b/Python/getplatform.c @@ -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 --git a/configure.ac b/configure.ac index 4c440a9..6e5de72 100644 --- a/configure.ac +++ b/configure.ac @@ -350,6 +350,17 @@ AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX) # Set name for machine-dependent library files 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 environement. + ac_sys_system=ignore + ;; +esac if test -z "$MACHDEP" then # avoid using uname for cross builds @@ -409,12 +420,23 @@ if test "$cross_compiling" = yes; then *-*-cygwin*) _host_cpu= ;; + *-*-mingw*) + _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}" + + case "$host_os" in + mingw*) + # As sys.platform() return 'win32' to build python and extantions + # we will use 'mingw' (in setup.py and etc.) + _PYTHON_HOST_PLATFORM=mingw + ;; + esac fi # Some systems cannot stand _XOPEN_SOURCE being defined at all; they -- 1.7.12.1