X-Git-Url: http://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/68ce1875d53a61a6edd7d6af44f60fe0293103e3..2f0508f0e763b4162b568dad3a1b70951e2ab287:/m4/guix.m4 diff --git a/m4/guix.m4 b/m4/guix.m4 index 6d8ec2e4e0..8be7cca54f 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -1,6 +1,7 @@ dnl GNU Guix --- Functional package management for GNU -dnl Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès +dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès dnl Copyright © 2014 Mark H Weaver +dnl Copyright © 2017 Efraim Flashner dnl dnl This file is part of GNU Guix. dnl @@ -17,24 +18,6 @@ dnl dnl You should have received a copy of the GNU General Public License dnl along with GNU Guix. If not, see . -dnl GUIX_ASSERT_LIBGCRYPT_USABLE -dnl -dnl Assert that GNU libgcrypt is usable from Guile. -AC_DEFUN([GUIX_ASSERT_LIBGCRYPT_USABLE], - [AC_CACHE_CHECK([whether $LIBGCRYPT can be dynamically loaded], - [guix_cv_libgcrypt_usable_p], - [GUILE_CHECK([retval], - [(dynamic-func \"gcry_md_hash_buffer\" (dynamic-link \"$LIBGCRYPT\"))]) - if test "$retval" = 0; then - guix_cv_libgcrypt_usable_p="yes" - else - guix_cv_libgcrypt_usable_p="no" - fi]) - - if test "x$guix_cv_libgcrypt_usable_p" != "xyes"; then - AC_MSG_ERROR([GNU libgcrypt does not appear to be usable; see `--with-libgcrypt-prefix' and `README'.]) - fi]) - dnl GUIX_SYSTEM_TYPE dnl dnl Determine the Guix host system type, and store it in the @@ -105,7 +88,7 @@ courageous and port the GNU System distribution to it (see # Currently only Linux-based systems are supported, and only on some # platforms. case "$guix_system" in - x86_64-linux|i686-linux|armhf-linux|mips64el-linux) + x86_64-linux|i686-linux|armhf-linux|aarch64-linux|mips64el-linux) ;; *) if test "x$guix_courageous" = "xyes"; then @@ -135,42 +118,82 @@ AC_DEFUN([GUIX_ASSERT_GUILE_FEATURES], [ done ]) -dnl GUIX_CHECK_SRFI_37 +dnl GUIX_ASSERT_SYNTAX_OBJECT_EQUAL dnl -dnl Check whether SRFI-37 suffers from . -dnl This bug was fixed in Guile 2.0.9. -AC_DEFUN([GUIX_CHECK_SRFI_37], [ - AC_CACHE_CHECK([whether (srfi srfi-37) is affected by http://bugs.gnu.org/13176], - [ac_cv_guix_srfi_37_broken], - [if "$GUILE" -c "(use-modules (srfi srfi-37)) \ - (sigaction SIGALRM (lambda _ (primitive-exit 1))) \ - (alarm 1) \ - (define opts (list (option '(#\I) #f #t (lambda _ #t)))) \ - (args-fold '(\"-I\") opts (lambda _ (error)) (lambda _ #f) '())" +dnl Guile 2.2.1 was a brown-paper-bag release where 'equal?' wouldn't work +dnl for syntax objects, which broke gexps. Unfortunately Fedora 25 provides it. +dnl Reject it. +AC_DEFUN([GUIX_ASSERT_SYNTAX_OBJECT_EQUAL], [ + AC_CACHE_CHECK([whether 'equal?' works for syntax objects], + [ac_cv_guix_syntax_object_equal], + [if "$GUILE" -c '(exit (equal? (syntax x) (syntax x)))' then - ac_cv_guix_srfi_37_broken=no + ac_cv_guix_syntax_object_equal=yes else - ac_cv_guix_srfi_37_broken=yes + ac_cv_guix_syntax_object_equal=no fi]) + if test "x$ac_cv_guix_syntax_object_equal" != xyes; then + # This bug was present in Guile 2.2.1 only. + AC_MSG_ERROR(['equal?' does not work for syntax object; upgrade to Guile 2.2.2 or later.]) + fi ]) -dnl GUIX_CHECK_UNBUFFERED_CBIP +dnl GUIX_CHECK_GUILE_SSH dnl -dnl Check whether 'setbvuf' works on custom binary input ports (CBIPs), as is -dnl the case starting with Guile 2.0.10. -AC_DEFUN([GUIX_CHECK_UNBUFFERED_CBIP], [ - AC_CACHE_CHECK([whether Guile's custom binary input ports support 'setvbuf'], - [ac_cv_guix_cbips_support_setvbuf], - [if "$GUILE" -c "(use-modules (rnrs io ports)) \ - (let ((p (make-custom-binary-input-port \"cbip\" pk #f #f #f))) \ - (setvbuf p _IONBF))" >&5 2>&1 - then - ac_cv_guix_cbips_support_setvbuf=yes +dnl Check whether a recent-enough Guile-SSH is available. +AC_DEFUN([GUIX_CHECK_GUILE_SSH], [ + dnl Check whether 'channel-send-eof' (introduced in 0.10.2) is present. + AC_CACHE_CHECK([whether Guile-SSH is available and recent enough], + [guix_cv_have_recent_guile_ssh], + [GUILE_CHECK([retval], + [(and (@ (ssh channel) channel-send-eof) + (@ (ssh popen) open-remote-pipe) + (@ (ssh dist node) node-eval))]) + if test "$retval" = 0; then + guix_cv_have_recent_guile_ssh="yes" + else + guix_cv_have_recent_guile_ssh="no" + fi]) +]) + +dnl GUIX_CHECK_GUILE_SQLITE3 +dnl +dnl Check whether a recent-enough Guile-Sqlite3 is available. +AC_DEFUN([GUIX_CHECK_GUILE_SQLITE3], [ + dnl Check whether 'sqlite-bind-arguments' is available. It was introduced + dnl in February 2018: + dnl . + AC_CACHE_CHECK([whether Guile-Sqlite3 is available and recent enough], + [guix_cv_have_recent_guile_sqlite3], + [GUILE_CHECK([retval], + [(@ (sqlite3) sqlite-bind-arguments)]) + if test "$retval" = 0; then + guix_cv_have_recent_guile_sqlite3="yes" else - ac_cv_guix_cbips_support_setvbuf=no + guix_cv_have_recent_guile_sqlite3="no" fi]) ]) +dnl GUIX_CHECK_GUILE_JSON +dnl +dnl Check whether a recent-enough Guile-JSON is available. +AC_DEFUN([GUIX_CHECK_GUILE_JSON], [ + dnl Check whether we're using Guile-JSON 3.x, which uses a JSON-to-Scheme + dnl mapping different from that of earlier versions. + AC_CACHE_CHECK([whether Guile-JSON is available and recent enough], + [guix_cv_have_recent_guile_json], + [GUILE_CHECK([retval], + [(use-modules (json) (ice-9 match)) + (match (json-string->scm \"[[ { \\\"a\\\": 42 } ]]\") + (#((("a" . 42))) #t))]) + if test "$retval" = 0; then + guix_cv_have_recent_guile_json="yes" + else + guix_cv_have_recent_guile_json="no" + fi]) +]) + + dnl GUIX_TEST_ROOT_DIRECTORY AC_DEFUN([GUIX_TEST_ROOT_DIRECTORY], [ AC_CACHE_CHECK([for unit test root directory], @@ -309,6 +332,21 @@ AC_DEFUN([GUIX_LIBZ_LIBDIR], [ $1="$guix_cv_libz_libdir" ]) +dnl GUIX_LIBLZ_FILE_NAME VAR +dnl +dnl Attempt to determine liblz's absolute file name; store the result in VAR. +AC_DEFUN([GUIX_LIBLZ_FILE_NAME], [ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + AC_CACHE_CHECK([lzlib's file name], + [guix_cv_liblz_libdir], + [old_LIBS="$LIBS" + LIBS="-llz" + AC_LINK_IFELSE([AC_LANG_SOURCE([int main () { return LZ_decompress_open(); }])], + [guix_cv_liblz_libdir="`ldd conftest$EXEEXT | grep liblz | sed '-es/.*=> \(.*\) .*$/\1/g'`"]) + LIBS="$old_LIBS"]) + $1="$guix_cv_liblz_libdir" +]) + dnl GUIX_CURRENT_LOCALSTATEDIR dnl dnl Determine the localstatedir of an existing Guix installation and set