Use pkg-config to check for libxml.

This commit is contained in:
fredkiefer 2020-02-05 23:10:53 +01:00
parent f261ae3a90
commit 4b5594c63d
2 changed files with 425 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2020-02-05 Fred Kiefer <fredkiefer@gmx.de>
* configure.ac: Use pkg-config to check for libxml.
* configure: regenerate
2020-01-23 Fred Kiefer <fredkiefer@gmx.de>
* Source/Additions/NSURL+GNUstepBase.m: Handle case where scheme

433
configure vendored
View file

@ -645,10 +645,10 @@ TLS_CFLAGS
TLS_CONFIG
HAVE_LIBXML
HAVE_LIBXSLT
XML_LIBS
XML_CFLAGS
XML_CONFIG
XML2_CONFIG
XML_LIBS
XML_CFLAGS
WITH_FFI
GS_FAKE_MAIN
GS_PASS_ARGUMENTS
@ -838,6 +838,8 @@ CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
XML_CFLAGS
XML_LIBS
ICU_CFLAGS
ICU_LIBS'
@ -1590,6 +1592,8 @@ Some influential environment variables:
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
XML_CFLAGS C compiler flags for XML, overriding pkg-config
XML_LIBS linker flags for XML, overriding pkg-config
ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
ICU_LIBS linker flags for ICU, overriding pkg-config
@ -11252,11 +11256,68 @@ else
fi
HAVE_LIBXML=0
if test $enable_xml = yes; then
# Save CFLAGS and LIBS as AM_PATH_XML clobbers these variables regardless
# of the success of the macro.
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML" >&5
$as_echo_n "checking for XML... " >&6; }
if test -n "$XML_CFLAGS"; then
pkg_cv_XML_CFLAGS="$XML_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.3.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.3.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XML_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.3.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$XML_LIBS"; then
pkg_cv_XML_LIBS="$XML_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.3.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.3.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XML_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.3.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
XML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.3.0" 2>&1`
else
XML_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.3.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$XML_PKG_ERRORS" >&5
@ -11594,6 +11655,356 @@ $as_echo "no" >&6; }
rm -f conf.xmltest
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
# Check whether --with-xml-prefix was given.
if test "${with_xml_prefix+set}" = set; then :
withval=$with_xml_prefix; xml_config_prefix="$withval"
else
xml_config_prefix=""
fi
# Check whether --enable-xmltest was given.
if test "${enable_xmltest+set}" = set; then :
enableval=$enable_xmltest;
else
enable_xmltest=yes
fi
if test x$xml_config_prefix != x ; then
xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
if test x${XML2_CONFIG+set} != xset ; then
XML2_CONFIG=$xml_config_prefix/bin/xml2-config
fi
if test x${XML_CONFIG+set} != xset ; then
XML_CONFIG=$xml_config_prefix/bin/xml-config
fi
fi
# Extract the first word of "xml2-config", so it can be a program name with args.
set dummy xml2-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_XML2_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XML2_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_XML2_CONFIG" && ac_cv_path_XML2_CONFIG="no"
;;
esac
fi
XML2_CONFIG=$ac_cv_path_XML2_CONFIG
if test -n "$XML2_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5
$as_echo "$XML2_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$XML2_CONFIG" = "no" ; then
# Extract the first word of "xml-config", so it can be a program name with args.
set dummy xml-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_XML_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XML_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_XML_CONFIG="$XML_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XML_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_XML_CONFIG" && ac_cv_path_XML_CONFIG="no"
;;
esac
fi
XML_CONFIG=$ac_cv_path_XML_CONFIG
if test -n "$XML_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML_CONFIG" >&5
$as_echo "$XML_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
XML_CONFIG=$XML2_CONFIG
fi
min_xml_version=2.3.0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml - version >= $min_xml_version" >&5
$as_echo_n "checking for libxml - version >= $min_xml_version... " >&6; }
no_xml=""
if test "$XML_CONFIG" = "no" ; then
XML_CFLAGS=""
XML_LIBS="-lxml2"
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $XML_CFLAGS"
LIBS="$XML_LIBS $LIBS"
rm -f conf.xmltest
if test "$cross_compiling" = yes; then :
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
int
main()
{
int xml_major_version, xml_minor_version, xml_micro_version;
int major, minor, micro;
char *tmp_version;
system("touch conf.xmltest");
tmp_version = xmlStrdup("$min_xml_version");
if(sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_xml_version");
exit(1);
}
tmp_version = xmlStrdup(LIBXML_DOTTED_VERSION);
if(sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
printf("%s, bad version string\n", "$min_xml_version");
exit(1);
}
if ((xml_major_version > major) ||
((xml_major_version == major) && (xml_minor_version > minor)) ||
((xml_major_version == major) && (xml_minor_version == minor) &&
(xml_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
xml_major_version, xml_minor_version, xml_micro_version);
printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** libxml is always available from ftp://ftp.gnome.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the xml-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of libxml, but you can also set the XML_CONFIG environment to point to the\n");
printf("*** correct copy of xml-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
return 1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
no_xml=yes
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
else
XML_CFLAGS=`$XML_CONFIG $xml_config_args --cflags`
XML_LIBS=`$XML_CONFIG $xml_config_args --libs`
xml_config_major_version=`$XML_CONFIG $xml_config_args --version | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
xml_config_minor_version=`$XML_CONFIG $xml_config_args --version | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
xml_config_micro_version=`$XML_CONFIG $xml_config_args --version | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
if test "x$enable_xmltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $XML_CFLAGS"
LIBS="$XML_LIBS $LIBS"
rm -f conf.xmltest
if test "$cross_compiling" = yes; then :
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
int
main()
{
int xml_major_version, xml_minor_version, xml_micro_version;
int major, minor, micro;
char *tmp_version;
system("touch conf.xmltest");
tmp_version = xmlStrdup("$min_xml_version");
if(sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_xml_version");
exit(1);
}
tmp_version = xmlStrdup(LIBXML_DOTTED_VERSION);
if(sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
printf("%s, bad version string\n", "$min_xml_version");
exit(1);
}
if((xml_major_version != $xml_config_major_version) ||
(xml_minor_version != $xml_config_minor_version) ||
(xml_micro_version != $xml_config_micro_version))
{
printf("\n*** 'xml-config --version' returned %d.%d.%d, but libxml (%d.%d.%d)\n",
$xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version,
xml_major_version, xml_minor_version, xml_micro_version);
printf("*** was found! If xml-config was correct, then it is best\n");
printf("*** to remove the old version of libxml. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If xml-config was wrong, set the environment variable XML_CONFIG\n");
printf("*** to point to the correct copy of xml-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else
{
if ((xml_major_version > major) ||
((xml_major_version == major) && (xml_minor_version > minor)) ||
((xml_major_version == major) && (xml_minor_version == minor) &&
(xml_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
xml_major_version, xml_minor_version, xml_micro_version);
printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** libxml is always available from ftp://ftp.gnome.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the xml-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of libxml, but you can also set the XML_CONFIG environment to point to the\n");
printf("*** correct copy of xml-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
no_xml=yes
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_xml" = x ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
enable_libxml=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if test "$XML_CONFIG" = "no" ; then
echo "*** The xml-config script installed by libxml could not be found"
echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the XML_CONFIG environment variable to the"
echo "*** full path to xml-config."
else
if test -f conf.xmltest ; then
:
else
echo "*** Could not run libxml test program, checking why..."
CFLAGS="$CFLAGS $XML_CFLAGS"
LIBS="$LIBS $XML_LIBS"
fi
fi
XML_CFLAGS=""
XML_LIBS=""
enable_libxml=no
fi
rm -f conf.xmltest
else
XML_CFLAGS=$pkg_cv_XML_CFLAGS
XML_LIBS=$pkg_cv_XML_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
enable_libxml=yes
fi
if test $enable_libxml = yes; then
CPPFLAGS="$CPPFLAGS $XML_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $XML_CFLAGS"
@ -11614,6 +12025,7 @@ fi
done
#--------------------------------------------------------------------
# Check for (optional) libxslt
#--------------------------------------------------------------------
@ -11703,10 +12115,6 @@ $as_echo "$as_me: WARNING: Disabled support for XSLT funtionality." >&2;}
fi
else
HAVE_LIBXML=0
# Restore the CFLAGS and LIBS because AM_PATH_XML messes them
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
echo
echo "You do not appear to have usable libxml2 headers/library."
echo "Building without them will disable the GSXML and NSXMLNode."
@ -11716,9 +12124,8 @@ $as_echo "$as_me: WARNING: Disabled support for XSLT funtionality." >&2;}
as_fn_error $? "Missing support for XML DOM functionality." "$LINENO" 5
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabled support for XML funtionality." >&5
$as_echo "$as_me: WARNING: Disabled support for XML funtionality." >&2;}
HAVE_LIBXML=0
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: XML functionality disabled." >&5
$as_echo "$as_me: WARNING: XML functionality disabled." >&2;}
fi