From 3a310cc017c4bffbee8a6f37569145a593ac2912 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 17 Aug 2012 10:41:27 +0200 Subject: build: Add `--with-libgcrypt-prefix'; capture the path to libgcrypt. * configure.ac: Add `--with-libgcrypt-prefix'. Substitute `LIBGCRYPT'. * Makefile.am (.scm.go): Pass $(LIBGCRYPT). * guix/utils.scm (%libgcrypt): New variable. (sha256): Use it. --- Makefile.am | 1 + configure.ac | 17 +++++++++++++++++ guix/utils.scm | 8 ++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 18ebd658e0..b6203eff70 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,6 +75,7 @@ CLEANFILES = $(GOBJECTS) *.log $(MKDIR_P) `dirname "$@"` NIX_INSTANTIATE="$(NIX_INSTANTIATE)" \ NIXPKGS="$(NIXPKGS)" \ + LIBGCRYPT="$(LIBGCRYPT)" \ GUILE_AUTO_COMPILE=0 \ GUILE_LOAD_COMPILED_PATH="$(top_builddir):$$GUILE_LOAD_COMPILED_PATH" \ $(GUILD) compile -L "$(top_srcdir)" \ diff --git a/configure.ac b/configure.ac index aed8287bfd..821e746fe8 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,23 @@ else AC_MSG_WARN([Please use `--with-nixpkgs'.]) fi +AC_ARG_WITH([libgcrypt-prefix], + [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])], + [case "$withval" in + yes|no) + LIBGCRYPT="libgcrypt" + ;; + *) + LIBGCRYPT="$withval/lib/libgcrypt" + ;; + esac], + [LIBGCRYPT="libgcrypt"]) + +dnl Library name suitable for `dynamic-link'. +AC_MSG_CHECKING([for libgcrypt shared library name]) +AC_MSG_RESULT([$LIBGCRYPT]) +AC_SUBST([LIBGCRYPT]) + AC_CONFIG_FILES([Makefile po/Makefile.in guix-build]) diff --git a/guix/utils.scm b/guix/utils.scm index cbd51fae73..686175947e 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -384,14 +384,18 @@ starting from the right of S." ;;; Hash. ;;; +(define %libgcrypt + ;; Name of the libgcrypt shared library. + (compile-time-value (or (getenv "LIBGCRYPT") "libgcrypt"))) + (define sha256 (cond ((compile-time-value - (false-if-exception (dynamic-link "libgcrypt"))) + (false-if-exception (dynamic-link %libgcrypt))) ;; Using libgcrypt. (let ((hash (pointer->procedure void (dynamic-func "gcry_md_hash_buffer" - (dynamic-link "libgcrypt")) + (dynamic-link %libgcrypt)) `(,int * * ,size_t))) (sha256 8)) ; GCRY_MD_SHA256, as of 1.5.0 (lambda (bv) -- cgit v1.2.3