@@ -738,6 +738,65 @@ then
738
738
AC_DEFINE ( _INCLUDE__STDC_A1_SOURCE , 1 , Define to include mbstate_t for mbrtowc )
739
739
fi
740
740
741
+ # On 'semi-native' build systems (MSYS*/Cygwin targeting MinGW-w64)
742
+ # _sysconfigdata.py will contain paths that are correct only in the
743
+ # build environment. This means external modules will fail to build
744
+ # without setting up the same env and also that the build of Python
745
+ # itself will fail as the paths are not correct for the host tools.
746
+ #
747
+ # Also, getpath.c uses GetModuleFileNameW (replacing \ with /) and
748
+ # compares that with the define VPATH (passed in via command-line)
749
+ # to determine whether it's the build- or the installed-Python.
750
+ #
751
+ # To work around these issues a set of _b2h variables are created:
752
+ # VPATH_b2h, prefix_b2h, srcdir_b2h, abs_srcdir_b2h
753
+ # and abs_builddir_b2h
754
+ # .. where b2h stands for build to host. sysconfig.py replaces path
755
+ # prefixes matching the non-b2h versions with the b2h equivalents.
756
+ #
757
+ # (note this assumes the host compilers are native and *not* cross
758
+ # - in the 'semi-native' scenario only that is.)
759
+
760
+ AC_DEFUN ( [ ABS_PATH_HOST] ,
761
+ [ $1 =$(cd $$2 && pwd)
762
+ case $build_os in
763
+ mingw*)
764
+ case $host_os in
765
+ mingw*) $1 =$(cd $$2 && pwd -W) ;;
766
+ *) ;;
767
+ esac
768
+ ;;
769
+ cygwin*)
770
+ case $host_os in
771
+ mingw*) $1 =$(cygpath -w -m $$2 ) ;;
772
+ *) ;;
773
+ esac
774
+ ;;
775
+ esac
776
+ AC_SUBST ( [ $1 ] )
777
+ ] )
778
+
779
+ AC_MSG_CHECKING ( absolute host location of VPATH )
780
+ ABS_PATH_HOST([ VPATH_b2h] ,[ srcdir] )
781
+ AC_MSG_RESULT ( [ $VPATH_b2h] )
782
+
783
+ AC_MSG_CHECKING ( absolute host location of prefix )
784
+ ABS_PATH_HOST([ prefix_b2h] ,[ prefix] )
785
+ AC_MSG_RESULT ( [ $prefix_b2h] )
786
+
787
+ AC_MSG_CHECKING ( absolute host location of srcdir )
788
+ ABS_PATH_HOST([ srcdir_b2h] ,[ srcdir] )
789
+ AC_MSG_RESULT ( [ $srcdir_b2h] )
790
+
791
+ AC_MSG_CHECKING ( absolute host location of abs_srcdir )
792
+ ABS_PATH_HOST([ abs_srcdir_b2h] ,[ srcdir] )
793
+ AC_MSG_RESULT ( [ $abs_srcdir_b2h] )
794
+
795
+ my_builddir=.
796
+ AC_MSG_CHECKING ( Absolute host location of abs_builddir )
797
+ ABS_PATH_HOST([ abs_builddir_b2h] ,[ my_builddir] )
798
+ AC_MSG_RESULT ( [ $abs_builddir_b2h] )
799
+
741
800
AC_MSG_CHECKING ( [ for init system calls] )
742
801
AC_SUBST ( INITSYS )
743
802
case $host in
0 commit comments