|Subject:||Re: [Chicken-users] schemish/chickenish way to make configurable executables?|
|Date:||Sun, 3 Nov 2013 08:56:47 -0700|
On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote:Hi Matt,
> 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.
|[Prev in Thread]||Current Thread||[Next in Thread]|