[commit: ghc] master: distrib/configure: Fail if we can't detect machine's word size (60ec8f7)

git at git.haskell.org git at git.haskell.org
Wed Jul 12 12:55:18 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/60ec8f74d32a9976ac8ddf6fd366218283fcac3e/ghc

>---------------------------------------------------------------

commit 60ec8f74d32a9976ac8ddf6fd366218283fcac3e
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Jul 11 18:40:31 2017 -0400

    distrib/configure: Fail if we can't detect machine's word size
    
    This is a sure sign that something is terribly wrong.
    
    We also now verify that the word size that the binary distribution
    expects matches the word size produced by the local target toolchain.
    
    Finally we rename WordSize to TargetWordSize, since non-host/target
    qualified quantities are terribly confusing.
    
    Reviewers: austin, hvr, Phyx
    
    Reviewed By: Phyx
    
    Subscribers: Phyx, rwbarton, thomie, erikd
    
    Differential Revision: https://phabricator.haskell.org/D3711


>---------------------------------------------------------------

60ec8f74d32a9976ac8ddf6fd366218283fcac3e
 configure.ac            |  4 ++--
 distrib/configure.ac.in | 16 +++++++++++++---
 settings.in             |  2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index c31deba..043dea8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -875,8 +875,8 @@ FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t)
 
 
 dnl for use in settings.in
-WordSize=$ac_cv_sizeof_void_p
-AC_SUBST(WordSize)
+TargetWordSize=$ac_cv_sizeof_void_p
+AC_SUBST(TargetWordSize)
 FP_CHECK_FUNC([WinExec],
   [@%:@include <windows.h>], [WinExec("",0)])
 
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index ac6af24..a15b4a5 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -134,10 +134,20 @@ dnl May need to use gcc to find platform details.
 dnl --------------------------------------------------------------
 FPTOOLS_SET_HASKELL_PLATFORM_VARS
 
-dnl WordSize for settings.in
+dnl TargetWordSize for settings.in
 AC_CHECK_SIZEOF(void *, 4)
-WordSize=$ac_cv_sizeof_void_p
-AC_SUBST(WordSize)
+if test "x$ac_cv_sizeof_void_p" = "x0"; then
+    AC_MSG_ERROR([Failed to determine machine word size. Does your toolchain actually work?])
+fi
+dnl Check that the toolchain we have is consistent with what the compiler expects
+if test "x$ac_cv_sizeof_void_p" != "x at TargetWordSize@"; then
+    AC_MSG_ERROR([This binary distribution produces binaries for a target with
+                  word size of @TargetWordSize@, but your target toolchain produces binaries
+                  with a word size of $ac_cv_sizeof_void_p. Are you sure your toolchain
+                  targets the intended target platform of this compiler?])
+fi
+TargetWordSize=$ac_cv_sizeof_void_p
+AC_SUBST(TargetWordSize)
 
 #
 dnl ** how to invoke `ar' and `ranlib'
diff --git a/settings.in b/settings.in
index 04b913b..df647f1 100644
--- a/settings.in
+++ b/settings.in
@@ -22,7 +22,7 @@
  ("cross compiling", "@CrossCompiling@"),
  ("target os", "@HaskellTargetOs@"),
  ("target arch", "@HaskellTargetArch@"),
- ("target word size", "@WordSize@"),
+ ("target word size", "@TargetWordSize@"),
  ("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
  ("target has .ident directive", "@HaskellHaveIdentDirective@"),
  ("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@"),



More information about the ghc-commits mailing list