[libvirt] [libvirt-designer][PATCH v2 3/4] examples: Create an example of usage program

Martin Kletzander mkletzan at redhat.com
Mon Sep 10 16:58:48 UTC 2012


On 09/10/2012 03:58 PM, Michal Privoznik wrote:
> ---
>  .gitignore           |    1 +
>  Makefile.am          |    2 +-
>  configure.ac         |   12 ++-
>  examples/Makefile.am |   21 ++++
>  examples/virtxml.c   |  317 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 351 insertions(+), 2 deletions(-)
>  create mode 100644 examples/Makefile.am
>  create mode 100644 examples/virtxml.c
> 
[...]
> diff --git a/configure.ac b/configure.ac
> index 795990f..bdee845 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -13,6 +13,7 @@ AM_SILENT_RULES([yes])
>  LIBOSINFO_REQUIRED=0.0.5
>  LIBVIRT_GCONFIG_REQUIRED=0.0.9
>  GOBJECT_INTROSPECTION_REQUIRED=0.10.8
> +LIBVIRT_REQUIRED=0.9.0
>  
>  LIBVIRT_DESIGNER_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
>  LIBVIRT_DESIGNER_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
> @@ -30,6 +31,12 @@ AC_SUBST([LIBVIRT_DESIGNER_VERSION_NUMBER])
>  
>  AC_PROG_CC
>  AM_PROG_CC_C_O
> +AC_CHECK_FUNCS([strchr])
> +AC_CHECK_FUNCS([strrchr])
> +AC_CHECK_FUNCS([uname])
> +AC_PROG_CXX
> +AC_PROG_RANLIB

I get a warning that this is obsoleted by LT_INIT.

> +AC_TYPE_SIZE_T
>  
>  AC_LIBTOOL_WIN32_DLL
>  AC_PROG_LIBTOOL
> @@ -40,6 +47,7 @@ LIBVIRT_DESIGNER_COMPILE_WARNINGS
>  
>  PKG_CHECK_MODULES(LIBOSINFO, libosinfo-1.0 >= $LIBOSINFO_REQUIRED)
>  PKG_CHECK_MODULES(LIBVIRT_GCONFIG, libvirt-gconfig-1.0 >= $LIBVIRT_GCONFIG_REQUIRED)
> +PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
>  
>  LIBVIRT_DESIGNER_GETTEXT
>  LIBVIRT_DESIGNER_GTK_MISC
> @@ -51,7 +59,8 @@ LIBVIRT_DESIGNER_INTROSPECTION
>  AC_OUTPUT(Makefile
>            libvirt-designer/Makefile
>            libvirt-designer.spec
> -          libvirt-designer-1.0.pc)
> +          libvirt-designer-1.0.pc
> +          examples/Makefile)
>  
>  AC_MSG_NOTICE([])
>  AC_MSG_NOTICE([Configuration summary])
> @@ -62,4 +71,5 @@ AC_MSG_NOTICE([ Libraries:])
>  AC_MSG_NOTICE([])
>  AC_MSG_NOTICE([       LIBOSINFO: $LIBOSINFO_CFLAGS $LIBOSINFO_LIBS])
>  AC_MSG_NOTICE([ LIBVIRT_GCONFIG: $LIBVIRT_GCONFIG_CFLAGS $LIBVIRT_GCONFIG_LIBS])
> +AC_MSG_NOTICE([         LIBVIRT: $LIBVIRT_CFLAGS $LIBVIRT_LIBS])
>  AC_MSG_NOTICE([])
> diff --git a/examples/Makefile.am b/examples/Makefile.am
> new file mode 100644
> index 0000000..afbb3ce
> --- /dev/null
> +++ b/examples/Makefile.am
> @@ -0,0 +1,21 @@
> +INCLUDES = \
> +		-I$(top_builddir)/libvirt-designer	\
> +		-I$(top_srcdir)
> +
> +virtxml_LDADD = \
> +		$(top_builddir)/libvirt-designer/libvirt-designer-1.0.la
> +
> +virtxml_CFLAGS = \
> +		$(COVERAGE_CFLAGS) \
> +		$(LIBOSINFO_CFLAGS) \
> +		$(LIBVIRT_GCONFIG_CFLAGS) \
> +		$(WARN_CFLAGS2) \

There should be $(WARN_CFLAGS) here I bet (copy/paste error).

> +		$(LIBVIRT_CFLAGS) \
> +		$(NULL)
> +
> +virtxml_LDFLAGS = \
> +		$(LIBOSINFO_LIBS) \
> +		$(LIBVIRT_GCONFIG_LIBS) \
> +		$(LIBVIRT_LIBS)
> +
> +bin_PROGRAMS = virtxml
> diff --git a/examples/virtxml.c b/examples/virtxml.c
> new file mode 100644
> index 0000000..20e3f3c
> --- /dev/null
> +++ b/examples/virtxml.c
> @@ -0,0 +1,317 @@
> +/*
> + * virtxml.c: produce an domain XML
> + *
> + * Copyright (C) 2012 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Author: Michal Privoznik <mprivozn at redhat.com>
> + */
> +
> +#include <config.h>
> +#include <libvirt-designer/libvirt-designer.h>
> +#include <libvirt/libvirt.h>
> +#include <libvirt/virterror.h>
> +
> +#include <stdio.h>
> +#include <getopt.h>

Unused, can be removed.

[...]

ACK from me as I don't think it needs that much of a attention when
these are the (almost) first patches there. That reminds me, Add
yourself to the AUTHORS with this series ;)

Martin




More information about the libvir-list mailing list