Salome HOME
Updated copyright comment
[tools/configuration.git] / autotools / m4 / check_libxml.m4
1 dnl Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
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([CHECK_LIBXML],[
21
22 AC_CHECKING(for libxml library)
23
24 AC_LANG_SAVE
25 AC_LANG_C
26
27 AC_SUBST(LIBXML_INCLUDES)
28 AC_SUBST(LIBXML_LIBS)
29
30 LIBXML_INCLUDES=""
31 LIBXML_LIBS=""
32
33 AC_CHECKING(for libxml location)
34 AC_ARG_WITH(libxml,
35             [  --with-libxml=DIR      root directory path to LIBXML library installation ],
36             [LIBXML_DIR="$withval"
37              AC_MSG_RESULT("select $withval as path to LIBXML library")])
38
39 AC_MSG_RESULT(\$LIBXML_DIR = ${LIBXML_DIR})
40
41 libxml_ok=no
42
43 LOCAL_INCLUDES=""
44 LOCAL_LIBS=""
45
46 if test "x$LIBXML_DIR" != "x"
47 then
48   LOCAL_INCLUDES="-I$LIBXML_DIR/include/libxml2"
49   if test "x$LIBXML_DIR" = "x/usr"
50   then
51     AC_MSG_NOTICE(Trying native Libxml2...)
52     LOCAL_LIBS="-lxml2"
53   else
54     AC_MSG_NOTICE(Trying Libxml2 from $LIBXML_DIR ...)
55     LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2"
56   fi
57 else
58   AC_MSG_NOTICE(Trying native Libxml2...)
59   LOCAL_INCLUDES="-I/usr/include/libxml2"
60   LOCAL_LIBS="-lxml2"
61 fi
62
63 dnl libxml2 headers
64
65 CPPFLAGS_old="$CPPFLAGS"
66 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
67 AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no")
68 CPPFLAGS="$CPPFLAGS_old"
69
70 if  test "x$libxml_ok" = "xyes"
71 then
72
73 dnl libxml2 library
74
75   LIBS_old=$LIBS
76   LIBS="$LIBS $LOCAL_LIBS"
77   AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",)
78   LIBS=$LIBS_old
79 fi
80
81 if test "x$libxml_ok" = "xyes"
82 then
83   LIBXML_INCLUDES="$LOCAL_INCLUDES"
84   LIBXML_LIBS="$LOCAL_LIBS"
85 fi
86
87 AC_MSG_RESULT(for libxml: $libxml_ok)
88
89 AC_LANG_RESTORE
90
91 ])dnl
92 dnl
93