I am attempting to configure Apache 2.2 from ports (in FreeBSD). I have written my very own makefile with my preferred compile options and so far as I will tell, everything appears to look at. I.e.:

make -V <env_var> __MAKE_CONF=~/mk/make.apache22.conf

returns things i expect aside from PERL5 and USE_PERL5. I have attempted setting both variables in make.apache22.conf in addition to setting the atmosphere in each and every combination there's:

export PERL5=/usr/local/bin/perl
export USE_PERL5=5.12+

but

make -e -V USE_PERL5 -V PERL5

returns

yes
/usr/local/bin/perl5.10.1

(i have also attempted overriding with -E.) Another factor is the fact that I have only Perl 5.12.1 installed, therefore the version is clearly originating from either the Perl port and/or bsd.perl.mk, however the way I am grokking bsd.perl.mk and also the make utility itself I do not realise why my techniques aren't working.

What shall we be held missing?

So, in a nutshell, the solution lies inside the ports system. From /usr/ports/Mk/bsd.port.mk:

Note: the distinction between the USE_* and WANT_* variables, and the
WITH_* and WITHOUT_* variables, are that the former are restricted to
usage inside the ports framework, and the latter are reserved for user-
settable options.  (Setting USE_* in /etc/make.conf is always wrong).

Usually, when setting up from the port, the Makefile will recursively incorporate a chain of files which sooner or later earns:

/usr/ports/Mk/bsd.perl.mk

which file examines all of the USE_PERL* and PERL* variables defined the port's Makefile. Particularly, bsd.perl.mk hard-codes the needed Perl version and can install the Perl port whether it is not already around the system.

The ports product is pretty awesome, however i find this kind of factor frustrating because there does not seem to be any straightforward method to configure a port to construct and/or operated with pre-existing software.

UPDATE August 8, 2010:

The end result is you can either use ports or else you don't. If you do not, you need to by hand configure and track everything yourself however, you will also get the most recent and (hopefully) finest. The ports product is good, especially since each port could be set up as necessary and also you get the benefits of easy improving and package management. (For, say, making custom put together packages to set up into jails--especially utilizing a tool like ezjail.) However that sometimes you need to wait a little before a port is up-to-date towards the latest version. This is not a large deal for common software, but you may be waiting a while for additional obscure products.

Ultimately, the answer here's to set up the Perl 5.12 port and move from there.