Changeset 28474 for trunk/base


Ignore:
Timestamp:
Sep 1, 2007, 12:25:06 PM (12 years ago)
Author:
mww@…
Message:

rewrite compiler selection process: now allows to override any configure-related variable in the Portfile even if a compiler collection was chosen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portconfigure.tcl

    r28317 r28474  
    8787}
    8888
     89# internal function for setting compiler variables; use like "_set_compiler string var val var val .."
     90# this function will NOT override explicitely set variables from the portfile
     91proc select_compiler {info args} {
     92    global configure.cc configure.cxx configure.cpp configure.f77 configure.f90 configure.fc
     93    ui_debug "Using compiler '$info'"
     94    set i 0
     95    foreach value $args {
     96        if {0==$i} {
     97            set comp $value
     98            set i 1
     99        } else {
     100            switch -exact $comp {
     101                cc  { if {""==${configure.cc}}  { set configure.cc $value } }
     102                cxx { if {""==${configure.cxx}} { set configure.cxx $value } }
     103                cpp { if {""==${configure.cpp}} { set configure.cpp $value } }
     104                fc  { if {""==${configure.fc}}  { set configure.fc $value } }
     105                f77 { if {""==${configure.f77}} { set configure.f77 $value } }
     106                f90 { if {""==${configure.f90}} { set configure.f90 $value } }
     107            }
     108            set i 0
     109        }
     110    }
     111}
     112
    89113proc configure_main {args} {
    90114    global [info globals]
     
    110134    switch -exact ${configure.compiler} {
    111135        gcc-3.3 {
    112             ui_debug "Using Mac OS X gcc 3.3"
    113             set configure.cc "/usr/bin/gcc-3.3"
    114             set configure.cxx "/usr/bin/g++-3.3"
    115             set configure.cpp "/usr/bin/cpp-3.3" }
     136            select_compiler "Mac OS X gcc 3.3" \
     137                cc  /usr/bin/gcc-3.3 \
     138                cxx /usr/bin/g++-3.3 \
     139                cpp /usr/bin/cpp-3.3 }
    116140        gcc-4.0 {
    117             ui_debug "Using Mac OS X gcc 4.0"
    118             set configure.cc "/usr/bin/gcc-4.0"
    119             set configure.cxx "/usr/bin/g++-4.0"
    120             set configure.cpp "/usr/bin/cpp-4.0" }
     141            select_compiler "Mac OS X gcc 4.0" \
     142                cc  /usr/bin/gcc-4.0 \
     143                cxx /usr/bin/g++-4.0 \
     144                cpp /usr/bin/cpp-4.0 }
    121145        apple-gcc-3.3 {
    122             ui_debug "Using MacPorts Apple gcc 3.3"
    123             set configure.cc "${prefix}/bin/gcc-apple-3.3"
    124             set configure.cpp "${prefix}/bin/cpp-apple-3.3" }
     146            select_compiler "MacPorts Apple gcc 3.3" \
     147                cc  ${prefix}/bin/gcc-apple-3.3 \
     148                cpp ${prefix}/bin/cpp-apple-3.3 }
    125149        apple-gcc-4.0 {
    126             ui_debug "Using MacPorts Apple gcc 4.0"
    127             set configure.cc "${prefix}/bin/gcc-apple-4.0"
    128             set configure.cpp "${prefix}/bin/cpp-apple-4.0" }
    129         macports-gcc-3.3 {
    130             ui_debug "Using MacPorts gcc 3.3"
    131             set configure.cc "${prefix}/bin/gcc-mp-3.3"
    132             set configure.cxx "${prefix}/bin/g++-mp-3.3"
    133             set configure.cpp "${prefix}/bin/cpp-mp-3.3" }
    134         macports-gcc-3.4 {
    135             ui_debug "Using MacPorts gcc 3.4"
    136             set configure.cc "${prefix}/bin/gcc-mp-3.4"
    137             set configure.cxx "${prefix}/bin/g++-mp-3.4"
    138             set configure.cpp "${prefix}/bin/cpp-mp-3.4" }
     150            select_compiler "MacPorts Apple gcc 4.0" \
     151                cc  ${prefix}/bin/gcc-apple-4.0 \
     152                cpp ${prefix}/bin/cpp-apple-4.0 }
    139153        macports-gcc-4.0 {
    140             ui_debug "Using MacPorts gcc 4.0"
    141             set configure.cc "${prefix}/bin/gcc-mp-4.0"
    142             set configure.cxx "${prefix}/bin/g++-mp-4.0"
    143             set configure.cpp "${prefix}/bin/cpp-mp-4.0"
    144             set configure.fc "${prefix}/bin/gfortran-mp-4.0"
    145             set configure.f77 "${prefix}/bin/gfortran-mp-4.0"
    146             set configure.f90 "${prefix}/bin/gfortran-mp-4.0" }
     154            select_compiler "MacPorts gcc 4.0" \
     155                cc  ${prefix}/bin/gcc-mp-4.0 \
     156                cxx ${prefix}/bin/g++-mp-4.0 \
     157                cpp ${prefix}/bin/cpp-mp-4.0 \
     158                fc  ${prefix}/bin/gfortran-mp-4.0 \
     159                f77 ${prefix}/bin/gfortran-mp-4.0 \
     160                f90 ${prefix}/bin/gfortran-mp-4.0 }
    147161        macports-gcc-4.1 {
    148             ui_debug "Using MacPorts gcc 4.1"
    149             set configure.cc "${prefix}/bin/gcc-mp-4.1"
    150             set configure.cxx "${prefix}/bin/g++-mp-4.1"
    151             set configure.cpp "${prefix}/bin/cpp-mp-4.1"
    152             set configure.fc "${prefix}/bin/gfortran-mp-4.1"
    153             set configure.f77 "${prefix}/bin/gfortran-mp-4.1"
    154             set configure.f90 "${prefix}/bin/gfortran-mp-4.1" }
     162            select_compiler "MacPorts gcc 4.1" \
     163                cc  ${prefix}/bin/gcc-mp-4.1 \
     164                cxx ${prefix}/bin/g++-mp-4.1 \
     165                cpp ${prefix}/bin/cpp-mp-4.1 \
     166                fc  ${prefix}/bin/gfortran-mp-4.1 \
     167                f77 ${prefix}/bin/gfortran-mp-4.1 \
     168                f90 ${prefix}/bin/gfortran-mp-4.1 }
    155169        macports-gcc-4.2 {
    156             ui_debug "Using MacPorts gcc 4.2"
    157             set configure.cc "${prefix}/bin/gcc-mp-4.2"
    158             set configure.cxx "${prefix}/bin/g++-mp-4.2"
    159             set configure.cpp "${prefix}/bin/cpp-mp-4.2"
    160             set configure.fc "${prefix}/bin/gfortran-mp-4.2"
    161             set configure.f77 "${prefix}/bin/gfortran-mp-4.2"
    162             set configure.f90 "${prefix}/bin/gfortran-mp-4.2" }
     170            select_compiler "MacPorts gcc 4.2" \
     171                cc  ${prefix}/bin/gcc-mp-4.2 \
     172                cxx ${prefix}/bin/g++-mp-4.2 \
     173                cpp ${prefix}/bin/cpp-mp-4.2 \
     174                fc  ${prefix}/bin/gfortran-mp-4.2 \
     175                f77 ${prefix}/bin/gfortran-mp-4.2 \
     176                f90 ${prefix}/bin/gfortran-mp-4.2 }
    163177        macports-gcc-4.3 {
    164             ui_debug "Using MacPorts gcc 4.3"
    165             set configure.cc "${prefix}/bin/gcc-mp-4.3"
    166             set configure.cxx "${prefix}/bin/g++-mp-4.3"
    167             set configure.cpp "${prefix}/bin/cpp-mp-4.3"
    168             set configure.fc "${prefix}/bin/gfortran-mp-4.3"
    169             set configure.f77 "${prefix}/bin/gfortran-mp-4.3"
    170             set configure.f90 "${prefix}/bin/gfortran-mp-4.3" }
     178            select_compiler "MacPorts gcc 4.3" \
     179                cc  ${prefix}/bin/gcc-mp-4.3 \
     180                cxx ${prefix}/bin/g++-mp-4.3 \
     181                cpp ${prefix}/bin/cpp-mp-4.3 \
     182                fc  ${prefix}/bin/gfortran-mp-4.3 \
     183                f77 ${prefix}/bin/gfortran-mp-4.3 \
     184                f90 ${prefix}/bin/gfortran-mp-4.3 }
    171185        default {
    172186            ui_debug "No compiler collection selected explicitly" }
Note: See TracChangeset for help on using the changeset viewer.