1
dnl----------------------------------------------------------------------------
2
dnl This file is part of the Code_Saturne Kernel, element of the
3
dnl Code_Saturne CFD tool.
5
dnl Copyright (C) 2009 EDF S.A., France
7
dnl The Code_Saturne Kernel is free software; you can redistribute it
8
dnl and/or modify it under the terms of the GNU General Public License
9
dnl as published by the Free Software Foundation; either version 2 of
10
dnl the License, or (at your option) any later version.
12
dnl The Code_Saturne Kernel is distributed in the hope that it will be
13
dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14
dnl of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
dnl GNU General Public License for more details.
17
dnl You should have received a copy of the GNU General Public Licence
18
dnl along with the Code_Saturne Preprocessor; if not, write to the
19
dnl Free Software Foundation, Inc.,
20
dnl 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
dnl-----------------------------------------------------------------------------
25
# modifies or sets 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$have_libxml2" != "xyes"; then
99
CPPFLAGS="$saved_CPPFLAGS"
100
LDFLAGS="$saved_LDFLAGS"
109
AM_CONDITIONAL(HAVE_LIBXML2, test x$have_libxml2 = xyes)
111
AC_SUBST(LIBXML2_CPPFLAGS)
112
AC_SUBST(LIBXML2_LDFLAGS)
113
AC_SUBST(LIBXML2_LIBS)