Skip to content

Commit

Permalink
Added updated libxml2 check and moved result into HAVE_LIBVIRT
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain M Conochie committed Nov 25, 2023
1 parent d11337a commit d59aa6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
20 changes: 11 additions & 9 deletions m4/libxml2.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Configure paths for LIBXML2
# Simon Josefsson 2020-02-12
# Fix autoconf 2.70+ warnings
# Mike Hommey 2004-06-19
# use CPPFLAGS instead of CFLAGS
# Toshio Kuratomi 2001-04-21
Expand Down Expand Up @@ -58,7 +60,8 @@ dnl Now check if the installed libxml is sufficiently new.
dnl (Also sanity checks the results of xml2-config to some extent)
dnl
rm -f conf.xmltest
AC_TRY_RUN([
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -119,21 +122,20 @@ main()
{
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",
printf("*** You need a version of libxml newer than %d.%d.%d.\n",
major, minor, micro);
printf("*** libxml is always available from ftp://ftp.xmlsoft.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 xml2-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 XML2_CONFIG environment to point to the\n");
printf("*** correct copy of xml2-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("*** modify your LD_LIBRARY_PATH environment 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"])
]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
fi
Expand All @@ -156,10 +158,11 @@ main()
echo "*** Could not run libxml test program, checking why..."
CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
LIBS="$LIBS $XML_LIBS"
AC_TRY_LINK([
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <libxml/xmlversion.h>
#include <stdio.h>
], [ LIBXML_TEST_VERSION; return 0;],
]], [[ LIBXML_TEST_VERSION; return 0;]])],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
Expand All @@ -170,7 +173,7 @@ main()
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
CPPFLAGS="$ac_save_CPPFLAGS"
Expand All @@ -184,6 +187,5 @@ main()
fi
AC_SUBST(XML_CPPFLAGS)
AC_SUBST(XML_LIBS)
AC_DEFINE([HAVE_LIBXML], [1], [define to true if we find libxml])
rm -f conf.xmltest
])
5 changes: 2 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,17 @@ AM_CPPFLAGS += $(SQLITE3_CFLAGS)
AM_LDFLAGS += $(SQLITE3_LDFLAGS)
endif

if HAVE_LIBVIRT
if HAVE_LIBXML
AM_CPPFLAGS += $(XML_CPPFLAGS)
LIBS += $(XML_LIBS)
endif

if HAVE_LIBVIRT
AM_CPPFLAGS += $(LIBVIRT_CPPFLAGS)
AM_CFLAGS += $(LIBVIRT_CFLAGS)
AM_LDFLAGS += $(LIBVIRT_LDFLAGS)
LIBS += $(LIBVIRT_LIBS)
bin_PROGRAMS += mkvm mksp mknet
endif
endif

if HAVE_OPENSSL
AM_CFLAGS += $(OPENSSL_INCLUDES)
Expand Down

0 comments on commit d59aa6b

Please sign in to comment.