Salome HOME
81a435de365f64d51c6c30be285a50123bd863d9
[modules/yacs.git] / adm / unix / config_files / check_expat.m4
1 dnl Copyright (C) 2006-2014  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, 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_EXPAT],[
21
22 AC_CHECKING(for expat)
23
24 CXXFLAGS_old=$CXXFLAGS
25 CPPFLAGS_old=$CPPFLAGS
26
27 # Custom location of expat package can be specified
28 # through EXPAT_DIR variable
29 EXPATDIR=
30 if test "x$EXPAT_DIR" != "x"
31 then
32   EXPATDIR=$EXPAT_DIR
33 elif test "x$EXPAT_ROOT" != "x"
34 then
35   EXPATDIR=$EXPAT_ROOT
36 fi
37
38 if test "x$EXPATDIR" != "x"
39 then
40   if test "x$EXPATDIR" = "x/usr"
41   then
42     AC_MSG_NOTICE(Trying native Expat...)
43     TMPLIBS="-lexpat $LIBS"
44   else
45     AC_MSG_NOTICE(Trying Expat from $EXPATDIR ...)
46     TMPLIBS="-L$EXPATDIR/lib -lexpat $LIBS"
47     CXXFLAGS="$CXXFLAGS -I$EXPATDIR/include"
48     CPPFLAGS="$CPPFLAGS -I$EXPATDIR/include"
49     EXPAT_INCLUDES="-I$EXPATDIR/include"
50   fi
51 else
52   AC_MSG_NOTICE(Trying native Expat...)
53   TMPLIBS="-lexpat $LIBS"
54 fi
55
56 AC_CHECK_HEADER(expat.h,expat_ok="yes",expat_ok="no")
57
58 if  test "x$expat_ok" = "xyes"
59 then
60   LIBS_old=$LIBS
61   LIBS=$TMPLIBS
62   AC_CHECK_LIB(expat,XML_ExpatVersionInfo,expat_ok="yes",expat_ok="no",)
63   LIBS=$LIBS_old
64 fi
65
66 if test "x$expat_ok" = "xyes"
67 then
68   EXPAT_LIBS=$TMPLIBS
69 fi
70
71 AC_MSG_RESULT(for expat: $expat_ok)
72
73 CXXFLAGS=$CXXFLAGS_old
74 CPPFLAGS=$CPPFLAGS_old
75
76 AC_SUBST(EXPAT_LIBS)
77 AC_SUBST(EXPAT_INCLUDES)
78
79 ])dnl
80 dnl
81