| 146 | |
| 147 | set name "" |
| 148 | switch -exact ${configure.compiler} { |
| 149 | gcc-3.3 { set name "Mac OS X gcc 3.3" } |
| 150 | gcc-4.0 { set name "Mac OS X gcc 4.0" } |
| 151 | gcc-4.2 { set name "Mac OS X gcc 4.2" } |
| 152 | llvm-gcc-4.2 { set name "Mac OS X llvm-gcc 4.2" } |
| 153 | apple-gcc-3.3 { set name "MacPorts Apple gcc 3.3" } |
| 154 | apple-gcc-4.0 { set name "MacPorts Apple gcc 4.0" } |
| 155 | macports-gcc-3.3 { set name "MacPorts gcc 3.3" } |
| 156 | macports-gcc-3.4 { set name "MacPorts gcc 3.4" } |
| 157 | macports-gcc-4.0 { set name "MacPorts gcc 4.0" } |
| 158 | macports-gcc-4.1 { set name "MacPorts gcc 4.1" } |
| 159 | macports-gcc-4.2 { set name "MacPorts gcc 4.2" } |
| 160 | macports-gcc-4.3 { set name "MacPorts gcc 4.3" } |
| 161 | macports-gcc-4.4 { set name "MacPorts gcc 4.4" } |
| 162 | default { return -code error "Invalid value for configure.compiler" } |
| 163 | } |
| 164 | ui_debug "Using compiler '$name'" |
236 | | |
237 | | # internal function for setting compiler variables; use like "_set_compiler string var val var val .." |
238 | | # this function will NOT override explicitely set variables from the portfile |
239 | | proc select_compiler {info args} { |
240 | | global configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc |
241 | | ui_debug "Using compiler '$info'" |
242 | | set i 0 |
243 | | foreach value $args { |
244 | | if {0==$i} { |
245 | | set comp $value |
246 | | set i 1 |
247 | | } else { |
248 | | switch -exact $comp { |
249 | | cc { if {""==${configure.cc}} { set configure.cc $value } } |
250 | | cxx { if {""==${configure.cxx}} { set configure.cxx $value } } |
251 | | cpp { if {""==${configure.cpp}} { set configure.cpp $value } } |
252 | | objc { if {""==${configure.objc}} { set configure.objc $value } } |
253 | | fc { if {""==${configure.fc}} { set configure.fc $value } } |
254 | | f77 { if {""==${configure.f77}} { set configure.f77 $value } } |
255 | | f90 { if {""==${configure.f90}} { set configure.f90 $value } } |
| 268 | # internal function to find correct compilers |
| 269 | proc configure_get_compiler {type} { |
| 270 | global configure.compiler prefix |
| 271 | set ret "" |
| 272 | switch -exact ${configure.compiler} { |
| 273 | gcc-3.3 { |
| 274 | switch -exact ${type} { |
| 275 | cc { set ret /usr/bin/gcc-3.3 } |
| 276 | objc { set ret /usr/bin/gcc-3.3 } |
| 277 | cxx { set ret /usr/bin/g++-3.3 } |
| 278 | cpp { set ret /usr/bin/cpp-3.3 } |
| 281 | gcc-4.0 { |
| 282 | switch -exact ${type} { |
| 283 | cc { set ret /usr/bin/gcc-4.0 } |
| 284 | objc { set ret /usr/bin/gcc-4.0 } |
| 285 | cxx { set ret /usr/bin/g++-4.0 } |
| 286 | cpp { set ret /usr/bin/cpp-4.0 } |
| 287 | } |
| 288 | } |
| 289 | gcc-4.2 { |
| 290 | switch -exact ${type} { |
| 291 | cc { set ret /usr/bin/gcc-4.2 } |
| 292 | objc { set ret /usr/bin/gcc-4.2 } |
| 293 | cxx { set ret /usr/bin/g++-4.2 } |
| 294 | cpp { set ret /usr/bin/cpp-4.2 } |
| 295 | } |
| 296 | } |
| 297 | llvm-gcc-4.2 { |
| 298 | switch -exact ${type} { |
| 299 | cc { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 } |
| 300 | objc { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 } |
| 301 | cxx { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2 } |
| 302 | cpp { set ret /Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 } |
| 303 | } |
| 304 | } |
| 305 | apple-gcc-3.3 { |
| 306 | switch -exact ${type} { |
| 307 | cc { set ret ${prefix}/bin/gcc-apple-3.3 } |
| 308 | cpp { set ret ${prefix}/bin/cpp-apple-3.3 } |
| 309 | } |
| 310 | } |
| 311 | apple-gcc-4.0 { |
| 312 | switch -exact ${type} { |
| 313 | cc { set ret ${prefix}/bin/gcc-apple-4.0 } |
| 314 | objc { set ret ${prefix}/bin/gcc-apple-4.0 } |
| 315 | cpp { set ret ${prefix}/bin/cpp-apple-4.0 } |
| 316 | } |
| 317 | } |
| 318 | macports-gcc-3.3 { |
| 319 | switch -exact ${type} { |
| 320 | cc { set ret ${prefix}/bin/gcc-mp-3.3 } |
| 321 | cxx { set ret ${prefix}/bin/g++-mp-3.3 } |
| 322 | cpp { set ret ${prefix}/bin/cpp-mp-3.3 } |
| 323 | } |
| 324 | } |
| 325 | macports-gcc-3.4 { |
| 326 | switch -exact ${type} { |
| 327 | cc { set ret ${prefix}/bin/gcc-mp-3.4 } |
| 328 | cxx { set ret ${prefix}/bin/g++-mp-3.4 } |
| 329 | cpp { set ret ${prefix}/bin/cpp-mp-3.4 } |
| 330 | } |
| 331 | } |
| 332 | macports-gcc-4.0 { |
| 333 | switch -exact ${type} { |
| 334 | cc { set ret ${prefix}/bin/gcc-mp-4.0 } |
| 335 | objc { set ret ${prefix}/bin/gcc-mp-4.0 } |
| 336 | cxx { set ret ${prefix}/bin/g++-mp-4.0 } |
| 337 | cpp { set ret ${prefix}/bin/cpp-mp-4.0 } |
| 338 | fc { set ret ${prefix}/bin/gfortran-mp-4.0 } |
| 339 | f77 { set ret ${prefix}/bin/gfortran-mp-4.0 } |
| 340 | f90 { set ret ${prefix}/bin/gfortran-mp-4.0 } |
| 341 | } |
| 342 | } |
| 343 | macports-gcc-4.1 { |
| 344 | switch -exact ${type} { |
| 345 | cc { set ret ${prefix}/bin/gcc-mp-4.1 } |
| 346 | objc { set ret ${prefix}/bin/gcc-mp-4.1 } |
| 347 | cxx { set ret ${prefix}/bin/g++-mp-4.1 } |
| 348 | cpp { set ret ${prefix}/bin/cpp-mp-4.1 } |
| 349 | fc { set ret ${prefix}/bin/gfortran-mp-4.1 } |
| 350 | f77 { set ret ${prefix}/bin/gfortran-mp-4.1 } |
| 351 | f90 { set ret ${prefix}/bin/gfortran-mp-4.1 } |
| 352 | } |
| 353 | } |
| 354 | macports-gcc-4.2 { |
| 355 | switch -exact ${type} { |
| 356 | cc { set ret ${prefix}/bin/gcc-mp-4.2 } |
| 357 | objc { set ret ${prefix}/bin/gcc-mp-4.2 } |
| 358 | cxx { set ret ${prefix}/bin/g++-mp-4.2 } |
| 359 | cpp { set ret ${prefix}/bin/cpp-mp-4.2 } |
| 360 | fc { set ret ${prefix}/bin/gfortran-mp-4.2 } |
| 361 | f77 { set ret ${prefix}/bin/gfortran-mp-4.2 } |
| 362 | f90 { set ret ${prefix}/bin/gfortran-mp-4.2 } |
| 363 | } |
| 364 | } |
| 365 | macports-gcc-4.3 { |
| 366 | switch -exact ${type} { |
| 367 | cc { set ret ${prefix}/bin/gcc-mp-4.3 } |
| 368 | objc { set ret ${prefix}/bin/gcc-mp-4.3 } |
| 369 | cxx { set ret ${prefix}/bin/g++-mp-4.3 } |
| 370 | cpp { set ret ${prefix}/bin/cpp-mp-4.3 } |
| 371 | fc { set ret ${prefix}/bin/gfortran-mp-4.3 } |
| 372 | f77 { set ret ${prefix}/bin/gfortran-mp-4.3 } |
| 373 | f90 { set ret ${prefix}/bin/gfortran-mp-4.3 } |
| 374 | } |
| 375 | } |
| 376 | macports-gcc-4.4 { |
| 377 | switch -exact ${type} { |
| 378 | cc { set ret ${prefix}/bin/gcc-mp-4.4 } |
| 379 | objc { set ret ${prefix}/bin/gcc-mp-4.4 } |
| 380 | cxx { set ret ${prefix}/bin/g++-mp-4.4 } |
| 381 | cpp { set ret ${prefix}/bin/cpp-mp-4.4 } |
| 382 | fc { set ret ${prefix}/bin/gfortran-mp-4.4 } |
| 383 | f77 { set ret ${prefix}/bin/gfortran-mp-4.4 } |
| 384 | f90 { set ret ${prefix}/bin/gfortran-mp-4.4 } |
| 385 | } |
| 386 | } |
291 | | # 1st chose a reasonable default compiler suite for each platform if none was chosen |
292 | | if {""==${configure.compiler}} { |
293 | | switch -exact "${os.platform} ${os.major}" { |
294 | | "darwin 7" { set configure.compiler gcc-3.3 } |
295 | | "darwin 8" { set configure.compiler gcc-4.0 } |
296 | | "darwin 9" { set configure.compiler gcc-4.0 } |
297 | | "darwin 10" { set configure.compiler llvm-gcc-4.2 } |
298 | | } |
299 | | } |
300 | | |
301 | | # select a compiler collection |
302 | | switch -exact ${configure.compiler} { |
303 | | gcc-3.3 { |
304 | | select_compiler "Mac OS X gcc 3.3" \ |
305 | | cc /usr/bin/gcc-3.3 \ |
306 | | objc /usr/bin/gcc-3.3 \ |
307 | | cxx /usr/bin/g++-3.3 \ |
308 | | cpp /usr/bin/cpp-3.3 } |
309 | | gcc-4.0 { |
310 | | select_compiler "Mac OS X gcc 4.0" \ |
311 | | cc /usr/bin/gcc-4.0 \ |
312 | | objc /usr/bin/gcc-4.0 \ |
313 | | cxx /usr/bin/g++-4.0 \ |
314 | | cpp /usr/bin/cpp-4.0 } |
315 | | gcc-4.2 { |
316 | | select_compiler "Mac OS X gcc 4.2" \ |
317 | | cc /usr/bin/gcc-4.2 \ |
318 | | objc /usr/bin/gcc-4.2 \ |
319 | | cxx /usr/bin/g++-4.2 \ |
320 | | cpp /usr/bin/cpp-4.2 } |
321 | | llvm-gcc-4.2 { |
322 | | select_compiler "Mac OS X llvm-gcc 4.2" \ |
323 | | cc /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 \ |
324 | | objc /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 \ |
325 | | cxx /Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2 \ |
326 | | cpp /Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 } |
327 | | apple-gcc-3.3 { |
328 | | select_compiler "MacPorts Apple gcc 3.3" \ |
329 | | cc ${prefix}/bin/gcc-apple-3.3 \ |
330 | | cpp ${prefix}/bin/cpp-apple-3.3 } |
331 | | apple-gcc-4.0 { |
332 | | select_compiler "MacPorts Apple gcc 4.0" \ |
333 | | cc ${prefix}/bin/gcc-apple-4.0 \ |
334 | | objc ${prefix}/bin/gcc-apple-4.0 \ |
335 | | cpp ${prefix}/bin/cpp-apple-4.0 } |
336 | | macports-gcc-3.3 { |
337 | | select_compiler "MacPorts gcc 3.3" \ |
338 | | cc ${prefix}/bin/gcc-mp-3.3 \ |
339 | | cxx ${prefix}/bin/g++-mp-3.3 \ |
340 | | cpp ${prefix}/bin/cpp-mp-3.3 } |
341 | | macports-gcc-3.4 { |
342 | | select_compiler "MacPorts gcc 3.4" \ |
343 | | cc ${prefix}/bin/gcc-mp-3.4 \ |
344 | | cxx ${prefix}/bin/g++-mp-3.4 \ |
345 | | cpp ${prefix}/bin/cpp-mp-3.4 } |
346 | | macports-gcc-4.0 { |
347 | | select_compiler "MacPorts gcc 4.0" \ |
348 | | cc ${prefix}/bin/gcc-mp-4.0 \ |
349 | | objc ${prefix}/bin/gcc-mp-4.0 \ |
350 | | cxx ${prefix}/bin/g++-mp-4.0 \ |
351 | | cpp ${prefix}/bin/cpp-mp-4.0 \ |
352 | | fc ${prefix}/bin/gfortran-mp-4.0 \ |
353 | | f77 ${prefix}/bin/gfortran-mp-4.0 \ |
354 | | f90 ${prefix}/bin/gfortran-mp-4.0 } |
355 | | macports-gcc-4.1 { |
356 | | select_compiler "MacPorts gcc 4.1" \ |
357 | | cc ${prefix}/bin/gcc-mp-4.1 \ |
358 | | objc ${prefix}/bin/gcc-mp-4.1 \ |
359 | | cxx ${prefix}/bin/g++-mp-4.1 \ |
360 | | cpp ${prefix}/bin/cpp-mp-4.1 \ |
361 | | fc ${prefix}/bin/gfortran-mp-4.1 \ |
362 | | f77 ${prefix}/bin/gfortran-mp-4.1 \ |
363 | | f90 ${prefix}/bin/gfortran-mp-4.1 } |
364 | | macports-gcc-4.2 { |
365 | | select_compiler "MacPorts gcc 4.2" \ |
366 | | cc ${prefix}/bin/gcc-mp-4.2 \ |
367 | | objc ${prefix}/bin/gcc-mp-4.2 \ |
368 | | cxx ${prefix}/bin/g++-mp-4.2 \ |
369 | | cpp ${prefix}/bin/cpp-mp-4.2 \ |
370 | | fc ${prefix}/bin/gfortran-mp-4.2 \ |
371 | | f77 ${prefix}/bin/gfortran-mp-4.2 \ |
372 | | f90 ${prefix}/bin/gfortran-mp-4.2 } |
373 | | macports-gcc-4.3 { |
374 | | select_compiler "MacPorts gcc 4.3" \ |
375 | | cc ${prefix}/bin/gcc-mp-4.3 \ |
376 | | objc ${prefix}/bin/gcc-mp-4.3 \ |
377 | | cxx ${prefix}/bin/g++-mp-4.3 \ |
378 | | cpp ${prefix}/bin/cpp-mp-4.3 \ |
379 | | fc ${prefix}/bin/gfortran-mp-4.3 \ |
380 | | f77 ${prefix}/bin/gfortran-mp-4.3 \ |
381 | | f90 ${prefix}/bin/gfortran-mp-4.3 } |
382 | | macports-gcc-4.4 { |
383 | | select_compiler "MacPorts gcc 4.4" \ |
384 | | cc ${prefix}/bin/gcc-mp-4.4 \ |
385 | | objc ${prefix}/bin/gcc-mp-4.4 \ |
386 | | cxx ${prefix}/bin/g++-mp-4.4 \ |
387 | | cpp ${prefix}/bin/cpp-mp-4.4 \ |
388 | | fc ${prefix}/bin/gfortran-mp-4.4 \ |
389 | | f77 ${prefix}/bin/gfortran-mp-4.4 \ |
390 | | f90 ${prefix}/bin/gfortran-mp-4.4 } |
391 | | default { |
392 | | return -code error "Invalid value for configure.compiler" } |
393 | | } |
394 | | |