Bug 58199

Summary: Test for X11/extensions/Xrender.h usability is broken under Solaris 10
Product: cairo Reporter: Andreas F. Borchert <bugzilla>
Component: xlib backendAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: minor    
Priority: medium CC: bugzilla
Version: 1.12.8   
Hardware: x86-64 (AMD64)   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:

Description Andreas F. Borchert 2012-12-12 16:43:47 UTC
Xrender.h should not be #included without including <X11/Xlib.h> first. Otherwise, XID remains undefined on Solaris 10, causing the test to fail:

configure:22124: checking X11/extensions/Xrender.h usability
configure:22124: gcc -c -g -O2 -D_POSIX_PTHREAD_SEMANTICS    -I/usr/openwin/include conftest.c >&5
In file included from /usr/openwin/include/X11/extensions/Xrender.h:28:0,
                 from conftest.c:115:
/usr/openwin/include/X11/extensions/render.h:29:1: error: unknown type name 'XID'
/usr/openwin/include/X11/extensions/render.h:30:1: error: unknown type name 'XID'
/usr/openwin/include/X11/extensions/render.h:31:1: error: unknown type name 'XID'
/usr/openwin/include/X11/extensions/render.h:32:1: error: unknown type name 'XID'
configure:22124: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "cairo"
| #define PACKAGE_TARNAME "cairo"
| #define PACKAGE_VERSION "1.12.8"
| #define PACKAGE_STRING "cairo 1.12.8"
| #define PACKAGE_BUGREPORT "http://bugs.freedesktop.org/enter_bug.cgi?product=cairo"
| #define PACKAGE_URL "http://cairographics.org/"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define _FILE_OFFSET_BITS 64
| #define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
| #define HAVE_INTEL_ATOMIC_PRIMITIVES 1
| #define SIZEOF_VOID_P 4
| #define SIZEOF_INT 4
| #define SIZEOF_LONG 4
| #define SIZEOF_LONG_LONG 8
| #define SIZEOF_SIZE_T 4
| #define HAVE_LIBRT 1
| #define HAVE_BUILTIN_RETURN_ADDRESS 1
| #define HAVE_STDINT_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_SYS_INT_TYPES_H 1
| #define HAVE_UINT64_T 1
| #define HAVE_FCNTL_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_ALARM 1
| #define HAVE_SCHED_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_MMAP 1
| #define HAVE_TIME_H 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_FECLEAREXCEPT 1
| #define HAVE_LIBGEN_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_SETJMP_H 1
| #define HAVE_FENV_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_CTIME_R 1
| #define HAVE_DRAND48 1
| #define HAVE_FLOCKFILE 1
| #define HAVE_FUNLOCKFILE 1
| #define HAVE_LINK 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_MKDIR 2
| #define HAVE_FORK 1
| #define HAVE_WAITPID 1
| #define HAVE_RAISE 1
| #undef PACKAGE_VERSION
| #undef PACKAGE_STRING
| #undef PACKAGE_NAME
| #undef PACKAGE_TARNAME
| #define PACKAGE_VERSION USE_cairo_version_OR_cairo_version_string_INSTEAD
| #define PACKAGE_STRING USE_cairo_version_OR_cairo_version_string_INSTEAD
| #define PACKAGE_NAME USE_cairo_INSTEAD
| #define PACKAGE_TARNAME USE_cairo_INSTEAD
| #define HAVE_ZLIB 1
| #define HAVE_DLFCN_H 1
| #define CAIRO_HAS_DLSYM 1
| #define HAVE_X11_EXTENSIONS_XSHM_H 1
| #define HAVE_X11_EXTENSIONS_SHMSTR_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <X11/extensions/Xrender.h>

On Solaris 10, <X11/extensions/Xrender.h> is located in
   /usr/openwin/share/include/X11/extensions/Xrender.h
which has as first include
   #include <X11/extensions/render.h>
which in turn loads /usr/openwin/share/include/X11/extensions/render.h. These
are the very first lines of it:

typedef XID             Glyph;
typedef XID             GlyphSet;
typedef XID             Picture;
typedef XID             PictFormat;

But XID has not been defined at that point as unfortunately neither Xrender.h
nor render.h as shipped under Solaris include <X11/Xlib.h> first. Both files
are part of the Solaris 10 package SUNWxwinc in the version
   6.6.2.7400,REV=0.2004.12.15

A workaround is to specify
   xlib_CFLAGS="-include /usr/openwin/include/X11/X.h"
to configure.
Comment 1 Chris Wilson 2013-01-29 10:37:19 UTC
commit 74a19c527c1fa07ade2042a8d2acecbb5f6ccab1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 29 10:31:05 2013 +0000

    configure: Include X11.h before testing for usability of Xrender.h
    
    On Solaris at least, the Xrender.h header is not standalone and requires
    X11/X.h to be included first to define the essential types.
    
    Reported-by: Andreas F. Borchert <bugzilla@andreas-borchert.de>
    Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=58199
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

That should get you past configure. Though I suspect we may be missing a few includes in the body of the code as well...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.