about summary refs log tree commit diff stats
path: root/configure.ac
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2014-01-02 22:18:42 +0200
committerDmitry Podgorny <pasis.ua@gmail.com>2014-01-02 22:18:42 +0200
commit0cdbfecb35670fbcb84f0b6914cc35460f2fb3ca (patch)
tree92a978c20fc1fbdf4ce700434f6ac8128a9f20ca /configure.ac
parentc7551b50c3a9ed5998a0a61ab742058f43834451 (diff)
downloadprofani-tty-0cdbfecb35670fbcb84f0b6914cc35460f2fb3ca.tar.gz
configure.ac: added check for expat without pkg-config
and some refactoring
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac37
1 files changed, 24 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index bb042e66..7bfd0ab1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,12 +34,17 @@ AC_ARG_WITH([libxml2],
 AC_ARG_WITH([xscreensaver],
     [AS_HELP_STRING([--with-xscreensaver], [use libXScrnSaver to determine idle time])])
 
+### Select first existing xml library among expat and libxml2
 PARSER=""
+PARSER_LIBS=""
+PARSER_CFLAGS=""
 AS_IF([test "x$with_libxml2" != xyes],
     [PKG_CHECK_MODULES([expat], [expat],
         [PARSER_CFLAGS="$expat_CFLAGS"; PARSER_LIBS="$expat_LIBS"; PARSER="expat"],
-        AS_IF([test "x$with_libxml2" = xno],
-            [AC_MSG_ERROR([expat is required but does not exist])]))
+        [AC_CHECK_LIB([expat], [XML_ParserCreate],
+            [PARSER_LIBS="-lexpat"; PARSER="expat"],
+            AS_IF([test "x$with_libxml2" = xno],
+                [AC_MSG_ERROR([expat is required but does not exist])]))])
     ])
 
 AS_IF([test "x$PARSER" = x -a "x$with_libxml2" != xno],
@@ -51,20 +56,23 @@ AS_IF([test "x$PARSER" = x -a "x$with_libxml2" != xno],
 
 AS_IF([test "x$PARSER" = x],
     [AC_MSG_ERROR([either expat or libxml2 is required for profanity])])
+AM_CPPFLAGS="$AM_CPPFLAGS $PARSER_CFLAGS"
+LIBS="$LIBS $PARSER_LIBS"
 
+### Check for libstrophe dependencies
 AC_CHECK_LIB([resolv], [__res_query], [],
     [AC_MSG_ERROR([libresolv is required for profanity])])
-AC_CHECK_LIB([strophe], [main], [],
-    [AC_MSG_ERROR([libstrophe is required for profanity])])
 PKG_CHECK_MODULES([openssl], [openssl], [],
     [AC_MSG_ERROR([openssl is required for profanity])])
+AM_CPPFLAGS="$AM_CPPFLAGS $openssl_CFLAGS"
+LIBS="$LIBS $openssl_LIBS"
 
 # TODO: autodetect of XML parser libstrophe linked with
-
-PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
-    [AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
-PKG_CHECK_MODULES([curl], [libcurl], [],
-    [AC_MSG_ERROR([libcurl is required for profanity])])
+CFLAGS_RESTORE="$CFLAGS"
+CFLAGS="$CFLAGS $AM_CPPFLAGS"
+AC_CHECK_LIB([strophe], [parser_new], [],
+    [AC_MSG_ERROR([libstrophe linked with $PARSER is required for profanity])])
+CFLAGS="$CFLAGS_RESTORE"
 
 ### Check for ncurses library
 PKG_CHECK_MODULES([ncursesw], [ncursesw],
@@ -94,6 +102,11 @@ CFLAGS="$CFLAGS_RESTORE"
 AS_IF([test "x$ncurses_cv_wget_wch" != xyes],
     [AC_MSG_ERROR([ncurses does not support wide characters])])
 
+### Check for other profanity dependencies
+PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
+    [AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
+PKG_CHECK_MODULES([curl], [libcurl], [],
+    [AC_MSG_ERROR([libcurl is required for profanity])])
 AS_IF([test "x$enable_notifications" != xno],
     [PKG_CHECK_MODULES([libnotify], [libnotify],
         [AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
@@ -127,10 +140,8 @@ AC_CHECK_HEADERS([ncurses.h], [], [])
 AM_CFLAGS="-Wall"
 AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
     [AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
-AM_CPPFLAGS="$AM_CPPFLAGS $openssl_CFLAGS $glib_CFLAGS $curl_CFLAGS"
-AM_CPPFLAGS="$AM_CPPFLAGS $libnotify_CFLAGS $PARSER_CFLAGS"
-LIBS="$LIBS $openssl_LIBS $glib_LIBS $curl_LIBS $libnotify_LIBS"
-LIBS="$LIBS $PARSER_LIBS"
+AM_CPPFLAGS="$AM_CPPFLAGS $glib_CFLAGS $curl_CFLAGS $libnotify_CFLAGS"
+LIBS="$LIBS $glib_LIBS $curl_LIBS $libnotify_LIBS"
 
 AC_SUBST(AM_CFLAGS)
 AC_SUBST(AM_CPPFLAGS)