1dnl call this macro with the minimum required version as an argument 2dnl this macro sets and AC_SUBSTs XML_CFLAGS and XML_LIBS 3dnl it also sets LIBXML_PKG, used for the pkg-config file 4 5AC_DEFUN([AG_GST_LIBXML2_CHECK], 6[ 7 dnl Minimum required version of libxml2 8 dnl default to 2.4.9 if not specified 9 LIBXML2_REQ=ifelse([$1],,2.4.9,[$1]) 10 AC_SUBST(LIBXML2_REQ) 11 12 dnl check for libxml2 13 PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_REQ, 14 HAVE_LIBXML2=yes, [ 15 AC_MSG_RESULT(no) 16 HAVE_LIBXML2=no 17 ]) 18 if test "x$HAVE_LIBXML2" = "xyes"; then 19 AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 is available]) 20 else 21 AC_MSG_ERROR([ 22 Need libxml2 and development headers/files to build GStreamer. 23 24 You can do without libxml2 if you pass --disable-loadsave to 25 configure, but that breaks ABI, so don't do that unless you 26 are building for an embedded setup and know what you are doing. 27 ]) 28 fi 29 dnl this is for the .pc file 30 LIBXML_PKG=', libxml-2.0' 31 AC_SUBST(LIBXML_PKG) 32 AC_SUBST(XML_LIBS) 33 AC_SUBST(XML_CFLAGS) 34 35 dnl XML_LIBS might pull in -lz without zlib actually being on the system, so 36 dnl try linking with these LIBS and CFLAGS 37 ac_save_CFLAGS=$CFLAGS 38 ac_save_LIBS=$LIBS 39 CFLAGS="$CFLAGS $XML_CFLAGS" 40 LIBS="$LIBS $XML_LIBS" 41 AC_TRY_LINK([ 42#include <libxml/tree.h> 43#include <stdio.h> 44],[ 45/* function body */ 46], 47 AC_MSG_NOTICE([Test xml2 program linked]), 48 AC_MSG_ERROR([Could not link libxml2 test program. Check if you have the necessary dependencies.]) 49 ) 50 CFLAGS="$ac_save_CFLAGS" 51 LIBS="$ac_save_LIBS" 52]) 53