about summary refs log tree commit diff stats
path: root/configure.ac
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2020-05-31 20:02:48 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2020-05-31 20:02:48 +0300
commit75bb00368f4f8c0a3e5a7da8aa347f86f07fc53a (patch)
treeafbba4cf6487087c026fa46e8635b0c35f4fe73d /configure.ac
parentac5ce105ac08f022d88d7e73dc38f2706d4c44cf (diff)
downloadprofani-tty-75bb00368f4f8c0a3e5a7da8aa347f86f07fc53a.tar.gz
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac15
1 files 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 <strophe.h>
+    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"],