From 75983ab9b1da29d147d8989575dc81f1f2ce10a0 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 24 Nov 2019 11:03:33 +0000 Subject: [PATCH] Ensure Makefile.config gets Windows-style prefix Prefix may be passed to configure using a Cygwin-style PATH (e.g. `./configure --prefix ~/local`). Use cygpath to ensure that the correct version gets written to Makefile.config, or the resulting compiler has an invalid default stdlib path. --- Changes | 4 ++++ README.win32.adoc | 8 ++------ configure | 10 ++++++++++ configure.ac | 6 +++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index f5f22f87e..f42e64c00 100644 --- a/Changes +++ b/Changes @@ -71,6 +71,10 @@ Working version ### Build system: +- #9136: Don't propagate Cygwin-style prefix from configure to Makefile.config + on Windows ports. + (David Allsopp, review by Sébastien Hinderer) + ### Bug fixes: - #7683, #1499: Fixes one case where the evaluation order in native-code diff --git a/README.win32.adoc b/README.win32.adoc index 0c70d5182..d6da9138a 100644 --- a/README.win32.adoc +++ b/README.win32.adoc @@ -202,9 +202,7 @@ for 32-bit, or: ./configure --build=x86_64-unknown-cygwin --host=x86_64-pc-windows -for 64-bit. Then, edit `Makefile.config` as needed, following the comments in -this file. Normally, the only variable that needs to be changed is `PREFIX`, -which indicates where to install everything. +for 64-bit. Finally, use `make` to build the system, e.g. @@ -269,9 +267,7 @@ for 32-bit, or: ./configure --build=x86_64-unknown-cygwin --host=x86_64-w64-mingw32 -for 64-bit. Then, edit `Makefile.config` as needed, following the comments in -this file. Normally, the only variable that needs to be changed is `PREFIX`, -which indicates where to install everything. +for 64-bit. Finally, use `make` to build the system, e.g. diff --git a/configure b/configure index fa4787983..3bbc89185 100755 --- a/configure +++ b/configure @@ -16832,6 +16832,16 @@ if test x"$prefix" = "xNONE"; then : *) : ;; esac +else + if test x"$unix_or_win32" = "xwin32" \ + && test "$host_vendor-$host_os" != "$build_vendor-$build_os" ; then : + case $build in #( + *-pc-cygwin) : + prefix=`cygpath -m "$prefix"` ;; #( + *) : + ;; +esac +fi fi # Define a few macros that were defined in config/m-nt.h diff --git a/configure.ac b/configure.ac index 63e2354ee..b5d44c047 100644 --- a/configure.ac +++ b/configure.ac @@ -1781,7 +1781,11 @@ AS_IF([test x"$prefix" = "xNONE"], [i686-w64-mingw32], [prefix='C:/ocamlmgw'], [x86_64-w64-mingw32], [prefix='C:/ocamlmgw64'], [i686-pc-windows], [prefix='C:/ocamlms'], - [x86_64-pc-windows], [prefix='C:/ocamlms64'])]) + [x86_64-pc-windows], [prefix='C:/ocamlms64'])], + [AS_IF([test x"$unix_or_win32" = "xwin32" \ + && test "$host_vendor-$host_os" != "$build_vendor-$build_os" ], + [AS_CASE([$build], + [*-pc-cygwin], [prefix=`cygpath -m "$prefix"`])])]) # Define a few macros that were defined in config/m-nt.h # but whose value is not guessed properly by configure