mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 13:36:36 +01:00
daemon: Fix linking gcrypt when --as-needed linker arg is used
This is a followup to 8a7bd211d2
.
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>
This commit is contained in:
parent
b0421cc964
commit
dcaccc8b72
2 changed files with 20 additions and 8 deletions
|
@ -39,27 +39,32 @@ if test "x$guix_build_daemon" = "xyes"; then
|
||||||
|
|
||||||
case "$LIBGCRYPT_PREFIX" in
|
case "$LIBGCRYPT_PREFIX" in
|
||||||
no)
|
no)
|
||||||
LIBGCRYPT_CXXFLAGS=""
|
LIBGCRYPT_CPPFLAGS=""
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LIBGCRYPT_CXXFLAGS="-I$LIBGCRYPT_PREFIX/include"
|
LIBGCRYPT_CPPFLAGS="-I$LIBGCRYPT_PREFIX/include"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$LIBGCRYPT_LIBDIR" in
|
case "$LIBGCRYPT_LIBDIR" in
|
||||||
no | "")
|
no | "")
|
||||||
LIBGCRYPT_LDFLAGS="-lgcrypt"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LIBGCRYPT_LDFLAGS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
|
LIBGCRYPT_LDFLAGS="-L$LIBGCRYPT_LIBDIR"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_SUBST([LIBGCRYPT_CXXFLAGS])
|
LIBGCRYPT_LIBS="-lgcrypt"
|
||||||
|
AC_SUBST([LIBGCRYPT_CPPFLAGS])
|
||||||
AC_SUBST([LIBGCRYPT_LDFLAGS])
|
AC_SUBST([LIBGCRYPT_LDFLAGS])
|
||||||
|
AC_SUBST([LIBGCRYPT_LIBS])
|
||||||
|
|
||||||
CXXFLAGS="$CXXFLAGS $LIBGCRYPT_CXXFLAGS"
|
save_CPPFLAGS="$CPPFLAGS"
|
||||||
|
save_LDFLAGS="$LDFLAGS"
|
||||||
|
save_LIBS="$LIBS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CPPFLAGS"
|
||||||
LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
|
LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
|
||||||
|
LIBS="$LIBS $LIBGCRYPT_LIBS"
|
||||||
|
|
||||||
have_gcrypt=yes
|
have_gcrypt=yes
|
||||||
AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
|
AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
|
||||||
|
@ -67,6 +72,9 @@ if test "x$guix_build_daemon" = "xyes"; then
|
||||||
if test "x$have_gcrypt" != "xyes"; then
|
if test "x$have_gcrypt" != "xyes"; then
|
||||||
AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
|
AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
|
||||||
fi
|
fi
|
||||||
|
CPPFLAGS="$save_CPPFLAGS"
|
||||||
|
LDFLAGS="$save_LDFLAGS"
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
|
||||||
dnl Chroot support.
|
dnl Chroot support.
|
||||||
AC_CHECK_FUNCS([chroot unshare])
|
AC_CHECK_FUNCS([chroot unshare])
|
||||||
|
|
|
@ -69,7 +69,8 @@ libutil_headers = \
|
||||||
libutil_a_CPPFLAGS = \
|
libutil_a_CPPFLAGS = \
|
||||||
-I$(top_builddir)/nix \
|
-I$(top_builddir)/nix \
|
||||||
-I$(top_srcdir)/%D%/libutil \
|
-I$(top_srcdir)/%D%/libutil \
|
||||||
$(libformat_a_CPPFLAGS)
|
$(libformat_a_CPPFLAGS) \
|
||||||
|
$(LIBGCRYPT_CPPFLAGS)
|
||||||
|
|
||||||
libstore_a_SOURCES = \
|
libstore_a_SOURCES = \
|
||||||
%D%/libstore/gc.cc \
|
%D%/libstore/gc.cc \
|
||||||
|
@ -109,7 +110,7 @@ libstore_a_CPPFLAGS = \
|
||||||
-DDEFAULT_CHROOT_DIRS="\"\""
|
-DDEFAULT_CHROOT_DIRS="\"\""
|
||||||
|
|
||||||
libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \
|
libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \
|
||||||
$(SQLITE3_CFLAGS) $(LIBGCRYPT_CFLAGS)
|
$(SQLITE3_CFLAGS)
|
||||||
|
|
||||||
bin_PROGRAMS = guix-daemon
|
bin_PROGRAMS = guix-daemon
|
||||||
|
|
||||||
|
@ -122,6 +123,9 @@ guix_daemon_CPPFLAGS = \
|
||||||
$(libutil_a_CPPFLAGS) \
|
$(libutil_a_CPPFLAGS) \
|
||||||
-I$(top_srcdir)/%D%/libstore
|
-I$(top_srcdir)/%D%/libstore
|
||||||
|
|
||||||
|
guix_daemon_LDFLAGS = \
|
||||||
|
$(LIBGCRYPT_LDFLAGS)
|
||||||
|
|
||||||
guix_daemon_LDADD = \
|
guix_daemon_LDADD = \
|
||||||
libstore.a libutil.a libformat.a -lz \
|
libstore.a libutil.a libformat.a -lz \
|
||||||
$(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
|
$(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
|
||||||
|
|
Loading…
Reference in a new issue