[libvirt] [PATCHv3 7/7] build: make building on cygwin easier

Matthias Bolte matthias.bolte at googlemail.com
Sat Dec 18 21:52:42 UTC 2010


2010/12/18 Eric Blake <eblake at redhat.com>:
> * 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.
> ---
>
> This fixed things so I could again compile on cygwin.
>
>  configure.ac    |   33 +++++++++++++++++++++++++++------
>  src/Makefile.am |    2 +-
>  2 files changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 4df915a..50ee862 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -339,6 +339,25 @@ 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 CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do
> +        if test x"$CFLAGS" = xmissing; then
> +          lv_cv_xdr_cflags=missing; break
> +        fi
> +        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rpc/rpc.h>
> +        ]])], [lv_cv_xdr_cflags=${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

Due to the specific directory layout I use in my msys_setup this
breaks my MinGW build. The problem is that I have MSYS and MinGW in
different base directories and "mount" the MinGW directory into the
MSYS environment. I have rpc/rpc.h in MSYS in /include (MSYS
internally "symlinks" /usr/include to /include), due to the directory
layout this is not in the default GCC include path. I use
"CFLAGS=-I/include ./configure" to fix this.

Now the new check ignores CFLAGS making my build fail.

This incremental patch fixes it, by including the current CFLAGS
instead of overriding them.


diff --git a/configure.ac b/configure.ac
index 27239f6..93532a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -343,12 +343,13 @@ if test x"$with_remote" = x"yes" || test
x"$with_libvirtd" = x"yes"; then
     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 CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do
-        if test x"$CFLAGS" = xmissing; then
+      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=${CFLAGS:-none}; break])
+        ]])], [lv_cv_xdr_cflags=${add_CFLAGS:-none}; break])
       done
     ])
     CFLAGS=$old_CFLAGS


Matthias




More information about the libvir-list mailing list