On Tue, Oct 15, 2024, at 10:38 AM, suzuki toshiya wrote:
> I'm looking for a combination of the target to include sub-packages
> which is built conditionally.
>
> A package "X" include a libary "Y" as a subpackage, like
...
> Y is often installed as an external or system library, so X/configure
> calls AC_CONFIG_SUBDIRS([Y]) in some cases, not always.

You need to call AC_CONFIG_SUBDIRS([Y]) unconditionally.  Many things
break if you call it conditionally, not just what you have already
tripped over.  Not only this, but Y's configure script needs to actually
run and its Makefiles need to be generated unconditionally.  (The basic
_issue_ is what you've already tripped over: Automake needs to know
_statically_ all of the files included in package X.  But many other
things besides "make dist" depend on this.)

Instead, I suggest that you have Y detect when it is being configured
as an embedded subpackage that will not actually be used.  For example,
if X decides to build Y based on the value of a --with-system-Y
configure switch, Y's configure.ac can itself respond to --with-system-Y
by skipping all its system probes and using Automake conditionals to
avoid building the library.  As I recall, AC_CONFIG_SUBDIRS([Y]) will
pass --with-system-Y down to Y's configure.ac, so you don't need to do
anything special there.

zw

Reply via email to