arabica/m4/expat.m4

45 lines
1.3 KiB
Text
Raw Normal View History

2006-09-12 23:21:48 +02:00
AC_DEFUN([ARABICA_HAS_EXPAT],
2007-07-19 19:04:18 +02:00
[
AC_ARG_WITH([expat],
2007-08-29 04:02:25 +02:00
AS_HELP_STRING([--with-expat=PREFIX],[Specify expat library location]),
2007-07-19 19:04:18 +02:00
[],
[with_expat=yes])
2006-09-12 23:21:48 +02:00
EXPAT_CFLAGS=
EXPAT_LIBS=
if test $with_expat != no; then
if test $with_expat != yes; then
expat_possible_path="$with_expat"
else
2007-07-19 19:04:18 +02:00
expat_possible_path="/usr/local /usr /opt /var"
2006-09-12 23:21:48 +02:00
fi
AC_MSG_CHECKING([for expat headers])
expat_save_CXXFLAGS="$CXXFLAGS"
expat_found=no
for expat_path_tmp in $expat_possible_path ; do
CXXFLAGS="$CXXFLAGS -I$expat_path_tmp/include"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <expat.h>]],[[]])],
2007-07-19 19:04:18 +02:00
[EXPAT_CFLAGS="-I$expat_path_tmp/include"
EXPAT_LIBS="-L$expat_path_tmp/lib"
expat_found=yes],
[expat_found=no])
CXXFLAGS="$expat_save_CXXFLAGS"
2006-09-12 23:21:48 +02:00
if test $expat_found = yes; then
break;
fi
done
AC_MSG_RESULT($expat_found)
if test $expat_found = yes; then
2007-07-19 19:04:18 +02:00
AC_CHECK_LIB([expat],
[XML_ParserCreate],
[ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
expat_found=yes ],
[ expat_found=no ],
"$EXPAT_LIBS")
2006-09-12 23:21:48 +02:00
if test $expat_found = yes; then
HAVE_EXPAT=1
fi
fi
fi
])