Ticket #12954: mpir-2.4.0.p4.diff
File mpir-2.4.0.p4.diff, 11.2 KB (added by , 10 years ago) |
---|
-
SPKG.txt
diff --git a/SPKG.txt b/SPKG.txt
a b 57 57 58 58 == Changelog == 59 59 60 === mpir-2.4.0.p4 (Jeroen Demeyer, 26 May 2012) === 61 * Trac #12954: when SAGE_FAT_BINARY=yes on systems which don't support 62 --enable-fat, compile a generic binary (not assuming any particular 63 CPU) by passing the output of configfsf.guess to the --build option 64 of ./configure. 65 * Disable SAGE_FAT_BINARY when bootstrapping GCC. 66 * Rename MPIR_EXTRA_OPTS to MPIR_CONFIGURE. 67 * Add configure options directly to MPIR_CONFIGURE, no longer use 68 SAGE_CONF_OPTS for this. 69 * When user specifies CFLAGS, append them to MPIR's flags instead of 70 completely replacing MPIR's flags. 71 * Remove $default_cflags and get_processor_specific_cflags(). 72 60 73 === mpir-2.4.0.p3 (Jeroen Demeyer, April 26th, 2012) === 61 74 Trac #11616, reviewer fixes: 62 75 * When the first configure run (with CFLAGS unset) of MPIR fails, bail -
spkg-install
diff --git a/spkg-install b/spkg-install
a b 58 58 cd "$saved" 59 59 } 60 60 61 get_processor_specific_cflags() # Extract some processor-specific CFLAGS.62 {63 # Internal sanity check:64 if [ $# -lt 1 ]; then65 echo >&2 "Error: get_processor_specific_cflags() requires 'CFLAGS' parameter."66 exit 167 fi68 flags=$*69 arch_flags=""70 for opt in $flags; do71 case $opt in72 -march=*|-mcpu=*|-mtune=*|-mpower*|-mno-power*)73 arch_flags="$arch_flags $opt"74 ;;75 # We could add further '-m' or '-f' options here, but note that76 # this function is also used to determine if the user specified77 # some, which we don't want to override.78 esac79 done80 echo $arch_flags81 }82 83 61 ############################################################################### 84 62 # Set up environment variables: 85 63 ############################################################################### … … 97 75 98 76 user_cflags=$CFLAGS # Save them. 'sage-env' sets CC, but not CFLAGS. 99 77 required_cflags="" # Additional mandatory settings required by Sage, accumulated below. 100 default_cflags="" # Spkg defaults that can and might get overridden.101 78 user_ldflags=$LDFLAGS # Save them. 102 79 required_ldflags="" # Additional mandatory settings required by Sage, accumulated below. 103 80 user_abi=$ABI # Just save it. … … 105 82 # We don't have to add (e.g.) '-m64' to CFLAGS/CPPFLAGS/CXXFLAGS/LDFLAGS, since 106 83 # MPIR's 'configure' is smart enough to add it if necessary or appropriate. 107 84 108 SAGE_CONF_OPTS="" # Clear them. (Further options to `configure` are added below.)109 110 85 111 86 if [ -z "$CFLAG32" ]; then 112 87 CFLAG32="-m32" # Only used in this script, no need to export it. … … 121 96 required_cflags="$required_cflags -g -O0" 122 97 echo >&2 "Warning: Building MPIR with SAGE_DEBUG=yes disables optimization." 123 98 else 124 # Add debug symbols by default, enable optimization, but do not (yet) 125 # add processor-specific flags (these are eventually added later): 126 default_cflags="$default_cflags -g -O3" 99 # Add debug symbols by default 100 required_cflags="$required_cflags -g" 127 101 fi 128 102 129 103 130 104 case "$UNAME" in 131 105 SunOS) 132 106 if [ "$SAGE64" = yes ]; then 133 echo "Building a 64-bit version of MPIR." 107 echo "Building a 64-bit version of MPIR." 134 108 ABI=64 135 109 else 136 echo "Building a 32-bit version of MPIR." 110 echo "Building a 32-bit version of MPIR." 137 111 ABI=32 138 112 fi;; 139 113 Darwin) … … 174 148 # systems: 175 149 required_ldflags="$required_ldflags -Wl,-z,noexecstack" 176 150 177 if [ "$SAGE_FAT_BINARY" = "yes" ]; then178 # For now we do the same thing -- namely "--enable-fat" --179 # on both 64-bit and 32-bit, though this is likely to change.180 case "`uname -m`" in181 i[3456]86)182 echo "** Building with \"fat binary\" support for 32-bit CPUs **"183 SAGE_CONF_OPTS="$SAGE_CONF_OPTS --enable-fat"184 ;;185 x86_64|amd64)186 echo "** Building with \"fat binary\" support for 64-bit CPUs **"187 SAGE_CONF_OPTS="$SAGE_CONF_OPTS --enable-fat"188 ;;189 *) # e.g. ia64 (Itanium) or PPC (ppc, ppc64)190 echo >&2 "Warning: A \"fat binary\" build is currently not" \191 "supported on this CPU architecture."192 # XXX exit 1 ?193 esac194 fi195 196 151 # MPIR fails to build on 32-bit operating systems running on 197 152 # 64-bit CPUs if CFLAGS happen to contain '-m32' and ABI is 198 153 # *not* set, so we set it here if necessary: … … 204 159 echo "int main(){return 0;}" > foo.c 205 160 # Try building and running a 64-bit executable: 206 161 # (Building usually succeeds even on 32-bit systems, unless e.g. a 32-bit 207 162 # CPU is explicitly selected by CFLAGS, while running does not.) 208 163 if $CC $CFLAGS $CFLAG64 -o foo foo.c 2>/dev/null && ./foo 2>/dev/null; then 209 164 # We can run 64-bit executables. 210 165 # Setting ABI=64 shouldn't be necessary, but shouldn't hurt either. … … 254 209 # Now configure MPIR, eventually modifying CFLAGS [further]: 255 210 ############################################################################### 256 211 257 SAGE_CONF_OPTS="--enable-gmpcompat --enable-shared $SAGE_CONF_OPTS"212 MPIR_CONFIGURE="--enable-gmpcompat --enable-shared $MPIR_CONFIGURE" 258 213 259 # If we're bootstrapping GCC from the GCC spkg, don't build the C++ interface 260 # and static libraries in the first place (cf. #12782): 214 # If we're bootstrapping GCC from the GCC spkg, don't build the C++ 215 # interface (cf. #12782), static libraries and disable fat binary. 216 # After GCC is built, we will build MPIR again. 261 217 if [ "$SAGE_BUILD_TOOLCHAIN" = yes ]; then 262 218 echo "Building a reduced version of MPIR to bootstrap GCC." 263 219 echo "MPIR will later get rebuilt (with the C++ interface and static libraries" 264 220 echo "enabled) using the new compiler." 265 SAGE_CONF_OPTS="--disable-cxx --disable-static $SAGE_CONF_OPTS" 221 MPIR_CONFIGURE="--disable-cxx --disable-static $MPIR_CONFIGURE" 222 SAGE_FAT_BINARY=no 266 223 else 267 224 # Also build the static library to be used by e.g. ECM: 268 225 echo "Building MPIR with the C++ interface and (also) static libraries." 269 SAGE_CONF_OPTS="--enable-cxx --enable-static $SAGE_CONF_OPTS"226 MPIR_CONFIGURE="--enable-cxx --enable-static $MPIR_CONFIGURE" 270 227 fi 271 228 # (Further options to 'configure' are added below.) 272 229 230 # If SAGE_FAT_BINARY is enabled, then add --enable-fat to configure 231 # options on Linux x86 systems. On other systems, fat binaries are not 232 # supported. Then we specify a build architecture which doesn't 233 # have a CPU name in it. This means which use the vanilla config.guess 234 # (renamed to configfsf.guess in MPIR) file instead of MPIR's version. 235 if [ "$SAGE_FAT_BINARY" = "yes" ]; then 236 case "$UNAME-`uname -m`" in 237 Linux-i[3456]86) 238 echo "** Building with \"fat binary\" support for 32-bit CPUs **" 239 MPIR_CONFIGURE="--enable-fat $MPIR_CONFIGURE" 240 ;; 241 Linux-x86_64|Linux-amd64) 242 echo "** Building with \"fat binary\" support for 64-bit CPUs **" 243 MPIR_CONFIGURE="--enable-fat $MPIR_CONFIGURE" 244 ;; 245 *) # Anything else 246 echo "** Building a generic binary (not assuming any specific CPU) **" 247 MPIR_CONFIGURE="--build=`./configfsf.guess` $MPIR_CONFIGURE" 248 ;; 249 esac 250 fi 251 273 252 274 253 # Pre-configure MPIR to get the settings it would use if CFLAGS were empty: 275 254 echo "Checking what CFLAGS MPIR would use if they were empty..." 276 (unset CFLAGS CPPFLAGS CXXFLAGS && ./configure $ SAGE_CONF_OPTS $MPIR_EXTRA_OPTS) &>configure-empty.log255 (unset CFLAGS CPPFLAGS CXXFLAGS && ./configure $MPIR_CONFIGURE) &>configure-empty.log 277 256 if [ $? -ne 0 ]; then 278 257 # Output the log of the failed configure run 279 258 cat configure-empty.log … … 294 273 echo "Settings chosen by MPIR when configuring with CFLAGS unset:" 295 274 echo " CC: $mpir_cc" 296 275 echo " CFLAGS: $mpir_cflags" 297 echo "Settings required to properlybuild MPIR, taking into account SAGE_DEBUG etc.:"276 echo "Settings added by Sage to build MPIR, taking into account SAGE_DEBUG etc.:" 298 277 echo " CFLAGS: $required_cflags" # Might be empty. 299 278 echo " LDFLAGS: $required_ldflags" # Might be empty. 300 279 echo " ABI: $ABI" # Might be empty, or the one specified by the user. … … 305 284 echo " ABI: $user_abi" 306 285 echo " (CPP, CPPFLAGS, CXX and CXXFLAGS are listed below; these don't get modified.)" 307 286 308 if [ -z "$user_cflags" ]; then 309 # No CFLAGS specified by user => Use MPIR's flags, plus those 310 # required by Sage for the package to build properly: 311 echo "Using MPIR's settings (plus mandatory ones)." 312 CFLAGS="$mpir_cflags $required_cflags" 313 else 314 # CFLAGS were specified by the user, so don't override them (unless 315 # necessary) and only add some useful ones to improve code generation: 316 echo "Using user-specified settings (overriding defaults), with some additions." 317 CFLAGS="$default_cflags $user_cflags $required_cflags" 318 319 # Now add processor-specific flags if appropriate: 320 if [ -z "`get_processor_specific_cflags $CFLAGS`" ]; then 321 # User didn't specify specific architecture, so try to add such flag(s): 322 # Add MPIR's. Honors '--enable-fat'. 323 echo "Adding processor-specific options from MPIR." 324 CFLAGS="`get_processor_specific_cflags $mpir_cflags` $CFLAGS" 325 else 326 # User did specify some processor-specific CFLAGS. 327 # We *might* prepend all of MPIR's CFLAGS here in addition, 328 # but doing so could raise a conflict. 329 :; 330 fi 331 fi 332 287 # Finally: use MPIR's flags, plus those required by Sage for the 288 # package to build properly, plus those specified by the user. 289 CFLAGS="$mpir_cflags $required_cflags $user_cflags" 333 290 LDFLAGS="$required_ldflags $user_ldflags" 334 291 335 292 echo "Finally using the following settings:" … … 350 307 # We also add '--libdir="$SAGE_LOCAL/lib"' below, since newer autotools may 351 308 # otherwise put the libraries into .../lib64 on 64-bit systems (cf. #12131). 352 309 353 if [ -z "$MPIR_EXTRA_OPTS" ]; then 354 echo "Configuring MPIR with the following options:" 355 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $SAGE_CONF_OPTS" 356 echo "You can set MPIR_EXTRA_OPTS to pass additional parameters." 357 else 358 echo "Using additional 'configure' options as specified through" \ 359 "MPIR_EXTRA_OPTS:" 360 echo " $MPIR_EXTRA_OPTS" 361 echo "Configuring MPIR with the following options:" 362 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS" 363 fi 310 echo "Configuring MPIR with the following options:" 311 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $MPIR_CONFIGURE" 312 echo "You can set MPIR_CONFIGURE to pass additional parameters." 364 313 365 314 # Clear the cache of the previous configure run 366 315 find . -name config.cache -exec rm -f {} \; 367 316 368 ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $ SAGE_CONF_OPTS $MPIR_EXTRA_OPTS317 ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $MPIR_CONFIGURE 369 318 if [ $? -ne 0 ]; then 370 319 echo >&2 "Error configuring MPIR. (See above for the options passed to it.)" 371 320 exit 1