Better way to recognise mingw64 in config script
[openssl.git] / config
diff --git a/config b/config
index b8a787cc5377f9dfad21a278b46aee5f69776fe5..c8886de4310797e10b19c0162b0ecdee64920e54 100755 (executable)
--- a/config
+++ b/config
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1998-2017 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -320,6 +320,15 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        echo "${MACHINE}-v11-${SYSTEM}"; exit 0;
        ;;
 
+    # The following combinations are supported
+    # MINGW64* on x86_64 => mingw64
+    # MINGW32* on x86_64 => mingw
+    # MINGW32* on i?86 => mingw
+    #
+    # MINGW64* on i?86 isn't expected to work...
+    MINGW64*:*:*:x86_64)
+       echo "${MACHINE}-whatever-mingw64"; exit 0;
+       ;;
     MINGW*)
        echo "${MACHINE}-whatever-mingw"; exit 0;
        ;;
@@ -504,16 +513,6 @@ case "$GUESSOS" in
            OUT="darwin-i386-cc"
        fi ;;
   x86_64-apple-darwin*)
-       if [ -z "$KERNEL_BITS" ]; then
-           echo "WARNING! If you wish to build 32-bit library, then you have to"
-           echo "         invoke 'KERNEL_BITS=32 $THERE/config $options'."
-           if [ "$DRYRUN" = "false" -a -t 1 ]; then
-             echo "         You have about 5 seconds to press Ctrl-C to abort."
-             # The stty technique used elsewhere doesn't work on
-             # MacOS. At least, right now on this Mac.
-             sleep 5
-           fi
-       fi
        if [ "$KERNEL_BITS" = "32" ]; then
            OUT="darwin-i386-cc"
        else
@@ -640,7 +639,14 @@ case "$GUESSOS" in
        else
            OUT="linux-x86_64"
        fi ;;
-  *86-*-linux2) OUT="linux-elf" ;;
+  *86-*-linux2)
+        # On machines where the compiler understands -m32, prefer a
+        # config target that uses it
+        if $CC -m32 -E -x c /dev/null > /dev/null 2>&1; then
+            OUT="linux-x86"
+        else
+            OUT="linux-elf"
+        fi ;;
   *86-*-linux1) OUT="linux-aout" ;;
   *-*-linux?) OUT="linux-generic32" ;;
   sun4[uv]*-*-solaris2)
@@ -858,7 +864,7 @@ case "$GUESSOS" in
   i386-*) options="$options 386" ;;
 esac
 
-for i in aes bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha
+for i in aes aria bf camellia cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa seed sha
 do
   if [ ! -d $THERE/crypto/$i ]
   then
@@ -918,4 +924,9 @@ else
   echo "This system ($OUT) is not supported. See file INSTALL for details."
   exit 1
 fi
+
+if [ "$OUT" = "darwin64-x86_64-cc" ]; then
+    echo "WARNING! If you wish to build 32-bit libraries, then you have to"
+    echo "         invoke 'KERNEL_BITS=32 $THERE/config $options'."
+fi
 )