Ticket #11616: mpir-2.4.0.p1-p2.diff
| File mpir-2.4.0.p1-p2.diff, 26.3 KB (added by jdemeyer, 14 months ago) |
|---|
-
SPKG.txt
# HG changeset patch # User Jeroen Demeyer <jdemeyer@cage.ugent.be> # Date 1334060092 -7200 # Node ID 7353f501cc393146517fbc253a2972e45dba4883 # Parent f0de181e1710e4fb5e9227cefed4b9d6656a3ae4 Trac #11616: upgrade MPIR to version 2.4.0; many other fixes * Before enabling `-march=native`, minimalistically check whether the system's assembler also understands the instructions the compiler emits with that option. (Work-around for e.g. GCC 4.6.3 on MacOS X 10.x and Intel Core i7-family CPUs with AVX.) * Do not unconditionally unset `PYTHON`, since Sage (>=5.0.beta10) no longer pollutes the environment with its package version variables, which previous- ly confused yasm's `configure`. * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` from `gmp.h`, since MPIR meanwhile defines these to preprocessor variables (rather than literals). Also don't use `\+` in `sed` patterns, as this is less portable. * Work around GCC 4.7.0 bug (compilation error) on Linux ia64 (Itanium) by almost completely disabling optimization on that platform if GCC 4.7.x is detected. This doesn't hurt much if we later rebuild MPIR with a (non- broken) GCC from the new GCC spkg. Cf. #12765. * Do not build the C++ interface and static libraries when bootstrapping the GCC spkg, i.e. if `SAGE_BUILD_TOOLCHAIN=yes`. (GMP/MPIR is a prerequisite for it, and MPIR will later get rebuilt with both enabled, with the newly built GCC.) Cf. #12782. * Fix a potential race condition in yasm's build by patching the re2c source. Cf. #11844. * Add "`patch` loop" to apply any patches (`*.patch`) located in `patches/`. Currently only the re2c patch matches that; the prepatched header to support Sun's C compiler is still copied over (and only on SunOS, although it doesn't do any harm on other platforms). * Minor clean-up; e.g. redirect error messages and warnings to `stderr`, quote parameter to `--libdir`, add some comments and messages, also save user's setting of `LDFLAGS` and `ABI`. diff --git a/SPKG.txt b/SPKG.txt
a b 20 20 21 21 == Dependencies == 22 22 * iconv 23 * GNU patch 23 24 24 25 == Special Update/Build Instructions == 25 * TODO: Use 'patch' rather than copying over patched upstream files. 26 (The currently patched file for Sun CC on SunOS has to be refreshed on 27 each upgrade.) 28 * Make sure the patches still apply; also, putting "-Wl,z,noexecstack" 26 * TODO: 27 - Use 'patch' also to (unconditionally) apply the harmless patch for Sun CC 28 (on SunOS), as the current prepatched file which is still copied over has 29 to get refreshed on each upgrade. 30 - Perhaps also modify CXXFLAGS (and/or CPPFLAGS). 31 - We currently don't use anything of GMP's/MPIR's CC setting, and matching 32 with the current compiler (`$CC`) is perhaps suboptimal. 33 * Make sure the patches still apply; also, putting "-Wl,-z,noexecstack" 29 34 into LDFLAGS might not be necessary for later versions. 30 35 * Perhaps make sure we still delete the correct files on 32-bit MacOS X 31 36 on Intel hardware (x86) to not break PIC there. 37 * The work-around for the broken GCC 4.7.0 on Linux ia64 (Itanium) is current- 38 ly applied for any 4.7.x version (of course only on that platform), as it 39 seems unlikely that the bug which breaks the build of MPIR gets fixed soon. 40 In case GCC 4.7.1 or a later version is meanwhile released, one should check 41 whether the build is still broken with this or these, and eventually change 42 the version pattern accordingly. 32 43 * Remove some files / directories not needed for Sage from upstream: 33 44 rm -rf src/build.vc* # Microsoft Visual C build files 34 45 rm -rf src/yasm/Mkfiles/{dj,vc*} # DJGPP, Microsoft Visual C 35 46 (Saves 13 of 40 MB uncompressed.) 36 47 37 48 === Patches === 38 * We currently only apply a trivial patch to gmp-h.in on SunOS such that 39 MPIR would compile with Sun CC there. See also `spkg-install`. 49 * We currently apply a trivial patch to gmp-h.in on SunOS such that 50 MPIR would compile with Sun CC there. See also `spkg-install`. 51 This patch could be applied on all platforms, as the changes only take 52 effect if the preprocessor variable `__SUNPRO_CC` is defined. 53 * We apply a simple patch to upstream yasm's re2c code, to avoid a potential 54 race condition when building yasm in parallel. (Cf. #11844.) 40 55 41 56 == Changelog == 42 57 58 === mpir-2.4.0.p2 (Leif Leonhardy, April 4th, 2012) === 59 #11616 (upgrading MPIR), further fixes: 60 * Before enabling `-march=native`, minimalistically check whether the 61 system's assembler also understands the instructions the compiler emits 62 with that option. (Work-around for e.g. GCC 4.6.3 on MacOS X 10.x and 63 Intel Core i7-family CPUs with AVX.) 64 * Do not unconditionally unset `PYTHON`, since Sage (>=5.0.beta10) no longer 65 pollutes the environment with its package version variables, which previous- 66 ly confused yasm's `configure`. 67 * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` from `gmp.h`, since MPIR 68 meanwhile defines these to preprocessor variables (rather than literals). 69 Also don't use `\+` in `sed` patterns, as this is less portable. 70 * Work around GCC 4.7.0 bug (compilation error) on Linux ia64 (Itanium) by 71 almost completely disabling optimization on that platform if GCC 4.7.x 72 is detected. This doesn't hurt much if we later rebuild MPIR with a (non- 73 broken) GCC from the new GCC spkg. Cf. #12765. 74 * Do not build the C++ interface and static libraries when bootstrapping the 75 GCC spkg, i.e. if `SAGE_BUILD_TOOLCHAIN=yes`. (GMP/MPIR is a prerequisite 76 for it, and MPIR will later get rebuilt with both enabled, with the newly 77 built GCC.) Cf. #12782. 78 * Fix a potential race condition in yasm's build by patching the re2c source. 79 Cf. #11844. 80 * Add "`patch` loop" to apply any patches (`*.patch`) located in `patches/`. 81 Currently only the re2c patch matches that; the prepatched header to support 82 Sun's C compiler is still copied over (and only on SunOS, although it doesn't 83 do any harm on other platforms). 84 * Minor clean-up; e.g. redirect error messages and warnings to `stderr`, 85 quote parameter to `--libdir`, add some comments and messages, also save 86 user's setting of `LDFLAGS` and `ABI`. 87 43 88 === mpir-2.4.0.p1 (Leif Leonhardy, March 21st, 2012) === 44 89 * Upstream upgrade to MPIR 2.4.0 (#11616). 45 90 The 2.4.0.p0 spkg isn't in this history, as it was based -
new file patches/yasm__tools__re2c__code.c.patch
diff --git a/patches/yasm__tools__re2c__code.c.patch b/patches/yasm__tools__re2c__code.c.patch new file mode 100644
- + 1 --- src/yasm/tools/re2c/code.c 2011-03-05 14:47:11.000000000 +0100 2 +++ src/yasm/tools/re2c/code.c 2012-04-05 12:34:44.958541522 +0200 3 @@ -1,5 +1,6 @@ 4 #include <stdlib.h> 5 #include <string.h> 6 +#include <errno.h> 7 #include <ctype.h> 8 #include "tools/re2c/substr.h" 9 #include "tools/re2c/globals.h" 10 @@ -10,7 +11,7 @@ 11 while (value >= vUsedLabelAlloc) { 12 vUsedLabels = realloc(vUsedLabels, vUsedLabelAlloc * 2); 13 if (!vUsedLabels) { 14 - fputs("Out of memory.\n", stderr); 15 + fputs("Error: re2c: Out of memory.\n", stderr); 16 exit(EXIT_FAILURE); 17 } 18 memset(vUsedLabels + vUsedLabelAlloc, 0, vUsedLabelAlloc); 19 @@ -844,14 +845,17 @@ 20 nOrgOline = oline; 21 maxFillIndexes = vFillIndexes; 22 orgVFillIndexes = vFillIndexes; 23 - tmpo = fopen("re2c.tmp", "wt"); 24 + if (!(tmpo = tmpfile())) 25 + { 26 + fprintf(stderr, "Error: re2c: tmpfile(): %s\n", strerror(errno)); 27 + exit(EXIT_FAILURE); 28 + } 29 for(s = d->head; s; s = s->next){ 30 int readCh = 0; 31 State_emit(s, tmpo, &readCh); 32 Go_genGoto(&s->go, tmpo, s, s->next, &readCh); 33 } 34 fclose(tmpo); 35 - remove("re2c.tmp"); 36 maxFillIndexes = vFillIndexes; 37 vFillIndexes = orgVFillIndexes; 38 oline = nOrgOline; -
spkg-check
diff --git a/spkg-check b/spkg-check
a b 1 1 #!/usr/bin/env bash 2 2 3 3 if [ -z "$SAGE_LOCAL" ]; then 4 echo "Error: SAGE_LOCAL undefined - exiting..."5 echo "Maybe run 'sage -sh'?"4 echo >&2 "Error: SAGE_LOCAL undefined - exiting..." 5 echo >&2 "Maybe run 'sage -sh'?" 6 6 exit 1 7 7 fi 8 8 … … 11 11 # We don't have to set up any environment variables here since the 12 12 # Makefiles already have them from 'configure'. 13 13 14 echo "Now building and running MPIR's test suite..." 14 15 $MAKE check 15 16 if [ $? -ne 0 ]; then 16 echo "Error: The MPIR test suite failed."17 echo >&2 "Error: The MPIR test suite failed." 17 18 exit 1 18 19 fi 19 20 -
spkg-install
diff --git a/spkg-install b/spkg-install
a b 6 6 ############################################################################### 7 7 8 8 if [ -z "$SAGE_LOCAL" ]; then 9 echo "Error: SAGE_LOCAL undefined - exiting..."10 echo "Maybe run 'sage -sh'?"9 echo >&2 "Error: SAGE_LOCAL undefined - exiting..." 10 echo >&2 "Maybe run 'sage -sh'?" 11 11 exit 1 12 12 fi 13 13 14 14 CUR=`pwd` 15 15 16 cd src/ 17 16 18 ############################################################################### 17 19 # Apply patches (if any): 18 20 ############################################################################### … … 25 27 # has to be refreshed on each new release, since gmp-h.in also 26 28 # contains the full version number. 27 29 echo "Copying a version of gmp-h.in which is patched for Sun Studio..." 28 cp patches/gmp-h.in src/30 cp ../patches/gmp-h.in . # We are in src/. 29 31 if [ $? -ne 0 ]; then 30 echo "Error: Failed to patch MPIR for Sun Studio."32 echo >&2 "Error: Failed to patch MPIR for Sun Studio." 31 33 exit 1 32 34 fi 33 35 fi 34 36 37 echo "Applying further patches (if any) to upstream sources..." 38 for patch in ../patches/*.patch; do 39 patch -p1 <"$patch" 40 if [ $? -ne 0 ]; then 41 echo >&2 "Error: '$patch' failed to apply." 42 exit 1 43 fi 44 done 45 35 46 ############################################################################### 36 47 # Previous MPIR installations are only removed after a *successful* (re)build, 37 48 # before installing the new one. (Done below.) … … 71 82 { 72 83 # Internal sanity check: 73 84 if [ $# -ne 1 ]; then 74 echo "Error: get_upstream_selected_cflags() requires 'file' parameter."85 echo >&2 "Error: get_upstream_selected_cflags() requires 'file' parameter." 75 86 exit 1 76 87 fi 77 88 header_file=$1 78 # We'll probably have to change the following patterns (conditionally) when we79 # upgrade to MPIR >=2.5.0(?), since MPIR's gmp.h was changed to define __GMP_CC80 # to (literally) __MPIR_CC, and likewise __GMP_CFLAGS to __MPIR_CFLAGS.81 # I.e., in later releases __MPIR_CC and __MPIR_CFLAGS will contain the real strings82 # we need (unless they again change this; I've already complained about that).83 gmp_cc_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CC[ ]\+/s/.*"\([^"]*\)"/\1/p'84 gmp_cflags_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CFLAGS[ ]\+/s/.*"\([^"]*\)"/\1/p'85 89 if ! [ -f "$header_file" ]; then 86 90 upstream_cc="" 87 91 upstream_cflags="" 88 92 return 1 89 93 fi 94 # The following patterns only extract the contents of (double-quoted) strings: 95 gmp_cc_pat='/^[ ]*#[ ]*define[ ]\{1,\}__GMP_CC[ ]\{1,\}/s/.*"\([^"]*\)"/\1/p' 96 gmp_cflags_pat='/^[ ]*#[ ]*define[ ]\{1,\}__GMP_CFLAGS[ ]\{1,\}/s/.*"\([^"]*\)"/\1/p' 97 # Extract preprocessor definitions of __GMP_CC and __GMP_CFLAGS: 90 98 upstream_cc=`sed -n -e "$gmp_cc_pat" "$header_file"` 91 99 upstream_cflags=`sed -n -e "$gmp_cflags_pat" "$header_file"` 100 # At least /some/ newer versions of MPIR define __GMP_CC and __GMP_CFLAGS 101 # (also in gmp.h! -- how compatible is that?) to (literally) __MPIR_CC and 102 # __MPIR_CFLAGS, respectively, i.e., to preprocessor variables, so we might 103 # have to get the real strings from their definitions: 104 # (Since we currently only match string literals above, both variables would 105 # be empty in that case, and not contain the names of preprocessor variables. 106 # We could change the patterns to actually match any definition / "value".) 107 case "$upstream_cc" in __MPIR_CC|"") 108 upstream_cc=`sed -n -e "${gmp_cc_pat/GMP/MPIR}" "$header_file"` 109 esac 110 case "$upstream_cflags" in __MPIR_CFLAGS|"") 111 upstream_cflags=`sed -n -e "${gmp_cflags_pat/GMP/MPIR}" "$header_file"` 112 esac 113 # Upstream-selected CFLAGS may be empty, CC shouldn't: 114 if [ -z "$upstream_cc" ]; then 115 return 1 116 fi 92 117 return 0 93 118 } 94 119 … … 96 121 { 97 122 # Internal sanity check: 98 123 if [ $# -lt 1 ]; then 99 echo "Error: get_processor_specific_cflags() requires 'CFLAGS' parameter."124 echo >&2 "Error: get_processor_specific_cflags() requires 'CFLAGS' parameter." 100 125 exit 1 101 126 fi 102 127 flags=$@ … … 109 134 # We could add further '-m' or '-f' options here, but note that 110 135 # this function is also used to determine if the user specified 111 136 # some, which we don't want to override. 137 # AFAIK, MPIR currently uses / defines at most '-m{arch,cpu,tune}', 138 # not more specific / additional ones like e.g. '-mavx' or '-mvsx'. 139 # (-leif, 04/2012) 112 140 esac 113 141 done 114 142 echo $arch_flags … … 121 149 # (Compilers other than 'gcc' might support it as well, in which case the 122 150 # following also works. Other flavours could be added, too.) 123 151 if touch foo.c && $CC -march=native -c foo.c &>/dev/null; then 124 echo "-march=native" 152 # Ok, the compiler (presumably GCC) understands '-march=native', which 153 # doesn't yet mean the *assembler* will know the fancy instructions 154 # the compiler emits with that option. 155 # For example, Apple's assembler on Mac OS X 10.7.1 apparently doesn't 156 # yet support AVX, which could also cause MPIR's 'configure' to fail. 157 cat >foo.c <<-"EOF" 158 double d; 159 unsigned long fancy_insns() { return (unsigned long) d; } 160 int main () { return 0; } 161 EOF 162 if $CC -march=native -o foo foo.c &>/dev/null && ./foo >/dev/null; then 163 echo "-march=native" 164 else 165 echo >&2 "Warning: Your assembler apparently doesn't understand the instructions" 166 echo >&2 " your compiler ($CC) generates with '-march=native'." 167 echo >&2 " You might also try to compile MPIR with (e.g.)" 168 echo >&2 " CFLAGS=\"-march=native -mno-avx\"" 169 echo >&2 " to disable specific instruction set extension (in this case, AVX)." 170 fi 125 171 fi 126 rm -f foo .* >/dev/null172 rm -f foo foo.* >/dev/null 127 173 } 128 174 129 175 ############################################################################### 130 176 # Set up environment variables: 131 177 ############################################################################### 132 178 133 # The Yasm build uses PYTHON from the environment to find python, so unset 134 # it since the setting from 'spkg/standard/newest_version' confuses it: 135 unset PYTHON 136 # This can be removed once #10492 has been merged, which turns the "package 137 # version" environment variables into solely `make` variables, such that the 138 # (shell) environment does no longer get polluted. 179 # The Yasm build uses PYTHON from the environment to find the Python interpreter, 180 # so unset it in case it apparently contains nothing useful (like it did in Sage 181 # versions prior to 5.0.beta10; cf. #10492), to not break Yasm's 'configure': 182 if ! $PYTHON --version &>/dev/null; then 183 # Only issue a warning if it was really non-empty, to not confuse users: 184 if [ -n "$PYTHON" ]; then 185 echo >&2 "Warning: Unsetting PYTHON (=\"$PYTHON\"), since it doesn't seem" 186 echo >&2 " to contain the name of / path to a Python interpreter." 187 fi 188 unset PYTHON 189 fi 139 190 140 191 user_cflags=$CFLAGS # Save them. 'sage-env' sets CC, but not CFLAGS. 141 required_cflags="" # Additional mandatory settings required by Sage, accumulated below. 142 default_cflags="" # Spkg defaults that can and might get overridden. 192 required_cflags="" # Additional mandatory settings required by Sage, accumulated below. 193 default_cflags="" # Spkg defaults that can and might get overridden. 194 user_ldflags=$LDFLAGS # Save them. 195 required_ldflags="" # Additional mandatory settings required by Sage, accumulated below. 196 user_abi=$ABI # Just save it. 197 # In case we changed CPPFLAGS or CXXFLAGS, too, we should save the user's here as well. 198 # We don't have to add (e.g.) '-m64' to CFLAGS/CPPFLAGS/CXXFLAGS/LDFLAGS, since 199 # MPIR's 'configure' is smart enough to add it if necessary or appropriate. 143 200 144 # Newer autotools may put libs into .../lib64 (on 64-bit systems): 145 SAGE_CONF_OPTS=--libdir="$SAGE_LOCAL/lib" 146 # (Further options to `configure` are added below.) 201 SAGE_CONF_OPTS="" # Clear them. (Further options to `configure` are added below.) 147 202 148 203 149 204 if [ -z "$CFLAG32" ]; then … … 157 212 if [ "$SAGE_DEBUG" = yes ]; then 158 213 # Disable optimization, add debug symbols: 159 214 required_cflags="$required_cflags -g -O0" 160 echo "Warning: Building MPIR with SAGE_DEBUG=yes disables optimization."215 echo >&2 "Warning: Building MPIR with SAGE_DEBUG=yes disables optimization." 161 216 else 162 217 # Add debug symbols by default, enable optimization, but do not (yet) 163 218 # add processor-specific flags (these are eventually added later): … … 167 222 168 223 case "$UNAME" in 169 224 SunOS) 170 if [ "$SAGE64" = "yes"]; then225 if [ "$SAGE64" = yes ]; then 171 226 echo "Building a 64-bit version of MPIR." 172 227 ABI=64 173 228 else … … 175 230 ABI=32 176 231 fi;; 177 232 Darwin) 178 if [ "$SAGE64" = "yes"]; then179 # Note that we do not support 64-bit builds on PPC at all,233 if [ "$SAGE64" = yes ]; then 234 # Note that we do not support 64-bit builds on MacOS X PPC at all, 180 235 # so we don't special-case on the architecture here. 181 236 echo "Building a 64-bit version of MPIR." 182 237 ABI=64 183 238 else 184 # Do not set ABI=32 on OS X 10.6 (Darwin 10) and later, since239 # Do not set ABI=32 on MacOS X 10.6 (Darwin 10) and later, since 185 240 # there everything defaults to 64-bit: 186 241 if [ "`uname -r | sed 's/\..*//'`" -lt 10 ]; then 187 242 # Assume MacOS X 10.4 or 10.5 (Darwin 8 or 9); also, PPC CPUs 188 243 # are only supported by these, not later versions. 244 echo "Building a 32-bit version of MPIR, which is the only supported option." 189 245 ABI=32 190 246 case "`uname -m`" in 191 247 i[3456]86) … … 198 254 required_cflags="$required_cflags -Wa,-force_cpusubtype_ALL" 199 255 ;; 200 256 esac 257 else 258 # Darwin 10 (MacOS X 10.6) or later, SAGE64 not "yes" 259 # We don't have to set ABI here. 260 echo "Building a 64-bit version of MPIR, which is the default." 201 261 fi 202 fi;; 262 fi 263 ;; # Darwin 203 264 Linux) 204 265 # Work around (erroneously) set "executable stack" attributes, 205 266 # causing runtime errors on Fedora 14 and other SELinux-enabled 206 267 # systems: 207 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" 208 export LDFLAGS # perhaps redundant, but safe(r) 268 required_ldflags="$required_ldflags -Wl,-z,noexecstack" 209 269 210 270 if [ "$SAGE_FAT_BINARY" = "yes" ]; then 211 271 # For now we do the same thing -- namely "--enable-fat" -- … … 220 280 SAGE_CONF_OPTS="$SAGE_CONF_OPTS --enable-fat" 221 281 ;; 222 282 *) # e.g. ia64 (Itanium) or PPC (ppc, ppc64) 223 echo "Warning: A \"fat binary\" build is currently not" \283 echo >&2 "Warning: A \"fat binary\" build is currently not" \ 224 284 "supported on this CPU architecture." 225 285 # XXX exit 1 ? 226 286 esac … … 256 316 echo "Your compiler does not support '$CFLAG32' nor '$CFLAG64'. Leaving ABI unset." 257 317 fi 258 318 rm -f foo foo.c 259 fi;; 319 fi 320 321 # Work around a bug in GCC 4.7.0 which breaks the build on Itanium CPUs: 322 # (Cf. #12765, #12751, and bug URL below.) 323 case "`uname -m`-`$CC -dumpversion 2>/dev/null`" in ia64-4.7.*) 324 # It's quite unlikely we match other compilers than GCC (e.g. clang) here. 325 required_cflags="$required_cflags -O0 -finline-functions -fschedule-insns" 326 echo >&2 "Warning: Disabling almost all optimization due to a bug in (at least)" 327 echo >&2 " GCC 4.7.0 on Itanium, which otherwise would break the build." 328 echo >&2 " See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496" 329 echo >&2 " for current status and further details." 330 echo >&2 " (And please report to e.g. sage-devel in case you feel this bug" 331 echo >&2 " should already be fixed in GCC `$CC -dumpversion`.)" 332 esac 333 ;; # Linux 260 334 CYGWIN) 261 335 # Nothing special performed (yet). 262 336 ;; 263 337 *) # e.g. AIX or HP-UX 264 echo "Warning: Your platform ($UNAME) isn't yet explicitly supported" \338 echo >&2 "Warning: Your platform ($UNAME) isn't yet explicitly supported" \ 265 339 "by this MPIR spkg, i.e., by Sage's part of it." 266 340 esac 267 341 268 342 export ABI CFLAGS CXXFLAGS # Partially redundant, but safe(r). 343 # We don't export CPPFLAGS here, since we don't (have to) modify them. 344 if [ -n "$required_ldflags" ]; then 345 export LDFLAGS # Probably redundant, but safe(r). 346 fi 269 347 270 348 ############################################################################### 271 349 # Now configure MPIR, eventually modifying CFLAGS [further]: 272 350 ############################################################################### 273 351 274 cd src 352 SAGE_CONF_OPTS="--enable-gmpcompat --enable-shared $SAGE_CONF_OPTS" 275 353 276 277 SAGE_CONF_OPTS="--enable-gmpcompat --enable-cxx=yes $SAGE_CONF_OPTS" 278 # Also build the static library to be used by e.g. ECM: 279 # SAGE_CONF_OPTS="--enable-shared --disable-static $SAGE_CONF_OPTS" 280 SAGE_CONF_OPTS="--enable-shared --enable-static $SAGE_CONF_OPTS" 354 # If we're bootstrapping GCC from the GCC spkg, don't build the C++ interface 355 # and static libraries in the first place (cf. #12782): 356 if [ "$SAGE_BUILD_TOOLCHAIN" = yes ]; then 357 echo "Building a reduced version of MPIR to bootstrap GCC." 358 echo "MPIR will later get rebuilt (with the C++ interface and static libraries" 359 echo "enabled) using the new compiler." 360 SAGE_CONF_OPTS="--disable-cxx --disable-static $SAGE_CONF_OPTS" 361 else 362 # Also build the static library to be used by e.g. ECM: 363 echo "Building MPIR with the C++ interface and (also) static libraries." 364 SAGE_CONF_OPTS="--enable-cxx --enable-static $SAGE_CONF_OPTS" 365 fi 281 366 # (Further options to 'configure' are added below.) 282 367 283 368 … … 293 378 echo " CC: $mpir_cc" 294 379 echo " CFLAGS: $mpir_cflags" 295 380 else 296 echo "Warning: Couldn't determine MPIR-selected CFLAGS from 'mpir.h'"381 echo >&2 "Warning: Couldn't determine MPIR-selected CFLAGS from 'mpir.h'" 297 382 fi 298 383 else 299 384 # We ignore errors in the first place, since we redirected all … … 314 399 done 315 400 316 401 echo "Settings required to properly build MPIR, taking into account SAGE_DEBUG etc.:" 317 echo " CFLAGS: $required_cflags" 318 echo " LDFLAGS: $ LDFLAGS" # Might be empty, or specified by the user.319 echo " ABI: $ABI" # Might be empty, or specified by the user.402 echo " CFLAGS: $required_cflags" # Might be empty. 403 echo " LDFLAGS: $required_ldflags" # Might be empty. 404 echo " ABI: $ABI" # Might be empty, or the one specified by the user. 320 405 echo "Settings from the \"global\" environment:" 321 406 echo " CC: $CC" # Set by Sage, maybe overridden by the user. 322 407 echo " CFLAGS: $user_cflags" 323 echo " (CPPFLAGS, CXX and CXXFLAGS are listed below; these don't get modified.)" 408 echo " LDFLAGS: $user_ldflags" 409 echo " ABI: $user_abi" 410 echo " (CPP, CPPFLAGS, CXX and CXXFLAGS are listed below; these don't get modified.)" 324 411 325 412 if [ -z "$user_cflags" ]; then 326 413 # No CFLAGS specified by user => Use either MPIR's, GMP's or our default … … 374 461 fi 375 462 fi 376 463 464 LDFLAGS="$required_ldflags $user_ldflags" 465 377 466 echo "Finally using the following settings:" 378 467 echo " CC=$CC" 379 468 echo " CFLAGS=$CFLAGS" 469 echo " CPP=$CPP" 380 470 echo " CPPFLAGS=$CPPFLAGS" 381 471 echo " CXX=$CXX" 382 472 echo " CXXFLAGS=$CXXFLAGS" … … 388 478 # Now really configure MPIR with proper settings: 389 479 ############################################################################### 390 480 481 # We also add '--libdir="$SAGE_LOCAL/lib"' below, since newer autotools may 482 # otherwise put the libraries into .../lib64 on 64-bit systems (cf. #12131). 483 391 484 if [ -z "$MPIR_EXTRA_OPTS" ]; then 392 485 echo "Configuring MPIR with the following options:" 393 echo " --prefix=\"$SAGE_LOCAL\" $SAGE_CONF_OPTS"486 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $SAGE_CONF_OPTS" 394 487 echo "You can set MPIR_EXTRA_OPTS to pass additional parameters." 395 488 else 396 489 echo "Using additional 'configure' options as specified through" \ 397 490 "MPIR_EXTRA_OPTS:" 398 491 echo " $MPIR_EXTRA_OPTS" 399 492 echo "Configuring MPIR with the following options:" 400 echo " --prefix=\"$SAGE_LOCAL\" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS"493 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS" 401 494 fi 402 495 403 ./configure --prefix="$SAGE_LOCAL" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS496 ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS 404 497 if [ $? -ne 0 ]; then 405 echo "Error configuring MPIR. (See above for the options passed to it.)"498 echo >&2 "Error configuring MPIR. (See above for the options passed to it.)" 406 499 exit 1 407 500 fi 408 501 … … 410 503 # Now build MPIR: 411 504 ############################################################################### 412 505 506 echo "Now building MPIR..." 413 507 $MAKE 414 508 if [ $? -ne 0 ]; then 415 echo "Error building MPIR."509 echo >&2 "Error building MPIR." 416 510 exit 1 417 511 fi 418 512 … … 442 536 # Now install MPIR: 443 537 ############################################################################### 444 538 539 echo "Now installing MPIR..." 445 540 # The potential race condition in `make install` was fixed in MPIR 2.1.4. 446 541 $MAKE install 447 542 if [ $? -ne 0 ]; then … … 451 546 fi 452 547 fi 453 548 549 echo 454 550 echo "Remember to rebuild the Sage library ('./sage -b') such that it" 455 551 echo "will use the new MPIR." 456 552 echo "You may also have to (or want to) rebuild other Sage packages" … … 459 555 echo " cd $SAGE_ROOT" 460 556 echo " env SAGE_UPGRADING=yes make" 461 557 echo "but note that this will usually take quite a lot of time." 558 echo
