2 # Configure paths for LIBXML2
3 # Toshio Kuratomi 2001-04-21
5 # Configure paths for GLIB
8 # Modified to work with libxslt by Thomas Schraitle 2002/10/25
11 dnl AM_PATH_XSLT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
12 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
14 AC_DEFUN(AM_PATH_XSLT,[
15 AC_ARG_WITH(xslt-prefix,
16 [ --with-xslt-prefix=PFX Prefix where libxslt is installed (optional)],
17 xslt_config_prefix="$withval", xslt_config_prefix="")
18 AC_ARG_WITH(xslt-exec-prefix,
19 [ --with-xslt-exec-prefix=PFX Exec prefix where libxslt is installed (optional)],
20 xslt_config_exec_prefix="$withval", xslt_config_exec_prefix="")
21 AC_ARG_ENABLE(xslttest,
22 [ --disable-xslttest Do not try to compile and run a test LIBXSLT program],,
25 if test x$xslt_config_exec_prefix != x ; then
26 xslt_config_args="$xslt_config_args --exec-prefix=$xslt_config_exec_prefix"
27 if test x${XSLT_CONFIG+set} != xset ; then
28 XSLT_CONFIG=$xslt_config_exec_prefix/bin/xslt-config
31 if test x$xslt_config_prefix != x ; then
32 xslt_config_args="$xslt_config_args --prefix=$xslt_config_prefix"
33 if test x${XSLT_CONFIG+set} != xset ; then
34 XSLT_CONFIG=$xslt_config_prefix/bin/xslt-config
38 AC_PATH_PROG(XSLT_CONFIG, xslt-config, no)
39 min_xslt_version=ifelse([$1], ,1.0.0,[$1])
40 AC_MSG_CHECKING(for libxslt - version >= $min_xslt_version)
42 if test "$XSLT_CONFIG" = "no" ; then
45 XSLT_CFLAGS=`$XSLT_CONFIG $xslt_config_args --cflags`
46 XSLT_LIBS=`$XSLT_CONFIG $xslt_config_args --libs`
47 xslt_config_major_version=`$XSLT_CONFIG $xslt_config_args --version | \
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
49 xslt_config_minor_version=`$XSLT_CONFIG $xslt_config_args --version | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
51 xslt_config_micro_version=`$XSLT_CONFIG $xslt_config_args --version | \
52 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
53 if test "x$enable_xslttest" = "xyes" ; then
54 ac_save_CFLAGS="$CFLAGS"
56 CFLAGS="$CFLAGS $XSLT_CFLAGS"
57 LIBS="$XSLT_LIBS $LIBS"
59 dnl Now check if the installed libxslt is sufficiently new.
60 dnl (Also sanity checks the results of xslt-config to some extent)
67 #include <libxslt/xslt.h>
71 int xslt_major_version, xslt_minor_version, xslt_micro_version;
72 int major, minor, micro;
75 system("touch conf.xslttest");
77 /* Capture xslt-config output via autoconf/configure variables */
78 /* HP/UX 9 (%@#!) writes to sscanf strings */
79 tmp_version = (char *)strdup("$min_xslt_version");
80 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
81 printf("%s, bad version string from xslt-config\n", "$min_xslt_version");
86 /* Capture the version information from the header files */
87 tmp_version = (char *)strdup(LIBXSLT_DOTTED_VERSION);
88 if (sscanf(tmp_version, "%d.%d.%d", &xslt_major_version, &xslt_minor_version, &xslt_micro_version) != 3) {
89 printf("%s, bad version string from libxslt includes\n", "LIBXSLT_DOTTED_VERSION");
94 /* Compare xslt-config output to the libxslt headers */
95 if ((xslt_major_version != $xslt_config_major_version) ||
96 (xslt_minor_version != $xslt_config_minor_version) ||
97 (xslt_micro_version != $xslt_config_micro_version))
99 printf("*** libxslt header files (version %d.%d.%d) do not match\n",
100 xslt_major_version, xslt_minor_version, xslt_micro_version);
101 printf("*** xslt-config (version %d.%d.%d)\n",
102 $xslt_config_major_version, $xslt_config_minor_version, $xslt_config_micro_version);
105 /* Compare the headers to the library to make sure we match */
106 /* Less than ideal -- doesn't provide us with return value feedback,
107 * only exits if there's a serious mismatch between header and library.
109 /* copied from LIBXXML_TEST_VERSION; */
110 xmlCheckVersion(LIBXSLT_VERSION_STRING);
112 /* Test that the library is greater than our minimum version */
113 if ((xslt_major_version > major) ||
114 ((xslt_major_version == major) && (xslt_minor_version > minor)) ||
115 ((xslt_major_version == major) && (xslt_minor_version == minor) &&
116 (xslt_micro_version >= micro)))
122 printf("\n*** An old version of libxslt (%d.%d.%d) was found.\n",
123 xslt_major_version, xslt_minor_version, xslt_micro_version);
124 printf("*** You need a version of libxslt newer than %d.%d.%d. The latest version of\n",
125 major, minor, micro);
126 printf("*** libxslt is always available from ftp://ftp.xmlsoft.org.\n");
128 printf("*** If you have already installed a sufficiently new version, this error\n");
129 printf("*** probably means that the wrong copy of the xslt-config shell script is\n");
130 printf("*** being found. The easiest way to fix this is to remove the old version\n");
131 printf("*** of LIBXSLT, but you can also set the XSLT_CONFIG environment to point to the\n");
132 printf("*** correct copy of xslt-config. (In this case, you will have to\n");
133 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
134 printf("*** so that the correct libraries are found at run-time))\n");
138 ],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
139 CFLAGS="$ac_save_CFLAGS"
144 if test "x$no_xslt" = x ; then
145 AC_MSG_RESULT(yes (version $xslt_config_major_version.$xslt_config_minor_version.$xslt_config_micro_version))
146 ifelse([$2], , :, [$2])
149 if test "$XSLT_CONFIG" = "no" ; then
150 echo "*** The xslt-config script installed by LIBXSLT could not be found"
151 echo "*** If libxslt was installed in PREFIX, make sure PREFIX/bin is in"
152 echo "*** your path, or set the XSLT_CONFIG environment variable to the"
153 echo "*** full path to xslt-config."
155 if test -f conf.xslttest ; then
158 echo "*** Could not run libxslt test program, checking why..."
159 CFLAGS="$CFLAGS $XSLT_CFLAGS"
160 LIBS="$LIBS $XSLT_LIBS"
162 #include <libxslt/xslt.h>
164 ], [ LIBXSLT_TEST_VERSION; return 0;],
165 [ echo "*** The test program compiled, but did not run. This usually means"
166 echo "*** that the run-time linker is not finding LIBXSLT or finding the wrong"
167 echo "*** version of LIBXSLT. If it is not finding LIBXSLT, you'll need to set your"
168 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
169 echo "*** to the installed location Also, make sure you have run ldconfig if that"
170 echo "*** is required on your system"
172 echo "*** If you have an old version installed, it is best to remove it, although"
173 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
174 [ echo "*** The test program failed to compile or link. See the file config.log for the"
175 echo "*** exact error that occured. This usually means LIBXSLT was incorrectly installed"
176 echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you"
177 echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ])
178 CFLAGS="$ac_save_CFLAGS"
185 ifelse([$3], , :, [$3])
187 AC_SUBST(XSLT_CFLAGS)