From acf522e85a9747457e6d81a6cae9eef1cf677ff0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 7 Jan 2019 22:15:48 -0600 Subject: [PATCH] examples: Avoid gnulib, have standalone examples MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 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 is included first. Commit b6f78259 papered over the symptoms of that by including 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 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 , -Ignulib, and -llibgnu.la, making all of the examples truly standalone. Signed-off-by: Eric Blake Acked-by: Michal Privoznik Reviewed-by: Ján Tomko --- examples/Makefile.am | 5 ++--- examples/admin/client_close.c | 2 -- examples/admin/client_info.c | 3 +-- examples/admin/client_limits.c | 2 -- examples/admin/list_clients.c | 2 -- examples/admin/list_servers.c | 2 -- examples/admin/logging.c | 2 -- examples/admin/threadpool_params.c | 2 -- examples/dommigrate/dommigrate.c | 2 -- examples/domsuspend/suspend.c | 2 -- examples/domtop/domtop.c | 2 -- examples/hellolibvirt/hellolibvirt.c | 2 -- examples/object-events/event-test.c | 2 -- examples/openauth/openauth.c | 2 -- examples/rename/rename.c | 2 -- 15 files changed, 3 insertions(+), 31 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index 61cf2af4a5..76907a1c8f 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -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 \ diff --git a/examples/admin/client_close.c b/examples/admin/client_close.c index 9b7e1febb1..5c28ce7949 100644 --- a/examples/admin/client_close.c +++ b/examples/admin/client_close.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c index 550a24824a..2c46ccf514 100644 --- a/examples/admin/client_info.c +++ b/examples/admin/client_info.c @@ -1,5 +1,4 @@ -#include - +#define _GNU_SOURCE #include #include #include diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c index a87cb52c82..69b931682c 100644 --- a/examples/admin/client_limits.c +++ b/examples/admin/client_limits.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/list_clients.c b/examples/admin/list_clients.c index 1d961a1ec9..15205a7bd1 100644 --- a/examples/admin/list_clients.c +++ b/examples/admin/list_clients.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/list_servers.c b/examples/admin/list_servers.c index d48d87af6e..e53cd3b48f 100644 --- a/examples/admin/list_servers.c +++ b/examples/admin/list_servers.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/logging.c b/examples/admin/logging.c index 10952afa03..730ae40d9d 100644 --- a/examples/admin/logging.c +++ b/examples/admin/logging.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool_params.c index 9517dcb0f2..be833c2ea3 100644 --- a/examples/admin/threadpool_params.c +++ b/examples/admin/threadpool_params.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/dommigrate/dommigrate.c b/examples/dommigrate/dommigrate.c index 71a0af4058..1b6072d138 100644 --- a/examples/dommigrate/dommigrate.c +++ b/examples/dommigrate/dommigrate.c @@ -20,8 +20,6 @@ * . */ -#include - #include #include #include diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c index ac816044ef..af61129ecc 100644 --- a/examples/domsuspend/suspend.c +++ b/examples/domsuspend/suspend.c @@ -19,8 +19,6 @@ * . */ -#include - #include #include #include diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c index fb631781fd..4224e4c9ec 100644 --- a/examples/domtop/domtop.c +++ b/examples/domtop/domtop.c @@ -18,8 +18,6 @@ * . */ -#include - #include #include #include diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c index 02c4401987..bfb12846e6 100644 --- a/examples/hellolibvirt/hellolibvirt.c +++ b/examples/hellolibvirt/hellolibvirt.c @@ -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 - #include #include #include diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c index 6694d3dffc..53d95b10d0 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c index eef46d5f52..efd21c374f 100644 --- a/examples/openauth/openauth.c +++ b/examples/openauth/openauth.c @@ -1,8 +1,6 @@ /* This is a copy of the hellolibvirt example demonstaring how to use * virConnectOpenAuth with a custom auth callback */ -#include - #include #include #include diff --git a/examples/rename/rename.c b/examples/rename/rename.c index c64dd5baa3..85f18e9df3 100644 --- a/examples/rename/rename.c +++ b/examples/rename/rename.c @@ -16,8 +16,6 @@ * . */ -#include - #include #include #include -- 2.39.5