Fixes for MinGW.

* configure.in: Fix pkg-config detection of libxml2,
	  add -lgcrypt to gnutls lib.
	* src/Makefile.am: If compiling --without-libvirtd then
	  don't compile any part of the storage driver.
	* configure.in, src/hash.c, src/internal.h: Detect availability
	  of pthread library and compile out mutex code if not available.
	* src/storage_driver.c, src/util.c: Ignore some missing
	  headers on MinGW.
This commit is contained in:
Richard W.M. Jones 2008-04-18 08:33:23 +00:00
parent 3ff503b923
commit 8df91acf70
7 changed files with 51 additions and 10 deletions

View File

@ -1,3 +1,15 @@
Fri Apr 18 09:27:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
Fixes for MinGW.
* configure.in: Fix pkg-config detection of libxml2,
add -lgcrypt to gnutls lib.
* src/Makefile.am: If compiling --without-libvirtd then
don't compile any part of the storage driver.
* configure.in, src/hash.c, src/internal.h: Detect availability
of pthread library and compile out mutex code if not available.
* src/storage_driver.c, src/util.c: Ignore some missing
headers on MinGW.
Tue Apr 15 17:19:16 CEST 2008 Daniel Veillard <veillard@redhat.com>
* virsh.1 docs/virsh.pod: fix missing entries and small cleanups

View File

@ -81,6 +81,13 @@ AM_CONDITIONAL(GLIBC_RPCGEN,
[test "x$ac_cv_path_RPCGEN" != "xno" &&
$ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
dnl pthread?
AC_CHECK_HEADER(pthread.h,
AC_CHECK_LIB(pthread,pthread_join,[
AC_DEFINE([HAVE_LIBPTHREAD],[],[Define if pthread (-lpthread)])
AC_DEFINE([HAVE_PTHREAD_H],[],[Define if <pthread.h>])
]))
dnl Miscellaneous external programs.
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
@ -301,7 +308,7 @@ AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location])
if test "x$with_libxml" = "xno" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
AC_MSG_ERROR(libxml2 >= $LIBXML_REQUIRED is required for libvirt)
elif test "x$with_libxml" = "x" -a "x$PKG_CONFIG" = "x" ; then
elif test "x$with_libxml" = "x" -a "x$PKG_CONFIG" != "x" ; then
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [LIBXML_FOUND=no])
fi
if test "$LIBXML_FOUND" = "no" ; then
@ -356,7 +363,8 @@ if test "$GNUTLS_FOUND" = "no"; then
AC_CHECK_LIB(gnutls, gnutls_handshake,
[],
[AC_MSG_ERROR(
[You must install the GnuTLS library in order to compile and run libvirt])])
[You must install the GnuTLS library in order to compile and run libvirt])],
[-lgcrypt])
GNUTLS_LIBS=$LIBS
LIBS="$old_libs"
fi

View File

@ -61,17 +61,21 @@ CLIENT_SOURCES = \
openvz_driver.c openvz_driver.h \
lxc_driver.c lxc_driver.h \
lxc_conf.c lxc_conf.h \
lxc_container.c lxc_container.h \
lxc_container.c lxc_container.h \
nodeinfo.h nodeinfo.c \
storage_conf.h storage_conf.c \
storage_driver.h storage_driver.c \
storage_backend.h storage_backend.c \
storage_backend_fs.h storage_backend_fs.c \
util.c util.h
SERVER_SOURCES = \
../qemud/remote_protocol.c ../qemud/remote_protocol.h
if WITH_LIBVIRTD
CLIENT_SOURCES += \
storage_conf.h storage_conf.c \
storage_driver.h storage_driver.c \
storage_backend.h storage_backend.c \
storage_backend_fs.h storage_backend_fs.c
if WITH_STORAGE_LVM
CLIENT_SOURCES += storage_backend_logical.h storage_backend_logical.c
else
@ -90,7 +94,7 @@ else
EXTRA_DIST += storage_backend_disk.h storage_backend_disk.c
endif
endif
libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
@ -130,12 +134,14 @@ virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
if WITH_STORAGE_DISK
if WITH_LIBVIRTD
libexec_PROGRAMS = libvirt_parthelper
libvirt_parthelper_SOURCES = parthelper.c
libvirt_parthelper_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDCFLAGS)
libvirt_parthelper_LDADD = $(LIBPARTED_LIBS)
libvirt_parthelper_CFLAGS = $(LIBPARTED_CFLAGS)
endif
else
EXTRA_DIST += parthelper.c
endif

View File

@ -25,7 +25,6 @@
#include <libxml/threads.h>
#include "internal.h"
#include "hash.h"
#include <pthread.h>
#define MAX_HASH_LEN 8

View File

@ -12,6 +12,18 @@
#include <sys/syslimits.h>
#endif
#if HAVE_PTHREAD_H
#include <pthread.h>
#define PTHREAD_MUTEX_T(v) pthread_mutex_t v
#else
/* Mutex functions disappear if we don't have pthread. */
#define PTHREAD_MUTEX_T(v) /*empty*/
#define pthread_mutex_init(lk,p) /*empty*/
#define pthread_mutex_destroy(lk) /*empty*/
#define pthread_mutex_lock(lk) /*empty*/
#define pthread_mutex_unlock(lk) /*empty*/
#endif
#include "gettext.h"
#include "hash.h"
@ -195,7 +207,7 @@ struct _virConnect {
* count of any virDomain/virNetwork object associated with
* this connection
*/
pthread_mutex_t lock;
PTHREAD_MUTEX_T (lock);
virHashTablePtr domains; /* hash table for known domains */
virHashTablePtr networks; /* hash table for known domains */
virHashTablePtr storagePools;/* hash table for known storage pools */

View File

@ -26,7 +26,9 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#if HAVE_PWD_H
#include <pwd.h>
#endif
#include <errno.h>
#include <string.h>

View File

@ -33,7 +33,9 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <string.h>
#include <ctype.h>