Add CONFIGURE_ARGS option for port in make.conf

Martin Tournoij carpetsmoker at
Thu Aug 7 18:54:23 UTC 2008

On Thu, Aug 07, 2008 at 10:04:23AM +0200, Matthias Kellermann wrote:
> Hi list,
> I want to compile a port with an option that is not controllable through 
> the FreeBSD Makefile or with make config.
> The specific port is lang/php4 and the option I want to add is 
> --with-mime-magic (I know, php4 is old and not supported after 8.8.08 
> and --with-mime-magic is deprecated, but thats another story...).
> So I added an option to make.conf(5):
> .if ${.CURDIR:M*/lang/php4}
> CONFIGURE_ARGS+=--with-mime-magic
> .endif
> Unfortonately, this does not work.
> When I add this option in the Makefile it works. The relevant part looks 
> like this:
> CONFIGURE_ARGS= --enable-versioning \
> 		--with-mime-magic \
>                  --enable-memory-limit \
>                  --with-layout=GNU \
>                  --with-config-file-scan-dir=${PREFIX}/etc/php \
>                  --disable-all \
>                  --program-prefix=""
> Any ideas whats wrong here?
> Regards,
> Matthias

/etc/make.conf is read first, from make(1):
	First of all, the initial list of specifications will be read from the
	system makefile,, unless inhibited with the -r option.  The standard as shipped with FreeBSD also handles make.conf(5)

So if the port uses VAR= instead of VAR+= (Or VAR?=) then settings in
/etc/make.conf will have no effect.

AFAIK there is no pretty workaround, you will need to edit the Makefile.

For a more structual solution, ports should use CONFIGURE_ARGS+= instead of
CONFIGURE_ARGS, or a a new variable can be added, where the user can set
custom configure arguments (i.e.  LOCAL_CONFIGURE_ARGS).

Martin Tournoij
carpetsmoker at

Do not overtax your powers.

More information about the freebsd-questions mailing list