emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 01/01: configure.ac [mingw]: Set $canonical default


From: Oscar Fuentes
Subject: [Emacs-diffs] master 01/01: configure.ac [mingw]: Set $canonical default value
Date: Tue, 25 Nov 2014 02:35:08 +0000

branch: master
commit 70d7aa8a289375a119f5d4e785c8a5882f0a2e99
Author: Oscar Fuentes <address@hidden>
Date:   Tue Nov 25 03:29:43 2014 +0100

    configure.ac [mingw]: Set $canonical default value
    
    ... as per the compiler's target.
    
    The value provided by MSYS2 `uname' is not correct when MSYS2 runs on
    one architecture (x86_64) and the user is building for another (i686).
    
        * configure.ac [mingw]: Set $canonical default value as per the
        compiler's target.
---
 ChangeLog    |    5 +++++
 configure.ac |   28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5fe2a91..808f3a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-25  Oscar Fuentes  <address@hidden>
+
+       * configure.ac [MINGW]: Set $canonical default value as per the
+       compiler's target.
+
 2014-11-24  Glenn Morris  <address@hidden>
 
        * configure.ac [HAVE_W32]: Generate nt/*.rc files when HAVE_W32,
diff --git a/configure.ac b/configure.ac
index 0f1508f..6b6b1c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,34 @@ case $canonical in
  *-mingw*)
   . $srcdir/nt/mingw-cfg.site
 
+  # When we build with MinGW under MSYS, we are cross-compiling. Hence
+  # we can't rely on the output of MSYS `uname' for the architecture
+  # (32 bit MinGW compiler with 64 bit MSYS2, for instance) and must
+  # use the compiler's target, unless when the user explicitly
+  # provides one:
+  if test -z $target_alias; then
+      AC_MSG_CHECKING([the compiler's target])
+      if test -z $CC; then
+         cc=gcc
+      else
+         cc=$CC
+      fi
+      t=`$cc -v 2>&1 | sed -n 's/Target: //p'`
+      case "$t" in
+          *-*) canonical=$t
+             ;;
+          "") AC_MSG_ERROR([Impossible to obtain $cc compiler target.
+Please explicitly provide --target])
+              ;;
+         *) AC_MSG_WARN([Compiler reported non-standard target.
+Defaulting to $canonical.])
+              ;;
+      esac
+      AC_MSG_RESULT([$canonical])
+  else
+      canonical=$target_alias
+  fi
+
   case $srcdir in
     /* | ?:*)
       # srcdir is an absolute path.  In this case, force the format



reply via email to

[Prev in Thread] Current Thread [Next in Thread]