]> xenbits.xensource.com Git - libvirt.git/commitdiff
freebsd: Fix build problem due to picking up the wrong libvirt.h
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 28 Jul 2011 12:55:21 +0000 (14:55 +0200)
committerEric Blake <eblake@redhat.com>
Fri, 29 Jul 2011 13:35:54 +0000 (07:35 -0600)
Gettext annoyingly modifies CPPFLAGS in-place, putting
-I/usr/local/include into the search patch if libintl headers
must be used from that location.  But since we must support
automake 1.9.6 which lacks AM_CPPFLAGS, and since CPPFLAGS is used
prior to INCLUDES, this means that the build picks up the _old_
installed libvirt.h in priority to the in-tree version, leading
to all sorts of weird build failures on FreeBSD.

Fix this by teaching configure to undo gettext's actions, but
to keep any changes required by gettext at the end of INCLUDES
after all in-tree locations are used first.  Also requires
adding a wrapper Makefile.am and making gnulib-tool create
just gnulib.mk files during the bootstrap process.

Signed-off-by: Eric Blake <eblake@redhat.com>
.gitignore
bootstrap.conf
configure.ac
daemon/Makefile.am
gnulib/lib/Makefile.am [new file with mode: 0644]
gnulib/tests/Makefile.am [new file with mode: 0644]
python/Makefile.am
src/Makefile.am
tests/Makefile.am
tools/Makefile.am

index dd64ca59d3c3b63c4bf019d72945197ee35f6304..60220ada59b2b7f08cdfb21f9178a2018cb01a16 100644 (file)
@@ -36,7 +36,9 @@
 /configure.lineno
 /daemon/*_dispatch.h
 /docs/hvsupport.html.in
-/gnulib/
+/gnulib/lib/*
+/gnulib/m4/*
+/gnulib/tests/*
 /libtool
 /libvirt-*.tar.gz
 /libvirt-[0-9]*
@@ -74,6 +76,8 @@ results.log
 stamp-h
 stamp-h.in
 stamp-h1
+!/gnulib/lib/Makefile.am
+!/gnulib/tests/Makefile.am
 !/m4/virt-*.m4
 !/po/*.po
 !/po/POTFILES.in
index 3b105b147c5aec2dc1eb610e6559255d26eb177c..7882886b795f6bcb0b4ec859fb834224d70f61d3 100644 (file)
@@ -161,7 +161,6 @@ gnulib_name=libgnu
 m4_base=gnulib/m4
 source_base=gnulib/lib
 tests_base=gnulib/tests
-gnulib_mk=Makefile.am
 gnulib_tool_option_extras="\
  --lgpl=2\
  --with-tests\
@@ -203,9 +202,9 @@ gnulib_extra_files="
 
 bootstrap_epilogue()
 {
-  # Change paths in gnulib/tests/Makefile.am from "../../.." to "../..",
+  # Change paths in gnulib/tests/gnulib.mk from "../../.." to "../..",
   # then ensure that gnulib/tests/Makefile.in is up-to-date.
-  m=gnulib/tests/Makefile.am
+  m=gnulib/tests/gnulib.mk
   sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t
   mv -f $m-t $m
   ${AUTOMAKE-automake} gnulib/tests/Makefile
index 36037e5aa3db6deb0a25c2a12d607325c24c1880..7c4fb32a26355ddaa28d9414c84ce998e9144dce 100644 (file)
@@ -2058,8 +2058,30 @@ 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 source tree.
+dnl compute the difference between save_CPPFLAGS and CPPFLAGS and append it
+dnl to INCLUDES in order to preserve changes made by gettext but in a place
+dnl that does not break the build
+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; shift
+ for var
+ do
+   case " $var " in
+     " $save_CPPFLAGS ") ;;
+     *) GETTEXT_CPPFLAGS="$GETTEXT_CPPFLAGS $var" ;;
+   esac
+ done
+fi
+CPPFLAGS="$save_CPPFLAGS"
+AC_SUBST([GETTEXT_CPPFLAGS])
 
 ALL_LINGUAS=`cd "$srcdir/po" > /dev/null && ls *.po | sed 's+\.po$++'`
 
index 65ac8e9724abad04db4a7075ddb45b686d51183b..690bf851aa46bba0a5de90ad05604a35c63e60ec 100644 (file)
@@ -3,6 +3,16 @@
 ## Copyright (C) 2005-2011 Red Hat, Inc.
 ## See COPYING.LIB for the License of this software
 
+INCLUDES = \
+       -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
+       -I$(top_srcdir)/include -I$(top_builddir)/include \
+       -I$(top_srcdir)/src \
+       -I$(top_srcdir)/src/util \
+       -I$(top_srcdir)/src/conf \
+       -I$(top_srcdir)/src/rpc \
+       -I$(top_srcdir)/src/remote \
+       $(GETTEXT_CPPFLAGS)
+
 CLEANFILES =
 
 DAEMON_GENERATED =                                     \
@@ -82,13 +92,6 @@ libvirtd_SOURCES = $(DAEMON_SOURCES)
 
 #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
 libvirtd_CFLAGS = \
-       -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-       -I$(top_srcdir)/include -I$(top_builddir)/include \
-       -I$(top_srcdir)/src \
-       -I$(top_srcdir)/src/util \
-       -I$(top_srcdir)/src/conf \
-       -I$(top_srcdir)/src/rpc \
-       -I$(top_srcdir)/src/remote \
        $(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
        $(XDR_CFLAGS) $(POLKIT_CFLAGS) \
        $(WARN_CFLAGS) \
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
new file mode 100644 (file)
index 0000000..3445c6d
--- /dev/null
@@ -0,0 +1,8 @@
+## Makefile for gnulib/lib                             -*-Makefile-*-
+
+## Copyright (C) 2011 Red Hat, Inc.
+## See COPYING.LIB for the License of this software
+
+include gnulib.mk
+
+INCLUDES = $(GETTEXT_CPPFLAGS)
diff --git a/gnulib/tests/Makefile.am b/gnulib/tests/Makefile.am
new file mode 100644 (file)
index 0000000..3445c6d
--- /dev/null
@@ -0,0 +1,8 @@
+## Makefile for gnulib/lib                             -*-Makefile-*-
+
+## Copyright (C) 2011 Red Hat, Inc.
+## See COPYING.LIB for the License of this software
+
+include gnulib.mk
+
+INCLUDES = $(GETTEXT_CPPFLAGS)
index 0e14d233149b126b20218b1757d3363d9fc1b993..5943fe80dc06bc8d1e60f48cda337d501ca7f69a 100644 (file)
@@ -9,7 +9,8 @@ INCLUDES = \
        $(PYTHON_INCLUDES) \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/include \
-       -I$(top_builddir)/$(subdir)
+       -I$(top_builddir)/$(subdir) \
+       $(GETTEXT_CPPFLAGS)
 
 AM_CFLAGS = $(WARN_CFLAGS)
 
index 00307fa60f9060e3663ab2bdbab3735be3f4310d..b7e49912eda37795f6156be171754836a7834af6 100644 (file)
@@ -5,13 +5,14 @@
 
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
-# that actually use them
+# that actually use them. Also keep GETTEXT_CPPFLAGS at the end.
 INCLUDES =     -I$(top_srcdir)/gnulib/lib                      \
                -I../gnulib/lib                                 \
                -I../include                                    \
                -I@top_srcdir@/src/util                         \
                -I@top_srcdir@/include                          \
-               -DIN_LIBVIRT
+               -DIN_LIBVIRT                                    \
+               $(GETTEXT_CPPFLAGS)
 
 AM_CFLAGS =    $(DRIVER_MODULE_CFLAGS)                         \
                $(LIBXML_CFLAGS)                                \
index 1560ac1c3e8b451aede94430141d46dc1bc450b3..43a4301995574251a0689353b8f37db708d4a4f6 100644 (file)
@@ -11,7 +11,8 @@ INCLUDES = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/util \
-       -I$(top_srcdir)/src/conf
+       -I$(top_srcdir)/src/conf \
+       $(GETTEXT_CPPFLAGS)
 
 AM_CFLAGS = \
        $(LIBXML_CFLAGS) \
index 66d4ed2d637d87cadc6084a08a7f40fb644b2d55..71131e2879dbe0b1096c56c50cd7ca52abac3f5f 100644 (file)
@@ -1,6 +1,14 @@
 ## Copyright (C) 2005-2011 Red Hat, Inc.
 ## See COPYING.LIB for the License of this software
 
+INCLUDES = \
+       -I../include -I$(top_srcdir)/include \
+       -I$(top_srcdir)/gnulib/lib -I../gnulib/lib      \
+       -I$(top_srcdir)/src                             \
+       -I$(top_srcdir)/src/util                        \
+       -I$(top_srcdir)                                 \
+       $(GETTEXT_CPPFLAGS)
+
 POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
 
 ICON_FILES = \
@@ -68,11 +76,6 @@ virsh_LDADD =                                                        \
                $(LIBXML_LIBS)                                  \
                $(VIRSH_LIBS)
 virsh_CFLAGS =                                                 \
-               -I$(top_srcdir)/gnulib/lib -I../gnulib/lib      \
-               -I../include -I$(top_srcdir)/include            \
-               -I$(top_srcdir)/src                             \
-               -I$(top_srcdir)/src/util                        \
-               -I$(top_srcdir)                                 \
                $(WARN_CFLAGS)                                  \
                $(COVERAGE_CFLAGS)                              \
                $(LIBXML_CFLAGS)                                \