]> xenbits.xensource.com Git - libvirt.git/commitdiff
examples: Avoid gnulib, have standalone examples
authorEric Blake <eblake@redhat.com>
Tue, 8 Jan 2019 04:15:48 +0000 (22:15 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 8 Jan 2019 15:26:51 +0000 (09:26 -0600)
Commit 0c6ad476 updated gnulib, which rearranged some of the
conditions in gnulib wrapper headers such that compilation
started failing on BSD systems when the normal system <unistd.h>
tried to include another system header but instead got a
gnulib wrapper header in an incomplete state; this is because
gnulib headers only work if <config.h> is included first.

Commit b6f78259 papered over the symptoms of that by including
<config.h> in all the examples.  But this logic is backwards -
if our examples are truly meant to be stand-alone, they should
NOT depend on how libvirt was configured, and should NOT
depend on the gnulib fixes for system quirks.  In particular,
if an example does not need to link against libgnulib.la,
then it also does not need to use -Ignulib in its compile
flags, and likewise does not need to include <config.h> since
none of the gnulib wrapper headers should be interfering.

So, revert (most of) b6f78259 (except for the bogus pre-patch
use of "config.h" in admin/logging.c: if config.h is included,
it should be via <> rather than "", and must be before any
system headers); then additionally nuke all mention of
<config.h>, -Ignulib, and -llibgnu.la, making all of the
examples truly standalone.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 files changed:
examples/Makefile.am
examples/admin/client_close.c
examples/admin/client_info.c
examples/admin/client_limits.c
examples/admin/list_clients.c
examples/admin/list_servers.c
examples/admin/logging.c
examples/admin/threadpool_params.c
examples/dommigrate/dommigrate.c
examples/domsuspend/suspend.c
examples/domtop/domtop.c
examples/hellolibvirt/hellolibvirt.c
examples/object-events/event-test.c
examples/openauth/openauth.c
examples/rename/rename.c

index 61cf2af4a5b43e72b1d121ace80170501d755794..76907a1c8f21a4676dd78722ac7ffc5b92eaf62a 100644 (file)
@@ -34,10 +34,9 @@ EXTRA_DIST = \
 
 
 AM_CPPFLAGS = \
-       -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \
-       -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib
+       -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)
 LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \
-       $(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la \
+       $(top_builddir)/src/libvirt.la \
        $(top_builddir)/src/libvirt-admin.la
 
 noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \
index 9b7e1febb1a9132740fe5e8165f3455a2ba3c303..5c28ce794912476ff6b7493f7367bb7cb77bf27e 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt.h>
index 550a24824af5ed844fb6263ec7dd3ec0d0f72bc8..2c46ccf5145a591fe214304e00e3615a23a12d4d 100644 (file)
@@ -1,5 +1,4 @@
-#include <config.h>
-
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
index a87cb52c8259b5de13916550e69d1a4b065cc363..69b931682c6897e1d8b7f83a25c22fce00df4dcd 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt-admin.h>
index 1d961a1ec93867b7631cca4255f42739c0af12de..15205a7bd1e01e6de0fc4c2d7420d366c01c4857 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
index d48d87af6e7755b6b2c059b3a6d3a8f5bcc3de38..e53cd3b48f9bb6ba089d073060ca62412b9384ce 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt-admin.h>
index 10952afa03e4d52ff1268374246db21318c4ab7f..730ae40d9d536ba334d78ee9d13d109ea92f367c 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
index 9517dcb0f203e8a48b28129acc462812463c0c65..be833c2ea3068f42f594887250fcea7a1760c8e7 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt-admin.h>
index 71a0af40582d7b23eb7f2349e9e5263e4a39aefa..1b6072d1380639e5b14b2d50de4bba2ca379acec 100644 (file)
@@ -20,8 +20,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt.h>
index ac816044efb3f1092fbb5c8c3ee6d7490eb2ca55..af61129ecc7882c1e32d04341aabf0b7987264bd 100644 (file)
@@ -19,8 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-
 #include <errno.h>
 #include <getopt.h>
 #include <libvirt/libvirt.h>
index fb631781fdba7a080ce5a9c214ee708ef3ece702..4224e4c9ec8b28dc6fdae6683a32f549303e2982 100644 (file)
@@ -18,8 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-
 #include <errno.h>
 #include <getopt.h>
 #include <libvirt/libvirt.h>
index 02c4401987c28d3dd5703baa99e8a023ac13d10c..bfb12846e6649004f7851c152e9867f70e9d8795 100644 (file)
@@ -2,8 +2,6 @@
  * hypervisor and gather a few bits of information about domains.
  * Similar API's exist for storage pools, networks, and interfaces. */
 
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt.h>
index 6694d3dffc4e87b99ff385de5b93161362481423..53d95b10d07d12ce42a26920e1758e3a25a53125 100644 (file)
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index eef46d5f5257ccab70e30a8f34fcdbd597d45528..efd21c374f55c47957c12e4859956568c95fcc76 100644 (file)
@@ -1,8 +1,6 @@
 /* This is a copy of the hellolibvirt example demonstaring how to use
  * virConnectOpenAuth with a custom auth callback */
 
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index c64dd5baa3c06ee4f1fbaa8ba56a002592a1a993..85f18e9df32ddcc9b3c3674aaf5d259b5750ade7 100644 (file)
@@ -16,8 +16,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <libvirt/libvirt.h>