[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] freebsd: Fix build problem due to picking up the wrong libvirt.h



On 07/26/2011 02:45 PM, Matthias Bolte wrote:
+++ b/configure.ac
@@ -2011,8 +2011,16 @@ dnl Enable building libvirtd?
  AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])

  dnl Check for gettext - don't go any newer than what RHEL 5 supports
+dnl
+dnl save and restore CPPFLAGS around gettext check as the internal iconv
+dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting
+dnl in the build picking up previously installed libvirt/libvirt.h instead
+dnl of the correct one from the soucre tree
+
+save_CPPFLAGS="$CPPFLAGS"
  AM_GNU_GETTEXT_VERSION([0.17])
  AM_GNU_GETTEXT([external])
+CPPFLAGS="$save_CPPFLAGS"


But I'm still worried that we have to use -I/usr/local/include somewhere
in the command line, which means we would have to modify src/Makefile.am
(and friends) to have:

INCLUDES= ... $(GETTEXT_CPPFLAGS)

where GETTEXT_CPPFLAGS is substituted with the difference in
$save_CPPFLAGS and $CPPFLAGS prior to the point where we restore $CPPFLAGS.

That's probably what we should do here.

Now how to compute this difference? When we assume that save_CPPFLAGS
and CPPFLAGS have a common prefix that we need to strip to get
GETTEXT_CPPFLAGS then we could do it like this

   echo $(CPPFLAGS) | cut -c 1-`expr length $(save_CPPFLAGS)` --complement -

This is probably neither the best nor a robustest way to do this. Do
you have a better idea?

Yep (although I haven't tested it thoroughly):

save_CPPFLAGS="$CPPFLAGS"
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
GETTEXT_CPPFLAGS=
if test "x$save_CPPFLAGS" != "x$CPPFLAGS"; then
  set dummy $CPPFLAGS
  for var
  do
    case " $var " in
      " $save_CPPFLAGS ") ;;
      *) GETTEXT_CPPFLAGS="$GETTEXT_CPPFLAGS $var" ;;
    esac
  done
fi
CPPFLAGS="$save_CPPFLAGS"

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]