1
dnl--------------------------------------------------------------------------------
3
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
5
dnl Copyright (C) 1998-2011 EDF S.A.
7
dnl This program is free software; you can redistribute it and/or modify it under
8
dnl the terms of the GNU General Public License as published by the Free Software
9
dnl Foundation; either version 2 of the License, or (at your option) any later
12
dnl This program is distributed in the hope that it will be useful, but WITHOUT
13
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17
dnl You should have received a copy of the GNU General Public License along with
18
dnl this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
19
dnl Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
dnl--------------------------------------------------------------------------------
25
# modifies or sets cs_have_libxml2, LIBXML2_CPPFLAGS, LIBXML2_LDFLAGS, and LIBXML2_LIBS
26
# depending on libraries found
28
AC_DEFUN([CS_AC_TEST_LIBXML2], [
33
[AS_HELP_STRING([--with-libxml2=PATH],
34
[specify prefix directory for LIBXML2])],
35
[if test "x$withval" = "x"; then
40
AC_ARG_WITH(libxml2-include,
41
[AS_HELP_STRING([--with-libxml2-include=PATH],
42
[specify directory for LIBXML2 include files])],
43
[if test "x$with_libxml2" = "xcheck"; then
46
LIBXML2_CPPFLAGS="-I$with_libxml2_include"],
47
[if test "x$with_libxml2" != "xno" ; then
48
if test "x$with_libxml2" != "xyes" \
49
-a "x$with_libxml2" != "xcheck"; then
50
LIBXML2_CPPFLAGS="-I$with_libxml2/include/libxml2"
52
LIBXML2_CPPFLAGS="-I/usr/include/libxml2"
56
AC_ARG_WITH(libxml2-lib,
57
[AS_HELP_STRING([--with-libxml2-lib=PATH],
58
[specify directory for LIBXML2 library])],
59
[if test "x$with_libxml2" = "xcheck"; then
62
LIBXML2_LDFLAGS="-L$with_libxml2_lib"],
63
[if test "x$with_libxml2" != "xno" -a "x$with_libxml2" != "xyes" \
64
-a "x$with_libxml2" != "xcheck"; then
65
LIBXML2_LDFLAGS="-L$with_libxml2/lib"
69
if test "x$with_libxml2" != "xno" ; then
71
saved_CPPFLAGS="$CPPFLAGS"
72
saved_LDFLAGS="$LDFLAGS"
77
CPPFLAGS="${CPPFLAGS} ${LIBXML2_CPPFLAGS}"
78
LDFLAGS="${LDFLAGS} ${LIBXML2_LDFLAGS}"
79
LIBS="${LIBS} ${LIBXML2_LIBS}"
81
AC_CHECK_HEADER([libxml/parser.h])
83
AC_CHECK_LIB(xml2, xmlInitParser,
84
[ AC_DEFINE([HAVE_LIBXML2], 1, [LIBXML2 support])
87
[if test "x$with_libxml2" != "xcheck" ; then
88
AC_MSG_FAILURE([LIBXML2 support is requested, but test for LIBXML2 failed!])
90
AC_MSG_WARN([no LIBXML2 support])
95
if test "x$cs_have_libxml2" != "xyes"; then
99
CPPFLAGS="$saved_CPPFLAGS"
100
LDFLAGS="$saved_LDFLAGS"
109
AM_CONDITIONAL(HAVE_LIBXML2, test x$cs_have_libxml2 = xyes)
111
AC_SUBST(cs_have_libxml2)
112
AC_SUBST(LIBXML2_CPPFLAGS)
113
AC_SUBST(LIBXML2_LDFLAGS)
114
AC_SUBST(LIBXML2_LIBS)