In some cases, a module is needed by another module only on specific
platforms. But when a module is present, its autoconf checks are always
executed, and its
Makefile.am additions are always enabled. So
it can happen that some autoconf checks are executed and some source files
are compiled, although no other module needs them on this particular
platform, just in case some other module would need them.
The option ‘--conditional-dependencies’ enables an optimization of
configure checks and
Makefile.am snippets that avoids this. With
this option, whether a module is considered “present” is no longer decided
gnulib-tool is invoked, but later, when
configure is run.
This applies to modules that were added as dependencies while
gnulib-tool was run; modules that were passed on the command line
explicitly are always “present”.
For example, the
timegm module needs, on platforms
where the system’s
timegm function is missing or buggy, a replacement
that is based on a function
mktime_internal. The module
mktime-internal that provides this function provides it on all
platforms. So, by default, the file mktime-internal.c will be
compiled on all platforms, even on glibc and BSD systems which have a
timegm function. When the option
‘--conditional-dependencies’ is given, on the other hand, and if
mktime-internal was not explicitly required on the command line,
the file mktime-internal.c will only be compiled on the platforms
timegm needs them.
Conditional dependencies are specified in the module description by putting
the condition on the same line as the dependent module, enclosed in brackets.
The condition is a boolean shell expression that can assume that the
configure.ac snippet from the module description has already been
executed. In the example above, the dependency from
mktime-internal is written like this:
Depends-on: ... mktime-internal [test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1] ...
Note: The option ‘--conditional-dependencies’ cannot be used together
with the option ‘--with-tests’. It also cannot be used when a package
gnulib-tool for several subdirectories, with different values
of ‘--source-base’, in the scope of a single