]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: make building on cygwin easier
authorEric Blake <eblake@redhat.com>
Wed, 8 Dec 2010 03:35:08 +0000 (20:35 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 20 Dec 2010 18:14:27 +0000 (11:14 -0700)
* configure.ac (dlopen): Cygwin dlopen is in libc; avoid spurious
failure.
(XDR_CFLAGS): Define when needed.
* src/Makefile.am (libvirt_driver_remote_la_CFLAGS): Use it.

configure.ac
src/Makefile.am

index 4df915a8b097c22b3972c3df40d049411d710eb9..73c117652bb7c28bae74e53919739a6642789579 100644 (file)
@@ -339,6 +339,26 @@ if test x"$with_remote" = x"yes" || test x"$with_libvirtd" = x"yes"; then
 
     dnl check for cygwin's variation in xdr function names
     AC_CHECK_FUNCS([xdr_u_int64_t],[],[],[#include <rpc/xdr.h>])
+
+    dnl Cygwin requires -I/usr/include/tirpc for <rpc/rpc.h>
+    old_CFLAGS=$CFLAGS
+    AC_CACHE_CHECK([where to find <rpc/rpc.h>], [lv_cv_xdr_cflags], [
+      for add_CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do
+        if test x"$add_CFLAGS" = xmissing; then
+          lv_cv_xdr_cflags=missing; break
+        fi
+        CFLAGS="$old_CFLAGS $add_CFLAGS"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rpc/rpc.h>
+        ]])], [lv_cv_xdr_cflags=${add_CFLAGS:-none}; break])
+      done
+    ])
+    CFLAGS=$old_CFLAGS
+    case $lv_cv_xdr_cflags in
+      none) XDR_CFLAGS= ;;
+      missing) AC_MSG_ERROR([Unable to find <rpc/rpc.h>]) ;;
+      *) XDR_CFLAGS=$lv_cv_xdr_cflags ;;
+    esac
+    AC_SUBST([XDR_CFLAGS])
 fi
 
 
@@ -359,12 +379,9 @@ AC_DEFINE_UNQUOTED([VBOX_XPCOMC_DIR], ["$vbox_xpcomc_dir"],
 
 if test "x$with_vbox" = "xyes"; then
     AC_SEARCH_LIBS([dlopen], [dl],,)
-    case $ac_cv_search_dlopen in
-      no*) DLOPEN_LIBS=
-           case "$host" in
-             *-*-mingw* | *-*-msvc*) ;;
-             *) AC_MSG_ERROR([Unable to find dlopen()]) ;;
-           esac ;;
+    case $ac_cv_search_dlopen:$host_os in
+      'none required'* | *:mingw* | *:msvc*) DLOPEN_LIBS= ;;
+      no*) AC_MSG_ERROR([Unable to find dlopen()]) ;;
       *) DLOPEN_LIBS=$ac_cv_search_dlopen ;;
     esac
     AC_SUBST([DLOPEN_LIBS])
@@ -2438,6 +2455,11 @@ AC_MSG_NOTICE([   mscom: $MSCOM_LIBS])
 else
 AC_MSG_NOTICE([   mscom: no])
 fi
+if test "$with_remote" = "yes" || test "$with_libvirtd" = "yes" ; then
+AC_MSG_NOTICE([     xdr: $XDR_CFLAGS])
+else
+AC_MSG_NOTICE([     xdr: no])
+fi
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Test suite])
 AC_MSG_NOTICE([])
index 07ec528a5534d7c8b250bc23106dbc55b07ef4fd..fe34b7b09b8008f03e86bb027b3c104d644e5dc6 100644 (file)
@@ -486,7 +486,7 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_remote.la
 endif
 libvirt_driver_remote_la_CFLAGS =                              \
                $(GNUTLS_CFLAGS)                                \
-               $(SASL_CFLAGS)                                  \
+               $(SASL_CFLAGS) $(XDR_CFLAGS)                    \
                -I@top_srcdir@/src/conf                         \
                $(AM_CFLAGS)
 libvirt_driver_remote_la_LDFLAGS = $(AM_LDFLAGS)