source: trunk/m4/libxml.m4 @ 704

Revision 614, 1.9 KB checked in by dcarter, 4 years ago (diff)

see #111 - Build beta3

Line 
1# Copyright (C) 2005-2008 David Carter <arm4@arm4.org>
2
3# This file is free software; as a special exception the author gives
4# unlimited permission to copy and/or distribute it, with or without
5# modifications, as long as this notice is preserved.
6#
7# This program is distributed in the hope that it will be useful, but
8# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
11# Macros to check the version for the libxml library, and to set whatever link flags are appropriate
12
13AC_DEFUN([__ARM4_LIBXML_COMPILE],
14[
15  LIBXML_INCLUDES="$1"
16  ac_save_CFLAGS="$CFLAGS"
17  CFLAGS="$CFLAGS $LIBXML_INCLUDES"
18  AC_COMPILE_IFELSE([
19#include <libxml/xmlreader.h>
20
21main ()
22{
23    xmlTextReaderPtr reader;
24    LIBXML_TEST_VERSION
25    reader = xmlReaderForFile("/dev/null", NULL, 0);
26}
27], ,[LIBXML_INCLUDES=""])
28  CFLAGS="$ac_save_CFLAGS"
29  AC_SUBST(LIBXML_INCLUDES)
30])
31
32AC_DEFUN([__ARM4_LIBXML_CHECKLINK],
33[
34  LIBXML_LIBS="$1"
35  ac_save_CFLAGS="$CFLAGS"
36  CFLAGS="$CFLAGS $LIBXML_INCLUDES"
37  ac_save_LIBS="$LIBS"
38  LIBS="$LIBS $LIBXML_LIBS"
39  AC_LINK_IFELSE([
40#include <libxml/xmlreader.h>
41
42main ()
43{
44    xmlTextReaderPtr reader;
45    LIBXML_TEST_VERSION
46    reader = xmlReaderForFile("/dev/null", NULL, 0);
47}
48], ,[LIBXML_LIBS=""])
49  LIBS="$ac_save_libs"
50  CFLAGS="$ac_save_CFLAGS"
51  AC_SUBST(LIBXML_LIBS)
52])
53
54AC_DEFUN([ARM4_CHECK_LIBXML],
55[
56  AC_MSG_CHECKING(for libxml2)
57  __ARM4_LIBXML_COMPILE([])
58  if test "x$LIBXML_INCLUDES" = "x" ; then
59    __ARM4_LIBXML_COMPILE([-I/usr/include/libxml2])
60  fi
61  if test "x$LIBXML_INCLUDES" != "x" ; then
62    __ARM4_LIBXML_CHECKLINK([-lxml2])
63  fi
64  if test "x$LIBXML_LIBS" = x ; then
65    AC_MSG_RESULT(no)
66    AC_MSG_ERROR(require libxml2 libraries)
67  else
68    AC_DEFINE(HAVE_LIBXML2, 1,
69      [Define wether the libxml2 libraries are implemented on this platform])
70    AC_MSG_RESULT(yes)
71  fi
72])
Note: See TracBrowser for help on using the repository browser.