Subject: handling "optional" features in packages which add dependencies on other packages
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <>
List: tech-pkg
Date: 04/25/1999 18:53:03
[ On Sunday, April 25, 1999 at 11:46:31 (-0700), Todd Vierling wrote: ]
> Subject: CVS commit: pkgsrc
> Module Name:	pkgsrc
> Committed By:	tv
> Date:		Sun Apr 25 18:46:30 UTC 1999
> Modified Files:
> 	pkgsrc/graphics/ImageMagick: Makefile
> 	pkgsrc/graphics/ImageMagick/patches: patch-aa
> 	pkgsrc/graphics/ImageMagick/pkg: PLIST
> Removed Files:
> 	pkgsrc/graphics/ImageMagick/patches: patch-ab patch-ac
> Log Message:
> Do the following to make this ELF and 1.3 friendly:
> - use the autoconf configure script to configure and build (we were
> already running configure but using Imake to build!?)
> - make use of pkglibtool (package already has full libtool support)
> (Note that now that we use Autoconf, this installs in ${LOCALBASE} without
> the need for a tool such as xpkgwedge.  The configure script automatically
> detects all the stuff for which we had used patches in the Imakefiles.)
> Also use --without-... to disable optional components for which we have no
> explicit dependencies, which can be reenabled by the user in pkgsrc, so
> that the built binaries do not have "hidden" dependencies.
> Closes PR pkg/7463.

I've recently encountered at least one other package (pgsql-current,
which I'll send-pr when I've polished it up a bit more) which
"accidentally" finds things which might be installed on the build system
if those things are installed on the build system.

As you might know pgsql uses autoconf to configure itself.  The
"optional" packages it finds, if they happen to be installed, are things
like "readline", "ncurses", and "sfio".  Unfortunately the AC_CHECK_LIB
macro is used to find these things, and configure's "--without-*" option
won't disable the finding of these optional pakages.

For now I've patched pgsql's not to look for ncurses or
sfio, and have added ".if defined(USE_READLINE)" to so that I can
optionally include a "DEPENDS+=readline*", though I've not yet patched
the to use AC_CHECK_LIB only if "--with-readline" is

Similarly I've added ".if defined(USE_TCL)" to turn on "--with-tcl" and
the appropriate DEPENDS, etc.

I don't really like this though -- I basically just borrowed the idea
from one of FreeBSD's ports (perhaps even pgsql, I don't remember) to
get things working so that I could use the resulting binary package.

I think we need to come up with a more generic naming scheme for
controlling optional features of packages, especially when they create
dependencies on other packages.  I haven't really got anything concrete
to propose yet, but my thinking is along the lines:


I.e. have a PKG_{add-on} variable that controls the default use of an
add-on dependant for any other package that might use it, and then have
PKG_{parent-pkg}_{add-on} that can override the default for a given
dependant in some specific package.  This gets very verbose though.

I've also raised the issue of controlling AC_CHECK_LIB and similar
macros which might create dependencies on the <> mailing
list, but so far I haven't seen too much response.

							Greg A. Woods

+1 416 218-0098      VE3TCP      <>      <robohack!woods>
Planix, Inc. <>; Secrets of the Weird <>