[PATCH:libICE] Fix stdio.h include for asprintf.

Alan Coopersmith alan.coopersmith at oracle.com
Sun Dec 19 09:53:29 PST 2010


On 12/19/10 09:43 AM, Cyril Brulebois wrote:
> asprintf is a GNU extension and one needs to define _GNU_SOURCE before
> including stdio.h. Otherwise, the build breaks this way with
> CFLAGS="-Wall -Werror":

Would it be better to just add AC_USE_SYSTEM_EXTENSIONS to configure.ac?
That way it's set when testing for asprintf() in configure as well - something
like (untested, just copied from libX11 configure.ac with a slight comment tweak):

diff --git a/configure.ac b/configure.ac
index 03432f5..27c02ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,11 @@ AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

+# Set common system defines for POSIX extensions, such as _GNU_SOURCE
+# Must be called before any macros that run the compiler (like
+# AC_PROG_LIBTOOL or XORG_DEFAULT_OPTIONS) to avoid autoconf errors.
+AC_USE_SYSTEM_EXTENSIONS
+
 # Require xorg-macros minimum of 1.10 for DocBook XML documentation
 m4_ifndef([XORG_MACROS_VERSION],
           [m4_fatal([must install xorg-macros 1.10 or later before running auto



-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list