runtime variable substitution
Joshua Root
jmr at macports.org
Sat Jul 13 14:07:39 PDT 2013
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
More information about the macports-dev
mailing list