On Sep 28, 2007, at 09:55, Michael Wild wrote:
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...
No. MacPorts does not require any MacPorts-built gcc to be there. Most ports don't need that. MacPorts itself, and most ports, use the Apple's system gcc, which is 3.3 on Mac OS X 10.3.9 and 4.0 on 10.4.10.
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.
If you require gfortran, you should depends_build on gcc42. Nevermind anyone who has gcc43 installed; that's beta and shouldn't be relied on until gcc44 is released, at which point the port can be updated. Nevermind anyone who has gcc41 or gc40 or earlier installed; any ports that still depend on those should be updated to gcc42.
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?
Yeah, that's hacky. Just depend on gcc42. Some ports have variants for selecting a compiler. See pdftk. But it's only because gcc takes so long to build, especially on PowerPCs. Everyone who has ports that depend on non-Apple gcc, though, should strive to update them to gcc42 so that nobody needs the old versions installed anymore.