Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 1 | # Configure paths for LIBXML2 |
| 2 | # Toshio Kuratomi 2001-04-21 |
| 3 | # Adapted from: |
| 4 | # Configure paths for GLIB |
| 5 | # Owen Taylor 97-11-3 |
| 6 | |
| 7 | dnl AM_PATH_XML([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 8 | dnl Test for XML, and define XML_CFLAGS and XML_LIBS |
| 9 | dnl |
| 10 | AC_DEFUN(AM_PATH_XML,[ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 11 | AC_ARG_WITH(xml-prefix, |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 12 | [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 13 | xml_config_prefix="$withval", xml_config_prefix="") |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 14 | AC_ARG_WITH(xml-exec-prefix, |
| 15 | [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], |
| 16 | xml_config_exec_prefix="$withval", xml_config_exec_prefix="") |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 17 | AC_ARG_ENABLE(xmltest, |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 18 | [ --disable-xmltest Do not try to compile and run a test LIBXML program],, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 19 | enable_xmltest=yes) |
| 20 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 21 | if test x$xml_config_exec_prefix != x ; then |
| 22 | xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix" |
| 23 | if test x${XML_CONFIG+set} != xset ; then |
| 24 | XML_CONFIG=$xml_config_exec_prefix/bin/xml-config |
| 25 | fi |
| 26 | fi |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 27 | if test x$xml_config_prefix != x ; then |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 28 | xml_config_args="$xml_config_args --prefix=$xml_config_prefix" |
| 29 | if test x${XML_CONFIG+set} != xset ; then |
| 30 | XML_CONFIG=$xml_config_prefix/bin/xml-config |
| 31 | fi |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 32 | fi |
| 33 | |
| 34 | AC_PATH_PROG(XML_CONFIG, xml-config, no) |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 35 | min_xml_version=ifelse([$1], ,1.0.0,[$1]) |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 36 | AC_MSG_CHECKING(for libxml - version >= $min_xml_version) |
| 37 | no_xml="" |
| 38 | if test "$XML_CONFIG" = "no" ; then |
| 39 | no_xml=yes |
| 40 | else |
| 41 | XML_CFLAGS=`$XML_CONFIG $xml_config_args --cflags` |
| 42 | XML_LIBS=`$XML_CONFIG $xml_config_args --libs` |
| 43 | xml_config_major_version=`$XML_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 44 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 45 | xml_config_minor_version=`$XML_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 46 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 47 | xml_config_micro_version=`$XML_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 48 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 49 | if test "x$enable_xmltest" = "xyes" ; then |
| 50 | ac_save_CFLAGS="$CFLAGS" |
| 51 | ac_save_LIBS="$LIBS" |
| 52 | CFLAGS="$CFLAGS $XML_CFLAGS" |
| 53 | LIBS="$XML_LIBS $LIBS" |
| 54 | dnl |
| 55 | dnl Now check if the installed libxml is sufficiently new. |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 56 | dnl (Also sanity checks the results of xml-config to some extent) |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 57 | dnl |
| 58 | rm -f conf.xmltest |
| 59 | AC_TRY_RUN([ |
| 60 | #include <stdlib.h> |
| 61 | #include <stdio.h> |
Daniel Veillard | 88e0ad4 | 2002-04-09 13:48:02 +0000 | [diff] [blame] | 62 | #include <string.h> |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 63 | #include <libxml/tree.h> |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 64 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 65 | int |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 66 | main() |
| 67 | { |
| 68 | int xml_major_version, xml_minor_version, xml_micro_version; |
| 69 | int major, minor, micro; |
| 70 | char *tmp_version; |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 71 | int tmp_int_version; |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 72 | |
| 73 | system("touch conf.xmltest"); |
| 74 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 75 | /* Capture xml-config output via autoconf/configure variables */ |
| 76 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
| 77 | tmp_version = (char *)strdup("$min_xml_version"); |
| 78 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
| 79 | printf("%s, bad version string from xml-config\n", "$min_xml_version"); |
| 80 | exit(1); |
| 81 | } |
| 82 | free(tmp_version); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 83 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 84 | /* Capture the version information from the header files */ |
Daniel Veillard | 70ac0e3 | 2001-08-13 11:24:16 +0000 | [diff] [blame] | 85 | tmp_int_version = LIBXML_VERSION; |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 86 | xml_major_version=tmp_int_version / 10000; |
| 87 | xml_minor_version=(tmp_int_version - xml_major_version * 10000) / 100; |
| 88 | xml_micro_version=(tmp_int_version - xml_minor_version * 100 - xml_major_version * 10000); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 89 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 90 | /* Compare xml-config output to the libxml headers */ |
| 91 | if ((xml_major_version != $xml_config_major_version) || |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 92 | (xml_minor_version != $xml_config_minor_version) |
| 93 | #if 0 |
| 94 | || |
| 95 | /* The last released version of libxml-1.x has an incorrect micro version in |
| 96 | * the header file so neither the includes nor the library will match the |
| 97 | * micro_version to the output of xml-config |
| 98 | */ |
| 99 | (xml_micro_version != $xml_config_micro_version) |
| 100 | #endif |
| 101 | ) |
| 102 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 103 | { |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 104 | printf("*** libxml header files (version %d.%d.%d) do not match\n", |
| 105 | xml_major_version, xml_minor_version, xml_micro_version); |
| 106 | printf("*** xml-config (version %d.%d.%d)\n", |
| 107 | $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); |
| 108 | return 1; |
| 109 | } |
| 110 | /* Compare the headers to the library to make sure we match */ |
| 111 | /* Less than ideal -- doesn't provide us with return value feedback, |
| 112 | * only exits if there's a serious mismatch between header and library. |
| 113 | */ |
| 114 | LIBXML_TEST_VERSION; |
| 115 | |
| 116 | /* Test that the library is greater than our minimum version */ |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 117 | if (($xml_config_major_version > major) || |
| 118 | (($xml_config_major_version == major) && ($xml_config_minor_version > minor)) || |
| 119 | (($xml_config_major_version == major) && ($xml_config_minor_version == minor) && |
| 120 | ($xml_config_micro_version >= micro))) |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 121 | { |
| 122 | return 0; |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", |
| 127 | xml_major_version, xml_minor_version, xml_micro_version); |
| 128 | printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", |
| 129 | major, minor, micro); |
| 130 | printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); |
| 131 | printf("***\n"); |
| 132 | printf("*** If you have already installed a sufficiently new version, this error\n"); |
| 133 | printf("*** probably means that the wrong copy of the xml-config shell script is\n"); |
| 134 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
| 135 | printf("*** of LIBXML, but you can also set the XML_CONFIG environment to point to the\n"); |
| 136 | printf("*** correct copy of xml-config. (In this case, you will have to\n"); |
| 137 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
| 138 | printf("*** so that the correct libraries are found at run-time))\n"); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 139 | } |
| 140 | return 1; |
| 141 | } |
| 142 | ],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 143 | CFLAGS="$ac_save_CFLAGS" |
| 144 | LIBS="$ac_save_LIBS" |
| 145 | fi |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 146 | fi |
| 147 | |
| 148 | if test "x$no_xml" = x ; then |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 149 | AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) |
| 150 | ifelse([$2], , :, [$2]) |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 151 | else |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 152 | AC_MSG_RESULT(no) |
| 153 | if test "$XML_CONFIG" = "no" ; then |
| 154 | echo "*** The xml-config script installed by LIBXML could not be found" |
| 155 | echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" |
| 156 | echo "*** your path, or set the XML_CONFIG environment variable to the" |
| 157 | echo "*** full path to xml-config." |
| 158 | else |
| 159 | if test -f conf.xmltest ; then |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 160 | : |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 161 | else |
| 162 | echo "*** Could not run libxml test program, checking why..." |
| 163 | CFLAGS="$CFLAGS $XML_CFLAGS" |
| 164 | LIBS="$LIBS $XML_LIBS" |
| 165 | AC_TRY_LINK([ |
Daniel Veillard | dbb14a7 | 2001-04-26 20:54:01 +0000 | [diff] [blame] | 166 | #include <libxml/tree.h> |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 167 | #include <stdio.h> |
| 168 | ], [ LIBXML_TEST_VERSION; return 0;], |
| 169 | [ echo "*** The test program compiled, but did not run. This usually means" |
| 170 | echo "*** that the run-time linker is not finding LIBXML or finding the wrong" |
| 171 | echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" |
| 172 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
| 173 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
| 174 | echo "*** is required on your system" |
| 175 | echo "***" |
| 176 | echo "*** If you have an old version installed, it is best to remove it, although" |
| 177 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
| 178 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
| 179 | echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" |
| 180 | echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" |
| 181 | echo "*** may want to edit the xml-config script: $XML_CONFIG" ]) |
| 182 | CFLAGS="$ac_save_CFLAGS" |
| 183 | LIBS="$ac_save_LIBS" |
| 184 | fi |
| 185 | fi |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 186 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 187 | XML_CFLAGS="" |
| 188 | XML_LIBS="" |
| 189 | ifelse([$3], , :, [$3]) |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 190 | fi |
| 191 | AC_SUBST(XML_CFLAGS) |
| 192 | AC_SUBST(XML_LIBS) |
| 193 | rm -f conf.xmltest |
| 194 | ]) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 195 | |
| 196 | # Configure paths for LIBXML2 |
| 197 | # Toshio Kuratomi 2001-04-21 |
| 198 | # Adapted from: |
| 199 | # Configure paths for GLIB |
| 200 | # Owen Taylor 97-11-3 |
| 201 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 202 | dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 203 | dnl Test for XML, and define XML_CFLAGS and XML_LIBS |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 204 | dnl |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 205 | AC_DEFUN(AM_PATH_XML2,[ |
| 206 | AC_ARG_WITH(xml-prefix, |
| 207 | [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], |
| 208 | xml_config_prefix="$withval", xml_config_prefix="") |
| 209 | AC_ARG_WITH(xml-exec-prefix, |
| 210 | [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], |
| 211 | xml_config_exec_prefix="$withval", xml_config_exec_prefix="") |
| 212 | AC_ARG_ENABLE(xmltest, |
| 213 | [ --disable-xmltest Do not try to compile and run a test LIBXML program],, |
| 214 | enable_xmltest=yes) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 215 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 216 | if test x$xml_config_exec_prefix != x ; then |
| 217 | xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix" |
| 218 | if test x${XML2_CONFIG+set} != xset ; then |
| 219 | XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 220 | fi |
| 221 | fi |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 222 | if test x$xml_config_prefix != x ; then |
| 223 | xml_config_args="$xml_config_args --prefix=$xml_config_prefix" |
| 224 | if test x${XML2_CONFIG+set} != xset ; then |
| 225 | XML2_CONFIG=$xml_config_prefix/bin/xml2-config |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 226 | fi |
| 227 | fi |
| 228 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 229 | AC_PATH_PROG(XML2_CONFIG, xml2-config, no) |
| 230 | min_xml_version=ifelse([$1], ,2.0.0,[$1]) |
| 231 | AC_MSG_CHECKING(for libxml - version >= $min_xml_version) |
| 232 | no_xml="" |
| 233 | if test "$XML2_CONFIG" = "no" ; then |
| 234 | no_xml=yes |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 235 | else |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 236 | XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags` |
| 237 | XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` |
| 238 | xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 239 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 240 | xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 241 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 242 | xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 243 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 244 | if test "x$enable_xmltest" = "xyes" ; then |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 245 | ac_save_CFLAGS="$CFLAGS" |
| 246 | ac_save_LIBS="$LIBS" |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 247 | CFLAGS="$CFLAGS $XML_CFLAGS" |
| 248 | LIBS="$XML_LIBS $LIBS" |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 249 | dnl |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 250 | dnl Now check if the installed libxml is sufficiently new. |
| 251 | dnl (Also sanity checks the results of xml2-config to some extent) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 252 | dnl |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 253 | rm -f conf.xmltest |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 254 | AC_TRY_RUN([ |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 255 | #include <stdlib.h> |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 256 | #include <stdio.h> |
Daniel Veillard | 88e0ad4 | 2002-04-09 13:48:02 +0000 | [diff] [blame] | 257 | #include <string.h> |
Daniel Veillard | e979e3b | 2002-03-29 22:43:00 +0000 | [diff] [blame] | 258 | #include <libxml/xmlversion.h> |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 259 | |
| 260 | int |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 261 | main() |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 262 | { |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 263 | int xml_major_version, xml_minor_version, xml_micro_version; |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 264 | int major, minor, micro; |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 265 | char *tmp_version; |
| 266 | |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 267 | system("touch conf.xmltest"); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 268 | |
| 269 | /* Capture xml2-config output via autoconf/configure variables */ |
| 270 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 271 | tmp_version = (char *)strdup("$min_xml_version"); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 272 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 273 | printf("%s, bad version string from xml2-config\n", "$min_xml_version"); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 274 | exit(1); |
| 275 | } |
| 276 | free(tmp_version); |
| 277 | |
| 278 | /* Capture the version information from the header files */ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 279 | tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); |
| 280 | if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { |
| 281 | printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); |
| 282 | exit(1); |
| 283 | } |
| 284 | free(tmp_version); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 285 | |
| 286 | /* Compare xml2-config output to the libxml headers */ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 287 | if ((xml_major_version != $xml_config_major_version) || |
| 288 | (xml_minor_version != $xml_config_minor_version) || |
| 289 | (xml_micro_version != $xml_config_micro_version)) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 290 | { |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 291 | printf("*** libxml header files (version %d.%d.%d) do not match\n", |
| 292 | xml_major_version, xml_minor_version, xml_micro_version); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 293 | printf("*** xml2-config (version %d.%d.%d)\n", |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 294 | $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 295 | return 1; |
| 296 | } |
| 297 | /* Compare the headers to the library to make sure we match */ |
| 298 | /* Less than ideal -- doesn't provide us with return value feedback, |
| 299 | * only exits if there's a serious mismatch between header and library. |
| 300 | */ |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 301 | LIBXML_TEST_VERSION; |
| 302 | |
| 303 | /* Test that the library is greater than our minimum version */ |
| 304 | if ((xml_major_version > major) || |
| 305 | ((xml_major_version == major) && (xml_minor_version > minor)) || |
| 306 | ((xml_major_version == major) && (xml_minor_version == minor) && |
| 307 | (xml_micro_version >= micro))) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 308 | { |
| 309 | return 0; |
| 310 | } |
| 311 | else |
| 312 | { |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 313 | printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", |
| 314 | xml_major_version, xml_minor_version, xml_micro_version); |
| 315 | printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", |
| 316 | major, minor, micro); |
| 317 | printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 318 | printf("***\n"); |
| 319 | printf("*** If you have already installed a sufficiently new version, this error\n"); |
| 320 | printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); |
| 321 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 322 | printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 323 | printf("*** correct copy of xml2-config. (In this case, you will have to\n"); |
| 324 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
| 325 | printf("*** so that the correct libraries are found at run-time))\n"); |
| 326 | } |
| 327 | return 1; |
| 328 | } |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 329 | ],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 330 | CFLAGS="$ac_save_CFLAGS" |
| 331 | LIBS="$ac_save_LIBS" |
| 332 | fi |
| 333 | fi |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 334 | |
| 335 | if test "x$no_xml" = x ; then |
| 336 | AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 337 | ifelse([$2], , :, [$2]) |
| 338 | else |
| 339 | AC_MSG_RESULT(no) |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 340 | if test "$XML2_CONFIG" = "no" ; then |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 341 | echo "*** The xml2-config script installed by LIBXML could not be found" |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 342 | echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" |
| 343 | echo "*** your path, or set the XML2_CONFIG environment variable to the" |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 344 | echo "*** full path to xml2-config." |
| 345 | else |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 346 | if test -f conf.xmltest ; then |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 347 | : |
| 348 | else |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 349 | echo "*** Could not run libxml test program, checking why..." |
| 350 | CFLAGS="$CFLAGS $XML_CFLAGS" |
| 351 | LIBS="$LIBS $XML_LIBS" |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 352 | AC_TRY_LINK([ |
Daniel Veillard | e979e3b | 2002-03-29 22:43:00 +0000 | [diff] [blame] | 353 | #include <libxml/xmlversion.h> |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 354 | #include <stdio.h> |
| 355 | ], [ LIBXML_TEST_VERSION; return 0;], |
| 356 | [ echo "*** The test program compiled, but did not run. This usually means" |
| 357 | echo "*** that the run-time linker is not finding LIBXML or finding the wrong" |
| 358 | echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" |
| 359 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
| 360 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
| 361 | echo "*** is required on your system" |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 362 | echo "***" |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 363 | echo "*** If you have an old version installed, it is best to remove it, although" |
| 364 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
| 365 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
| 366 | echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" |
| 367 | echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 368 | echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ]) |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 369 | CFLAGS="$ac_save_CFLAGS" |
| 370 | LIBS="$ac_save_LIBS" |
| 371 | fi |
| 372 | fi |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 373 | |
| 374 | XML_CFLAGS="" |
| 375 | XML_LIBS="" |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 376 | ifelse([$3], , :, [$3]) |
| 377 | fi |
Daniel Veillard | 2913e4c | 2001-04-26 19:29:02 +0000 | [diff] [blame] | 378 | AC_SUBST(XML_CFLAGS) |
| 379 | AC_SUBST(XML_LIBS) |
| 380 | rm -f conf.xmltest |
Daniel Veillard | 5c4ec4c | 2001-04-26 07:43:59 +0000 | [diff] [blame] | 381 | ]) |