unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to add Guile support to a package
@ 2015-01-04 13:47 Antonio Ceballos
  2015-01-04 15:03 ` Matt Wette
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Antonio Ceballos @ 2015-01-04 13:47 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

Hi Guile folks,

I am thinking about adding guile support to GNU Chess. As it would be used
as a kind of debug mode, I don't want it to have it by default, so as to
avoid usually unnecessary extra dependencies. I have gone through some
tutorials, and have prototyped a guile-enabled version, but it is far from
working fine yet. Could you please give me some advice? I am not sure if
this is the right list to post this question.

To be more specific, I would like to get something like this:

1. Optional guile support via a configure option, being the default no
guile support.
2. Conditional compilation of guile-enabled source code, via C
precompilation directive.

More details will be necessary for sure, but I would like to have a contact
with some of you guys first.

Thanks in advance!

Regards,
Antonio Ceballos

[-- Attachment #2: Type: text/html, Size: 1027 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: How to add Guile support to a package
@ 2015-01-05  9:19 Antonio Ceballos
  2015-01-05 10:05 ` Hans Aberg
  0 siblings, 1 reply; 14+ messages in thread
From: Antonio Ceballos @ 2015-01-05  9:19 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

Hi Matt,

Thanks for your reply.

Yes, at the current stage maybe my question is rather concerning GNU auto
tools. I have also read the sections you pointed out in the Guile manual.

GNU Chess has not been using the garbage collector so far.

I have added these lines in configure.ac:

dnl AC_ARG_ENABLE(guile,
dnl AC_HELP_STRING([--enable-guile],[Enable Guile support [[default=no]]]),
dnl [case $enableval in
dnl yes|no) ;;
dnl ") AC_MSG_ERROR([bad value $enableval for --enable-guile, need yes or
no])  ;;
dnl esac],
dnl [enable_guile=false])
AC_ARG_ENABLE(guile,
  [  --enable-guile    Enable Guile support [default=false]],
  [case "${enableval}" in
     yes | y) guile=true ;;
     no | n)  guile=false ;;
     *) AC_MSG_ERROR(bad value ${enableval} for --enable-guile) ;;
   esac],[guile=false])

AM_CONDITIONAL([HAVE_GUILE], [test x$guile = xtrue])

I have added these lines in src/Makefile.am:

if HAVE_GUILE
gnuchess_SOURCES += guile.cc
AM_CPPFLAGS += `guile-config compile` -DHAVE_GUILE
AM_LDFLAGS += `guile-config link`
endif

This way I can configure the package with guile support:

./configure --enable-guile

Whereas guile will not be used/required by default:

./configure

And I can use C recompilation directives like this:

#ifdef HAVE_GUILE
do_some_guile_work();
#endif

With do_some_guile_work() defined in guile.cc.

So far so good, apparently. Is this the way to go?

Regards,
Antonio

[-- Attachment #2: Type: text/html, Size: 4056 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-01-06 20:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04 13:47 How to add Guile support to a package Antonio Ceballos
2015-01-04 15:03 ` Matt Wette
2015-01-05  9:59 ` John Darrington
2015-01-05 17:08 ` Ludovic Courtès
2015-01-05 17:34   ` Antonio Ceballos
2015-01-05 19:45     ` Ludovic Courtès
2015-01-06 10:26       ` Antonio Ceballos
2015-01-06 20:16     ` Hans Aberg
  -- strict thread matches above, loose matches on Subject: below --
2015-01-05  9:19 Antonio Ceballos
2015-01-05 10:05 ` Hans Aberg
2015-01-05 13:18   ` Chris Vine
2015-01-05 14:44     ` Hans Aberg
2015-01-05 16:27       ` Chris Vine
2015-01-05 17:06         ` Hans Aberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).