Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / adm / unix / config_files / check_libxml.m4
1 dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
2 dnl
3 dnl  This library is free software; you can redistribute it and/or
4 dnl  modify it under the terms of the GNU Lesser General Public
5 dnl  License as published by the Free Software Foundation; either
6 dnl  version 2.1 of the License.
7 dnl
8 dnl  This library is distributed in the hope that it will be useful,
9 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 dnl  Lesser General Public License for more details.
12 dnl
13 dnl  You should have received a copy of the GNU Lesser General Public
14 dnl  License along with this library; if not, write to the Free Software
15 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 dnl
17 dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 dnl
19 AC_DEFUN([AC_CHECK_LIBXML],[
20
21 AC_CHECKING(for libxml)
22
23 CPPFLAGS_old=$CPPFLAGS
24 CXXFLAGS_old=$CXXFLAGS
25
26 # Custom location of libxml2 package can be specified
27 # thorugh LIBXML_DIR variable
28 if test "x$LIBXML_DIR" != "x"
29 then
30   CPPFLAGS="$CPPFLAGS -I$LIBXML_DIR/include/libxml2"
31   CXXFLAGS="$CXXFLAGS -I$LIBXML_DIR/include/libxml2"
32   if test "x$LIBXML_DIR" = "x/usr"
33   then
34     TMPLIBS="-lxml2 $LIBS"
35   else
36     TMPLIBS="-L$LIBXML_DIR/lib -lxml2 $LIBS"
37   fi
38   LIBXML_INCLUDES="-I$LIBXML_DIR/include/libxml2"
39 else
40   CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
41   CXXFLAGS="$CXXFLAGS -I/usr/include/libxml2"
42   TMPLIBS="-lxml2 $LIBS"
43   LIBXML_INCLUDES="-I/usr/include/libxml2"
44 fi
45
46 AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no")
47
48 if  test "x$libxml_ok" = "xyes"
49 then
50   LIBS_old=$LIBS
51   LIBS=$TMPLIBS
52   AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",)
53   LIBS=$LIBS_old
54 fi
55
56 if test "x$libxml_ok" = "xyes"
57 then
58   LIBXML_LIBS=$TMPLIBS
59 fi
60
61 AC_MSG_RESULT(for libxml: $libxml_ok)
62
63 CXXFLAGS=$CXXFLAGS_old
64 CPPFLAGS=$CPPFLAGS_old
65
66 AC_SUBST(LIBXML_LIBS)
67 AC_SUBST(LIBXML_INCLUDES)
68
69 ])dnl
70 dnl
71