Browse Source

Add --with-libxslt configure option

Serj Kalichev 8 years ago
parent
commit
5cd3b32c95
1 changed files with 38 additions and 2 deletions
  1. 38 2
      configure.ac

+ 38 - 2
configure.ac

@@ -1,8 +1,8 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 m4_define([MAJOR_VERSION], 2)
-m4_define([MINOR_VERSION], 0)
-m4_define([MICRO_VERSION], 4)
+m4_define([MINOR_VERSION], 1)
+m4_define([MICRO_VERSION], 0)
 
 AC_PREREQ(2.59)
 AC_INIT([klish],
@@ -475,6 +475,42 @@ if test $count_xml_backends -eq 0; then
     AC_MSG_NOTICE([I found a suitable XML backend: $found_xml_backend])
 fi
 
+# LIBXSLT
+AC_ARG_WITH(libxslt,
+            [AS_HELP_STRING([--with-libxslt=DIR],
+                            [Use libxslt as the XSLT transform engine [default=no]. Depend on libxml2 library.])],
+            [use_libxslt=$withval],
+            [use_libxslt=no])
+
+if test "x$use_libxslt" != "xno" -a "$found_xml_backend" != "libxml2"; then
+    AC_MSG_ERROR([The libxml2 is necessary for libxslt])
+fi
+
+################################
+# Check for the libxslt transform engine
+################################
+
+if test x$use_libxslt != xno; then
+	XSLT_CFLAGS="`pkg-config libxslt --cflags`"
+	XSLT_LDFLAGS="`pkg-config libxslt --libs-only-L`"
+	XSLT_LIBS="`pkg-config libxslt --libs-only-l`"
+	AC_CHECK_LIB([xslt], [xsltApplyStylesheet], [libxslt_lib_found=yes])
+	XSLT_CFLAGS="`pkg-config libxslt --cflags`"
+	XSLT_LDFLAGS="`pkg-config libxslt --libs-only-L`"
+	XSLT_LIBS="`pkg-config libxslt --libs-only-l`"
+	if test "x${XSLT_LIBS}" = "x"; then
+		XSLT_LIBS="-lxslt"
+	fi
+	XML_CFLAGS="${XML_CFLAGS} ${XSLT_CFLAGS}"
+	XML_LDFLAGS="${XML_LDFLAGS} ${XSLT_LDFLAGS}"
+	XML_LIBS="${XML_LIBS} ${XSLT_LIBS}"
+        AC_DEFINE([HAVE_LIB_LIBXSLT], [], [libxslt XML transform engine])
+fi
+
+################################
+# Common XML related subst
+################################
+
 AC_SUBST(XML_LIBS)
 AC_SUBST(XML_LDFLAGS)
 AC_SUBST(XML_CFLAGS)