Salome HOME
de8b9a99821ddce44fbc1d09fca82cd9e7c3f5c9
[modules/hexablock.git] / adm_local / unix / config_files / check_libxml.m4
1 dnl Copyright (C) 2009-2023  CEA, EDF
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, or (at your option) any later version.
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
20 AC_DEFUN([AC_CHECK_LIBXML],[
21
22 AC_CHECKING(for libxml)
23
24 CPPFLAGS_old=$CPPFLAGS
25 CXXFLAGS_old=$CXXFLAGS
26
27 # Custom location of libxml2 package can be specified
28 # thorugh LIBXML_DIR variable
29 if test "x$LIBXML_DIR" != "x"
30 then
31   CPPFLAGS="$CPPFLAGS -I$LIBXML_DIR/include/libxml2"
32   CXXFLAGS="$CXXFLAGS -I$LIBXML_DIR/include/libxml2"
33   if test "x$LIBXML_DIR" = "x/usr"
34   then
35     AC_MSG_NOTICE(Trying native Libxml2...)
36     TMPLIBS="-lxml2 $LIBS"
37   else
38     AC_MSG_NOTICE(Trying Libxml2 from $LIBXML_DIR ...)
39     TMPLIBS="-L$LIBXML_DIR/lib -lxml2 $LIBS"
40   fi
41   LIBXML_INCLUDES="-I$LIBXML_DIR/include/libxml2"
42 else
43   CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
44   CXXFLAGS="$CXXFLAGS -I/usr/include/libxml2"
45   TMPLIBS="-lxml2 $LIBS"
46   LIBXML_INCLUDES="-I/usr/include/libxml2"
47 fi
48
49 AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no")
50
51 if  test "x$libxml_ok" = "xyes"
52 then
53   LIBS_old=$LIBS
54   LIBS=$TMPLIBS
55   AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",)
56   LIBS=$LIBS_old
57 fi
58
59 if test "x$libxml_ok" = "xyes"
60 then
61   LIBXML_LIBS=$TMPLIBS
62 fi
63
64 AC_MSG_RESULT(for libxml: $libxml_ok)
65
66 CXXFLAGS=$CXXFLAGS_old
67 CPPFLAGS=$CPPFLAGS_old
68
69 AC_SUBST(LIBXML_LIBS)
70 AC_SUBST(LIBXML_INCLUDES)
71
72 ])dnl
73 dnl
74