[Xcb] [PATCH util 2/6] config: use AC_CONFIG_HEADERS to create a config.h file

Gaetan Nadon memsize at videotron.ca
Sun Feb 9 22:31:27 CET 2014


This file contains C preprocessor #define statements which replace
the current -Ds added to each compilation invocation.

This makes the gcc output command easier to read and prevents exceeding
the max line limits on some computers. This is the preferred method
in al the xorg modules.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 configure.ac  |    1 +
 src/atoms.c   |    5 +++++
 src/event.c   |    4 ++++
 src/xcb_aux.c |    4 ++++
 4 files changed, 14 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7693872..5e66d01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@ AC_INIT([xcb-util],[0.3.9],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xcb&component=Utils],
         [xcb-util])
 AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
diff --git a/src/atoms.c b/src/atoms.c
index e9133a6..e5c33e5 100644
--- a/src/atoms.c
+++ b/src/atoms.c
@@ -1,3 +1,8 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 /* Rely on vasprintf (GNU extension) instead of vsnprintf if
    possible... */
 #define _GNU_SOURCE
diff --git a/src/event.c b/src/event.c
index de8899a..b868252 100644
--- a/src/event.c
+++ b/src/event.c
@@ -26,6 +26,10 @@
  * prior written authorization from the authors.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/xcb_aux.c b/src/xcb_aux.c
index 4efb5cb..b6f64f8 100644
--- a/src/xcb_aux.c
+++ b/src/xcb_aux.c
@@ -29,6 +29,10 @@
  * prior written authorization from the authors.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-- 
1.7.9.5



More information about the Xcb mailing list