compiler selection

Michael Wild themiwi at gmail.com
Fri Sep 28 07:55:11 PDT 2007


Hi all

I wonder what the policy/methodology is concerning compiler selection. I 
perused the MacPorts guide but couldn't find anything. Am I right in the 
assumption that MacPorts automatically comes with its own gcc compiler 
suite and requires it to be present (I think I read something like that 
somewhere in the FAQ)? If so, on which one can I rely to be there? 
gcc32, gcc40/1/2 or apple-gcc40? just because the executable have all 
different names...

My problem actually is that a port which I'm preparing requires gfortran 
which doesn't come with Apple's system gcc but is in port:gcc42. I could 
simply do "configure.fc ${prefix}/bin/gfortran-mp-4.2, but what if 
someone has another gcc installed? I could depends_build on gcc42 but if 
a gcc suite is required by MacPorts anyways I wouldn't like to impose 
something which might install another compiler suite unnecessarily.

So, currently I do a hacky

set gfortran [lindex [lsort -decreasing [glob \
     -type f "${prefix}/bin/gfortran*"]] 0]
configure.fc ${gfortran}

and hope to get the compiler with the highest version number. For my 
installation this works, but I'm quite unhappy with it.

Does anyone know a better solution to that problem?

Thanks for the help

Michael



More information about the macports-dev mailing list