runtime variable substitution

David Strubbe dstrubbe at gmail.com
Sat Jul 13 14:52:47 PDT 2013


I see. So, is there a place I can move this piece of code, or should I just
write an error message by hand instead of using require_active_variants?

On Sat, Jul 13, 2013 at 5:07 PM, Joshua Root <jmr at macports.org> wrote:

> On 2013-7-14 06:44 , David Strubbe wrote:
> > Hi all,
> >
> > I am trying to add MPI support to my octopus port, and trying to find
> > the proper way of enforcing consistent Fortran versions. I put the
> > following code into pre-configure, which almost seems to do the job. The
> > error is not triggered, and the message gives the correct Fortran
> > compiler in the cases I tried. However, the "require_active_variants
> > libxc" line does not seem to be executed: there is no corresponding
> > output in the main.log, and it does not cause an error even when the
> > variant in question is not set. Am I supposed to wrap something around
> > this call to make it substitute the variable properly?
> >
> > Thanks,
> > David
> >
> > pre-configure {
> >     set fortran unknown
> >     set fortrans { gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 g95 }
> >     foreach fc_name ${fortrans} {
> >         if { [variant_isset ${fc_name}] } {
> >             set fortran ${fc_name}
> >         } elseif { [variant_isset openmpi] } {
> >             if { [active_variants openmpi ${fc_name}] } { set fortran
> > ${fc_name} }
> >         } elseif { [variant_isset mpich] } {
> >             if { _portnameactive mpich} {
> >                 if { [active_variants mpich ${fc_name}] } { set fortran
> > ${fc_name} }
> >             } elseif { _portnameactive mpich-devel } {
> >                 if { [active_variants mpich-devel ${fc_name}] } { set
> > fortran ${fc_name} }
> >             }
> >         }
> >     }
> >     if { ${fortran} == "unknown" } {
> >         ui_error "Internal error: cannot determine Fortran compiler."
> >     }
> >     ui_msg "Fortran compiler is ${fortran}."
> >
> >     require_active_variants libxc ${fortran}
> > }
>
> require_active_variants only appends to a variable indicating which
> variants you want to require. The actual check is done in pre-configure
> (and pre-archivefetch) code, which has already run by the time your
> pre-configure runs.
>
> - Josh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130713/f03cd989/attachment.html>


More information about the macports-dev mailing list