Ticket #13287: trac_13287-set_CPP_FC_etal_if_GCC_spkg_is_installed.patch

File trac_13287-set_CPP_FC_etal_if_GCC_spkg_is_installed.patch, 1.3 KB (added by leif, 9 years ago)

Patch to sage-env to also override CPP, FC, F77 and F95 settings when appropriate. Based on Sage 5.2.rc0. Apply to the Sage root repository.

  • spkg/bin/sage-env

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1343156802 -7200
    # Node ID 8f872b5f2a2351b8b172a04597b628e6386b490d
    # Parent  1aea842c737fe5c92ba22cf5e1d1efc523a44208
    #13287: Set/override more compiler-related env vars if Sage's GCC is installed, to avoid conflicts with previous user-specified compilers.
    diff --git a/spkg/bin/sage-env b/spkg/bin/sage-env
    a b  
    426426if [ -z "$CXX" ]; then
    427427    CXX=g++
     429# We may set CPP, FC, F77 (to sage_fortran?) etc. here as well;
     430# letting at least CPP have a default value ('cpp') probably makes sense.
    430432# An Objective-C compiler is needed for R on Darwin.
    431433# On Darwin, /usr/bin/cc supports Objective-C.  The gcc shipped with
    439441    fi
    442 # Override CC and CXX if the gcc spkg was installed.
     444# Override CC, CPP, CXX, FC, F77 and F95 if the GCC spkg was installed:
     445# (We *may* also just unset FC/F77/F95 in case $SAGE_LOCAL/bin/gfortran is
     446# present.)
    443447if [ -x "$SAGE_LOCAL/bin/gcc" ]; then
    444448    CC=gcc
     450if [ -x "$SAGE_LOCAL/bin/cpp" ]; then
     451    CPP=cpp
    446453if [ -x "$SAGE_LOCAL/bin/g++" ]; then
    447454    CXX=g++
    449 export CC CXX
     456export CC CPP CXX
     457if [ -x "$SAGE_LOCAL/bin/gfortran" ]; then
     458    for var in FC F77 F95; do
     459        export ${var}=gfortran
     460    done
    452464if [ "$LD" = "" ]; then