Ticket #11896: mpir-2.1.3.p5-p6.diff

File mpir-2.1.3.p5-p6.diff, 2.3 KB (added by jdemeyer, 11 years ago)
  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    4343
    4444== Changelog ==
    4545
     46=== mpir-2.1.3.p6 (Jeroen Demeyer, October 11th, 2011) ===
     47 * #11896: Do not set ABI at all when the compiler does not support
     48   $CFLAG32 nor $CFLAG64 (by default set to '-m32' resp. '-m64').
     49
    4650=== mpir-2.1.3.p5 (Leif Leonhardy, October 5th, 2011) ===
    4751 * #11896: Set ABI=32 on 32-bit (Linux) systems that run on 64-bit
    4852   processors since otherwise the build might fail with a bunch of
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    135135SAGE_CONF_OPTS=""
    136136
    137137
     138if [ -z "$CFLAG32" ]; then
     139    CFLAG32="-m32" # Only used in this script, no need to export it.
     140fi
    138141if [ -z "$CFLAG64" ]; then
    139142    CFLAG64="-m64" # Only used in this script, no need to export it.
    140143fi
     
    221224        #       OSs above (and print an according message), it's here.
    222225        if [ -z "$ABI" ]; then
    223226            echo "int main(){return 0;}" > foo.c
    224             # Build a 64-bit executable:
     227            # Try building and running a 64-bit executable
    225228            # (Usually succeeds, unless e.g. a 32-bit CPU is explicitly selected by CFLAGS.)
    226             $CC $CFLAGS $CFLAG64 -o foo foo.c 2>/dev/null
    227             if ! ./foo 2>/dev/null; then
     229            if $CC $CFLAGS $CFLAG64 -o foo foo.c 2>/dev/null && ./foo 2>/dev/null; then
     230                # We can run 64-bit executables.
     231                # Setting ABI=64 shouldn't be necessary, but shouldn't hurt either.
     232                echo "Building a 64-bit version of MPIR"
     233                ABI=64
     234            elif $CC $CFLAGS $CFLAG32 -o foo foo.c 2>/dev/null && ./foo 2>/dev/null; then
    228235                # We're on a 32-bit OS which cannot run 64-bit executables.
    229                 echo "Building a 32-bit version of MPIR" 
     236                echo "Building a 32-bit version of MPIR"
    230237                ABI=32
    231238            else
    232                 # Setting ABI=64 shouldn't be necessary, but shouldn't hurt either.
    233                 echo "Building a 64-bit version of MPIR"
    234                 ABI=64
     239                # It seems the compiler does not support -m32 nor -m64,
     240                # do not set ABI at all.
     241                echo "Your compiler does not support '$CFLAG32' nor '$CFLAG64'.  Leaving ABI unset."
    235242            fi
    236243            rm -f foo foo.c
    237244        fi;;