gnu: julia-pdmats: Update to 0.11.1.
[jackhill/guix/guix.git] / m4 / guix.m4
index d0c5ec0..05d409a 100644 (file)
@@ -1,7 +1,8 @@
 dnl GNU Guix --- Functional package management for GNU
-dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+dnl Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 dnl Copyright © 2014 Mark H Weaver <mhw@netris.org>
 dnl Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+dnl Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
 dnl
 dnl This file is part of GNU Guix.
 dnl
@@ -26,7 +27,7 @@ AC_DEFUN([GUIX_SYSTEM_TYPE], [
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_PATH_PROG([SED], [sed])
 
-  AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
+  AC_ARG_WITH(system, AS_HELP_STRING([--with-system=SYSTEM],
     [Platform identifier (e.g., `i686-linux').]),
     [guix_system="$withval"],
     [case "$host_cpu" in
@@ -78,7 +79,7 @@ dnl Assert that this is a system to which the distro is ported.
 AC_DEFUN([GUIX_ASSERT_SUPPORTED_SYSTEM], [
   AC_REQUIRE([GUIX_SYSTEM_TYPE])
 
-  AC_ARG_WITH([courage], [AC_HELP_STRING([--with-courage],
+  AC_ARG_WITH([courage], [AS_HELP_STRING([--with-courage],
     [Assert that even if this platform is unsupported, you will be
 courageous and port the GNU System distribution to it (see
 "GNU Distribution" in the manual.)])],
@@ -88,7 +89,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|aarch64-linux|mips64el-linux)
+    x86_64-linux|i686-linux|armhf-linux|aarch64-linux|powerpc64le-linux)
       ;;
     *)
       if test "x$guix_courageous" = "xyes"; then
@@ -118,37 +119,20 @@ AC_DEFUN([GUIX_ASSERT_GUILE_FEATURES], [
   done
 ])
 
-dnl GUIX_ASSERT_SYNTAX_OBJECT_EQUAL
-dnl
-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_syntax_object_equal=yes
-     else
-       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_GUILE_SSH
 dnl
 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.
+  dnl Check whether '#:nodelay' paramater to 'make-session' (introduced in
+  dnl 0.13.0) 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))])
+            (@ (ssh dist node) node-eval)
+            (@ (ssh auth) userauth-gssapi!)
+            ((@ (ssh session) make-session) #:nodelay #t))])
      if test "$retval" = 0; then
        guix_cv_have_recent_guile_ssh="yes"
      else
@@ -174,6 +158,93 @@ AC_DEFUN([GUIX_CHECK_GUILE_SQLITE3], [
      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 4.3+, which provides
+  dnl 'define-json-mapping'.
+  AC_CACHE_CHECK([whether Guile-JSON is available and recent enough],
+    [guix_cv_have_recent_guile_json],
+    [GUILE_CHECK([retval],
+      [(use-modules (json))
+
+       (define-json-mapping <frob> make-frob
+         frob?
+        json->frob
+        (a frob-a)
+        (b frob-b \"bee\"))
+
+       (exit
+        (equal? (json->frob
+                 (open-input-string \"{ \\\"a\\\": 1, \\\"bee\\\": 2 }\"))
+                (make-frob 1 2)))])
+     if test "$retval" = 0; then
+       guix_cv_have_recent_guile_json="yes"
+     else
+       guix_cv_have_recent_guile_json="no"
+     fi])
+])
+
+dnl GUIX_CHECK_GUILE_GCRYPT
+dnl
+dnl Check whether a recent-enough Guile-Gcrypt is available.
+AC_DEFUN([GUIX_CHECK_GUILE_GCRYPT], [
+  dnl Check whether we're using Guile-Gcrypt 0.2.x or later.  0.2.0
+  dnl introduced the 'hash-algorithm' macro and related code.
+  AC_CACHE_CHECK([whether Guile-Gcrypt is available and recent enough],
+    [guix_cv_have_recent_guile_gcrypt],
+    [GUILE_CHECK([retval],
+      [(use-modules (gcrypt hash))
+       (equal? (hash-algorithm sha256)
+               (lookup-hash-algorithm 'sha256))])
+     if test "$retval" = 0; then
+       guix_cv_have_recent_guile_gcrypt="yes"
+     else
+       guix_cv_have_recent_guile_gcrypt="no"
+     fi])
+])
+
+dnl GUIX_CHECK_GUILE_GIT
+dnl
+dnl Check whether a recent-enough Guile-Git is available.
+AC_DEFUN([GUIX_CHECK_GUILE_GIT], [
+  dnl Check whether we're using Guile-Git 0.3.0 or later.  0.3.0
+  dnl introduced SSH authentication support and more.
+  AC_CACHE_CHECK([whether Guile-Git is available and recent enough],
+    [guix_cv_have_recent_guile_git],
+    [GUILE_CHECK([retval],
+      [(use-modules (git) (git auth) (git submodule))
+       (let ((auth (%make-auth-ssh-agent)))
+         repository-close!
+        object-lookup-prefix
+         (make-clone-options
+          #:fetch-options (make-fetch-options auth)))])
+     if test "$retval" = 0; then
+       guix_cv_have_recent_guile_git="yes"
+     else
+       guix_cv_have_recent_guile_git="no"
+     fi])
+])
+
+dnl GUIX_CHECK_GUILE_ZLIB
+dnl
+dnl Check whether a recent-enough Guile-zlib is available.
+AC_DEFUN([GUIX_CHECK_GUILE_ZLIB], [
+  dnl Check whether we're using Guile-zlib 0.1.0 or later.
+  dnl 0.1.0 introduced the 'make-zlib-input-port' and related code.
+  AC_CACHE_CHECK([whether Guile-zlib is available and recent enough],
+    [guix_cv_have_recent_guile_zlib],
+    [GUILE_CHECK([retval],
+      [(use-modules (zlib))
+       make-zlib-input-port])
+     if test "$retval" = 0; then
+       guix_cv_have_recent_guile_zlib="yes"
+     else
+       guix_cv_have_recent_guile_zlib="no"
+     fi])
+])
+
 dnl GUIX_TEST_ROOT_DIRECTORY
 AC_DEFUN([GUIX_TEST_ROOT_DIRECTORY], [
   AC_CACHE_CHECK([for unit test root directory],
@@ -301,32 +372,6 @@ AC_DEFUN([GUIX_LIBGCRYPT_LIBDIR], [
   $1="$guix_cv_libgcrypt_libdir"
 ])
 
-dnl GUIX_LIBZ_LIBDIR VAR
-dnl
-dnl Attempt to determine libz's LIBDIR; store the result in VAR.
-AC_DEFUN([GUIX_LIBZ_LIBDIR], [
-  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-  AC_CACHE_CHECK([zlib's library directory],
-    [guix_cv_libz_libdir],
-    [guix_cv_libz_libdir="`$PKG_CONFIG zlib --variable=libdir 2> /dev/null`"])
-  $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
@@ -372,3 +417,31 @@ that of the existing installation '$guix_cv_current_localstatedir'])
       esac
     fi
   fi])
+
+dnl GUIX_CHANNEL_METADATA
+dnl
+dnl Provide the channel metadata for this build.  This allows 'guix describe'
+dnl to return meaningful data, as it would for a 'guix pull'-provided 'guix'.
+dnl The default URL and introduction are taken from (guix channels).
+AC_DEFUN([GUIX_CHANNEL_METADATA], [
+  AC_ARG_WITH([channel-url], [AS_HELP_STRING([--with-channel-url=URL],
+    [assert that this is built from the Git repository at URL])],
+    [guix_channel_url="\"$withval\""],
+    [guix_channel_url="\"https://git.savannah.gnu.org/git/guix.git\""])
+  AC_ARG_WITH([channel-commit], [AS_HELP_STRING([--with-channel-commit=COMMIT],
+    [assert that this is built from COMMIT])],
+    [guix_channel_commit="\"$withval\""],
+    [guix_channel_commit="#f"])
+  AC_ARG_WITH([channel-introduction], [AS_HELP_STRING([--with-channel-introduction=COMMIT:FINGERPRINT],
+    [specify COMMIT and FINGERPRINT as the introduction of this channel])],
+    [guix_channel_introduction="'(\"`echo $withval | cut -f1 -d:`\" \"`echo $withval | cut -f2 -d:`\")"],
+    [guix_channel_introduction="'(\"9edb3f66fd807b096b48283debdcddccfea34bad\" . \"BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA\")"])
+
+  GUIX_CHANNEL_URL="$guix_channel_url"
+  GUIX_CHANNEL_COMMIT="$guix_channel_commit"
+  GUIX_CHANNEL_INTRODUCTION="$guix_channel_introduction"
+
+  AC_SUBST([GUIX_CHANNEL_URL])
+  AC_SUBST([GUIX_CHANNEL_COMMIT])
+  AC_SUBST([GUIX_CHANNEL_INTRODUCTION])
+])