bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditional inclusion


From: Micah Cowan
Subject: Re: Conditional inclusion
Date: Sun, 14 Oct 2007 19:50:14 -0700
User-agent: Thunderbird 1.5.0.13 (X11/20070824)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Bruno Haible wrote:
> Hi,
> 
> Micah Cowan asked:
>> If I've --import'ed md5, is there a means for me to specify in
>> configure.ac that it should not be included in certain circumstances?
> 
> Depending on what you want, there are different answers:
> 
> 1) If it's ok to build the module even though it does not get used -
>    this is usually the case if you build libgnu.a as a static library
>    and it is not installed, only used to link an executable - then
>    simply leave the module in the list.

For some reason, I totally blanked out on the fact that just because
it's compiled, doesn't mean it'll be included in the binary.

> 2) If the condition when to use the module is a simple one that can be
>    determined at configure time, you can put all code that is subject to
>    the same condition into a library that is built conditionally. Call
>    this library, say, libwcrypt. Then you will have two gnulib-tool
>    invocations, one for libgnu, one for libwcrypt. They have to have
>    their sources in different directories (a limitation of gnulib-tool).
>    I.e. you will have two directories 'gl' and 'wcrypt', and your Makefile.am
>    will contain this:
> 
>         if ENABLE_LIBWCRYPT
>         SUBDIR_wcrypt = wcrypt
>         else
>         SUBDIR_wcrypt =
>         endif
>         SUBDIRS = gl $(SUBDIR_wcrypt) src doc po ...
> 
>    Such declarations will prevent "make" from recursing into wcrypt.
>    But this poses problems when doing "make dist", therefore an alternative
>    way to do it is to always recurse into the subdirectory:
> 
>         SUBDIRS = gl wcrypt src doc po ...
> 
>    wcrypt/Makefile.am:
>         if ENABLE_LIBWCRYPT
>         noinst_LIBRARIES = libwcrypt.a
>         else
>         noinst_LIBRARIES =
>         endif
>         # use gnulib-tool option --makefile-name=Makefile.gnulib
>         include Makefile.gnulib

What a great suggestion. I'll probably just leave it in libgnu.a (#1),
but this could be very useful for the future. Thanks!

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHEtVl7M8hyUobTrERCAaIAJ4oZMcSFyPSmF2fra+pRAVpvoGuywCfVMCm
PZ7IECjTZFUK2GxeYEks1tM=
=qPJg
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]