~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to m4/cs_libxml2.m4

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl--------------------------------------------------------------------------------
 
2
dnl
 
3
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
 
4
dnl
 
5
dnl Copyright (C) 1998-2011 EDF S.A.
 
6
dnl
 
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
 
10
dnl version.
 
11
dnl
 
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
 
15
dnl details.
 
16
dnl
 
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.
 
20
dnl
 
21
dnl--------------------------------------------------------------------------------
 
22
 
 
23
# CS_AC_TEST_LIBXML2
 
24
#-------------------
 
25
# modifies or sets cs_have_libxml2, LIBXML2_CPPFLAGS, LIBXML2_LDFLAGS, and LIBXML2_LIBS
 
26
# depending on libraries found
 
27
 
 
28
AC_DEFUN([CS_AC_TEST_LIBXML2], [
 
29
 
 
30
cs_have_libxml2=no
 
31
 
 
32
AC_ARG_WITH(libxml2,
 
33
            [AS_HELP_STRING([--with-libxml2=PATH],
 
34
                            [specify prefix directory for LIBXML2])],
 
35
            [if test "x$withval" = "x"; then
 
36
               with_libxml2=yes
 
37
             fi],
 
38
            [with_libxml2=check])
 
39
 
 
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
 
44
               with_libxml2=yes
 
45
             fi
 
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"
 
51
               else
 
52
                 LIBXML2_CPPFLAGS="-I/usr/include/libxml2"
 
53
               fi
 
54
             fi])
 
55
 
 
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
 
60
               with_libxml2=yes
 
61
             fi
 
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"
 
66
             fi])
 
67
 
 
68
 
 
69
if test "x$with_libxml2" != "xno" ; then
 
70
 
 
71
  saved_CPPFLAGS="$CPPFLAGS"
 
72
  saved_LDFLAGS="$LDFLAGS"
 
73
  saved_LIBS="$LIBS"
 
74
 
 
75
  LIBXML2_LIBS="-lxml2"
 
76
 
 
77
  CPPFLAGS="${CPPFLAGS} ${LIBXML2_CPPFLAGS}"
 
78
  LDFLAGS="${LDFLAGS} ${LIBXML2_LDFLAGS}"
 
79
  LIBS="${LIBS} ${LIBXML2_LIBS}"
 
80
 
 
81
  AC_CHECK_HEADER([libxml/parser.h])
 
82
 
 
83
  AC_CHECK_LIB(xml2, xmlInitParser, 
 
84
               [ AC_DEFINE([HAVE_LIBXML2], 1, [LIBXML2 support])
 
85
                 cs_have_libxml2=yes
 
86
               ], 
 
87
               [if test "x$with_libxml2" != "xcheck" ; then
 
88
                  AC_MSG_FAILURE([LIBXML2 support is requested, but test for LIBXML2 failed!])
 
89
                else
 
90
                  AC_MSG_WARN([no LIBXML2 support])
 
91
                fi
 
92
               ],
 
93
              )
 
94
 
 
95
  if test "x$cs_have_libxml2" != "xyes"; then
 
96
    LIBXML2_LIBS=""
 
97
  fi
 
98
 
 
99
  CPPFLAGS="$saved_CPPFLAGS"
 
100
  LDFLAGS="$saved_LDFLAGS"
 
101
  LIBS="$saved_LIBS"
 
102
 
 
103
  unset saved_CPPFLAGS
 
104
  unset saved_LDFLAGS
 
105
  unset saved_LIBS
 
106
 
 
107
fi
 
108
 
 
109
AM_CONDITIONAL(HAVE_LIBXML2, test x$cs_have_libxml2 = xyes)
 
110
 
 
111
AC_SUBST(cs_have_libxml2)
 
112
AC_SUBST(LIBXML2_CPPFLAGS)
 
113
AC_SUBST(LIBXML2_LDFLAGS)
 
114
AC_SUBST(LIBXML2_LIBS)
 
115
 
 
116
])dnl
 
117