summaryrefslogtreecommitdiff
path: root/config-daemon.ac
diff options
context:
space:
mode:
authorDoğan Çeçen <sepeth@fastmail.com>2024-12-04 12:10:11 +0200
committerLudovic Courtès <ludo@gnu.org>2024-12-09 23:15:45 +0100
commitdcaccc8b722cee279c00bb321baa48ae73563931 (patch)
treec66294a7bcac452b69fe22c8695fa606be1fbb0b /config-daemon.ac
parentb0421cc964ce11c1e43da5ad2a8e31205539737c (diff)
daemon: Fix linking gcrypt when --as-needed linker arg is used
This is a followup to 8a7bd211d21f06c1234fbb82bb905d202d58f598. As it is mentioned in autoconf manual that library names should be specified in LIBS, not LDFLAGS. See: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Preset-Output-Variables.html#index-LDFLAGS-2 This change also brings back the save_* vars trick that was there before. I missed in my earlier change that nix/local.mk was referring LIBGCRYPT_* vars directly. And, instead of CXXFLAGS, CPPFLAGS is used since the latter is probably more correct as this is used for include dirs, therefore using preprocessor flags. Tested with ./configure LDFLAGS="-Wl,--as-needed" --with-libgcrypt-prefix=... combinations. * config-daemon.ac: Set ‘LIBGCRYPT_CPPFLAGS’ instead of ‘LIBGCRYPT_CXXFLAGS’. Set ‘LIBGCRYPT_LIBS’ in addition to ‘LIBGCRYPT_LDFLAGS’. Save and restore ‘CPPFLAGS’, ‘LDFLAGS’, and ‘LIBS’ around test. * nix/local.mk (libutil_a_CPPFLAGS): Add $(LIBGCRYPT_CPPFLAGS). (libstore_a_CXXFLAGS): Remove $(LIBGCRYPT_CFLAGS). (guix_daemon_LDFLAGS): New variable. Change-Id: Iadb10e1994c9a78e2927847af2cfe5e096fbb2a8 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'config-daemon.ac')
-rw-r--r--config-daemon.ac20
1 files changed, 14 insertions, 6 deletions
diff --git a/config-daemon.ac b/config-daemon.ac
index 1ac204ceed1..6731c68bc39 100644
--- a/config-daemon.ac
+++ b/config-daemon.ac
@@ -39,27 +39,32 @@ if test "x$guix_build_daemon" = "xyes"; then
39 39
40 case "$LIBGCRYPT_PREFIX" in 40 case "$LIBGCRYPT_PREFIX" in
41 no) 41 no)
42 LIBGCRYPT_CXXFLAGS="" 42 LIBGCRYPT_CPPFLAGS=""
43 ;; 43 ;;
44 *) 44 *)
45 LIBGCRYPT_CXXFLAGS="-I$LIBGCRYPT_PREFIX/include" 45 LIBGCRYPT_CPPFLAGS="-I$LIBGCRYPT_PREFIX/include"
46 ;; 46 ;;
47 esac 47 esac
48 48
49 case "$LIBGCRYPT_LIBDIR" in 49 case "$LIBGCRYPT_LIBDIR" in
50 no | "") 50 no | "")
51 LIBGCRYPT_LDFLAGS="-lgcrypt"
52 ;; 51 ;;
53 *) 52 *)
54 LIBGCRYPT_LDFLAGS="-L$LIBGCRYPT_LIBDIR -lgcrypt" 53 LIBGCRYPT_LDFLAGS="-L$LIBGCRYPT_LIBDIR"
55 ;; 54 ;;
56 esac 55 esac
57 56
58 AC_SUBST([LIBGCRYPT_CXXFLAGS]) 57 LIBGCRYPT_LIBS="-lgcrypt"
58 AC_SUBST([LIBGCRYPT_CPPFLAGS])
59 AC_SUBST([LIBGCRYPT_LDFLAGS]) 59 AC_SUBST([LIBGCRYPT_LDFLAGS])
60 AC_SUBST([LIBGCRYPT_LIBS])
60 61
61 CXXFLAGS="$CXXFLAGS $LIBGCRYPT_CXXFLAGS" 62 save_CPPFLAGS="$CPPFLAGS"
63 save_LDFLAGS="$LDFLAGS"
64 save_LIBS="$LIBS"
65 CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CPPFLAGS"
62 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS" 66 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
67 LIBS="$LIBS $LIBGCRYPT_LIBS"
63 68
64 have_gcrypt=yes 69 have_gcrypt=yes
65 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no]) 70 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
@@ -67,6 +72,9 @@ if test "x$guix_build_daemon" = "xyes"; then
67 if test "x$have_gcrypt" != "xyes"; then 72 if test "x$have_gcrypt" != "xyes"; then
68 AC_MSG_ERROR([GNU libgcrypt not found; please install it.]) 73 AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
69 fi 74 fi
75 CPPFLAGS="$save_CPPFLAGS"
76 LDFLAGS="$save_LDFLAGS"
77 LIBS="$save_LIBS"
70 78
71 dnl Chroot support. 79 dnl Chroot support.
72 AC_CHECK_FUNCS([chroot unshare]) 80 AC_CHECK_FUNCS([chroot unshare])