# HG changeset patch
# User Leif Leonhardy <not.really@online.de>
# Date 1311999991 -7200
# Node ID b258663f3102a1d2ddf07a8c3b4d2db74cb33036
# Parent 883a63fad1e40bb2e765c78195b79bbb034f4fc2
#11321 2nd reviewer patch to 1.23.p8: Change a patch to work with PARI <2.4.4 as well; improve documentation.
diff -r 883a63fad1e4 -r b258663f3102 SPKG.txt
a
|
b
|
|
30 | 30 | |
31 | 31 | == Special Update/Build Instructions == |
32 | 32 | |
33 | | * There is some garbage in the upstream sources: |
| 33 | * There is some garbage in the upstream sources which should be removed: |
34 | 34 | src/include/.Lexplicit_formula.h.swp |
35 | 35 | src/include/.Lvalue.h.swp |
36 | 36 | src/include/._.DS_Store |
… |
… |
|
44 | 44 | src/src/.Lcommandline.ggo.swp |
45 | 45 | src/src/libLfunction.a |
46 | 46 | * Make sure the patches still apply cleanly. |
| 47 | * We (and apparently also upstream) currently don't build Lcalc's tests |
| 48 | (see Makefile), hence there's no spkg-check. |
| 49 | This might change in newer upstream versions. |
47 | 50 | * TODO / FIXME: |
48 | 51 | The (upstream) Makefile uses $(CC) to compile C++ (also using $(CCFLAGS)), |
49 | 52 | which it defines to 'g++', and hardcodes 'g++' when linking the shared |
… |
… |
|
70 | 73 | - use $(MAKE) instead of 'make' in the crude build receipts, |
71 | 74 | - use CXXFLAG64 when linking the shared library. |
72 | 75 | * pari-2.4.4.patch: |
73 | | Use allocatemem() instead of allocatemoremem() which the new PARI no |
74 | | longer supports. (The former isn't supported by older versions of PARI |
75 | | though; cf. #11321.) |
| 76 | (Patches src/src/Lcommandline.cc and src/src/Lcommandline_elliptic.cc.) |
| 77 | Use allocatemem() instead of allocatemoremem() if PARI version >= 2.4.4 |
| 78 | because the newer PARI versions no longer support the latter. |
| 79 | (The former function isn't supported by older versions of PARI though, |
| 80 | therefore we use conditional compilation for that; cf. #11321.) |
| 81 | The part which patches Lcommandline_elliptic.cc does not really depend on |
| 82 | the PARI version 2.4.4; it was introduced by #9592 when we upgraded PARI |
| 83 | to 2.4.3 [svn-12577], see also #9343. |
| 84 | (That part of the patch replaces lgeti() by (long)cgeti().) |
76 | 85 | * time.h.patch: |
| 86 | (Patches src/include/Lcommandline_numbertheory.h.) |
77 | 87 | Include also <time.h> in Lcommandline_numbertheory.h (at least required |
78 | 88 | on Cygwin, cf. #9845). |
79 | 89 | This should get reported upstream. |
diff -r 883a63fad1e4 -r b258663f3102 patches/pari-2.4.4.patch
a
|
b
|
|
1 | | --- src/src/Lcommandline.cc 2010-01-31 16:16:45.000000000 +0100 |
2 | | +++ src/src/Lcommandline.cc 2011-05-10 17:22:10.000000000 +0200 |
| 1 | --- src/src/Lcommandline.cc 2009-02-25 08:32:44.000000000 +0100 |
| 2 | +++ patches/Lcommandline.cc 2011-07-30 04:14:38.000000000 +0200 |
3 | 3 | @@ -31,6 +31,12 @@ |
4 | 4 | #include "Lcommandline.h" |
5 | 5 | #include "cmdline.h" |
6 | 6 | |
7 | 7 | +/* No-operation error recovery routine for PARI. This is needed for |
8 | | + * allocatemem(), which calls the error recovery routine (because |
9 | | + * allocatemem() destroys the PARI stack). |
| 8 | + * PARI >=2.4.4's allocatemem(), which calls the error recovery routine |
| 9 | + * (because allocatemem() destroys the PARI stack). |
10 | 10 | + */ |
11 | 11 | +void pari_err_recover_nop(long errnum) {return;} |
12 | 12 | + |
13 | 13 | int main (int argc, char *argv[]) |
14 | 14 | { |
15 | 15 | |
16 | | @@ -473,7 +479,13 @@ |
| 16 | @@ -473,7 +479,31 @@ |
17 | 17 | |
18 | 18 | #ifdef INCLUDE_PARI |
19 | 19 | if(do_elliptic_curve){ |
20 | | - allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double |
21 | | + /* allocatemem() calls the callback function cb_pari_err_recover(), |
22 | | + * which we temporarily change to do nothing. */ |
| 20 | + |
| 21 | +#if !defined(PARI_VERSION_CODE) || !defined(PARI_VERSION) |
| 22 | +#error "PARI_VERSION() and/or PARI_VERSION_CODE not defined. \ |
| 23 | +(These should come from paricfg.h, included by pari.h.)" |
| 24 | +#endif |
| 25 | + |
| 26 | +#if PARI_VERSION_CODE >= PARI_VERSION(2,4,4) |
| 27 | + |
| 28 | + /* PARI >= 2.4.4 no longer supports allocatemoremem(), |
| 29 | + * but provides allocatemem() instead. |
| 30 | + * |
| 31 | + * allocatemem() calls the callback function cb_pari_err_recover(), |
| 32 | + * which we temporarily change to do nothing. |
| 33 | + */ |
23 | 34 | + void (*saved_err_recover)(long) = cb_pari_err_recover; |
24 | 35 | + cb_pari_err_recover = pari_err_recover_nop; |
25 | 36 | + allocatemem(N_terms*16 + 1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double |
26 | 37 | + cb_pari_err_recover = saved_err_recover; |
27 | 38 | + |
| 39 | +#else // PARI version < 2.4.4 |
| 40 | + |
| 41 | allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double |
| 42 | + |
| 43 | +#endif |
| 44 | + |
28 | 45 | if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl; |
29 | 46 | initialize_new_L(a1,a2,a3,a4,a6,N_terms); |
30 | 47 | } |
31 | | --- src/src/Lcommandline_elliptic.cc 2010-01-31 16:16:45.000000000 +0100 |
32 | | +++ src/src/Lcommandline_elliptic.cc 2011-05-10 17:08:10.000000000 +0200 |
| 48 | --- src/src/Lcommandline_elliptic.cc 2008-09-17 05:41:06.000000000 +0200 |
| 49 | +++ patches/Lcommandline_elliptic.cc 2011-07-30 04:18:12.000000000 +0200 |
33 | 50 | @@ -121,11 +121,11 @@ |
34 | 51 | |
35 | 52 | |