From 75bb00368f4f8c0a3e5a7da8aa347f86f07fc53a Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Sun, 31 May 2020 20:02:48 +0300 Subject: [PATCH] configure.ac: add additional check for libstrophe After the library is found by pkg-config, try to build a simple program to check the installation. The motivation of this check is that the chance that users manually install libstrophe/libmesode is higher than for other libs. Fixes #1334. --- configure.ac | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3d14c6df..efdbcfce 100644 --- a/configure.ac +++ b/configure.ac @@ -130,11 +130,22 @@ AS_IF([test "x$PTHREAD_CC" != x], [ CC="$PTHREAD_CC" ]) ### Check for libmesode, fall back to libstrophe PKG_CHECK_MODULES([libmesode], [libmesode >= 0.9.2], - [LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])], + [LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" XMPP_LIB="libmesode" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])], [PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.9.2], - [LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])], + [LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" XMPP_LIB="libstrophe" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])], [AC_MSG_ERROR([Neither libmesode or libstrophe in version >= 0.9.2 found, either is required for profanity])])]) +AC_MSG_CHECKING([whether ${XMPP_LIB} works]) +AC_LINK_IFELSE([AC_LANG_SOURCE([[ + #include + int main() { + xmpp_initialize(); + return 0; + } + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([${XMPP_LIB} is broken, check config.log for details])]) + ### Check for ncurses library PKG_CHECK_MODULES([ncursesw], [ncursesw], [NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; NCURSES="ncursesw"],