Ticket #5847: trac_5847-ecm-6.3.p1-p2.diff

File trac_5847-ecm-6.3.p1-p2.diff, 20.0 KB (added by leif, 8 years ago)

Diff between the p1 and the p2 spkg. For reference / review.

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    2424
    2525== Special Update/Build Instructions ==
    2626
    27  * src/ contains upstream code, no patches were applied.
     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.
    2831 * GMP-ECM comes with a self-tuning feature; we could support
    2932   that as an option ($SAGE_TUNE_*=yes) in the future.
     33 * We currently work around a linker bug on MacOS X 10.5 PPC (with
     34   GCC 4.2.1) which breaks 'configure' if debug symbols are enabled.
     35   This *might* get fixed in later upstream releases.
     36 * ECM currently does not (by itself) use the CC and CFLAGS settings
     37   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.
     42   Of course a user can also manually enable them by setting the "global"
     43   CFLAGS to e.g. '-march=native' on x86[_64] systems, or '-mcpu=...' and
     44   '-mtune=...' on other architectures where "native" isn't supported.
     45   Note that this doesn't affect the packages' selection of processor-
     46   specific optimized [assembly] code.
     47   'spkg-install' already reads the settings from Sage's and also a
     48   system-wide GMP / MPIR now, but doesn't (yet) use all of them.
     49   If SAGE_FAT_BINARY="yes", we should avoid too specific settings of
     50   "-mcpu=...", and perhaps pass a more generic "--host=..." to
     51   'configure'. (MPIR honors '--enable-fat' to some extent, but this
     52   option isn't used on anything other than x86 / x86_64.)
    3053
    3154== Changelog ==
    3255
     56=== ecm-6.3.p2 (Leif Leonhardy, November 25th, 2010) ===
     57 * #5847: Apply another patch from upstream to 'configure.in' to fix com-
     58   pilation on 32-bit x86 processors supporting SSE2. (Also #10252.)
     59   (There's only a single, cumulative patch file since both patches are to
     60   'configure.in'.)
     61 * Work around linker bug on MacOS X 10.5 PPC (see Special Update/Build
     62   Instructions above, and #5847 comment 35 ff.).
     63 * Allow passing extra arguments to 'configure' through ECM_EXTRA_OPTS.
     64 * Add "-march=native" to CFLAGS on platforms that support it, or use
     65   processor-specific CFLAGS from GMP's / MPIR's 'gmp.h' if available,
     66   but only if CFLAGS do not already contain similar (i.e., don't over-
     67   ride a user's choice). [Subject to further improvement.]
     68 * Print settings of CC, CFLAGS etc. and how we configure.
     69 * Print settings of CC and CFLAGS found in 'SAGE_LOCAL/include/gmp.h'
     70   and eventually a system-wide 'gmp.h', although the latter aren't (yet)
     71   used at all, and only processor-specific parts of the former.
     72 * Add '-fPIC' conditionally, i.e. not if we're also building a shared
     73   library (or '--with-pic' was given).
     74 * Don't delete previous installations unless the build succeeded.
     75 * Further clean-up.
     76
    3377=== ecm-6.3.p1 (Jeroen Demeyer, November 10th, 2010) ===
    34  * Apply a patch from upstream to configure.in to fix compilation
     78 * #5847: Apply a patch from upstream to configure.in to fix compilation
    3579   on 32-bit PowerPC processors.
    3680
    3781=== ecm-6.3.p0 (Leif Leonhardy, November 4th, 2010) ===
  • new file patches/configure.in.patch

    diff --git a/patches/configure.in.patch b/patches/configure.in.patch
    new file mode 100644
    - +  
     1--- configure.in.orig   2010-04-18 22:03:10.000000000 +0200
     2+++ configure.in        2010-11-23 20:03:33.000000000 +0100
     3@@ -195,7 +195,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@@ -203,8 +203,18 @@
     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+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
     25+#if defined(__ppc__)
     26+#error
     27+#endif])], [], [AC_MSG_NOTICE([32-bit PowerPC, disabling asm-redc])
     28+                enable_asm_redc=no])
     29+                          ASMPATH=powerpc64;;
     30     powerpc64-*-linux*)
     31                          ECM_INCLUDE([<"$srcdir"/powerpc64/powerpc-defs.m4>])
     32                          ASMPATH=powerpc64;;
     33@@ -213,7 +223,9 @@
     34                          ASMPATH=athlon;;
     35     *) AC_MSG_ERROR([[asm redc not available on this machine $host]]);;
     36   esac
     37+fi
     38 
     39+if test "x$enable_asm_redc" = xyes; then
     40 # do the necessary definitions and includes
     41   AC_DEFINE([NATIVE_REDC],1,[Define to 1 to use asm redc])
     42   test "x$CCAS" != x || CCAS="$CC -c"
     43@@ -275,9 +287,9 @@
     44   AC_MSG_CHECKING([for SSE2 support])
     45   m4_define([SSE2_TEST_PROG], [AC_LANG_PROGRAM([], dnl
     46 [#if (defined(__GNUC__) || defined(__ICL)) && defined(__i386__)
     47-/* When there are no constraints, registers are referred to by
     48-   single % sign, not double. Argh */
     49-asm volatile ("pmuludq %xmm2, %xmm0");
     50+/* On some machines, a program without constraints may pass without -msse2 but
     51+   those with constraints in spv.c fail, thus we test with constraints here. */
     52+asm volatile ("pmuludq %%xmm2, %%xmm0" : : :"%xmm0");
     53 #else
     54 #error
     55 #IRIXdoesnotexitaterrordirective
  • deleted file patches/configure.patch

    diff --git a/patches/configure.patch b/patches/configure.patch
    deleted file mode 100644
    + -  
    1 diff -r -u src.old/configure src/configure
    2 --- src.old/configure   2010-04-18 22:17:12.000000000 +0200
    3 +++ src/configure       2010-11-10 11:21:04.000000000 +0100
    4 @@ -12340,7 +12340,7 @@
    5  # asm_redc enabled by default for x86_64 and 64 bit PowerPC
    6  if test "x$enable_asm_redc" = x; then
    7    case $host in
    8 -    x86_64* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
    9 +    x86_64*-*-* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
    10      *) enable_asm_redc=no;;
    11    esac
    12  fi
    13 @@ -12348,8 +12348,59 @@
    14  if test "x$enable_asm_redc" = xyes; then
    15    case $host in
    16      pentium4-*-* | pentium3-*-* | viac7-*-* | i786-*-*) ASMPATH=pentium4;;
    17 -    x86_64-*-*)  ASMPATH=x86_64;;
    18 -    powerpc-apple-darwin*) ASMPATH=powerpc64;;
    19 +    x86_64*-*-*)  ASMPATH=x86_64;;
    20 +# warning: with powerpc-apple-darwin* we can have ABI=32
    21 +# see bug #10646 on the bug tracker, where config.guess says
    22 +# powerpc-apple-darwin8.11.0 (this a 64-bit machine, but most applications
    23 +# are compiled in 32 bits). It works with --disable-asm-redc.
    24 +    powerpc-apple-darwin*)
    25 +cat >conftest.$ac_ext <<_ACEOF
    26 +/* confdefs.h.  */
    27 +_ACEOF
    28 +cat confdefs.h >>conftest.$ac_ext
    29 +cat >>conftest.$ac_ext <<_ACEOF
    30 +/* end confdefs.h.  */
    31 +
    32 +#if defined(__ppc__)
    33 +#error
    34 +#endif
    35 +int
    36 +main ()
    37 +{
    38 +
    39 +  ;
    40 +  return 0;
    41 +}
    42 +_ACEOF
    43 +if { (ac_try="$ac_cpp conftest.$ac_ext"
    44 +case "(($ac_try" in
    45 +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
    46 +  *) ac_try_echo=$ac_try;;
    47 +esac
    48 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
    49 +$as_echo "$ac_try_echo") >&5
    50 +  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
    51 +  ac_status=$?
    52 +  grep -v '^ *+' conftest.er1 >conftest.err
    53 +  rm -f conftest.er1
    54 +  cat conftest.err >&5
    55 +  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
    56 +  (exit $ac_status); } >/dev/null && {
    57 +        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
    58 +        test ! -s conftest.err
    59 +       }; then
    60 +  :
    61 +else
    62 +  $as_echo "$as_me: failed program was:" >&5
    63 +sed 's/^/| /' conftest.$ac_ext >&5
    64 +
    65 +  { $as_echo "$as_me:$LINENO: 32-bit PowerPC, disabling asm-redc" >&5
    66 +$as_echo "$as_me: 32-bit PowerPC, disabling asm-redc" >&6;}
    67 +                enable_asm_redc=no
    68 +fi
    69 +
    70 +rm -f conftest.err conftest.$ac_ext
    71 +                          ASMPATH=powerpc64;;
    72      powerpc64-*-linux*)
    73  
    74  echo "include(<"$srcdir"/powerpc64/powerpc-defs.m4>)" >> $gmp_tmpconfigm4
    75 @@ -12362,7 +12413,9 @@
    76  $as_echo "$as_me: error: asm redc not available on this machine $host" >&2;}
    77     { (exit 1); exit 1; }; };;
    78    esac
    79 +fi
    80  
    81 +if test "x$enable_asm_redc" = xyes; then
    82  # do the necessary definitions and includes
    83  
    84  cat >>confdefs.h <<\_ACEOF
    85 diff -r -u src.old/configure.in src/configure.in
    86 --- src.old/configure.in        2010-04-18 22:03:10.000000000 +0200
    87 +++ src/configure.in    2010-11-10 11:20:51.000000000 +0100
    88 @@ -195,7 +195,7 @@
    89  # asm_redc enabled by default for x86_64 and 64 bit PowerPC
    90  if test "x$enable_asm_redc" = x; then
    91    case $host in
    92 -    x86_64* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
    93 +    x86_64*-*-* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
    94      *) enable_asm_redc=no;;
    95    esac
    96  fi
    97 @@ -203,8 +203,18 @@
    98  if test "x$enable_asm_redc" = xyes; then
    99    case $host in
    100      pentium4-*-* | pentium3-*-* | viac7-*-* | i786-*-*) ASMPATH=pentium4;;
    101 -    x86_64-*-*)  ASMPATH=x86_64;;
    102 -    powerpc-apple-darwin*) ASMPATH=powerpc64;;
    103 +    x86_64*-*-*)  ASMPATH=x86_64;;
    104 +# warning: with powerpc-apple-darwin* we can have ABI=32
    105 +# see bug #10646 on the bug tracker, where config.guess says
    106 +# powerpc-apple-darwin8.11.0 (this a 64-bit machine, but most applications
    107 +# are compiled in 32 bits). It works with --disable-asm-redc.
    108 +    powerpc-apple-darwin*)
    109 +AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
    110 +#if defined(__ppc__)
    111 +#error
    112 +#endif])], [], [AC_MSG_NOTICE([32-bit PowerPC, disabling asm-redc])
    113 +                enable_asm_redc=no])
    114 +                          ASMPATH=powerpc64;;
    115      powerpc64-*-linux*)
    116                           ECM_INCLUDE([<"$srcdir"/powerpc64/powerpc-defs.m4>])
    117                           ASMPATH=powerpc64;;
    118 @@ -213,7 +223,9 @@
    119                           ASMPATH=athlon;;
    120      *) AC_MSG_ERROR([[asm redc not available on this machine $host]]);;
    121    esac
    122 +fi
    123  
    124 +if test "x$enable_asm_redc" = xyes; then
    125  # do the necessary definitions and includes
    126    AC_DEFINE([NATIVE_REDC],1,[Define to 1 to use asm redc])
    127    test "x$CCAS" != x || CCAS="$CC -c"
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    55    exit 1
    66fi
    77
     8###############################################################################
     9# Apply patches (if any):
     10###############################################################################
     11
     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)
     16echo "Copying patched files..."
     17cp -p patches/configure patches/configure.in src/
     18if [ $? -ne 0 ]; then
     19    echo "Error copying patched configure and configure.in."
     20    exit 1
     21fi
     22
     23###############################################################################
     24# Set up environment variables, depending on SAGE_* settings:
    825# Note that GMP-ECM is written in C (and assembler) - no C++ sources.
     26###############################################################################
     27
     28# We eventually use / add these settings (or parts of them) to "our" CFLAGS,
     29# e.g. "-march=..." or "-mcpu=..." and "-mtune=..." to let gcc generate better,
     30# processor-specific code, since ECM doesn't use them if we set our own:
     31# (But currently MPIR doesn't provide optimized settings either if we pass
     32# non-empty CFLAGS; of course the user could set such manually though.)
     33gmp_cc_pat='/^[         ]*#[    ]*define[       ]\+__GMP_CC[    ]\+/s/.*"\([^"]*\)"/\1/p'
     34gmp_cflags_pat='/^[     ]*#[    ]*define[       ]\+__GMP_CFLAGS[        ]\+/s/.*"\([^"]*\)"/\1/p'
     35
     36gmp_cc=`sed -n -e "$gmp_cc_pat" "$SAGE_LOCAL"/include/gmp.h`
     37gmp_cflags=`sed -n -e "$gmp_cflags_pat" "$SAGE_LOCAL"/include/gmp.h`
     38
     39system_gmp_h=""
     40for incdir in /usr/include /usr/local/include; do
     41    if [ -f $incdir/gmp.h ]; then
     42        system_gmp_h=$incdir/gmp.h
     43    fi
     44done
     45if [ -n "$system_gmp_h" ]; then
     46    system_gmp_cc=`sed -n -e "$gmp_cc_pat" $system_gmp_h`
     47    system_gmp_cflags=`sed -n -e "$gmp_cflags_pat" $system_gmp_h`
     48fi
     49
     50cc_is_gcc=false
     51if $CC -v 2>&1 | grep -i gcc &>/dev/null; then
     52    cc_is_gcc=true;
     53fi
     54
    955
    1056if [ "$SAGE64" = yes ]; then
    1157    echo "Building a 64-bit version of GMP-ECM"
    1258    if [ -z "$CFLAG64" ]; then
    1359        CFLAG64=-m64
    1460    fi
    15     CFLAGS="$CFLAGS $CFLAG64 -fPIC"
    16     LDFLAGS="$CFLAG64"; export LDFLAGS
     61    CFLAGS="$CFLAGS $CFLAG64"
     62    LDFLAGS="$LDFLAGS $CFLAG64"; export LDFLAGS
    1763else
    18     CFLAGS="$CFLAGS -fPIC"
     64    :;
    1965fi
    2066
    21 # We add debug symbols by default;
     67
     68# libtool should add the proper flags, but doesn't use "-fPIC"
     69# for the *static* library (which the Sage library links to unless
     70# we also build the shared one). The following only handles the
     71# most common cases, not all variations with '=yes' or '=no' etc.:
     72if ! (echo $ECM_EXTRA_OPTS | egrep -- "--enable-shared|--with-pic" >/dev/null) ||
     73     (echo $ECM_EXTRA_OPTS | egrep -- "--disable-shared" >/dev/null);
     74then
     75    echo "Adding '-fPIC' to CFLAGS since we don't (also) build a shared library."
     76    CFLAGS="$CFLAGS -fPIC" # alternatively add '--with-pic' to 'configure' options
     77else
     78    # PIC usually slows down the execution, so don't use it for the *static*
     79    # library (unless '--with-pic' was given). libtool does the right thing
     80    # for the shared one we also build, which then will be used by Sage.
     81    echo "Not adding '-fPIC' since we also build a shared library Sage will link"
     82    echo "to, or '--with-pic' was given in ECM_EXTRA_OPTS."
     83fi
     84
     85
    2286if [ "$SAGE_DEBUG" = yes ]; then
    23     # Disable optimization:
     87    # Add debug symbols and disable optimization:
    2488    CFLAGS="$CFLAGS -g -O0"
    2589else
    2690    # Enable optimization, may be overridden by user settings:
    27     CFLAGS="-g -O3 $CFLAGS"
     91    case "`uname -srm | tr ' ' '-'`" in
     92        Darwin-9*-[Pp]ower*)
     93            # Don't add debug symbols because configure otherwise
     94            # fails due to a bus error in Apple's 'ld' when trying
     95            # to determine if global symbols are prefixed with an
     96            # underscore (cf. http://trac.sagemath.org/sage_trac/ticket/5847#comment:35 ff.):
     97            echo "Warning: Disabling debug symbols on MacOS X 10.5" \
     98                "PowerPC because of a linker (?) bug."
     99            echo "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \
     100                "ff. for details."
     101            echo ""
     102            CFLAGS="-O3 $CFLAGS"
     103            ;;
     104        *)
     105            CFLAGS="-g -O3 $CFLAGS"
     106    esac
    28107fi
    29108
     109
     110if [ "$SAGE_FAT_BINARY" = yes ]; then
     111    # XXX Disable SSE2 on x86? (by passing '--enable-sse2=no' to 'configure')
     112    # XXX Disable asm-redc? Or pass some "generic" '--host=...' to 'configure'?
     113    echo "Warning: SAGE_FAT_BINARY is currently not really supported by this package."
     114    echo "         Add e.g. '--disable-asm-redc' and/or '--enable-sse2=no'"
     115    echo "         to ECM_EXTRA_OPTS if you run into problems."
     116else
     117    # Tune the code generation to the machine we build on:
     118    cpu_params=""; other_gmp_cflags=""
     119
     120    # Some gcc 4.0.x versions don't support '-march=native', and it's currently
     121    # not supported on all platforms supported by Sage:
     122    if touch foo.c && $CC -march=native -c foo.c &>/dev/null; then
     123        cpu_params="-march=native"
     124    else
     125        # 'native' not supported, see if GMP / MPIR provides us some CPU type:
     126        for opt in $gmp_cflags; do
     127            case $opt in
     128                -march=*|-mcpu=*|-mtune*)
     129                    echo "Found CPU parameter in gmp.h: $opt"
     130                    cpu_params="$cpu_params $opt"
     131                    ;;
     132                 # perhaps add other options, too (e.g. for different compilers)
     133                 *) other_gmp_cflags="$other_gmp_cflags $opt"
     134            esac
     135        done
     136    fi
     137    rm -f foo.*
     138    # Only add them if CFLAGS do not already contain similar:
     139    if [ -n "$cpu_params" ] &&
     140        ! (echo "$CFLAGS" | egrep -- '-march=|-mcpu=|-mtune=' >/dev/null);
     141    then
     142        echo "Using additional host-specific CFLAGS: $cpu_params"
     143        CFLAGS="$cpu_params $CFLAGS"
     144    fi
     145    if [ -n "$other_gmp_cflags" ]; then
     146        echo "Not using other CFLAGS provided by gmp.h: $other_gmp_cflags"
     147    fi
     148fi
     149
     150
     151echo ""
     152echo "Settings from SAGE_LOCAL/include/gmp.h:"
     153echo "    CC=$gmp_cc"
     154echo "    CFLAGS=$gmp_cflags"
     155if [ -n "$system_gmp_h" ]; then
     156    echo "Settings found in $system_gmp_h (currently not used):"
     157    echo "    CC=$system_gmp_cc"
     158    echo "    CFLAGS=$system_gmp_cflags"
     159fi
     160
     161echo "Using CC=$CC"
     162echo "Using CFLAGS=$CFLAGS"
     163echo "Using CPPFLAGS=$CPPFLAGS"
     164echo "Using LDFLAGS=$LDFLAGS"
     165echo "Using ABI=$ABI"
     166echo "(These settings may get overridden by 'configure' or Makefiles.)"
     167echo ""
     168
    30169export CFLAGS # usually redundant, but safe(r)
    31170
     171unset RM
    32172
     173cd src
     174
     175###############################################################################
     176# Now configure ECM:
     177# (Note: Building (also) a *shared* library is disabled by default.
     178#        Add "--enable-shared" below if you want it, though one can
     179#        now pass extra 'configure' options through ECM_EXTRA_OPTS.)
     180#        If you do so, i.e. add '--enable-shared' by default, also
     181#        adapt the logic regarding '-fPIC' above.
     182###############################################################################
     183
     184SAGE_CONF_OPTS=""
     185
     186echo ""
     187if [ -z "$ECM_EXTRA_OPTS" ]; then
     188    echo "Configuring GMP-ECM with the following options:"
     189    echo "    --prefix=\"$SAGE_LOCAL\" --with-gmp=\"$SAGE_LOCAL\"" \
     190        "$SAGE_CONF_OPTS"
     191    echo "You can set ECM_EXTRA_OPTS to pass additional parameters,"
     192    echo "e.g. \"--enable-shared\" to also build a *shared* library,"
     193    echo "or \"--disable-sse2\" if you encounter problems on a Pentium III system."
     194else
     195    echo "Using additional 'configure' options as specified with" \
     196        "ECM_EXTRA_OPTS:"
     197    echo "    $ECM_EXTRA_OPTS"
     198    echo "Configuring ECM with the following options:"
     199    echo "    --prefix=\"$SAGE_LOCAL\" --with-gmp=\"$SAGE_LOCAL\"" \
     200        "$SAGE_CONF_OPTS $ECM_EXTRA_OPTS"
     201fi
     202echo ""
     203
     204./configure --prefix="$SAGE_LOCAL" --with-gmp="$SAGE_LOCAL" \
     205    $SAGE_CONF_OPTS $ECM_EXTRA_OPTS
     206if [ $? -ne 0 ]; then
     207    echo "Error configuring GMP-ECM."
     208    exit 1
     209fi
     210
     211###############################################################################
     212# Now build ECM:
     213###############################################################################
     214
     215$MAKE
     216if [ $? -ne 0 ]; then
     217    echo "Error building GMP-ECM."
     218    exit 1
     219fi
     220
     221###############################################################################
    33222# Remove old executable/header/libraries/manpage:
    34 
    35 echo "Removing old binary, header file, manual page and libraries..."
     223###############################################################################
     224echo "Build succeeded, removing old binary, header file, manual page and libraries..."
    36225rm -f "$SAGE_LOCAL"/bin/ecm
    37226rm -f "$SAGE_LOCAL"/lib/libecm.*
    38227rm -f "$SAGE_LOCAL"/include/ecm.h
    39228rm -f "$SAGE_LOCAL"/share/man/man1/ecm.1
    40229
    41 
    42 cd src
    43 
    44 # Patch configure (and configure.in)
    45 cp -p ../patches/configure ../patches/configure.in .
    46 if [ $? != 0 ]; then
    47         echo >&2 "Error patching configure and configure.in"
    48         exit 1
    49 fi
    50 
    51 
    52 unset RM
    53 
    54 # Note: Building (also) a *shared* library is disabled by default.
    55 #       Add "--enable-shared" below if you want it.
    56 
    57 ./configure --with-gmp="$SAGE_LOCAL"  --prefix="$SAGE_LOCAL"
    58 
    59 if [ $? -ne 0 ]; then
    60     echo "Error configuring GMP-ECM."
    61     exit 1
    62 fi
    63 
    64 $MAKE
    65 
    66 if [ $? -ne 0 ]; then
    67     echo "Error building GMP-ECM."
    68     exit 1
    69 fi
    70 
     230###############################################################################
     231# Now install ECM:
     232###############################################################################
    71233
    72234$MAKE install
    73 
    74235if [ $? -ne 0 ]; then
    75236    echo "Error installing GMP-ECM (though it appears to have built fine)."
    76237    exit 1