summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-06 22:09:40 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-06 23:51:04 +0200
commitdd01fecd23a4ded46b99a51dc08ac5d964dbcd53 (patch)
tree7935564290df6b3a828d1e8a7f4eecb7c58392f8 /configure.ac
parent04d1ab3bf5394ae229161669e9717d76d483e7aa (diff)
downloadguix-dd01fecd23a4ded46b99a51dc08ac5d964dbcd53.tar.gz
build: Automatically determine libgcrypt's file name.
* m4/guix.m4 (GUIX_LIBGCRYPT_LIBDIR): New macro.
* configure.ac: Use it when no --with-libgcrypt-* option was passed.
* README: Do not recommend --with-libgcrypt-prefix.

Co-authored-by: 宋文武 <iyzsong@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 17 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index 1cfe876232..38e9ec56b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,23 +132,21 @@ else
    AC_MSG_RESULT([not found])
 fi
 
+LIBGCRYPT="libgcrypt"
+LIBGCRYPT_LIBDIR="no"
+LIBGCRYPT_PREFIX="no"
+
 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_PREFIX="no"
-      LIBGCRYPT_LIBDIR="no"
       ;;
     *)
       LIBGCRYPT="$withval/lib/libgcrypt"
       LIBGCRYPT_PREFIX="$withval"
       LIBGCRYPT_LIBDIR="$withval/lib"
       ;;
-   esac],
-  [LIBGCRYPT="libgcrypt"
-   LIBGCRYPT_PREFIX="no"
-   LIBGCRYPT_LIBDIR="no"])
+   esac])
 
 AC_ARG_WITH([libgcrypt-libdir],
   [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
@@ -162,13 +160,18 @@ AC_ARG_WITH([libgcrypt-libdir],
       LIBGCRYPT="$withval/libgcrypt"
       LIBGCRYPT_LIBDIR="$withval"
       ;;
-   esac],
-  [if test "x$LIBGCRYPT" = x; then
-      LIBGCRYPT="libgcrypt"
-   fi
-   if test "x$LIBGCRYPT_LIBDIR" = x; then
-      LIBGCRYPT_LIBDIR="no"
-   fi])
+   esac])
+
+dnl If none of the --with-libgcrypt-* options was used, try to determine the
+dnl absolute file name of libgcrypt.so.
+case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
+  xnono)
+    GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
+    if test "x$LIBGCRYPT_LIBDIR" != x; then
+      LIBGCRYPT="$LIBGCRYPT_LIBDIR/libgcrypt"
+    fi
+    ;;
+esac
 
 dnl Library name suitable for `dynamic-link'.
 AC_MSG_CHECKING([for libgcrypt shared library name])