Attempt to improve detection of libxml2

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20734 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-02-16 14:45:07 +00:00
parent 61dac0f08f
commit bdad1bf7e0
4 changed files with 619 additions and 576 deletions

View file

@ -1,3 +1,12 @@
2005-02-16 14:40 Richard Frith-Macdonald <rfm@gnu.org>
* config/patchxml.m4: Try to detect libxml2 in standard directories
exen if xml2-config is not present.
* configure.ac: Detect libxml2 becore iconv, in case libxml2
requires iconv (which it usually will on a system where iconv is
not built into the standard c library).
* confingure: Regenerate
2005-02-15 08:00 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSTask.m: Fix incorrect version comitted.

View file

@ -25,7 +25,73 @@ AC_ARG_ENABLE(xmltest,
AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
no_xml=""
if test "$XML_CONFIG" = "no" ; then
no_xml=yes
XML_CFLAGS=""
XML_LIBS="-lxml2"
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $XML_CFLAGS"
LIBS="$XML_LIBS $LIBS"
dnl
dnl Now check if the installed libxml is sufficiently new.
dnl
rm -f conf.xmltest
AC_TRY_RUN([
#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;
}
],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
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`

889
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1042,123 +1042,12 @@ if test $ffi_ok = no; then
fi
AC_SUBST(WITH_FFI)
#--------------------------------------------------------------------
# Check recent libxml for Properytlists, GSXML, GSDoc etc.
#--------------------------------------------------------------------
AC_ARG_ENABLE(xml,
[ --disable-xml Compile even if XML-dependencies are not met],,
enable_xml=yes)
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"
AM_PATH_XML(2.3.0, enable_libxml=yes, enable_libxml=no)
if test $enable_libxml = yes; then
CPPFLAGS="$CPPFLAGS $XML_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $XML_CFLAGS"
LIBS="$XML_LIBS $LIBS"
HAVE_LIBXML=1
AC_DEFINE(HAVE_LIBXML,1,[Define if libxml available])
AC_CHECK_HEADERS(libxml/SAX2.h)
#--------------------------------------------------------------------
# Check for (optional) libxslt
#--------------------------------------------------------------------
AC_ARG_ENABLE(xslt,
[ --disable-xslt Compile even if XSLT-dependency is not met],,
enable_xslt=yes)
if test $enable_xslt = yes; then
AC_CHECK_LIB(xslt, xsltApplyStylesheet, xslt_ok=yes, xslt_ok=no)
if test "$xslt_ok" = "yes"; then
AC_CHECK_HEADER(libxslt/xslt.h, xslthdr_ok=yes, xslthdr_ok=no)
if test "$xslthdr_ok" = "no"; then
xslt_ok=no
fi
fi
if test "$xslt_ok" = "yes"; then
HAVE_LIBXSLT=1
AC_DEFINE(HAVE_LIBXSLT,1,[Define if libxslt available])
LIBS="-lxslt $LIBS"
else
echo
echo "You most likely do not want to build base without XSLT support."
echo "If you really want to build -base without XSLT support, add --disable-xslt"
echo "to the configure arguments."
AC_MSG_WARN([Missing support for XSLT functionality.])
fi
else
HAVE_LIBXSLT=0
AC_MSG_WARN([Disabled support for XSLT funtionality.])
fi
AC_SUBST(HAVE_LIBXSLT)
else
HAVE_LIBXML=0
# Restore the CFLAGS and LIBS because AM_PATH_XML messes them
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
echo
echo "You most likely do not want to build base without XML support."
echo "For instance, MacOS-X compatible property lists require XML."
echo "If you really want to build -base without XML support, add --disable-xml"
echo "to the configure arguments."
AC_MSG_ERROR([Missing support for XML functionality.])
fi
else
AC_MSG_WARN([Disabled support for XML funtionality.])
HAVE_LIBXML=0
fi
AC_SUBST(HAVE_LIBXML)
#--------------------------------------------------------------------
# Check GMP for NSDecimal
#--------------------------------------------------------------------
AC_ARG_WITH(gmp-include,
[ --with-gmp-include=PATH include path for gmp headers],
gmp_incdir="$withval", gmp_incdir="no")
AC_ARG_WITH(gmp-library,
[ --with-gmp-library=PATH library path for gmp libraries],
gmp_libdir="$withval", gmp_libdir="no")
libs_temp=$LIBS
if test "$gmp_incdir" != "no"; then
CPPFLAGS="$CPPFLAGS -I$gmp_incdir"
INCLUDE_FLAGS="$INCLUDE_FLAGS -I$gmp_incdir"
fi
if test "$gmp_libdir" != "no"; then
LDFLAGS="$LDFLAGS -L$gmp_libdir"
LDIR_FLAGS="$LDIR_FLAGS -L$gmp_libdir"
fi
USE_GMP=0
AC_CHECK_HEADERS(gmp.h)
if test $ac_cv_header_gmp_h = yes; then
AC_CHECK_LIB(gmp, mpf_abs, gmp_ok=yes, gmp_ok=no)
if test "$gmp_ok" = no; then
AC_CHECK_LIB(gmp, __gmpf_abs, gmp_ok=yes, gmp_ok=no)
fi
if test "$gmp_ok" = yes; then
LIBS="-lgmp $LIBS"
USE_GMP=1
fi
fi
AC_SUBST(USE_GMP)
#--------------------------------------------------------------------
# Check whether nl_langinfo(CODESET) is supported, needed by Unicode.m.
#--------------------------------------------------------------------
AM_LANGINFO_CODESET
#--------------------------------------------------------------------
# Check for iconv support (for Unicode conversion).
#--------------------------------------------------------------------
# Do this before checking for xml2, as xml2 may require iconv.
#
# We need to find an iconv library that matches the installed iconv.h header
# (if any). It is important to check header/library compatibility. It's
# fairly common to have iconv support both in libc and from libiconv. In that
@ -1224,6 +1113,120 @@ if test $found_iconv = no ; then
)
fi
#--------------------------------------------------------------------
# Check recent libxml for Properytlists, GSXML, GSDoc etc.
#--------------------------------------------------------------------
AC_ARG_ENABLE(xml,
[ --disable-xml Compile even if XML-dependencies are not met],,
enable_xml=yes)
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"
AM_PATH_XML(2.3.0, enable_libxml=yes, enable_libxml=no)
if test $enable_libxml = yes; then
CPPFLAGS="$CPPFLAGS $XML_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $XML_CFLAGS"
LIBS="$XML_LIBS $LIBS"
HAVE_LIBXML=1
AC_DEFINE(HAVE_LIBXML,1,[Define if libxml available])
AC_CHECK_HEADERS(libxml/SAX2.h)
#--------------------------------------------------------------------
# Check for (optional) libxslt
#--------------------------------------------------------------------
AC_ARG_ENABLE(xslt,
[ --disable-xslt Compile even if XSLT-dependency is not met],,
enable_xslt=yes)
if test $enable_xslt = yes; then
AC_CHECK_LIB(xslt, xsltApplyStylesheet, xslt_ok=yes, xslt_ok=no)
if test "$xslt_ok" = "yes"; then
AC_CHECK_HEADER(libxslt/xslt.h, xslthdr_ok=yes, xslthdr_ok=no)
if test "$xslthdr_ok" = "no"; then
xslt_ok=no
fi
fi
if test "$xslt_ok" = "yes"; then
HAVE_LIBXSLT=1
AC_DEFINE(HAVE_LIBXSLT,1,[Define if libxslt available])
LIBS="-lxslt $LIBS"
else
echo
echo "You most likely do not want to build base without XSLT support."
echo "If you really want to build -base without XSLT support,"
echo "add --disable-xslt to the configure arguments."
AC_MSG_WARN([Missing support for XSLT functionality.])
fi
else
HAVE_LIBXSLT=0
AC_MSG_WARN([Disabled support for XSLT funtionality.])
fi
AC_SUBST(HAVE_LIBXSLT)
else
HAVE_LIBXML=0
# Restore the CFLAGS and LIBS because AM_PATH_XML messes them
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
echo
echo "You most likely do not want to build base without XML support."
echo "For instance, MacOS-X compatible property lists require XML."
echo "If you really want to build -base without XML support,"
echo "add --disable-xml to the configure arguments."
AC_MSG_ERROR([Missing support for XML functionality.])
fi
else
AC_MSG_WARN([Disabled support for XML funtionality.])
HAVE_LIBXML=0
fi
AC_SUBST(HAVE_LIBXML)
#--------------------------------------------------------------------
# Check GMP for NSDecimal
#--------------------------------------------------------------------
AC_ARG_WITH(gmp-include,
[ --with-gmp-include=PATH include path for gmp headers],
gmp_incdir="$withval", gmp_incdir="no")
AC_ARG_WITH(gmp-library,
[ --with-gmp-library=PATH library path for gmp libraries],
gmp_libdir="$withval", gmp_libdir="no")
libs_temp=$LIBS
if test "$gmp_incdir" != "no"; then
CPPFLAGS="$CPPFLAGS -I$gmp_incdir"
INCLUDE_FLAGS="$INCLUDE_FLAGS -I$gmp_incdir"
fi
if test "$gmp_libdir" != "no"; then
LDFLAGS="$LDFLAGS -L$gmp_libdir"
LDIR_FLAGS="$LDIR_FLAGS -L$gmp_libdir"
fi
USE_GMP=0
AC_CHECK_HEADERS(gmp.h)
if test $ac_cv_header_gmp_h = yes; then
AC_CHECK_LIB(gmp, mpf_abs, gmp_ok=yes, gmp_ok=no)
if test "$gmp_ok" = no; then
AC_CHECK_LIB(gmp, __gmpf_abs, gmp_ok=yes, gmp_ok=no)
fi
if test "$gmp_ok" = yes; then
LIBS="-lgmp $LIBS"
USE_GMP=1
fi
fi
AC_SUBST(USE_GMP)
#--------------------------------------------------------------------
# Check whether nl_langinfo(CODESET) is supported, needed by Unicode.m.
#--------------------------------------------------------------------
AM_LANGINFO_CODESET
AC_SUBST(INCLUDE_FLAGS)
AC_SUBST(LDIR_FLAGS)