Ticket #12825: 12825_detect_gcc.patch

File 12825_detect_gcc.patch, 3.6 KB (added by jdemeyer, 14 months ago)
  • spkg/install

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1334064059 -7200
    # Node ID 46c4ea32096b52f991a2fc3b637db2a63d431882
    # Parent  8f6b1a7f9a336165c97c7ceb51b60afeed31a05a
    Fix auto-detection of whether to install GCC based on sytem gcc version
    
    diff --git a/spkg/install b/spkg/install
    a b  
    124124        echo >&2 "Installing GCC because your '$CC' isn't GCC (GNU CC)." 
    125125        need_to_install_gcc=yes 
    126126    else 
    127         # $CC points to some version of GCC.  Install our own GCC if the 
    128         # system-provided one is older than gcc-4.4. 
    129         # Install GCC if we have version 4.6.0 or 4.6.1, which is 
    130         # known to give trouble within Sage: 
    131         # * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48702 
    132         # * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48774 
    133         if { $CC -dumpversion | grep '^\($\|[0-3]\.\|4\.[0-3]\|4\.6\.[01]$\)' ; } >/dev/null 2>/dev/null; then 
    134             echo >&2 "Installing GCC because your '$CC' is not so recent." 
    135             need_to_install_gcc=yes 
    136         fi 
     127        # $CC points to some version of GCC, find out which version. 
     128        GCCVERSION=`$CC -dumpversion` 
     129        case $GCCVERSION in 
     130            [0-3].*|4.[0-3].*) 
     131                # Install our own GCC if the system-provided one is older than gcc-4.4. 
     132                # (admittedly, this is a pretty arbitrary choice -- Jeroen Demeyer) 
     133                echo >&2 "Installing GCC because you have $CC version $GCCVERSION, which is quite old." 
     134                need_to_install_gcc=yes;; 
     135            4.6.[01]) 
     136                # Also install GCC if we have version 4.6.0 or 4.6.1, which is 
     137                # known to give trouble within Sage: 
     138                # * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48702 
     139                # * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48774 
     140                # 
     141                # Detect a Debian multi-arch install.  In this case, some 
     142                # include files will be in /usr/include/x86_64-linux-gnu for 
     143                # example.  We detect whether GCC searches for include files 
     144                # in /usr/include/*.  If so, we don't install GCC. 
     145                if gcc -x c /dev/null -E -v -o /dev/null 2>&1 |grep '/usr/include/.' >/dev/null; then 
     146                    echo >&2 "Not installing GCC as your system $CC is looking for include files" 
     147                    echo >&2 "in unusual directories." 
     148                else 
     149                    echo >&2 "Installing GCC because you have $CC version $GCCVERSION." 
     150                    echo >&2 "gcc-4.6.0 and gcc-4.6.1 have known bugs affecting Sage." 
     151                    need_to_install_gcc=yes 
     152                fi;; 
     153            4.7.*) 
     154                # GCC 4.7.0 is very broken on ia64, see 
     155                # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496 
     156                if [ x`uname -m` = xia64 ]; then 
     157                    echo >&2 "Installing GCC because you have $CC version $GCCVERSION on ia64." 
     158                    echo >&2 "gcc-4.7.0 has a serious bug on ia64." 
     159                    need_to_install_gcc=yes 
     160                else 
     161                    # On other systems, GCC 4.7.x works but it is not 
     162                    # supported by all packages inside Sage, see 
     163                    # http://trac.sagemath.org/sage_trac/ticket/12751 
     164                    echo >&2 "Installing GCC because you have $CC version $GCCVERSION." 
     165                    echo >&2 "gcc-4.7.x is currently not supported in Sage." 
     166                    need_to_install_gcc=yes 
     167                fi;; 
     168        esac 
    137169    fi 
    138170 
    139171    # Check C++ and Fortran compilers.