| 236 | # internal function find known compilers |
| 237 | proc portconfigure::find_known_compilers default { |
| 238 | set compiler_names {} |
| 239 | lappend $compiler_names cc gcc gcc-3.3 gcc-4.0 gcc-4.2 apple-gcc-3.3 apple-gcc-4.0 apple-gcc-4.2 |
| 240 | lappend $compiler_names macports-gcc-4.0 macports-gcc-4.1 macports-gcc-4.2 macports-gcc-4.3 macports-gcc-4.4 macports-gcc-4.5 macports-gcc-4.6 |
| 241 | lappend $compiler_names llvm-gcc-4.2 clang macports-llvm-gcc-4.2 macports-clang |
| 242 | |
| 243 | set compiler_binaries {} |
| 244 | lappend $compiler_binaries cc objc cxx cpp fc f77 f90 |
| 245 | |
| 246 | set found_compilers {} |
| 247 | ## assume the default compiler exists, search for the rest |
| 248 | #lappend $found_compilers [portconfigure::configure_get_default_compiler] |
| 249 | |
| 250 | # check for any binary from each compiler |
| 251 | foreach compiler $compiler_names { |
| 252 | foreach binary $compiler_binaries { |
| 253 | set test_compiler [portconfigure::configure_get_compiler $binary $compiler] |
| 254 | if {[file executable $test_compiler] && [lsearch -exact $found_compilers $compiler] == -1} { |
| 255 | lappend found_compilers $compiler |
| 256 | ui_debug "Found $compiler ($test_compiler)" |
| 257 | break |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | return $found_compilers |
| 263 | } |
| 264 | |
| 265 | # internal function to choose the default configure.compiler |
| 266 | proc portconfigure::choose_supported_compilers {compilers} { |
| 267 | |
| 268 | # if not set, any compiler will work |
| 269 | global supported_compilers |
| 270 | if {$supported_compilers == ""} { |
| 271 | return $compilers |
| 272 | } |
| 273 | |
| 274 | # if set, thin the available set |
| 275 | set ret {} |
| 276 | foreach compiler $compilers { |
| 277 | if {[lsearch -exact $supported_compilers $compiler] != -1]} { |
| 278 | if {[lsearch -exact $ret $add_compiler] == -1} { |
| 279 | lappend $ret $add_compiler |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | return $ret |
| 285 | } |
| 286 | |