1 dnl Check for LIBXML2 Libraries
2 dnl CHECK_LIBXML2(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
11 AC_DEFUN([CHECK_LIBXML2],
16 [AC_HELP_STRING([--with-libxml=PATH],[Path to libxml2 prefix or config script])],
17 [test_paths="${with_libxml}"],
18 [test_paths="/usr/local/libxml2 /usr/local/xml2 /usr/local/xml /usr/local /opt/libxml2 /opt/libxml /opt/xml2 /opt/xml /opt /usr"])
20 AC_MSG_CHECKING([for libxml2 config script])
22 for x in ${test_paths}; do
23 dnl # Determine if the script was specified and use it directly
24 if test ! -d "$x" -a -e "$x"; then
30 dnl # Try known config script names/locations
31 for LIBXML2_CONFIG in xml2-config xml-2-config xml-config; do
32 if test -e "${x}/bin/${LIBXML2_CONFIG}"; then
33 libxml2_path="${x}/bin"
35 elif test -e "${x}/${LIBXML2_CONFIG}"; then
42 if test -n "$libxml2_path"; then
49 if test -n "${libxml2_path}"; then
50 if test "${libxml2_path}" != "no"; then
51 LIBXML2_CONFIG="${libxml2_path}/${LIBXML2_CONFIG}"
53 AC_MSG_RESULT([${LIBXML2_CONFIG}])
54 LIBXML2_CFLAGS="`${LIBXML2_CONFIG} --cflags`"
55 if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(xml CFLAGS: $LIBXML2_CFLAGS); fi
56 LIBXML2_LIBS="`${LIBXML2_CONFIG} --libs`"
57 if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(xml LIBS: $LIBXML2_LIBS); fi
64 AC_SUBST(LIBXML2_LIBS)
65 AC_SUBST(LIBXML2_CFLAGS)
67 if test -z "${LIBXML2_LIBS}"; then
68 AC_MSG_NOTICE([*** xml library not found.])
69 ifelse([$2], , AC_MSG_ERROR([libxml2 is required]), $2)
71 AC_MSG_NOTICE([using '${LIBXML2_LIBS}' for libxml2])