From 603f19f641b60db4f33cbff888364eb10b41e06d Mon Sep 17 00:00:00 2001 From: mjentsch Date: Thu, 31 Dec 2015 09:32:23 +0100 Subject: [PATCH] Fix compilation Do the libgcrypt check to assure that all necessary flags are included, and clean up configure.ac a bit. --- configure | 62 +++++++++++++++++++++++++++++++++++++++++++++++----- configure.ac | 15 ++++++++----- 2 files changed, 66 insertions(+), 11 deletions(-) diff --git a/configure b/configure index b85b32d..eb75726 100755 --- a/configure +++ b/configure @@ -3321,17 +3321,66 @@ _ACEOF fi -CRYPTO_FLAG=--disable-openssl - # Check whether --enable-gcrypt was given. if test "${enable_gcrypt+set}" = set; then : enableval=$enable_gcrypt; fi -if test "x$enable_gcrypt" == "xno"; then : - # Let tgl/configure.ac handle OpenSSL- or gcrypt-detection. - CRYPTO_FLAG= +if test "x$enable_gcrypt" != "xno"; then : + + # Even though tgl/configure will do this too, still call our own libgcrypt check to assure that -lgcrypt is added to our makefile + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_mpi_snatch in -lgcrypt" >&5 +$as_echo_n "checking for gcry_mpi_snatch in -lgcrypt... " >&6; } +if ${ac_cv_lib_gcrypt_gcry_mpi_snatch+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcrypt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gcry_mpi_snatch (); +int +main () +{ +return gcry_mpi_snatch (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gcrypt_gcry_mpi_snatch=yes +else + ac_cv_lib_gcrypt_gcry_mpi_snatch=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_mpi_snatch" >&5 +$as_echo "$ac_cv_lib_gcrypt_gcry_mpi_snatch" >&6; } +if test "x$ac_cv_lib_gcrypt_gcry_mpi_snatch" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGCRYPT 1 +_ACEOF + + LIBS="-lgcrypt $LIBS" + +else + + echo "no libgcrypt >= 1.60 found" + exit -1 + +fi + + CRYPTO_FLAG=--disable-openssl fi @@ -4086,7 +4135,8 @@ if test "${enable_libwebp+set}" = set; then : enableval=$enable_libwebp; fi - if test "x$enable_libwebp" != "xno"; then : + +if test "x$enable_libwebp" != "xno"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } diff --git a/configure.ac b/configure.ac index 60a72f8..88c6e7e 100644 --- a/configure.ac +++ b/configure.ac @@ -33,12 +33,16 @@ AC_PROG_INSTALL AC_CHECK_LIB([rt], [clock_gettime]) -AC_SUBST([CRYPTO_FLAG], [--disable-openssl]) AC_ARG_ENABLE([gcrypt], AS_HELP_STRING([--disable-gcrypt], [Disable gcrypt, use OpenSSL instead. DO NOT DISTRIBUTE BINARIES!])) -AS_IF([test "x$enable_gcrypt" == "xno"], [ - # Let tgl/configure.ac handle OpenSSL- or gcrypt-detection. - AC_SUBST([CRYPTO_FLAG], [ ]) + +AS_IF([test "x$enable_gcrypt" != "xno"], [ + # Even though tgl/configure will do this too, still call our own libgcrypt check to assure that -lgcrypt is added to our makefile + AC_CHECK_LIB([gcrypt], [gcry_mpi_snatch], [], [ + echo "no libgcrypt >= 1.60 found" + exit -1 + ]) + AC_SUBST([CRYPTO_FLAG], [--disable-openssl]) ]) AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])]) @@ -48,7 +52,8 @@ PKG_CHECK_MODULES([PURPLE], [purple]) AC_MSG_CHECKING([for libwebp]) AC_ARG_ENABLE([libwebp], AS_HELP_STRING([--disable-libwebp], [Disable libwebp, stickers won't be displayed in the chat])) - AS_IF([test "x$enable_libwebp" != "xno"], [ + +AS_IF([test "x$enable_libwebp" != "xno"], [ AC_MSG_RESULT([enabled]) AC_CHECK_LIB([webp], [WebPDecodeRGBA], [], [AC_MSG_ERROR([no libwebp found, try --disable-libwebp, but stickers won't be displayed in the chat])]) ])