Ticket #12830: ecm-6.3.p4-p6.diff
File ecm-6.3.p4-p6.diff, 23.8 KB (added by , 10 years ago) |
---|
-
.hgignore
diff --git a/.hgignore b/.hgignore
a b 1 1 src 2 patches/configure3 patches/configure.in -
.hgtags
diff --git a/.hgtags b/.hgtags
a b 1 1 4fb2b9ca03a2973d035fad8c9cfe6062c79cc6f2 ecm-6.3.p2 2 2 4d6646f19caecfa0810d3341a8a1361cb529a7b4 ecm-6.3.p3 3 3 62e5a142f7157c6dfa8ab59fc9228208326507ad ecm-6.3.p4 4 14c0237361c1ffefdcece11d745f3381ec009a46 ecm-6.3.p5 5 7ac46fc5997fb25668f35b8571f48af69f5859f4 ecm-6.3.p6 -
SPKG.txt
diff --git a/SPKG.txt b/SPKG.txt
a b 21 21 == Dependencies == 22 22 23 23 * GMP/MPIR (Note: Python is *not* required for ordinary builds.) 24 * GNU patch 24 25 25 26 == Special Update/Build Instructions == 26 27 27 * src/ contains "stable" upstream code, to which we currently apply 28 two upstream patches (both to 'configure.in'). These (i.e. the 29 files 'patches/configure.in' and 'patches/configure') should be 30 removed on the next upgrade to a stable release. 28 * src/ contains "stable" upstream code, to which we currently apply a single 29 upstream patch (to 'configure'). The patch should be removed on the next 30 upgrade to a stable release. 31 Note that all autotools-generated files (and their support files) in src/ 32 have been regenerated with newer versions of autotools (autoconf 2.68, 33 automake 1.11.3 and libtool 2.4.2), to make the size of the patch to the 34 also generated `configure` acceptable. (See "Patches" section below for 35 why we don't patch `configure.in`, from which `configure` is created.) 31 36 * GMP-ECM comes with a self-tuning feature; we could support 32 37 that as an option ($SAGE_TUNE_*=yes) in the future. 33 38 * We currently work around a linker bug on MacOS X 10.5 PPC (with … … 35 40 This *might* get fixed in later upstream releases. 36 41 * ECM currently does not (by itself) use the CC and CFLAGS settings 37 42 from 'gmp.h' since we pass (other) options in CFLAGS, and CC is set 38 by Sage and might got set by the user (though MPIR currently doesn't 39 use its own CFLAGS for the same reason, which is fixed in an MPIR 40 2.1.3.p2 spkg). We now at least partially fix that s.t. "optimized" 41 code generation options ('-mcpu=...', '-mtune=...') are used by gcc. 43 by Sage and might got set by the user. We now at least partially fix that 44 such that "optimized" code generation options ('-mcpu=...', '-mtune=...') 45 are used by gcc. 42 46 Of course a user can also manually enable them by setting the "global" 43 47 CFLAGS to e.g. '-march=native' on x86[_64] systems, or '-mcpu=...' and 44 48 '-mtune=...' on other architectures where "native" isn't supported. … … 50 54 "-mcpu=...", and perhaps pass a more generic "--host=..." to 51 55 'configure'. (MPIR honors '--enable-fat' to some extent, but this 52 56 option isn't used on anything other than x86 / x86_64.) 57 * Check whether the work-around for GCC 4.7 on ia64 is still appropriate, i.e. 58 adapt it in case the issue has been fixed in later GCC versions of the 4.7 59 release series. (Although the bug currently affects only GCC 4.7.0, it 60 seems unlikely that it will be fixed soon, hence we apply the work-around 61 for any GCC 4.7.x version on ia64.) 62 See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496 for details and the 63 current status of that bug. 64 * We could save some space by removing the `src/build.vc9/` directory which 65 isn't used in Sage. (It gets probably more worth in case also directories / 66 files for later versions of Microsoft Visual C get added.) 67 68 === Patches === 69 * configure.patch: 70 - Disable "asm-redc" on 32-bit Darwin PPCs (upstream revision 1516 / bug 71 #10646). 72 (Note that this upstream patch is likely to slow down GMP-ECM on 64-bit 73 PPC CPUs running (32-bit) MacOS X, since the extended instruction set of 74 the CPU is no longer exploitet. A proper fix would just pass an option 75 to Apple's assembler to allow the use of the extended instruction set.) 76 - Fix compilation error on x86 CPUs supporting SSE2. (Sage trac #10252, 77 upstream revision 1546). 78 Note that we don't patch `configure.in`, since it is only needed to generate 79 automatically-generated files in the source tree. Patching `configure.in` 80 would force `automake` to be run, which could cause build failures on 81 systems where autotools aren't installed. 82 53 83 54 84 == Changelog == 55 85 86 === ecm-6.3.p6 (Leif Leonhardy, April 16th 2012) === 87 * #12830: Add a work-around for GCC 4.7.x on ia64 (Itanium), since GMP-ECM 88 currently won't build with that and anything but `-O0` on that platform. 89 * Use `\{1,\}` instead of `\+` in `sed` patterns, which is more portable. 90 * Also support newer system-wide MPIR installations for printing their 91 settings. 92 * Use `patch` to apply patches. Since the pre-patched `configure` in 93 `patches/` was created with a newer version of autotools (or, rather, the 94 original `configure` was created with an outdated version), the patch would 95 have been almost as large as the patched `configure` file itself. Hence 96 I `autoreconf`ed the source tree with a patched `configure.in` (and almost 97 the latest versions of autotools), then created a patch to `configure` 98 from the resulting file(s). Note that therefore `src/` isn't really vanilla 99 any more, although just the auto-generated files differ (which are still 100 made from vanilla upstream sources, including `configure.in`). 101 Add a "Patches" subsection and update "Special Update/Build Instructions". 102 Remove files in `patches/` from `.hgignore` (and also remove pre-patched 103 files from that directory); the patch to `configure` and the diff of 104 `configure.in` are [now] under revision control, which IMHO makes sense. 105 * Beautify (and simplify) the output with respect to options passed to 106 `configure`; print the settings of a few more environment variables that 107 GMP-ECM uses (in case they're set); add some messages, also mention 108 `--enable-assert` etc. if `SAGE_DEBUG=yes`. 109 * Remove unused test for GCC. 110 111 === ecm-6.3.p5 (Leif Leonhardy, April 11th 2012) === 112 * #12830: Don't add `-march=native` if the assembler doesn't understand the 113 instructions the compiler emits with that. (E.g. the Apple/XCode assembler 114 on Darwin doesn't yet support AVX.) 115 * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` (from `gmp.h`) for newer 116 versions of MPIR, which define these to preprocessor macros rather than 117 strings. 118 * Redirect warnings and error messages to `stderr`; add some messages. 119 * Correct `SPKG.txt` w.r.t. applied patches. 120 56 121 === ecm-6.3.p4 (Jeroen Demeyer, 13 February 2012) === 57 122 * #12501: Do not patch configure.in in spkg-install (to prevent 58 123 automake from running). -
new file patches/configure.patch
diff --git a/patches/configure.patch b/patches/configure.patch new file mode 100644
- + 1 --- src/configure 2012-04-16 21:51:42.586783117 +0200 2 +++ src-patched/configure 2012-04-16 22:13:59.096783235 +0200 3 @@ -12343,7 +12343,7 @@ 4 # asm_redc enabled by default for x86_64 and 64 bit PowerPC 5 if test "x$enable_asm_redc" = x; then 6 case $host in 7 - x86_64* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;; 8 + x86_64*-*-* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;; 9 *) enable_asm_redc=no;; 10 esac 11 fi 12 @@ -12351,8 +12351,35 @@ 13 if test "x$enable_asm_redc" = xyes; then 14 case $host in 15 pentium4-*-* | pentium3-*-* | viac7-*-* | i786-*-*) ASMPATH=pentium4;; 16 - x86_64-*-*) ASMPATH=x86_64;; 17 - powerpc-apple-darwin*) ASMPATH=powerpc64;; 18 + x86_64*-*-*) ASMPATH=x86_64;; 19 +# warning: with powerpc-apple-darwin* we can have ABI=32 20 +# see bug #10646 on the bug tracker, where config.guess says 21 +# powerpc-apple-darwin8.11.0 (this a 64-bit machine, but most applications 22 +# are compiled in 32 bits). It works with --disable-asm-redc. 23 + powerpc-apple-darwin*) 24 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext 25 +/* end confdefs.h. */ 26 + 27 +#if defined(__ppc__) 28 +#error 29 +#endif 30 +int 31 +main () 32 +{ 33 + 34 + ; 35 + return 0; 36 +} 37 +_ACEOF 38 +if ac_fn_c_try_cpp "$LINENO"; then : 39 + 40 +else 41 + { $as_echo "$as_me:${as_lineno-$LINENO}: 32-bit PowerPC, disabling asm-redc" >&5 42 +$as_echo "$as_me: 32-bit PowerPC, disabling asm-redc" >&6;} 43 + enable_asm_redc=no 44 +fi 45 +rm -f conftest.err conftest.i conftest.$ac_ext 46 + ASMPATH=powerpc64;; 47 powerpc64-*-linux*) 48 49 echo "include(<"$srcdir"/powerpc64/powerpc-defs.m4>)" >> $gmp_tmpconfigm4 50 @@ -12363,7 +12390,9 @@ 51 ASMPATH=athlon;; 52 *) as_fn_error $? "asm redc not available on this machine $host" "$LINENO" 5;; 53 esac 54 +fi 55 56 +if test "x$enable_asm_redc" = xyes; then 57 # do the necessary definitions and includes 58 59 $as_echo "#define NATIVE_REDC 1" >>confdefs.h 60 @@ -12684,9 +12713,9 @@ 61 main () 62 { 63 #if (defined(__GNUC__) || defined(__ICL)) && defined(__i386__) 64 -/* When there are no constraints, registers are referred to by 65 - single % sign, not double. Argh */ 66 -asm volatile ("pmuludq %xmm2, %xmm0"); 67 +/* On some machines, a program without constraints may pass without -msse2 but 68 + those with constraints in spv.c fail, thus we test with constraints here. */ 69 +asm volatile ("pmuludq %%xmm2, %%xmm0" : : :"%xmm0"); 70 #else 71 #error 72 #IRIXdoesnotexitaterrordirective 73 @@ -12708,9 +12737,9 @@ 74 main () 75 { 76 #if (defined(__GNUC__) || defined(__ICL)) && defined(__i386__) 77 -/* When there are no constraints, registers are referred to by 78 - single % sign, not double. Argh */ 79 -asm volatile ("pmuludq %xmm2, %xmm0"); 80 +/* On some machines, a program without constraints may pass without -msse2 but 81 + those with constraints in spv.c fail, thus we test with constraints here. */ 82 +asm volatile ("pmuludq %%xmm2, %%xmm0" : : :"%xmm0"); 83 #else 84 #error 85 #IRIXdoesnotexitaterrordirective -
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..."4 echo >&2 "Error: SAGE_LOCAL undefined - exiting..." 5 5 exit 1 6 6 fi 7 7 8 8 # Note: Running the test suite should not involve (re)compilation, 9 # so we don't set CFLAGS et al. here. 9 # so we don't set CFLAGS et al. here. (Their settings are 10 # stored in the Makefiles created by 'configure' anyway.) 10 11 11 12 cd src 12 13 13 echo "Running the GMP-ECM test suite..." 14 echo 15 echo "Now running GMP-ECM's test suite..." 14 16 15 17 $MAKE check 16 18 17 19 if [ $? -ne 0 ]; then 18 echo "Error: The GMP-ECMtest suite failed."20 echo >&2 "Error: GMP-ECM's test suite failed." 19 21 exit 1 20 22 fi 21 23 22 echo " The GMP-ECMtest suite passed."24 echo "GMP-ECM's test suite passed." -
spkg-install
diff --git a/spkg-install b/spkg-install
a b 1 1 #!/usr/bin/env bash 2 2 3 3 if [ -z "$SAGE_LOCAL" ]; then 4 echo "Error: SAGE_LOCAL undefined - exiting..."4 echo >&2 "Error: SAGE_LOCAL undefined - exiting..." 5 5 exit 1 6 6 fi 7 7 8 cd src/ 9 8 10 ############################################################################### 9 11 # Apply patches (if any): 10 12 ############################################################################### 11 13 12 # Patch configure (and configure.in): 13 # - Disable asm-redc on 32-bit Darwin PPCs (upstream revision 1516 / bug #10646) 14 # - Fix compilation error on x86 CPUs supporting SSE2. (Sage trac #10252, 15 # upstream revision 1546) 16 echo "Copying patched files..." 17 # Note that we don't patch configure.in here, since it is only needed 18 # to generate automatically-generated files in the source tree. 19 # Patching configure.in forces automake to be run, which may cause 20 # build failures on systems where autotools aren't installed. 21 cp -p patches/configure src/ 22 if [ $? -ne 0 ]; then 23 echo "Error copying patched configure." 24 exit 1 25 fi 14 ls ../patches/*.patch &>/dev/null && 15 echo "Applying patches to upstream sources..." && 16 for patch in ../patches/*.patch; do 17 basename "$patch" 18 patch -p1 <"$patch" 19 if [ $? -ne 0 ]; then 20 echo >&2 "Error: '$patch' failed to apply." 21 exit 1 22 fi 23 done && 24 echo 26 25 27 26 ############################################################################### 28 27 # Set up environment variables, depending on SAGE_* settings: … … 34 33 # processor-specific code, since ECM doesn't use them if we set our own: 35 34 # (But currently MPIR doesn't provide optimized settings either if we pass 36 35 # non-empty CFLAGS; of course the user could set such manually though.) 37 gmp_cc_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CC[ ]\+/s/.*"\([^"]*\)"/\1/p' 38 gmp_cflags_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CFLAGS[ ]\+/s/.*"\([^"]*\)"/\1/p' 36 gmp_cc_pat='/^[ ]*#[ ]*define[ ]\{1,\}__GMP_CC[ ]\{1,\}/s/.*"\([^"]*\)"/\1/p' 37 gmp_cflags_pat='/^[ ]*#[ ]*define[ ]\{1,\}__GMP_CFLAGS[ ]\{1,\}/s/.*"\([^"]*\)"/\1/p' 38 gmp_header_file="$SAGE_LOCAL"/include/gmp.h 39 39 40 gmp_cc=`sed -n -e "$gmp_cc_pat" "$SAGE_LOCAL"/include/gmp.h` 41 gmp_cflags=`sed -n -e "$gmp_cflags_pat" "$SAGE_LOCAL"/include/gmp.h` 40 gmp_cc=`sed -n -e "$gmp_cc_pat" "$gmp_header_file"` 41 gmp_cflags=`sed -n -e "$gmp_cflags_pat" "$gmp_header_file"` 42 # At least /some/ newer versions of MPIR define __GMP_CC and __GMP_CFLAGS 43 # (also in gmp.h! -- how compatible is that?) to (literally) __MPIR_CC and 44 # __MPIR_CFLAGS, respectively, i.e., to preprocessor variables, so we might 45 # have to get the real strings from their definitions: 46 # (Since we currently only match string literals above, both variables would 47 # be empty in that case, and not contain the names of preprocessor variables. 48 # We could change the patterns to actually match any definition / "value".) 49 case "$gmp_cc" in __MPIR_CC|"") 50 gmp_cc=`sed -n -e "${gmp_cc_pat/GMP/MPIR}" "$gmp_header_file"` 51 esac 52 case "$gmp_cflags" in __MPIR_CFLAGS|"") 53 gmp_cflags=`sed -n -e "${gmp_cflags_pat/GMP/MPIR}" "$gmp_header_file"` 54 esac 42 55 56 # Extract GMP's/MPIR's settings of CC and CFLAGS from a system-wide installation 57 # (if present); these are only printed, for informational purposes. 43 58 system_gmp_h="" 44 59 for incdir in /usr/include /usr/local/include; do 45 60 if [ -f $incdir/gmp.h ]; then … … 49 64 if [ -n "$system_gmp_h" ]; then 50 65 system_gmp_cc=`sed -n -e "$gmp_cc_pat" $system_gmp_h` 51 66 system_gmp_cflags=`sed -n -e "$gmp_cflags_pat" $system_gmp_h` 67 case "$system_gmp_cc" in __MPIR_CC|"") 68 system_gmp_cc=`sed -n -e "${gmp_cc_pat/GMP/MPIR}" $system_gmp_h` 69 esac 70 case "$system_gmp_cflags" in __MPIR_CFLAGS|"") 71 system_gmp_cflags=`sed -n -e "${gmp_cflags_pat/GMP/MPIR}" $system_gmp_h` 72 esac 52 73 fi 53 74 54 cc_is_gcc=false55 if $CC -v 2>&1 | grep -i gcc &>/dev/null; then56 cc_is_gcc=true;57 fi58 59 75 60 76 if [ "$SAGE64" = yes ]; then 61 echo "Building a 64-bit version of GMP-ECM "77 echo "Building a 64-bit version of GMP-ECM." 62 78 if [ -z "$CFLAG64" ]; then 63 79 CFLAG64=-m64 64 80 fi 65 81 CFLAGS="$CFLAGS $CFLAG64" 66 82 LDFLAGS="$LDFLAGS $CFLAG64"; export LDFLAGS 67 else68 :;69 83 fi 70 84 71 85 … … 89 103 90 104 if [ "$SAGE_DEBUG" = yes ]; then 91 105 # Add debug symbols and disable optimization: 106 echo >&2 "Warning: Setting SAGE_DEBUG=yes completely disables optimization." 92 107 CFLAGS="$CFLAGS -g -O0" 108 echo "You may in addition (or instead) pass '--enable-assert' and/or" 109 echo "'--enable-memory-debug' to GMP-ECM's 'configure' by setting (and" 110 echo "of course exporting) ECM_EXTRA_OPTS accordingly." 93 111 else 94 112 # Enable optimization, may be overridden by user settings: 95 113 case "`uname -srm | tr ' ' '-'`" in … … 98 116 # fails due to a bus error in Apple's 'ld' when trying 99 117 # to determine if global symbols are prefixed with an 100 118 # underscore (cf. http://trac.sagemath.org/sage_trac/ticket/5847#comment:35 ff.): 101 echo "Warning: Disabling debug symbols on MacOS X 10.5" \119 echo >&2 "Warning: Disabling debug symbols on MacOS X 10.5" \ 102 120 "PowerPC because of a linker (?) bug." 103 echo "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \121 echo >&2 "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \ 104 122 "ff. for details." 105 echo ""123 echo >&2 106 124 CFLAGS="-O3 $CFLAGS" 107 125 ;; 108 126 *) … … 111 129 fi 112 130 113 131 132 # Work around a bug in GCC 4.7.0 which breaks the build on Itanium CPUs with 133 # '-O3', '-O2' and '-O1' (cf. #12765, #12751, and the bug URL below.) 134 if [ "`uname -m`" = ia64 ] && [ "`testcc.sh $CC`" = GCC ]; then 135 gcc_version=`$CC -dumpversion` 136 case "$gcc_version" in 137 4.7.*) 138 CFLAGS="$CFLAGS -O0 -finline-functions -fschedule-insns" 139 echo >&2 "Warning: Disabling almost all optimization due to a bug in (at least)" 140 echo >&2 " GCC 4.7.0 on Itanium, which otherwise would break the build." 141 echo >&2 " See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496" 142 echo >&2 " for current status and further details." 143 echo >&2 " (And please report to e.g. sage-devel in case you feel this bug" 144 echo >&2 " should already be fixed in GCC $gcc_version.)" 145 esac 146 fi 147 148 114 149 if [ "$SAGE_FAT_BINARY" = yes ]; then 115 150 # XXX Disable SSE2 on x86? (by passing '--enable-sse2=no' to 'configure') 116 151 # XXX Disable asm-redc? Or pass some "generic" '--host=...' to 'configure'? 117 echo "Warning: SAGE_FAT_BINARY is currently not really supported by this package."118 echo " Add e.g. '--disable-asm-redc' and/or '--enable-sse2=no'"119 echo " to ECM_EXTRA_OPTS if you run into problems."152 echo >&2 "Warning: SAGE_FAT_BINARY is currently not really supported by this package." 153 echo >&2 " Add e.g. '--disable-asm-redc' and/or '--enable-sse2=no'" 154 echo >&2 " to ECM_EXTRA_OPTS if you run into problems." 120 155 else 121 156 # Tune the code generation to the machine we build on: 122 157 cpu_params=""; other_gmp_cflags="" … … 124 159 # Some gcc 4.0.x versions don't support '-march=native', and it's currently 125 160 # not supported on all platforms supported by Sage: 126 161 if touch foo.c && $CC -march=native -c foo.c &>/dev/null; then 127 cpu_params="-march=native" 128 else 162 # The compiler supports '-march=native', but the assembler might not 163 # support (some of) the instructions emitted with this (e.g. the 164 # Apple assembler doesn't know AVX yet). 165 cat >foo.c <<-"EOF" 166 double d; 167 unsigned long fancy_insns() { return (unsigned long) d; } 168 int main () { return 0; } 169 EOF 170 if $CC -march=native -o foo foo.c &>/dev/null && ./foo >/dev/null; then 171 cpu_params="-march=native" 172 else 173 echo >&2 "Warning: Your assembler apparently doesn't understand the instructions" 174 echo >&2 " your compiler ($CC) generates with '-march=native'." 175 echo >&2 " You might also try to compile GMP-ECM with (e.g.)" 176 echo >&2 " CFLAGS=\"-march=native -mno-avx\"" 177 echo >&2 " to disable specific instruction set extension (in this case, AVX)." 178 fi 179 fi 180 if [ -z "$cpu_params" ]; then 129 181 # 'native' not supported, see if GMP / MPIR provides us some CPU type: 130 182 for opt in $gmp_cflags; do 131 183 case $opt in … … 138 190 esac 139 191 done 140 192 fi 141 rm -f foo.* 193 rm -f foo.* foo 142 194 # Only add them if CFLAGS do not already contain similar: 143 195 if [ -n "$cpu_params" ] && 144 196 ! (echo "$CFLAGS" | egrep -- '-march=|-mcpu=|-mtune=' >/dev/null); … … 152 204 fi 153 205 154 206 155 echo ""207 echo 156 208 echo "Settings from SAGE_LOCAL/include/gmp.h:" 157 echo " 158 echo " 209 echo " CC=$gmp_cc" 210 echo " CFLAGS=$gmp_cflags" 159 211 if [ -n "$system_gmp_h" ]; then 160 212 echo "Settings found in $system_gmp_h (currently not used):" 161 echo " 162 echo " 213 echo " CC=$system_gmp_cc" 214 echo " CFLAGS=$system_gmp_cflags" 163 215 fi 164 216 165 echo "Using CC=$CC" 166 echo "Using CFLAGS=$CFLAGS" 167 echo "Using CPPFLAGS=$CPPFLAGS" 168 echo "Using LDFLAGS=$LDFLAGS" 169 echo "Using ABI=$ABI" 170 echo "(These settings may get overridden by 'configure' or Makefiles.)" 171 echo "" 217 echo "Finally using:" 218 echo " CC=$CC" 219 echo " CFLAGS=$CFLAGS" 220 echo " CPP=$CPP" 221 echo " CPPFLAGS=$CPPFLAGS" 222 test -n "$CCAS" && echo " CCAS=$CCAS" 223 test -n "$CCASFLAGS" && echo " CCASFLAGS=$CCASFLAGS" 224 echo " LDFLAGS=$LDFLAGS" 225 test -n "$LIBS" && echo " LIBS=$LIBS" 226 echo " ABI=$ABI" 227 echo " M4=$M4" 228 echo "(These settings may still get overridden by 'configure' or Makefiles.)" 172 229 173 export CFLAGS # usually redundant, but safe(r) 230 export CFLAGS # Not exported by 'sage-env'. LDFLAGS are exported above if 231 # necessary. We currently don't set (or modify) any other 232 # environment variables, so don't have to export them here. 174 233 175 234 unset RM 176 235 177 cd src178 179 236 ############################################################################### 180 237 # Now configure ECM: 181 238 # (Note: Building (also) a *shared* library is disabled by default. … … 185 242 # adapt the logic regarding '-fPIC' above. 186 243 ############################################################################### 187 244 188 SAGE_CONF_OPTS="" 245 SAGE_CONF_OPTS="" # XXX Move this up in case you add options above! 189 246 190 echo ""247 echo 191 248 if [ -z "$ECM_EXTRA_OPTS" ]; then 192 echo "Configuring GMP-ECM with the following options:" 193 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" --with-gmp=\"$SAGE_LOCAL\"" \ 194 "$SAGE_CONF_OPTS" 249 echo "Now configuring GMP-ECM with the following options:" 250 else 251 echo "Now configuring GMP-ECM with additional options as specified by" \ 252 "ECM_EXTRA_OPTS:" 253 echo " $ECM_EXTRA_OPTS" 254 echo "Finally configuring GMP-ECM with the following options:" 255 fi 256 echo " --prefix=\"$SAGE_LOCAL\"" 257 echo " --libdir=\"$SAGE_LOCAL/lib\"" 258 echo " --with-gmp=\"$SAGE_LOCAL\"" 259 for opt in $SAGE_CONF_OPTS $ECM_EXTRA_OPTS; do 260 echo " $opt" 261 done 262 if [ -z "$ECM_EXTRA_OPTS" ]; then 195 263 echo "You can set ECM_EXTRA_OPTS to pass additional parameters," 196 264 echo "e.g. \"--enable-shared\" to also build a *shared* library," 197 265 echo "or \"--disable-sse2\" if you encounter problems on a Pentium III system." 198 else199 echo "Using additional 'configure' options as specified with" \200 "ECM_EXTRA_OPTS:"201 echo " $ECM_EXTRA_OPTS"202 echo "Configuring ECM with the following options:"203 echo " --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" --with-gmp=\"$SAGE_LOCAL\"" \204 "$SAGE_CONF_OPTS $ECM_EXTRA_OPTS"205 266 fi 206 echo ""267 echo 207 268 208 ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --with-gmp="$SAGE_LOCAL" \ 209 $SAGE_CONF_OPTS $ECM_EXTRA_OPTS 269 ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" \ 270 --with-gmp="$SAGE_LOCAL" \ 271 $SAGE_CONF_OPTS $ECM_EXTRA_OPTS 210 272 if [ $? -ne 0 ]; then 211 echo "Error configuring GMP-ECM." 273 echo >&2 "Error configuring GMP-ECM." 274 echo >&2 "(See above for the options passed to its 'configure'.)" 212 275 exit 1 213 276 fi 214 277 … … 216 279 # Now build ECM: 217 280 ############################################################################### 218 281 282 echo 283 echo "Now building GMP-ECM..." 219 284 $MAKE 220 285 if [ $? -ne 0 ]; then 221 echo "Error building GMP-ECM."286 echo >&2 "Error building GMP-ECM." 222 287 exit 1 223 288 fi 224 289 225 290 ############################################################################### 226 291 # Remove old executable/header/libraries/manpage: 227 292 ############################################################################### 228 echo "Build succeeded, removing old binary, header file, manual page and libraries..." 293 294 echo 295 echo "Build succeeded. Now removing old binary, header file, manual page and libraries..." 229 296 rm -f "$SAGE_LOCAL"/bin/ecm 230 297 rm -f "$SAGE_LOCAL"/lib/libecm.* 231 298 rm -f "$SAGE_LOCAL"/include/ecm.h … … 235 302 # Now install ECM: 236 303 ############################################################################### 237 304 305 echo "Now installing GMP-ECM..." 238 306 $MAKE install 239 307 if [ $? -ne 0 ]; then 240 echo "Error installing GMP-ECM (though it appears to have built fine)."308 echo >&2 "Error installing GMP-ECM (though it appears to have built fine)." 241 309 exit 1 242 310 fi