[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] schemish/chickenish way to make configurable executa
Re: [Chicken-users] schemish/chickenish way to make configurable executables?
Sun, 3 Nov 2013 10:58:01 +0100
On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote:
> I'm curious to hear opinions on conditional complication and configuration
> using Chicken scheme.
> Say for example I want to enable or disable the use of a particular library
> or feature and I want there to be no trace of it in the executable.
> I can use a preprocessor such as cpp but I imagine there is a better way.
> Any strategies or methodologies you all can share? Are macros good for this?
Usually when I want to do something like this, I use cond-expand and
provide the feature via -feature provide-foo:
(else (error "support for foo is disabled"))))
This is used extensively by the "crypt" egg to select which
fallback implementations need to be provided and for which
implementations it can use the one provided by libc.
This is of course only available when compiling from Scheme.
If you want to ship precompiled C files (so you'll only need
a C compiler and libchicken), you'd have to use C preprocessor
and/or conditional compilation of various different implementation
files through Make like CHICKEN itself does (for posixunix/posixwin,
and for things like HAVE_POSIX_POLL). This is a lot trickier to
do right, and I wouldn't recommend it unless you really have to.