Update fipsld to use external signature for fips_premain.c . Update build system
[openssl.git] / config
diff --git a/config b/config
index e7cc768a79defbdf24797bcc12d3b4e80898c844..886665ba0ece3aa1c5da99840dfbc725e0896098 100755 (executable)
--- a/config
+++ b/config
@@ -20,8 +20,6 @@
 # Be as similar to the output of config.guess/config.sub
 # as possible.
 
-set -x
-
 PREFIX=""
 SUFFIX=""
 TEST="false"
@@ -56,6 +54,22 @@ SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
 VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
 
 
+
+
+# Check for VC++ presence first.
+#
+#if [ "x$MSVCDIR" != "x" -o "x$VCINSTALLDIR" != "x" ]; then
+#      perl Configure VC-WIN32 $*
+#      cmd /c ms\\do_masm.bat
+#      perl util/mk1mf.pl VC-WIN32-GMAKE >mak.tmp
+#      rm Makefile
+#      mv mak.tmp Makefile
+#      echo "Configured for VC++ using GNU make"
+#      exit 0
+#fi
+#
+
 # Now test for ISC and SCO, since it is has a braindamaged uname.
 #
 # We need to work around FreeBSD 1.1.5.1 
@@ -84,7 +98,7 @@ if [ "x$XREL" != "x" ]; then
                esac
                ;;
            4.2)
-               echo "whatever-whatever-unixware1"; exit 0
+               echo "i386-whatever-unixware1"; exit 0
                ;;
            5)
                case "x${VERSION}" in
@@ -339,6 +353,13 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        echo "mips-sony-newsos4"; exit 0;
        ;;
 
+    MINGW*)
+       echo "${MACHINE}-whatever-mingw"; echo 0;
+       # Save fipslib path so VC++ build can find it
+       (cd /usr/local/ssl/lib ; pwd -W ) > util/fipslib_path.txt
+       # Extract _chkstk.o so VC++ can use it, to avoid __alloca link error
+       (cd ms ; ar x `gcc -print-libgcc-file-name` _chkstk.o)
+       ;;
     CYGWIN*)
        case "$RELEASE" in
            [bB]*|1.0|1.[12].*)
@@ -406,7 +427,7 @@ if [ "$GCCVER" != "" ]; then
   CC=gcc
   # then strip off whatever prefix egcs prepends the number with...
   # Hopefully, this will work for any future prefixes as well.
-  GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'`
+  GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
   # Since gcc 3.1 gcc --version behaviour has changed.  gcc -dumpversion
   # does give us what we want though, so we use that.  We just just the
   # major and minor version numbers.
@@ -444,7 +465,7 @@ if [ "$SYSTEM" = "SunOS" ]; then
        egrep -e '^cc: .* C [0-9]\.[0-9]' | \
        sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
   CCVER=${CCVER:-0}
-  if [ $CCVER -gt 40 ]; then
+  if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
     CC=cc      # overrides gcc!!!
     if [ $CCVER -eq 50 ]; then
       echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
@@ -518,23 +539,36 @@ case "$GUESSOS" in
         #fi
        OUT="irix-mips3-$CC"
        ;;
-  ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
-  ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
-  i386-apple-darwin*) OUT="darwin-i386-cc" ;;
   alpha-*-linux2)
-        ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
+        ISA=`awk '/cpu model/{print$4}' /proc/cpuinfo`
        case ${ISA:-generic} in
-       *[678]) OUT="linux-alpha+bwx-$CC" ;;
+       *[67])  OUT="linux-alpha+bwx-$CC" ;;
        *)      OUT="linux-alpha-$CC" ;;
        esac
        if [ "$CC" = "gcc" ]; then
            case ${ISA:-generic} in
-           EV5|EV45)           options="$options -mcpu=ev5";;
-           EV56|PCA56)         options="$options -mcpu=ev56";;
-           *)                  options="$options -mcpu=ev6";;
+           EV5|EV45)           options="$options -march=ev5";;
+           EV56|PCA56)         options="$options -march=ev56";;
+           EV6|EV67|PCA57)     options="$options -march=ev6";;
            esac
        fi
        ;;
+  mips-*-linux?)
+          cat >dummy.c <<EOF
+#include <stdio.h>  /* for printf() prototype */
+        int main (argc, argv) int argc; char *argv[]; {
+#ifdef __MIPSEB__
+  printf ("linux-%s\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+  printf ("linux-%sel\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+       ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
+       rm dummy dummy.c
+       ;;
   ppc64-*-linux2)
        echo "WARNING! If you wish to build 64-bit library, then you have to"
        echo "         invoke './Configure linux-ppc64' *manually*."
@@ -545,7 +579,11 @@ case "$GUESSOS" in
        OUT="linux-ppc"
        ;;
   ppc-*-linux2) OUT="linux-ppc" ;;
+  m68k-*-linux*) OUT="linux-m68k" ;;
   ia64-*-linux?) OUT="linux-ia64" ;;
+  ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
+  ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
+  i386-apple-darwin*) OUT="darwin-i386-cc" ;;
   sparc64-*-linux2)
        echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
        echo "         and wish to build 64-bit library, then you have to"
@@ -556,18 +594,16 @@ case "$GUESSOS" in
        fi
        OUT="linux-sparcv9" ;;
   sparc-*-linux2)
-       KARCH=`awk '/^type/{print$3;exit(0);}' /proc/cpuinfo`
+       KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`
        case ${KARCH:-sun4} in
        sun4u*) OUT="linux-sparcv9" ;;
        sun4m)  OUT="linux-sparcv8" ;;
        sun4d)  OUT="linux-sparcv8" ;;
-       *)      OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
+       *)      OUT="linux-sparcv7" ;;
        esac ;;
-  parisc*-*-linux2)
-       # 64-bit builds under parisc64 linux are not supported and
-       # compiler is expected to generate 32-bit objects...
-       CPUARCH=`awk '/cpu family/{print substr($5,1,3); exit(0);}' /proc/cpuinfo`
-       CPUSCHEDULE=`awk '/^cpu.[       ]*: PA/{print substr($3,3); exit(0);}' /proc/cpuinfo`
+  parisc-*-linux2)
+        CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo`
+       CPUSCHEDULE=`awk '/^cpu.[       ]: PA/{print substr($3,3)}' /proc/cpuinfo`
 
        # ??TODO ??  Model transformations
        # 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
@@ -580,29 +616,30 @@ case "$GUESSOS" in
        #         PA8500   -> 8000   (2.0)
        #         PA8600   -> 8000   (2.0)
 
-       CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8.00/8000/'`
+       CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'`
        # Finish Model transformations
 
-       options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
-       OUT="linux-generic32" ;;
-  arm*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
-  arm*l-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
-  s390*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;;
+       options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH"
+       OUT="linux-parisc" ;;
+  arm*b-*-linux2) OUT="linux-elf-arm"; options="$options -DB_ENDIAN" ;;
+  arm*l-*-linux2) OUT="linux-elf-arm"; options="$options -DL_ENDIAN" ;;
+  arm*-*-linux2)  OUT="linux-elf-arm" ;;
+  s390-*-linux2) OUT="linux-s390" ;;
+  s390x-*-linux?) OUT="linux-s390x" ;;
   x86_64-*-linux?) OUT="linux-x86_64" ;;
-  *86-*-linux2) OUT="linux-elf"
+  *-*-linux2) OUT="linux-elf"
        if [ "$GCCVER" -gt 28 ]; then
           if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
-           options="$options -mcpu=pentium"
+            OUT="linux-pentium"
           fi
           if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then
-           options="$options -mcpu=pentiumpro"
+            OUT="linux-ppro"
           fi
           if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then
-           options="$options -mcpu=k6"
+            OUT="linux-k6"
           fi
         fi ;;
   *-*-linux1) OUT="linux-aout" ;;
-  *-*-linux2) OUT="linux-generic32" ;;
   sun4u*-*-solaris2)
        OUT="solaris-sparcv9-$CC"
        ISA64=`(isalist) 2>/dev/null | grep sparcv9`
@@ -640,23 +677,38 @@ case "$GUESSOS" in
   sun4m-*-solaris2)    OUT="solaris-sparcv8-$CC" ;;
   sun4d-*-solaris2)    OUT="solaris-sparcv8-$CC" ;;
   sun4*-*-solaris2)    OUT="solaris-sparcv7-$CC" ;;
-  *86*-*-solaris2)     OUT="solaris-x86-$CC" ;;
-  *-*-sunos4)          OUT="sunos-$CC" ;;
-
-  *86*-*-bsdi4)                OUT="bsdi-elf-gcc" ;;
-  alpha*-*-*bsd*)      OUT="BSD-generic64; options="$options -DL_ENDIAN" ;;
-  powerpc64-*-*bsd*)   OUT="BSD-generic64; options="$options -DB_ENDIAN" ;;
-  sparc64-*-*bsd*)     OUT="BSD-sparc64" ;;
-  ia64-*-*bsd*)                OUT="BSD-ia64" ;;
-  amd64-*-*bsd*)       OUT="BSD-x86_64" ;;
-  *86*-*-*bsd*)                case "`(file -L /usr/lib/libc.so.*) 2>/dev/null`" in
-                       *ELF*)  OUT="BSD-x86-elf" ;;
-                       *)      OUT="BSD-x86" ;;
-                       esac ;;
-  *-*-*bsd*)           OUT="BSD-generic32" ;;
-
-  *-*-osf)             OUT="osf1-alpha-cc" ;;
-  *-*-tru64)           OUT="tru64-alpha-cc" ;;
+  *86*-*-solaris2)
+       ISA64=`(isalist) 2>/dev/null | grep amd64`
+       if [ "$ISA64" != "" ]; then
+           OUT="solaris64-x86_64-$CC"
+       else
+           OUT="solaris-x86-$CC"
+       fi
+       ;;
+  *-*-sunos4) OUT="sunos-$CC" ;;
+  alpha*-*-freebsd*) OUT="FreeBSD-alpha" ;;
+  sparc64-*-freebsd*) OUT="FreeBSD-sparc64" ;;
+  ia64-*-freebsd*) OUT="FreeBSD-ia64" ;;
+  *-freebsd[3-9]*) OUT="FreeBSD-elf" ;;
+  *-freebsd[1-2]*) OUT="FreeBSD" ;;
+  *86*-*-netbsd) OUT="NetBSD-x86" ;;
+  sun3*-*-netbsd) OUT="NetBSD-m68" ;;
+  *-*-netbsd) OUT="NetBSD-sparc" ;;
+  alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
+  *86*-*-openbsd) OUT="OpenBSD-i386" ;;
+  m68k*-*-openbsd) OUT="OpenBSD-m68k" ;;
+  m88k*-*-openbsd) OUT="OpenBSD-m88k" ;;
+  mips*-*-openbsd) OUT="OpenBSD-mips" ;;
+  pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
+  powerpc*-*-openbsd) OUT="OpenBSD-powerpc" ;;
+  sparc64*-*-openbsd) OUT="OpenBSD-sparc64" ;;
+  sparc*-*-openbsd) OUT="OpenBSD-sparc" ;;
+  vax*-*-openbsd) OUT="OpenBSD-vax" ;;
+  hppa*-*-openbsd) OUT="OpenBSD-hppa" ;;
+  *-*-openbsd) OUT="OpenBSD" ;;
+  *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
+  *-*-osf) OUT="alphaold-cc" ;;
+  *-*-tru64) OUT="alpha-cc" ;;
   *-*-OpenUNIX*)
        if [ "$CC" = "gcc" ]; then
          OUT="OpenUNIX-8-gcc" 
@@ -664,9 +716,15 @@ case "$GUESSOS" in
          OUT="OpenUNIX-8" 
        fi
        ;;
-  *-*-[Uu]nix[Ww]are7) OUT="unixware-7" ;;
-  *-*-[Uu]nix[Ww]are20*) OUT="unixware-2.0" ;;
-  *-*-[Uu]nix[Ww]are21*) OUT="unixware-2.1" ;;
+  *-*-unixware7) OUT="unixware-7" ;;
+  *-*-UnixWare7) OUT="unixware-7" ;;
+  *-*-Unixware7) OUT="unixware-7" ;;
+  *-*-unixware20*) OUT="unixware-2.0" ;;
+  *-*-unixware21*) OUT="unixware-2.1" ;;
+  *-*-UnixWare20*) OUT="unixware-2.0" ;;
+  *-*-UnixWare21*) OUT="unixware-2.1" ;;
+  *-*-Unixware20*) OUT="unixware-2.0" ;;
+  *-*-Unixware21*) OUT="unixware-2.1" ;;
   *-*-vos)
        options="$options no-threads no-shared no-asm no-dso"
        EXE=".pm"
@@ -675,8 +733,15 @@ case "$GUESSOS" in
   RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
   *-siemens-sysv4) OUT="SINIX" ;;
   *-hpux1*)
-       if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
+       if [ $CC = "gcc" ];
+       then
+         if [ $GCC_BITS = "64" ]; then
            OUT="hpux64-parisc2-gcc"
+         else
+           OUT="hpux-parisc-gcc"
+         fi
+       else
+         OUT="hpux-parisc-$CC"
        fi
        KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
        KERNEL_BITS=${KERNEL_BITS:-32}
@@ -693,7 +758,9 @@ case "$GUESSOS" in
             fi
             OUT="hpux64-ia64-cc"
        elif [ $CPU_VERSION -ge 532 ]; then     # PA-RISC 2.x CPU
-            OUT=${OUT:-"hpux-parisc2-${CC}"}
+            if [ "$CC" = "cc" ]; then
+               OUT="hpux-parisc2-cc" # can't we have hpux-parisc2-gcc?
+            fi
             if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
                echo "WARNING! If you wish to build 64-bit library then you have to"
                echo "         invoke './Configure hpux64-parisc2-cc' *manually*."
@@ -703,9 +770,9 @@ case "$GUESSOS" in
                fi
             fi
        elif [ $CPU_VERSION -ge 528 ]; then     # PA-RISC 1.1+ CPU
-            OUT="hpux-parisc-${CC}
+            :
        elif [ $CPU_VERSION -ge 523 ]; then     # PA-RISC 1.0 CPU
-            OUT="hpux-parisc-${CC}
+            :
        else                                    # Motorola(?) CPU
             OUT="hpux-$CC"
        fi
@@ -755,13 +822,12 @@ esac
 #  options="$options -DATALLA"
 #fi
 
-# gcc < 2.8 does not support -mcpu=ultrasparc
+# gcc < 2.8 does not support -march=ultrasparc
 if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ]
 then
-  echo "WARNING! Falling down to 'solaris-sparcv8-gcc'."
-  echo "         Upgrade to gcc-2.8 or later."
+  echo "WARNING! Do consider upgrading to gcc-2.8 or later."
   sleep 5
-  OUT=solaris-sparcv8-gcc
+  OUT=solaris-sparcv9-gcc27
 fi
 if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ]
 then