diff --git a/SPKG.txt b/SPKG.txt
a
|
b
|
|
43 | 43 | |
44 | 44 | == Changelog == |
45 | 45 | |
| 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 | |
46 | 50 | === mpir-2.1.3.p5 (Leif Leonhardy, October 5th, 2011) === |
47 | 51 | * #11896: Set ABI=32 on 32-bit (Linux) systems that run on 64-bit |
48 | 52 | processors since otherwise the build might fail with a bunch of |
diff --git a/spkg-install b/spkg-install
a
|
b
|
|
135 | 135 | SAGE_CONF_OPTS="" |
136 | 136 | |
137 | 137 | |
| 138 | if [ -z "$CFLAG32" ]; then |
| 139 | CFLAG32="-m32" # Only used in this script, no need to export it. |
| 140 | fi |
138 | 141 | if [ -z "$CFLAG64" ]; then |
139 | 142 | CFLAG64="-m64" # Only used in this script, no need to export it. |
140 | 143 | fi |
… |
… |
|
221 | 224 | # OSs above (and print an according message), it's here. |
222 | 225 | if [ -z "$ABI" ]; then |
223 | 226 | echo "int main(){return 0;}" > foo.c |
224 | | # Build a 64-bit executable: |
| 227 | # Try building and running a 64-bit executable |
225 | 228 | # (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 |
228 | 235 | # 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" |
230 | 237 | ABI=32 |
231 | 238 | 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." |
235 | 242 | fi |
236 | 243 | rm -f foo foo.c |
237 | 244 | fi;; |