guile-devel
[Top][All Lists]
Advanced

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

Autoconf macros provided by Guile


From: Miguel Ángel Arruga Vivas
Subject: Autoconf macros provided by Guile
Date: Sat, 08 Jul 2023 20:26:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hello, Guilers,

These days I'm working on a C library with Guile bindings[1], but common
idioms for optional features and external dependencies[2] are not
possible with the provided macros.

Let's say a project wants to automatically build certain feature if
library libfoo is available.  Autoconf manual suggests something along
the following lines:
---
AC_ARG_ENABLE([libfoo],
  [AS_HELP_STRING([--enable-libfoo], [...])],
  [],
  [: m4_divert_text([DEFAULTS], [enable_libfoo=check])])
AS_IF([test "x$enable_libfoo" != xno],
 [AC_CHECK_LIB([foo], [foo_init],
   [AC_SUBST([LIBFOO_LIBS], ["-lfoo"])],
   [AS_IF([test "x$enable_libfoo" != xcheck],
     [AC_MSG_FAILURE([requested libfoo but not found])])
   ])
 ])
---

Nonetheless, this fails when using Guile macros and guile itself cannot
be found:
---
AC_ARG_ENABLE([guile],
  [AS_HELP_STRING([--enable-guile], [...])],
  [],
  [: m4_divert_text([DEFAULTS], [enable_guile=check])])
AS_IF([test "x$enable_guile" != xno],
 [GUILE_PKG([3.0])
  dnl check is not useful, configure exits with error
  ...
 ])
---

Is the current behavior a desired feature?

The attached patch is compatible with old code, as the default values
are the ones used before. The failure when pkg-config cannot be found
has not been removed, as it can be checked beforehand if needed.

What do you think?  Let me know any issues, ideas or anything I could
have missed.

Best regards,
Miguel

Attachment: 0001-Add-parameters-to-GUILE_PKG.patch
Description: GUILE_PKG extension


[1] Mandatory self insert: https://www.nongnu.org/mbenchmark
[2] 
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/External-Software.html

reply via email to

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