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