[Xcb] [PATCH RESEND image 04/12] config: use AC_CONFIG_HEADERS to create a config.h file

Josh Triplett josh at joshtriplett.org
Thu Mar 27 12:14:51 PDT 2014


On Thu, Mar 27, 2014 at 02:37:07PM -0400, Gaetan Nadon wrote:
> 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>

Reviewed-by: Josh Triplett <josh at joshtriplett.org>

However, isn't there a standard way to automatically add -include
config.h to all the compiler invocations, to avoid the explicit
inclusion in the source files?  Many projects take that approach.

>  configure.ac      |    1 +
>  image/xcb_image.c |    4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 7a31623..314a039 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3,6 +3,7 @@ AC_INIT([xcb-util-image],[0.3.9],
>          [https://bugs.freedesktop.org/enter_bug.cgi?product=xcb&component=Utils],
>  	[xcb-util-image])
>  AC_CONFIG_SRCDIR([Makefile.am])
> +AC_CONFIG_HEADERS([config.h])
>  AC_CONFIG_MACRO_DIR([m4])
>  AM_INIT_AUTOMAKE([foreign dist-bzip2])
>  AM_MAINTAINER_MODE
> diff --git a/image/xcb_image.c b/image/xcb_image.c
> index 5cfe383..4889c26 100644
> --- a/image/xcb_image.c
> +++ b/image/xcb_image.c
> @@ -23,6 +23,10 @@
>   * authorization from the authors.
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <string.h>
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list