Mailinglist Archive: vhostmd (42 mails)

< Previous Next >
[vhostmd] [PATCH 1/7] autotools: Use AC_GNU_SOURCE and config.h
  • From: "Richard W.M. Jones" <rjones@xxxxxxxxxx>
  • Date: Thu, 15 Oct 2009 13:18:58 +0100
  • Message-id: <20091015121858.GA31848@xxxxxxxxxxxxxxxxxxxx>

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
From d3958dc76cff61f0ed7563729dc3c2f2e3e3ae10 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones@xxxxxxxxxx>
Date: Thu, 15 Oct 2009 11:05:28 +0100
Subject: [PATCH 1/8] autotools: Use AC_GNU_SOURCE and config.h

Use AC_GNU_SOURCE instead of coding -D_GNU_SOURCE directly.

All C files should include <config.h> as the first line (before
any other includes or defines).
---
configure.ac | 4 +++-
libmetrics/host_metrics.c | 2 ++
libmetrics/libmetrics.c | 4 +---
libmetrics/vm_metrics.c | 2 ++
test/main.c | 2 ++
vhostmd/metric.c | 2 ++
vhostmd/util.c | 2 ++
vhostmd/vhostmd.c | 2 ++
vhostmd/virt-util.c | 2 ++
vhostmd/xen-metrics.c | 2 ++
vhostmd/xenctrl-util.c | 2 ++
vhostmd/xenstore-update.c | 2 ++
vm-dump-metrics/main.c | 2 ++
13 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 285e2c9..3d33f58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,12 +3,14 @@ AC_INIT(Virtual Host Metrics Daemon, 0.3, jfehlig@xxxxxxxxxx,
vhostmd)
AC_CONFIG_SRCDIR(vhostmd/vhostmd.c)
AC_CONFIG_HEADERS([config.h])

+AC_GNU_SOURCE
+
AC_PROG_LIBTOOL

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h paths.h stdlib.h string.h syslog.h
unistd.h])

-CFLAGS="-Wall $CFLAGS -D_GNU_SOURCE"
+CFLAGS="-Wall $CFLAGS"

# Checks for library functions.
AC_FUNC_FORK
diff --git a/libmetrics/host_metrics.c b/libmetrics/host_metrics.c
index ae4c5ba..741d871 100644
--- a/libmetrics/host_metrics.c
+++ b/libmetrics/host_metrics.c
@@ -19,6 +19,8 @@
* Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include "libmetrics.h"

int get_host_memory_metrics(memory_metrics *rec)
diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c
index 6764c3f..9b3f9fa 100644
--- a/libmetrics/libmetrics.c
+++ b/libmetrics/libmetrics.c
@@ -18,9 +18,7 @@
* Author: Pat Campbell <plc@xxxxxxxxxx>
*/

-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
+#include <config.h>

#include <stdio.h>
#include <string.h>
diff --git a/libmetrics/vm_metrics.c b/libmetrics/vm_metrics.c
index c8ca4ac..6fe23eb 100644
--- a/libmetrics/vm_metrics.c
+++ b/libmetrics/vm_metrics.c
@@ -19,6 +19,8 @@
* Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>

#include "libmetrics.h"
diff --git a/test/main.c b/test/main.c
index 0048164..341407c 100644
--- a/test/main.c
+++ b/test/main.c
@@ -18,6 +18,8 @@
* Author: Pat Campbell <plc@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
diff --git a/vhostmd/metric.c b/vhostmd/metric.c
index 2b88860..9407e0c 100644
--- a/vhostmd/metric.c
+++ b/vhostmd/metric.c
@@ -18,6 +18,8 @@
* Author: Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/vhostmd/util.c b/vhostmd/util.c
index ad664a2..17bef49 100644
--- a/vhostmd/util.c
+++ b/vhostmd/util.c
@@ -18,6 +18,8 @@
* Author: Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
index 9e43070..741caff 100644
--- a/vhostmd/vhostmd.c
+++ b/vhostmd/vhostmd.c
@@ -18,6 +18,8 @@
* Author: Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <unistd.h>
#include <fcntl.h>
#include <paths.h>
diff --git a/vhostmd/virt-util.c b/vhostmd/virt-util.c
index f5aca8f..79d1a14 100644
--- a/vhostmd/virt-util.c
+++ b/vhostmd/virt-util.c
@@ -18,6 +18,8 @@
* Author: Jim Fehlig <jfehlig@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <string.h>
#include <libvirt/libvirt.h>
diff --git a/vhostmd/xen-metrics.c b/vhostmd/xen-metrics.c
index c62ae5a..94f7dea 100644
--- a/vhostmd/xen-metrics.c
+++ b/vhostmd/xen-metrics.c
@@ -18,6 +18,8 @@
* Author: Pat Campbell <plc@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/vhostmd/xenctrl-util.c b/vhostmd/xenctrl-util.c
index 119cbbe..7c78ca4 100644
--- a/vhostmd/xenctrl-util.c
+++ b/vhostmd/xenctrl-util.c
@@ -20,6 +20,8 @@
* Preliminary, this could be done better
*/

+#include <config.h>
+
#include <stdio.h>
#include <string.h>
#include <xenctrl.h>
diff --git a/vhostmd/xenstore-update.c b/vhostmd/xenstore-update.c
index f1c153c..04bb09f 100644
--- a/vhostmd/xenstore-update.c
+++ b/vhostmd/xenstore-update.c
@@ -18,6 +18,8 @@
* Author: Pat Campbell <plc@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/vm-dump-metrics/main.c b/vm-dump-metrics/main.c
index 17648c9..4929838 100644
--- a/vm-dump-metrics/main.c
+++ b/vm-dump-metrics/main.c
@@ -18,6 +18,8 @@
* Author: Pat Campbell <plc@xxxxxxxxxx>
*/

+#include <config.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
--
1.6.5.rc2

< Previous Next >
Follow Ups
References