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 |
diff --git a/SPKG.txt b/SPKG.txt
a
|
b
|
|
25 | 25 | == Special Update/Build Instructions == |
26 | 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 | one upstream patch (to 'configure'). This (i.e., the file |
| 29 | 'patches/configure') should be removed on the next upgrade to a stable |
| 30 | release. |
31 | 31 | * GMP-ECM comes with a self-tuning feature; we could support |
32 | 32 | that as an option ($SAGE_TUNE_*=yes) in the future. |
33 | 33 | * We currently work around a linker bug on MacOS X 10.5 PPC (with |
… |
… |
|
53 | 53 | |
54 | 54 | == Changelog == |
55 | 55 | |
| 56 | === ecm-6.3.p5 (Leif Leonhardy, April 11th 2012) === |
| 57 | * #12830: Don't add `-march=native` if the assembler doesn't understand the |
| 58 | instructions the compiler emits with that. (E.g. the Apple/XCode assembler |
| 59 | on Darwin doesn't yet support AVX.) |
| 60 | * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` (from `gmp.h`) for newer |
| 61 | versions of MPIR, which define these to preprocessor macros rather than |
| 62 | strings. |
| 63 | * Redirect warnings and error messages to `stderr`; add some messages. |
| 64 | * Correct `SPKG.txt` w.r.t. applied patches. |
| 65 | |
56 | 66 | === ecm-6.3.p4 (Jeroen Demeyer, 13 February 2012) === |
57 | 67 | * #12501: Do not patch configure.in in spkg-install (to prevent |
58 | 68 | automake from running). |
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 | |
… |
… |
|
15 | 15 | $MAKE check |
16 | 16 | |
17 | 17 | if [ $? -ne 0 ]; then |
18 | | echo "Error: The GMP-ECM test suite failed." |
| 18 | echo >&2 "Error: The GMP-ECM test suite failed." |
19 | 19 | exit 1 |
20 | 20 | fi |
21 | 21 | |
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 | |
… |
… |
|
18 | 18 | # to generate automatically-generated files in the source tree. |
19 | 19 | # Patching configure.in forces automake to be run, which may cause |
20 | 20 | # build failures on systems where autotools aren't installed. |
21 | | cp -p patches/configure src/ |
| 21 | cp -pf patches/configure src/ |
22 | 22 | if [ $? -ne 0 ]; then |
23 | | echo "Error copying patched configure." |
| 23 | echo >&2 "Error copying patched 'configure'." |
24 | 24 | exit 1 |
25 | 25 | fi |
26 | 26 | |
… |
… |
|
36 | 36 | # non-empty CFLAGS; of course the user could set such manually though.) |
37 | 37 | gmp_cc_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CC[ ]\+/s/.*"\([^"]*\)"/\1/p' |
38 | 38 | gmp_cflags_pat='/^[ ]*#[ ]*define[ ]\+__GMP_CFLAGS[ ]\+/s/.*"\([^"]*\)"/\1/p' |
| 39 | gmp_header_file="$SAGE_LOCAL"/include/gmp.h |
39 | 40 | |
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` |
| 41 | gmp_cc=`sed -n -e "$gmp_cc_pat" "$gmp_header_file"` |
| 42 | gmp_cflags=`sed -n -e "$gmp_cflags_pat" "$gmp_header_file"` |
| 43 | # At least /some/ newer versions of MPIR define __GMP_CC and __GMP_CFLAGS |
| 44 | # (also in gmp.h! -- how compatible is that?) to (literally) __MPIR_CC and |
| 45 | # __MPIR_CFLAGS, respectively, i.e., to preprocessor variables, so we might |
| 46 | # have to get the real strings from their definitions: |
| 47 | # (Since we currently only match string literals above, both variables would |
| 48 | # be empty in that case, and not contain the names of preprocessor variables. |
| 49 | # We could change the patterns to actually match any definition / "value".) |
| 50 | case "$gmp_cc" in __MPIR_CC|"") |
| 51 | gmp_cc=`sed -n -e "${gmp_cc_pat/GMP/MPIR}" "$gmp_header_file"` |
| 52 | esac |
| 53 | case "$gmp_cflags" in __MPIR_CFLAGS|"") |
| 54 | gmp_cflags=`sed -n -e "${gmp_cflags_pat/GMP/MPIR}" "$gmp_header_file"` |
| 55 | esac |
42 | 56 | |
43 | 57 | system_gmp_h="" |
44 | 58 | for incdir in /usr/include /usr/local/include; do |
… |
… |
|
58 | 72 | |
59 | 73 | |
60 | 74 | if [ "$SAGE64" = yes ]; then |
61 | | echo "Building a 64-bit version of GMP-ECM" |
| 75 | echo "Building a 64-bit version of GMP-ECM." |
62 | 76 | if [ -z "$CFLAG64" ]; then |
63 | 77 | CFLAG64=-m64 |
64 | 78 | fi |
65 | 79 | CFLAGS="$CFLAGS $CFLAG64" |
66 | 80 | LDFLAGS="$LDFLAGS $CFLAG64"; export LDFLAGS |
67 | | else |
68 | | :; |
69 | 81 | fi |
70 | 82 | |
71 | 83 | |
… |
… |
|
89 | 101 | |
90 | 102 | if [ "$SAGE_DEBUG" = yes ]; then |
91 | 103 | # Add debug symbols and disable optimization: |
| 104 | echo >&2 "Warning: Setting SAGE_DEBUG=yes completely disables optimization." |
92 | 105 | CFLAGS="$CFLAGS -g -O0" |
93 | 106 | else |
94 | 107 | # Enable optimization, may be overridden by user settings: |
… |
… |
|
98 | 111 | # fails due to a bus error in Apple's 'ld' when trying |
99 | 112 | # to determine if global symbols are prefixed with an |
100 | 113 | # underscore (cf. http://trac.sagemath.org/sage_trac/ticket/5847#comment:35 ff.): |
101 | | echo "Warning: Disabling debug symbols on MacOS X 10.5" \ |
| 114 | echo >&2 "Warning: Disabling debug symbols on MacOS X 10.5" \ |
102 | 115 | "PowerPC because of a linker (?) bug." |
103 | | echo "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \ |
| 116 | echo >&2 "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \ |
104 | 117 | "ff. for details." |
105 | 118 | echo "" |
106 | 119 | CFLAGS="-O3 $CFLAGS" |
… |
… |
|
114 | 127 | if [ "$SAGE_FAT_BINARY" = yes ]; then |
115 | 128 | # XXX Disable SSE2 on x86? (by passing '--enable-sse2=no' to 'configure') |
116 | 129 | # 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." |
| 130 | echo >&2 "Warning: SAGE_FAT_BINARY is currently not really supported by this package." |
| 131 | echo >&2 " Add e.g. '--disable-asm-redc' and/or '--enable-sse2=no'" |
| 132 | echo >&2 " to ECM_EXTRA_OPTS if you run into problems." |
120 | 133 | else |
121 | 134 | # Tune the code generation to the machine we build on: |
122 | 135 | cpu_params=""; other_gmp_cflags="" |
… |
… |
|
124 | 137 | # Some gcc 4.0.x versions don't support '-march=native', and it's currently |
125 | 138 | # not supported on all platforms supported by Sage: |
126 | 139 | if touch foo.c && $CC -march=native -c foo.c &>/dev/null; then |
127 | | cpu_params="-march=native" |
128 | | else |
| 140 | # The compiler supports '-march=native', but the assembler might not |
| 141 | # support (some of) the instructions emitted with this (e.g. the |
| 142 | # Apple assembler doesn't know AVX yet). |
| 143 | cat >foo.c <<-"EOF" |
| 144 | double d; |
| 145 | unsigned long fancy_insns() { return (unsigned long) d; } |
| 146 | int main () { return 0; } |
| 147 | EOF |
| 148 | if $CC -march=native -o foo foo.c &>/dev/null && ./foo >/dev/null; then |
| 149 | cpu_params="-march=native" |
| 150 | else |
| 151 | echo >&2 "Warning: Your assembler apparently doesn't understand the instructions" |
| 152 | echo >&2 " your compiler ($CC) generates with '-march=native'." |
| 153 | echo >&2 " You might also try to compile GMP-ECM with (e.g.)" |
| 154 | echo >&2 " CFLAGS=\"-march=native -mno-avx\"" |
| 155 | echo >&2 " to disable specific instruction set extension (in this case, AVX)." |
| 156 | fi |
| 157 | fi |
| 158 | if [ -z "$cpu_params" ]; then |
129 | 159 | # 'native' not supported, see if GMP / MPIR provides us some CPU type: |
130 | 160 | for opt in $gmp_cflags; do |
131 | 161 | case $opt in |
… |
… |
|
138 | 168 | esac |
139 | 169 | done |
140 | 170 | fi |
141 | | rm -f foo.* |
| 171 | rm -f foo.* foo |
142 | 172 | # Only add them if CFLAGS do not already contain similar: |
143 | 173 | if [ -n "$cpu_params" ] && |
144 | 174 | ! (echo "$CFLAGS" | egrep -- '-march=|-mcpu=|-mtune=' >/dev/null); |
… |
… |
|
185 | 215 | # adapt the logic regarding '-fPIC' above. |
186 | 216 | ############################################################################### |
187 | 217 | |
188 | | SAGE_CONF_OPTS="" |
| 218 | SAGE_CONF_OPTS="" # XXX Move this up in case you add options above! |
189 | 219 | |
190 | | echo "" |
| 220 | echo |
191 | 221 | if [ -z "$ECM_EXTRA_OPTS" ]; then |
192 | 222 | 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" |
| 223 | echo " --prefix=\"$SAGE_LOCAL\"" |
| 224 | echo " --libdir=\"$SAGE_LOCAL/lib\"" |
| 225 | echo " --with-gmp=\"$SAGE_LOCAL\"" |
| 226 | test -n "$SAGE_CONF_OPTS" && echo " $SAGE_CONF_OPTS" |
195 | 227 | echo "You can set ECM_EXTRA_OPTS to pass additional parameters," |
196 | 228 | echo "e.g. \"--enable-shared\" to also build a *shared* library," |
197 | 229 | echo "or \"--disable-sse2\" if you encounter problems on a Pentium III system." |
… |
… |
|
200 | 232 | "ECM_EXTRA_OPTS:" |
201 | 233 | echo " $ECM_EXTRA_OPTS" |
202 | 234 | 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" |
| 235 | echo " --prefix=\"$SAGE_LOCAL\"" |
| 236 | echo " --libdir=\"$SAGE_LOCAL/lib\"" |
| 237 | echo " --with-gmp=\"$SAGE_LOCAL\"" |
| 238 | test -n "$SAGE_CONF_OPTS" && echo " $SAGE_CONF_OPTS" |
| 239 | echo " $ECM_EXTRA_OPTS" |
205 | 240 | fi |
206 | | echo "" |
| 241 | echo |
207 | 242 | |
208 | | ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --with-gmp="$SAGE_LOCAL" \ |
209 | | $SAGE_CONF_OPTS $ECM_EXTRA_OPTS |
| 243 | ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" \ |
| 244 | --with-gmp="$SAGE_LOCAL" \ |
| 245 | $SAGE_CONF_OPTS $ECM_EXTRA_OPTS |
210 | 246 | if [ $? -ne 0 ]; then |
211 | | echo "Error configuring GMP-ECM." |
| 247 | echo >&2 "Error configuring GMP-ECM." |
212 | 248 | exit 1 |
213 | 249 | fi |
214 | 250 | |
… |
… |
|
216 | 252 | # Now build ECM: |
217 | 253 | ############################################################################### |
218 | 254 | |
| 255 | echo |
| 256 | echo "Now building GMP-ECM..." |
219 | 257 | $MAKE |
220 | 258 | if [ $? -ne 0 ]; then |
221 | | echo "Error building GMP-ECM." |
| 259 | echo >&2 "Error building GMP-ECM." |
222 | 260 | exit 1 |
223 | 261 | fi |
224 | 262 | |
225 | 263 | ############################################################################### |
226 | 264 | # Remove old executable/header/libraries/manpage: |
227 | 265 | ############################################################################### |
228 | | echo "Build succeeded, removing old binary, header file, manual page and libraries..." |
| 266 | |
| 267 | echo |
| 268 | echo "Build succeeded. Now removing old binary, header file, manual page and libraries..." |
229 | 269 | rm -f "$SAGE_LOCAL"/bin/ecm |
230 | 270 | rm -f "$SAGE_LOCAL"/lib/libecm.* |
231 | 271 | rm -f "$SAGE_LOCAL"/include/ecm.h |
… |
… |
|
235 | 275 | # Now install ECM: |
236 | 276 | ############################################################################### |
237 | 277 | |
| 278 | echo "Now installing GMP-ECM..." |
238 | 279 | $MAKE install |
239 | 280 | if [ $? -ne 0 ]; then |
240 | | echo "Error installing GMP-ECM (though it appears to have built fine)." |
| 281 | echo >&2 "Error installing GMP-ECM (though it appears to have built fine)." |
241 | 282 | exit 1 |
242 | 283 | fi |