How can I determine if a function is available?

Ryan Schmidt ryandesign at
Mon Apr 9 23:48:59 PDT 2007

On Apr 9, 2007, at 08:38, Daniel J. Luke wrote:

> On Apr 9, 2007, at 4:39 AM, Ryan Schmidt wrote:
>> Which is why I'm looking for a solution within MacPorts, using  
>> which I have been able to create a solution, in the form of the  
>> patch attached to the ticket. I'm just looking for the most  
>> elegant way to construct the patch, and any assistance in that  
>> direction would be appreciated.
>> If the MacPorts commands I've found and used here are considered  
>> to be internal and subject to change, then I request a public API  
>> by which I can do what I'm trying to do.
> You could make the php port a shell port which depended on other  
> ports (php5-apache2, php5-fastcgi, php5-apache1).

If I do that, how can I avoid each port (php5-apache2, php5-fastcgi,  
etc.) having to download the php5 source again?

Another port, fftw-3, was recently rewritten [1] to use the former  
zlib strategy for rebuilding itself twice, specifically to avoid  
having two ports. Currently there is fftw-3 and fftw-3-single, with  
the latter depending on the former. The two current fftw-3 ports do  
both download the same source code, which is wasteful.

I'm not sure that making separate ports is the best strategy. The  
FastCGI version of PHP is not a separate software package. Rather,  
it's just one of the many ways in which PHP can be installed. It's a  
variation, a variant. And it seems most logical that it be  
implemented in MacPorts in that way, as a variant.

Isn't there a way in tcl to detect if a certain function exists? If  
this were PHP code, I would just write

if (function_exists('command_exec')) {

Is there a tcl equivalent of that?

I note, by the way, that there are several other ports already using  
the "command" command, which will break when MacPorts 1.5 (or  
whatever version) is released which removes the "command" command:

dports $ grep '\[command' */*/Portfile
aqua/radassist/Portfile:        system "[command patch] < \"$ 
devel/curlhandle/Portfile:      system "[command build]"
devel/libsdl-framework/Portfile:           system "[command build]"
net/nefu/Portfile:      system "[command build]"
textproc/gpsbabel/Portfile:                     system "[command build]"

[1] Mailing list discussion: 

[2] Ticket with new portfile as attachment:

More information about the macports-dev mailing list