
2011/7/26 Eric Blake <eblake@redhat.com>:
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"
Okay, this works for libvirt itself, but it fails for make check as the global CPPFLAGS also affect gnulib, but with this patch it doesn't contain the gettext related parts anymore and the gnulib tests fail to find libintl.h because of this. Making check in gnulib/tests Making check in . In file included from wait-process.c:37: ../../gnulib/lib/gettext.h:28:22: error: libintl.h: No such file or directory Is there any option in gnulib that would allow to inject GETTEXT_CPPFLAGS into the gnulib makefiles, or any other possibility to fix this? I attached a preliminary patch. -- Matthias Bolte http://photron.blogspot.com