<div dir="ltr">Hi Rainer,<div><br></div><div>Sean did indeed add the default_variants to the compilers portgroup in the last month or two. Perhaps you were trying before then.</div><div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 26, 2015 at 9:30 AM, Rainer Müller <span dir="ltr">&lt;<a href="mailto:raimue@macports.org" target="_blank">raimue@macports.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2015-02-26 14:22, Artur Szostak wrote:<br>
&gt; Let me rephrase: Assuming I have to use gcc rather than clang. What<br>
&gt; is the standard/best way to do that in a Portfile?<br>
&gt;<br>
&gt; I have a numerical code that gives inferior results with clang<br>
&gt; compared to gcc. Thus, I need to make sure the port uses GCC. Also,<br>
&gt; the code is C99, so that should mitigate any ABI issues.<br>
<br>
</span>Starting with Xcode 6, there are only clang and macports-clang-* in the<br>
default list of usable compilers. To use gcc you explicitly need to<br>
whitelist it.<br>
<br>
The simplest and least flexible would be to just use a specific version<br>
of gcc:<br>
<br>
  configure.compiler macports-gcc-4.9<br>
<br>
<br>
To be more flexible, you can also create variants that allow to choose<br>
the version of gcc with +gcc49, +gcc48, etc:<br>
<br>
  variant gcc47 description {Build with MacPorts gcc 4.7 compiler} conflicts gcc48 gcc49 {<br>
      configure.compiler macports-gcc-4.7<br>
  }<br>
<br>
  variant gcc48 description {Build with MacPorts gcc 4.8 compiler} conflicts gcc47 gcc49 {<br>
      configure.compiler macports-gcc-4.8<br>
  }<br>
<br>
  variant gcc49 description {Build with MacPorts gcc 4.9 compiler} conflicts gcc47 gcc48 {<br>
      configure.compiler macports-gcc-4.9<br>
  }<br>
<br>
  if {![variant_isset gcc47] &amp;&amp; ![variant_isset gcc48] &amp;&amp; ![variant_isset gcc49]} {<br>
      default_variants +gcc49<br>
  }<br>
<br>
<br>
Recently, there was also a new compilers port group added to the ports<br>
tree which is supposed to generate these variants automatically.<br>
However, as far as I was able to test it, it does not automatically<br>
handle the selection of a default compiler yet as shown in the example<br>
above using the variant_isset conditionals, so you still need to add<br>
that. Manually adding this would make the construct a bit fragile as<br>
new versions will be added to the port group in the future.<br>
<br>
  compilers.choose    cc cpp<br>
  compilers.setup     -clang -llvm -dragonegg<br>
  default_variants    +gcc49<br>
<br>
@Sean, David: did I do something wrong or is automatic selection just<br>
not supported yet by the compilers port group?<br>
<span class="HOEnZb"><font color="#888888"><br>
Rainer<br>
</font></span></blockquote></div><br></div>