Merge in Fixes for OSX warnings (Lion)
[m6w6/libmemcached] / m4 / pandora_have_libxml2.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl Provides support for finding libxml2.
7 dnl LIBXML2_CFLAGS will be set, in addition to LIBXML2 and LTLIBXML2
8
9 AC_DEFUN([_PANDORA_SEARCH_LIBXML2],[
10 AC_REQUIRE([AC_LIB_PREFIX])
11
12 dnl --------------------------------------------------------------------
13 dnl Check for libxml2
14 dnl --------------------------------------------------------------------
15
16 AC_ARG_ENABLE([libxml2],
17 [AS_HELP_STRING([--disable-libxml2],
18 [Build with libxml2 support @<:@default=on@:>@])],
19 [ac_enable_libxml2="$enableval"],
20 [ac_enable_libxml2="yes"])
21
22 AS_IF([test "x$ac_enable_libxml2" = "xyes"],[
23 AC_LIB_HAVE_LINKFLAGS(xml2,,[
24 #include <libxml/xmlversion.h>
25 ],[
26 const char *test= LIBXML_DOTTED_VERSION;
27 ])
28 ],[
29 ac_cv_libxml2="no"
30 ])
31
32 AS_IF([test "${ac_cv_libxml2}" = "no" -a "${ac_enable_libxml2}" = "yes"],[
33
34 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [
35 ac_cv_libxml2=yes
36 LTLIBXML2=${LIBXML2_LIBS}
37 LIBXML2=${LIBXML2_LIBS}
38 ],[])
39 ])
40
41 AM_CONDITIONAL(HAVE_LIBXML2, [test "${ac_cv_libxml2}" = "yes"])
42 ])
43
44 AC_DEFUN([PANDORA_HAVE_LIBXML2],[
45 AC_REQUIRE([_PANDORA_SEARCH_LIBXML2])
46 ])
47
48 AC_DEFUN([PANDORA_REQUIRE_LIBXML2],[
49 AC_REQUIRE([_PANDORA_SEARCH_LIBXML2])
50 AS_IF([test "x${ac_cv_libxml2}" = "xno"],
51 AC_MSG_ERROR([libxml2 is required for ${PACKAGE}. On Debian systems this is found in libxml2-dev. On RedHat, libxml2-devel.]))
52 ])