arabica/m4/xerces.m4

51 lines
1.8 KiB
Text
Raw Normal View History

2006-09-12 23:21:48 +02:00
AC_DEFUN([ARABICA_HAS_XERCES],
2007-07-19 19:04:18 +02:00
[ AC_ARG_WITH([xerces],
2007-08-29 04:02:25 +02:00
AS_HELP_STRING([--with-xerces=PREFIX],[Specify xerces library location]),
2007-07-19 19:04:18 +02:00
[],
[with_xerces=yes])
2006-09-12 23:21:48 +02:00
XERCES_CFLAGS=
XERCES_LIBS=
if test $with_xerces != no; then
if test $with_xerces != yes; then
xerces_possible_path="$with_xerces"
else
2007-07-19 19:04:18 +02:00
xerces_possible_path="/usr/local /usr /opt /var"
2006-09-12 23:21:48 +02:00
fi
AC_MSG_CHECKING([for Xerces headers])
xerces_save_CXXFLAGS="$CXXFLAGS"
xerces_found=no
for xerces_path_tmp in $xerces_possible_path ; do
CXXFLAGS="$CXXFLAGS -I$xerces_path_tmp/include"
2007-07-19 19:04:18 +02:00
AC_COMPILE_IFELSE([@%:@include <xercesc/sax2/SAX2XMLReader.hpp>],
[XERCES_CFLAGS="-I$xerces_path_tmp/include"
XERCES_LIBS="-L$xerces_path_tmp/lib"
xerces_found=yes]
[])
CXXFLAGS="$xerces_save_CXXFLAGS"
2006-09-12 23:21:48 +02:00
if test $xerces_found = yes; then
break;
fi
done
AC_MSG_RESULT($xerces_found)
if test $xerces_found = yes; then
AC_MSG_CHECKING([for XMLPlatformUtils::Initialize in -lxerces-c])
2007-07-19 19:04:18 +02:00
xerces_save_LIBS="$LDFLAGS"
2007-01-16 12:48:46 +01:00
CXXFLAGS="$CXXFLAGS $XERCES_CFLAGS"
2007-07-19 19:04:18 +02:00
LIBS="$LIBS $XERCES_LIBS -lxerces-c"
2006-09-12 23:21:48 +02:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
[[XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize()]])],
2007-07-19 19:04:18 +02:00
[ XERCES_LIBS="$XERCES_LIBS -lxerces-c"
xerces_found=yes],
[ xerces_found=no])
CXXFLAGS="$xerces_save_CXXFLAGS"
LIBS="$xerces_save_LIBS"
2006-09-12 23:21:48 +02:00
AC_MSG_RESULT($xerces_found)
if test $xerces_found = yes; then
HAVE_XERCES=1
fi
2007-01-16 12:48:46 +01:00
LIBS="$xerces_save_LIBS"
2006-09-12 23:21:48 +02:00
fi
fi
])