提交 acf522e8 编写于 作者: E Eric Blake

examples: Avoid gnulib, have standalone examples

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: NEric Blake <eblake@redhat.com>
Acked-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 6933ebc4
......@@ -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 \
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>
......
#include <config.h>
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt-admin.h>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt-admin.h>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt-admin.h>
......
......@@ -20,8 +20,6 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>
......
......@@ -19,8 +19,6 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <errno.h>
#include <getopt.h>
#include <libvirt/libvirt.h>
......
......@@ -18,8 +18,6 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <errno.h>
#include <getopt.h>
#include <libvirt/libvirt.h>
......
......@@ -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>
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......
/* 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>
......
......@@ -16,8 +16,6 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册