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>
This commit is contained in:
		
							parent
							
								
									04d1ab3bf5
								
							
						
					
					
						commit
						dd01fecd23
					
				
					 3 changed files with 32 additions and 15 deletions
				
			
		
							
								
								
									
										1
									
								
								README
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								README
									
										
									
									
									
								
							|  | @ -59,7 +59,6 @@ To do so: | |||
|       guix environment guix | ||||
| 
 | ||||
|   - Re-run the 'configure' script passing it the option | ||||
|     '--with-libgcrypt-prefix=$HOME/.guix-profile/', as well as | ||||
|     '--localstatedir=/somewhere', where '/somewhere' is the 'localstatedir' | ||||
|     value of the currently installed Guix (failing to do that would lead the | ||||
|     new Guix to consider the store to be empty!). | ||||
|  |  | |||
							
								
								
									
										31
									
								
								configure.ac
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								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]) | ||||
|  |  | |||
							
								
								
									
										15
									
								
								m4/guix.m4
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								m4/guix.m4
									
										
									
									
									
								
							|  | @ -270,3 +270,18 @@ AC_DEFUN([GUIX_CHECK_LIBC_MOUNT], [ | |||
|        guix_cv_libc_has_mount="no" | ||||
|      fi]) | ||||
| ]) | ||||
| 
 | ||||
| dnl GUIX_LIBGCRYPT_LIBDIR VAR | ||||
| dnl | ||||
| dnl Attempt to determine libgcrypt's LIBDIR; store the result in VAR. | ||||
| AC_DEFUN([GUIX_LIBGCRYPT_LIBDIR], [ | ||||
|   AC_PATH_PROG([LIBGCRYPT_CONFIG], [libgcrypt-config]) | ||||
|   AC_CACHE_CHECK([libgcrypt's library directory], | ||||
|     [guix_cv_libgcrypt_libdir], | ||||
|     [if test "x$LIBGCRYPT_CONFIG" != "x"; then | ||||
|        guix_cv_libgcrypt_libdir=`$LIBGCRYPT_CONFIG --libs | sed -e "s/.*-L\([[^ ]]\+\)[[[:blank:]]]\+-lgcrypt.*/\1/g"` | ||||
|      else | ||||
|        guix_cv_libgcrypt_libdir="" | ||||
|      fi]) | ||||
|   $1="$guix_cv_libgcrypt_libdir" | ||||
| ]) | ||||
|  |  | |||
		Reference in a new issue