881 |
dnl This is just to silence aclocal about the macro not being used |
dnl This is just to silence aclocal about the macro not being used |
882 |
ifelse([AC_DISABLE_FAST_INSTALL])dnl |
ifelse([AC_DISABLE_FAST_INSTALL])dnl |
883 |
|
|
884 |
|
# Configure paths for LIBXML2 |
885 |
|
# Toshio Kuratomi 2001-04-21 |
886 |
|
# Adapted from: |
887 |
|
# Configure paths for GLIB |
888 |
|
# Owen Taylor 97-11-3 |
889 |
|
|
890 |
|
dnl AM_PATH_XML([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
891 |
|
dnl Test for XML, and define XML_CFLAGS and XML_LIBS |
892 |
|
dnl |
893 |
|
AC_DEFUN(AM_PATH_XML,[ |
894 |
|
AC_ARG_WITH(xml-prefix, |
895 |
|
[ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], |
896 |
|
xml_config_prefix="$withval", xml_config_prefix="") |
897 |
|
AC_ARG_WITH(xml-exec-prefix, |
898 |
|
[ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], |
899 |
|
xml_config_exec_prefix="$withval", xml_config_exec_prefix="") |
900 |
|
AC_ARG_ENABLE(xmltest, |
901 |
|
[ --disable-xmltest Do not try to compile and run a test LIBXML program],, |
902 |
|
enable_xmltest=yes) |
903 |
|
|
904 |
|
if test x$xml_config_exec_prefix != x ; then |
905 |
|
xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix" |
906 |
|
if test x${XML_CONFIG+set} != xset ; then |
907 |
|
XML_CONFIG=$xml_config_exec_prefix/bin/xml-config |
908 |
|
fi |
909 |
|
fi |
910 |
|
if test x$xml_config_prefix != x ; then |
911 |
|
xml_config_args="$xml_config_args --prefix=$xml_config_prefix" |
912 |
|
if test x${XML_CONFIG+set} != xset ; then |
913 |
|
XML_CONFIG=$xml_config_prefix/bin/xml-config |
914 |
|
fi |
915 |
|
fi |
916 |
|
|
917 |
|
AC_PATH_PROG(XML_CONFIG, xml-config, no) |
918 |
|
min_xml_version=ifelse([$1], ,1.0.0,[$1]) |
919 |
|
AC_MSG_CHECKING(for libxml - version >= $min_xml_version) |
920 |
|
no_xml="" |
921 |
|
if test "$XML_CONFIG" = "no" ; then |
922 |
|
no_xml=yes |
923 |
|
else |
924 |
|
XML_CFLAGS=`$XML_CONFIG $xml_config_args --cflags` |
925 |
|
XML_LIBS=`$XML_CONFIG $xml_config_args --libs` |
926 |
|
xml_config_major_version=`$XML_CONFIG $xml_config_args --version | \ |
927 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
928 |
|
xml_config_minor_version=`$XML_CONFIG $xml_config_args --version | \ |
929 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
930 |
|
xml_config_micro_version=`$XML_CONFIG $xml_config_args --version | \ |
931 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
932 |
|
if test "x$enable_xmltest" = "xyes" ; then |
933 |
|
ac_save_CFLAGS="$CFLAGS" |
934 |
|
ac_save_LIBS="$LIBS" |
935 |
|
CFLAGS="$CFLAGS $XML_CFLAGS" |
936 |
|
LIBS="$XML_LIBS $LIBS" |
937 |
|
dnl |
938 |
|
dnl Now check if the installed libxml is sufficiently new. |
939 |
|
dnl (Also sanity checks the results of xml-config to some extent) |
940 |
|
dnl |
941 |
|
rm -f conf.xmltest |
942 |
|
AC_TRY_RUN([ |
943 |
|
#include <stdlib.h> |
944 |
|
#include <stdio.h> |
945 |
|
#include <libxml/tree.h> |
946 |
|
|
947 |
|
int |
948 |
|
main() |
949 |
|
{ |
950 |
|
int xml_major_version, xml_minor_version, xml_micro_version; |
951 |
|
int major, minor, micro; |
952 |
|
char *tmp_version; |
953 |
|
int tmp_int_version; |
954 |
|
|
955 |
|
system("touch conf.xmltest"); |
956 |
|
|
957 |
|
/* Capture xml-config output via autoconf/configure variables */ |
958 |
|
/* HP/UX 9 (%@#!) writes to sscanf strings */ |
959 |
|
tmp_version = (char *)strdup("$min_xml_version"); |
960 |
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
961 |
|
printf("%s, bad version string from xml-config\n", "$min_xml_version"); |
962 |
|
exit(1); |
963 |
|
} |
964 |
|
free(tmp_version); |
965 |
|
|
966 |
|
/* Capture the version information from the header files */ |
967 |
|
tmp_int_version = LIBXML_VERSION; |
968 |
|
xml_major_version=tmp_int_version / 10000; |
969 |
|
xml_minor_version=(tmp_int_version - xml_major_version * 10000) / 100; |
970 |
|
xml_micro_version=(tmp_int_version - xml_minor_version * 100 - xml_major_version * 10000); |
971 |
|
|
972 |
|
/* Compare xml-config output to the libxml headers */ |
973 |
|
if ((xml_major_version != $xml_config_major_version) || |
974 |
|
(xml_minor_version != $xml_config_minor_version) |
975 |
|
#if 0 |
976 |
|
|| |
977 |
|
/* The last released version of libxml-1.x has an incorrect micro version in |
978 |
|
* the header file so neither the includes nor the library will match the |
979 |
|
* micro_version to the output of xml-config |
980 |
|
*/ |
981 |
|
(xml_micro_version != $xml_config_micro_version) |
982 |
|
#endif |
983 |
|
) |
984 |
|
|
985 |
|
{ |
986 |
|
printf("*** libxml header files (version %d.%d.%d) do not match\n", |
987 |
|
xml_major_version, xml_minor_version, xml_micro_version); |
988 |
|
printf("*** xml-config (version %d.%d.%d)\n", |
989 |
|
$xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); |
990 |
|
return 1; |
991 |
|
} |
992 |
|
/* Compare the headers to the library to make sure we match */ |
993 |
|
/* Less than ideal -- doesn't provide us with return value feedback, |
994 |
|
* only exits if there's a serious mismatch between header and library. |
995 |
|
*/ |
996 |
|
LIBXML_TEST_VERSION; |
997 |
|
|
998 |
|
/* Test that the library is greater than our minimum version */ |
999 |
|
if (($xml_config_major_version > major) || |
1000 |
|
(($xml_config_major_version == major) && ($xml_config_minor_version > minor)) || |
1001 |
|
(($xml_config_major_version == major) && ($xml_config_minor_version == minor) && |
1002 |
|
($xml_config_micro_version >= micro))) |
1003 |
|
{ |
1004 |
|
return 0; |
1005 |
|
} |
1006 |
|
else |
1007 |
|
{ |
1008 |
|
printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", |
1009 |
|
xml_major_version, xml_minor_version, xml_micro_version); |
1010 |
|
printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", |
1011 |
|
major, minor, micro); |
1012 |
|
printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); |
1013 |
|
printf("***\n"); |
1014 |
|
printf("*** If you have already installed a sufficiently new version, this error\n"); |
1015 |
|
printf("*** probably means that the wrong copy of the xml-config shell script is\n"); |
1016 |
|
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
1017 |
|
printf("*** of LIBXML, but you can also set the XML_CONFIG environment to point to the\n"); |
1018 |
|
printf("*** correct copy of xml-config. (In this case, you will have to\n"); |
1019 |
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
1020 |
|
printf("*** so that the correct libraries are found at run-time))\n"); |
1021 |
|
} |
1022 |
|
return 1; |
1023 |
|
} |
1024 |
|
],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
1025 |
|
CFLAGS="$ac_save_CFLAGS" |
1026 |
|
LIBS="$ac_save_LIBS" |
1027 |
|
fi |
1028 |
|
fi |
1029 |
|
|
1030 |
|
if test "x$no_xml" = x ; then |
1031 |
|
AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) |
1032 |
|
ifelse([$2], , :, [$2]) |
1033 |
|
else |
1034 |
|
AC_MSG_RESULT(no) |
1035 |
|
if test "$XML_CONFIG" = "no" ; then |
1036 |
|
echo "*** The xml-config script installed by LIBXML could not be found" |
1037 |
|
echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" |
1038 |
|
echo "*** your path, or set the XML_CONFIG environment variable to the" |
1039 |
|
echo "*** full path to xml-config." |
1040 |
|
else |
1041 |
|
if test -f conf.xmltest ; then |
1042 |
|
: |
1043 |
|
else |
1044 |
|
echo "*** Could not run libxml test program, checking why..." |
1045 |
|
CFLAGS="$CFLAGS $XML_CFLAGS" |
1046 |
|
LIBS="$LIBS $XML_LIBS" |
1047 |
|
AC_TRY_LINK([ |
1048 |
|
#include <libxml/tree.h> |
1049 |
|
#include <stdio.h> |
1050 |
|
], [ LIBXML_TEST_VERSION; return 0;], |
1051 |
|
[ echo "*** The test program compiled, but did not run. This usually means" |
1052 |
|
echo "*** that the run-time linker is not finding LIBXML or finding the wrong" |
1053 |
|
echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" |
1054 |
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
1055 |
|
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
1056 |
|
echo "*** is required on your system" |
1057 |
|
echo "***" |
1058 |
|
echo "*** If you have an old version installed, it is best to remove it, although" |
1059 |
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
1060 |
|
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
1061 |
|
echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" |
1062 |
|
echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" |
1063 |
|
echo "*** may want to edit the xml-config script: $XML_CONFIG" ]) |
1064 |
|
CFLAGS="$ac_save_CFLAGS" |
1065 |
|
LIBS="$ac_save_LIBS" |
1066 |
|
fi |
1067 |
|
fi |
1068 |
|
|
1069 |
|
XML_CFLAGS="" |
1070 |
|
XML_LIBS="" |
1071 |
|
ifelse([$3], , :, [$3]) |
1072 |
|
fi |
1073 |
|
AC_SUBST(XML_CFLAGS) |
1074 |
|
AC_SUBST(XML_LIBS) |
1075 |
|
rm -f conf.xmltest |
1076 |
|
]) |
1077 |
|
|
1078 |
|
# Configure paths for LIBXML2 |
1079 |
|
# Toshio Kuratomi 2001-04-21 |
1080 |
|
# Adapted from: |
1081 |
|
# Configure paths for GLIB |
1082 |
|
# Owen Taylor 97-11-3 |
1083 |
|
|
1084 |
|
dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
1085 |
|
dnl Test for XML, and define XML_CFLAGS and XML_LIBS |
1086 |
|
dnl |
1087 |
|
AC_DEFUN(AM_PATH_XML2,[ |
1088 |
|
AC_ARG_WITH(xml-prefix, |
1089 |
|
[ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], |
1090 |
|
xml_config_prefix="$withval", xml_config_prefix="") |
1091 |
|
AC_ARG_WITH(xml-exec-prefix, |
1092 |
|
[ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], |
1093 |
|
xml_config_exec_prefix="$withval", xml_config_exec_prefix="") |
1094 |
|
AC_ARG_ENABLE(xmltest, |
1095 |
|
[ --disable-xmltest Do not try to compile and run a test LIBXML program],, |
1096 |
|
enable_xmltest=yes) |
1097 |
|
|
1098 |
|
if test x$xml_config_exec_prefix != x ; then |
1099 |
|
xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix" |
1100 |
|
if test x${XML2_CONFIG+set} != xset ; then |
1101 |
|
XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config |
1102 |
|
fi |
1103 |
|
fi |
1104 |
|
if test x$xml_config_prefix != x ; then |
1105 |
|
xml_config_args="$xml_config_args --prefix=$xml_config_prefix" |
1106 |
|
if test x${XML2_CONFIG+set} != xset ; then |
1107 |
|
XML2_CONFIG=$xml_config_prefix/bin/xml2-config |
1108 |
|
fi |
1109 |
|
fi |
1110 |
|
|
1111 |
|
AC_PATH_PROG(XML2_CONFIG, xml2-config, no) |
1112 |
|
min_xml_version=ifelse([$1], ,2.0.0,[$1]) |
1113 |
|
AC_MSG_CHECKING(for libxml - version >= $min_xml_version) |
1114 |
|
no_xml="" |
1115 |
|
if test "$XML2_CONFIG" = "no" ; then |
1116 |
|
no_xml=yes |
1117 |
|
else |
1118 |
|
XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags` |
1119 |
|
XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` |
1120 |
|
xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ |
1121 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
1122 |
|
xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ |
1123 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
1124 |
|
xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ |
1125 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
1126 |
|
if test "x$enable_xmltest" = "xyes" ; then |
1127 |
|
ac_save_CFLAGS="$CFLAGS" |
1128 |
|
ac_save_LIBS="$LIBS" |
1129 |
|
CFLAGS="$CFLAGS $XML_CFLAGS" |
1130 |
|
LIBS="$XML_LIBS $LIBS" |
1131 |
|
dnl |
1132 |
|
dnl Now check if the installed libxml is sufficiently new. |
1133 |
|
dnl (Also sanity checks the results of xml2-config to some extent) |
1134 |
|
dnl |
1135 |
|
rm -f conf.xmltest |
1136 |
|
AC_TRY_RUN([ |
1137 |
|
#include <stdlib.h> |
1138 |
|
#include <stdio.h> |
1139 |
|
#include <xmlversion.h> |
1140 |
|
|
1141 |
|
int |
1142 |
|
main() |
1143 |
|
{ |
1144 |
|
int xml_major_version, xml_minor_version, xml_micro_version; |
1145 |
|
int major, minor, micro; |
1146 |
|
char *tmp_version; |
1147 |
|
|
1148 |
|
system("touch conf.xmltest"); |
1149 |
|
|
1150 |
|
/* Capture xml2-config output via autoconf/configure variables */ |
1151 |
|
/* HP/UX 9 (%@#!) writes to sscanf strings */ |
1152 |
|
tmp_version = (char *)strdup("$min_xml_version"); |
1153 |
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
1154 |
|
printf("%s, bad version string from xml2-config\n", "$min_xml_version"); |
1155 |
|
exit(1); |
1156 |
|
} |
1157 |
|
free(tmp_version); |
1158 |
|
|
1159 |
|
/* Capture the version information from the header files */ |
1160 |
|
tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); |
1161 |
|
if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { |
1162 |
|
printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); |
1163 |
|
exit(1); |
1164 |
|
} |
1165 |
|
free(tmp_version); |
1166 |
|
|
1167 |
|
/* Compare xml2-config output to the libxml headers */ |
1168 |
|
if ((xml_major_version != $xml_config_major_version) || |
1169 |
|
(xml_minor_version != $xml_config_minor_version) || |
1170 |
|
(xml_micro_version != $xml_config_micro_version)) |
1171 |
|
{ |
1172 |
|
printf("*** libxml header files (version %d.%d.%d) do not match\n", |
1173 |
|
xml_major_version, xml_minor_version, xml_micro_version); |
1174 |
|
printf("*** xml2-config (version %d.%d.%d)\n", |
1175 |
|
$xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); |
1176 |
|
return 1; |
1177 |
|
} |
1178 |
|
/* Compare the headers to the library to make sure we match */ |
1179 |
|
/* Less than ideal -- doesn't provide us with return value feedback, |
1180 |
|
* only exits if there's a serious mismatch between header and library. |
1181 |
|
*/ |
1182 |
|
LIBXML_TEST_VERSION; |
1183 |
|
|
1184 |
|
/* Test that the library is greater than our minimum version */ |
1185 |
|
if ((xml_major_version > major) || |
1186 |
|
((xml_major_version == major) && (xml_minor_version > minor)) || |
1187 |
|
((xml_major_version == major) && (xml_minor_version == minor) && |
1188 |
|
(xml_micro_version >= micro))) |
1189 |
|
{ |
1190 |
|
return 0; |
1191 |
|
} |
1192 |
|
else |
1193 |
|
{ |
1194 |
|
printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", |
1195 |
|
xml_major_version, xml_minor_version, xml_micro_version); |
1196 |
|
printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", |
1197 |
|
major, minor, micro); |
1198 |
|
printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); |
1199 |
|
printf("***\n"); |
1200 |
|
printf("*** If you have already installed a sufficiently new version, this error\n"); |
1201 |
|
printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); |
1202 |
|
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
1203 |
|
printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); |
1204 |
|
printf("*** correct copy of xml2-config. (In this case, you will have to\n"); |
1205 |
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
1206 |
|
printf("*** so that the correct libraries are found at run-time))\n"); |
1207 |
|
} |
1208 |
|
return 1; |
1209 |
|
} |
1210 |
|
],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
1211 |
|
CFLAGS="$ac_save_CFLAGS" |
1212 |
|
LIBS="$ac_save_LIBS" |
1213 |
|
fi |
1214 |
|
fi |
1215 |
|
|
1216 |
|
if test "x$no_xml" = x ; then |
1217 |
|
AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) |
1218 |
|
ifelse([$2], , :, [$2]) |
1219 |
|
else |
1220 |
|
AC_MSG_RESULT(no) |
1221 |
|
if test "$XML2_CONFIG" = "no" ; then |
1222 |
|
echo "*** The xml2-config script installed by LIBXML could not be found" |
1223 |
|
echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" |
1224 |
|
echo "*** your path, or set the XML2_CONFIG environment variable to the" |
1225 |
|
echo "*** full path to xml2-config." |
1226 |
|
else |
1227 |
|
if test -f conf.xmltest ; then |
1228 |
|
: |
1229 |
|
else |
1230 |
|
echo "*** Could not run libxml test program, checking why..." |
1231 |
|
CFLAGS="$CFLAGS $XML_CFLAGS" |
1232 |
|
LIBS="$LIBS $XML_LIBS" |
1233 |
|
AC_TRY_LINK([ |
1234 |
|
#include <xmlversion.h> |
1235 |
|
#include <stdio.h> |
1236 |
|
], [ LIBXML_TEST_VERSION; return 0;], |
1237 |
|
[ echo "*** The test program compiled, but did not run. This usually means" |
1238 |
|
echo "*** that the run-time linker is not finding LIBXML or finding the wrong" |
1239 |
|
echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" |
1240 |
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
1241 |
|
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
1242 |
|
echo "*** is required on your system" |
1243 |
|
echo "***" |
1244 |
|
echo "*** If you have an old version installed, it is best to remove it, although" |
1245 |
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
1246 |
|
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
1247 |
|
echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" |
1248 |
|
echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" |
1249 |
|
echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ]) |
1250 |
|
CFLAGS="$ac_save_CFLAGS" |
1251 |
|
LIBS="$ac_save_LIBS" |
1252 |
|
fi |
1253 |
|
fi |
1254 |
|
|
1255 |
|
XML_CFLAGS="" |
1256 |
|
XML_LIBS="" |
1257 |
|
ifelse([$3], , :, [$3]) |
1258 |
|
fi |
1259 |
|
AC_SUBST(XML_CFLAGS) |
1260 |
|
AC_SUBST(XML_LIBS) |
1261 |
|
rm -f conf.xmltest |
1262 |
|
]) |
1263 |
|
|