Blame common/m4/gst-libxml2.m4

Packit f546b1
dnl call this macro with the minimum required version as an argument
Packit f546b1
dnl this macro sets and AC_SUBSTs XML_CFLAGS and XML_LIBS
Packit f546b1
dnl it also sets LIBXML_PKG, used for the pkg-config file
Packit f546b1
Packit f546b1
AC_DEFUN([AG_GST_LIBXML2_CHECK],
Packit f546b1
[
Packit f546b1
  dnl Minimum required version of libxml2
Packit f546b1
  dnl default to 2.4.9 if not specified
Packit f546b1
  LIBXML2_REQ=ifelse([$1],,2.4.9,[$1])
Packit f546b1
  AC_SUBST(LIBXML2_REQ)
Packit f546b1
Packit f546b1
  dnl check for libxml2
Packit f546b1
  PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_REQ,
Packit f546b1
                    HAVE_LIBXML2=yes, [
Packit f546b1
                      AC_MSG_RESULT(no)
Packit f546b1
                      HAVE_LIBXML2=no
Packit f546b1
                    ])
Packit f546b1
  if test "x$HAVE_LIBXML2" = "xyes"; then
Packit f546b1
    AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 is available])
Packit f546b1
  else
Packit f546b1
    AC_MSG_ERROR([
Packit f546b1
        Need libxml2 and development headers/files to build GStreamer.
Packit f546b1
Packit f546b1
        You can do without libxml2 if you pass --disable-loadsave to
Packit f546b1
        configure, but that breaks ABI, so don't do that unless you
Packit f546b1
        are building for an embedded setup and know what you are doing.
Packit f546b1
    ])
Packit f546b1
  fi
Packit f546b1
  dnl this is for the .pc file
Packit f546b1
  LIBXML_PKG=', libxml-2.0'
Packit f546b1
  AC_SUBST(LIBXML_PKG)
Packit f546b1
  AC_SUBST(XML_LIBS)
Packit f546b1
  AC_SUBST(XML_CFLAGS)
Packit f546b1
Packit f546b1
  dnl XML_LIBS might pull in -lz without zlib actually being on the system, so
Packit f546b1
  dnl try linking with these LIBS and CFLAGS
Packit f546b1
  ac_save_CFLAGS=$CFLAGS
Packit f546b1
  ac_save_LIBS=$LIBS
Packit f546b1
  CFLAGS="$CFLAGS $XML_CFLAGS"
Packit f546b1
  LIBS="$LIBS $XML_LIBS"
Packit f546b1
  AC_TRY_LINK([
Packit f546b1
#include <libxml/tree.h>
Packit f546b1
#include <stdio.h>
Packit f546b1
],[
Packit f546b1
/* function body */
Packit f546b1
],
Packit f546b1
    AC_MSG_NOTICE([Test xml2 program linked]),
Packit f546b1
    AC_MSG_ERROR([Could not link libxml2 test program.  Check if you have the necessary dependencies.])
Packit f546b1
  )
Packit f546b1
  CFLAGS="$ac_save_CFLAGS"
Packit f546b1
  LIBS="$ac_save_LIBS"
Packit f546b1
])