[Libguestfs] use gnulib, and begin to pass its "make syntax-check" tests

Jim Meyering jim at meyering.net
Mon Aug 3 13:22:30 UTC 2009


Richard W.M. Jones wrote:

> On Mon, Aug 03, 2009 at 02:38:19PM +0200, Jim Meyering wrote:
>> One other alternative: guard the #inclusion:
>>
>>   #if HAVE_CONFIG_H
>>   # include <config.h>
>>   #endif
>>
>> What do you prefer?
>
> This looks OK to me.

I pushed this:

>From 5fa153b18661e3651e1cc57bb3f477f9bef37f8f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 3 Aug 2009 15:21:44 +0200
Subject: [PATCH] Guard #inclusion of config.h in examples.

* examples/hello.c [HAVE_CONFIG_H]: Include <config.h> conditionally.
* examples/to-xml.c: Likewise.
---
 examples/hello.c  |    4 +++-
 examples/to-xml.c |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/hello.c b/examples/hello.c
index a8649f3..1c12f8e 100644
--- a/examples/hello.c
+++ b/examples/hello.c
@@ -4,7 +4,9 @@
  *   hello guest.img /dev/VolGroup00/LogVol00
  */

-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/examples/to-xml.c b/examples/to-xml.c
index 5b75244..a62660c 100644
--- a/examples/to-xml.c
+++ b/examples/to-xml.c
@@ -7,7 +7,9 @@
  *   to-xml guest.img [guest.img ...]
  */

-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--
1.6.4.212.g4719




More information about the Libguestfs mailing list