~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to m4/reorganization/libs/xml.m4

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
want_xml="auto"
 
3
AC_ARG_ENABLE([xml],
 
4
[  --disable-xml          disable DMG and XAR support],
 
5
want_xml=$enableval, want_xml="auto")
 
6
 
 
7
XML_HOME=""
 
8
if test "X$want_xml" != "Xno"; then
 
9
  AC_MSG_CHECKING([for libxml2 installation])
 
10
  AC_ARG_WITH([xml],
 
11
  [  --with-xml=DIR       path to directory containing libxml2 library (default=
 
12
                          /usr/local or /usr if not found in /usr/local)],
 
13
  [
 
14
  if test "$withval"
 
15
  then
 
16
    XML_HOME="$withval"
 
17
    AC_MSG_RESULT([using $XML_HOME])
 
18
  else
 
19
    AC_MSG_ERROR([cannot assign blank value to --with-xml])
 
20
  fi
 
21
  ], [
 
22
  XML_HOME=/usr/local
 
23
  if test ! -x "$XML_HOME/bin/xml2-config"
 
24
  then
 
25
    XML_HOME=/usr
 
26
    if test ! -x "$XML_HOME/bin/xml2-config"
 
27
    then
 
28
      XML_HOME=""
 
29
    fi
 
30
  fi
 
31
  if test "x$XML_HOME" != "x"; then
 
32
    AC_MSG_RESULT([$XML_HOME])
 
33
  else
 
34
    AC_MSG_RESULT([not found])
 
35
  fi
 
36
  ])
 
37
fi
 
38
 
 
39
found_xml="no"
 
40
XMLCONF_VERSION=""
 
41
XML_CPPFLAGS=""
 
42
XML_LIBS=""
 
43
if test "x$XML_HOME" != "x"; then
 
44
  AC_MSG_CHECKING([xml2-config version])
 
45
  XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
 
46
  if test "x%XMLCONF_VERSION" != "x"; then
 
47
    AC_MSG_RESULT([$XMLCONF_VERSION])
 
48
    found_xml="yes"
 
49
    XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
 
50
    XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
 
51
  else
 
52
    AC_MSG_ERROR([xml2-config failed])
 
53
  fi
 
54
fi
 
55
 
 
56
working_xml="no"
 
57
if test "X$found_xml" != "Xno"; then
 
58
  AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
 
59
 
 
60
  if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
 
61
    AC_MSG_RESULT([not found])
 
62
  else
 
63
    AC_MSG_RESULT([found])
 
64
    save_LIBS="$LIBS"
 
65
    save_CPPFLAGS="$CPPFLAGS"
 
66
    CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
 
67
    save_LDFLAGS="$LDFLAGS"
 
68
    LDFLAGS="$LDFLAGS $XML_LIBS"
 
69
 
 
70
    AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"])
 
71
 
 
72
    CPPFLAGS="$save_CPPFLAGS"
 
73
    LDFLAGS="$save_LDFLAGS"
 
74
    LIBS="$save_LIBS"
 
75
  fi
 
76
fi
 
77
 
 
78
if test "$working_xml" = "yes"; then
 
79
  AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
 
80
  AC_SUBST(XML_CPPFLAGS)
 
81
  AC_SUBST(XML_LIBS)
 
82
  AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
 
83
else
 
84
  if test "$want_xml" = "yes"; then
 
85
     AC_MSG_ERROR([****** Please install libxml2 packages!])
 
86
  else
 
87
    if test "$want_xml" != "no"; then
 
88
      AC_MSG_NOTICE([****** libxml2 support unavailable])
 
89
    fi
 
90
  fi
 
91
  XML_CPPFLAGS=""
 
92
  XML_LIBS=""
 
93
  AC_SUBST(XML_CPPFLAGS)
 
94
  AC_SUBST(XML_LIBS)
 
95
fi
 
96
 
 
97
AM_CONDITIONAL([HAVE_LIBXML2], test "x$HAVE_LIBXML2" = "xyes")