Subject: Re: bug#18465: X11/extensions/Xrandr.h: present but cannot be compiled

From: Glenn Morris <[email-masked]>
Date: Fri, 12 Sep 2014 20:54:25 -0400

Dan Nicolaescu wrote:

> Red Hat Enterprise Linux Client release 5.9 (Tikanga)
>
> configure: WARNING: X11/extensions/Xrandr.h: present but cannot be compiled

It's a harmless issue, due to what seems to be a bug in that old version
of Xrandr.h (which is in any case too old for Emacs to use it).

This seems to fix it.
I do not know if it is appropriate for emacs-24?

*** configure.ac	2014-08-22 13:03:05 +0000
--- configure.ac	2014-09-13 00:43:55 +0000
***************
*** 3333,3339 ****
    if test $HAVE_XRANDR = no; then
      # Test old way in case pkg-config doesn't have it (older machines).
      AC_CHECK_HEADER(X11/extensions/Xrandr.h,
!       [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)])
      if test $HAVE_XRANDR = yes; then
        XRANDR_LIBS=-lXrandr
        AC_SUBST(XRANDR_LIBS)
--- 3333,3342 ----
    if test $HAVE_XRANDR = no; then
      # Test old way in case pkg-config doesn't have it (older machines).
      AC_CHECK_HEADER(X11/extensions/Xrandr.h,
!       [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)],
!       [], [AC_INCLUDES_DEFAULT
! #include <X11/extensions/Xrender.h>
! ])
      if test $HAVE_XRANDR = yes; then
        XRANDR_LIBS=-lXrandr
        AC_SUBST(XRANDR_LIBS)

Relevant config.log extract:

configure:14628: checking X11/extensions/Xrandr.h usability
configure:14628: gcc -std=gnu99 -c  -g3 -O2 -I/usr/include/librsvg-2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gtk-2.0   -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/include/freetype2       -I/usr/include/freetype2   conftest.c >&5
In file included from conftest.c:140:
/usr/include/X11/extensions/Xrandr.h:49: error: expected specifier-qualifier-list before 'Bool'
/usr/include/X11/extensions/Xrandr.h:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRQueryExtension'
/usr/include/X11/extensions/Xrandr.h:69: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRQueryVersion'
/usr/include/X11/extensions/Xrandr.h:73: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:85: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRSetScreenConfig'
/usr/include/X11/extensions/Xrandr.h:93: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRSetScreenConfigAndRate'
/usr/include/X11/extensions/Xrandr.h:104: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRConfigTimes'
/usr/include/X11/extensions/Xrandr.h:115: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:126: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:127: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:128: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:136: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:137: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:138: error: expected ')' before '*' token
/usr/include/X11/extensions/Xrandr.h:139: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'XRRTimes'
/usr/include/X11/extensions/Xrandr.h:147: error: expected ')' before '*' token
configure:14628: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "emacs"
| #define PACKAGE_TARNAME "emacs"
| #define PACKAGE_VERSION "24.3.93"
| #define PACKAGE_STRING "emacs 24.3.93"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "emacs"
| #define VERSION "24.3.93"
| #define MAIL_USE_POP 1
| #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 _DARWIN_C_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define _DARWIN_USE_64_BIT_INODE 1
| #define SYSTEM_TYPE "gnu/linux"
| #define HAVE_SYS_SOUNDCARD_H 1
| #define HAVE_ALSA 1
| #define HAVE_SOUND 1
| #define HAVE_PTY_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_PWD_H 1
| #define HAVE_UTMP_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_EXECINFO_H 1
| #define HAVE_STDIO_EXT_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_PERSONALITY_LINUX32 1
| #define HAVE_TERM_H 1
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_DECL_SYS_SIGLIST 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_IFADDRS_H 1
| #define HAVE_STRUCT_IFREQ_IFR_FLAGS 1
| #define HAVE_STRUCT_IFREQ_IFR_HWADDR 1
| #define HAVE_STRUCT_IFREQ_IFR_NETMASK 1
| #define HAVE_STRUCT_IFREQ_IFR_BROADADDR 1
| #define HAVE_STRUCT_IFREQ_IFR_ADDR 1
| #define HAVE_LONG_FILE_NAMES 1
| #define HAVE_SYS_VLIMIT_H 1
| #define HAVE_DATA_START 1
| #define DOUG_LEA_MALLOC 1
| #define HAVE_GETPAGESIZE 1
| #define HAVE_MMAP 1
| #define HAVE_PTHREAD 1
| #define HAVE_XKB 1
| #define HAVE_XRMSETDATABASE 1
| #define HAVE_XSCREENRESOURCESTRING 1
| #define HAVE_XSCREENNUMBEROFSCREEN 1
| #define HAVE_X11R6 1
| #define HAVE_X_I18N 1
| #define HAVE_X11R6_XIM 1
| #define HAVE_RSVG 1
| #define USE_GTK 1
| #define HAVE_GTK_FILE_SELECTION_NEW 1
| #define HAVE_GTK_HANDLE_BOX_NEW 1
| #define HAVE_GTK_TEAROFF_MENU_ITEM_NEW 1
| #define HAVE_DBUS 1
| #define HAVE_DBUS_WATCH_GET_UNIX_FD 1
| #define HAVE_GCONF 1
| #define HAVE_LIBSELINUX 1
| #define USE_TOOLKIT_SCROLL_BARS 1
| #define HAVE_XIM 1
| #define USE_XIM 1
| #define XRegisterIMInstantiateCallback_arg6 XPointer
| #define HAVE_XFT 1
| #define HAVE_FREETYPE 1
| #define HAVE_XPM 1
| #define HAVE_JPEG 1
| #define HAVE_JPEG 1
| #define HAVE_PNG_H 1
| #define HAVE_PNG 1
| #define PNG_DEPSTRUCT /**/
| #define HAVE_ZLIB 1
| #define HAVE_TIFF 1
| #define HAVE_GIF 1
| #define HAVE_GPM 1
| #define HAVE_X_SM 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/Xrandr.h>
configure:14628: result: no
configure:14628: checking X11/extensions/Xrandr.h presence
configure:14628: gcc -E     -I/usr/include/freetype2   conftest.c
configure:14628: $? = 0
configure:14628: result: yes
configure:14628: WARNING: X11/extensions/Xrandr.h: present but cannot be compiled
configure:14628: WARNING: X11/extensions/Xrandr.h:     check for missing prerequisite headers?
configure:14628: WARNING: X11/extensions/Xrandr.h: see the Autoconf documentation
configure:14628: WARNING: X11/extensions/Xrandr.h:     section "Present But Cannot Be Compiled"
configure:14628: WARNING: X11/extensions/Xrandr.h: proceeding with the compiler's result
configure:14628: checking for X11/extensions/Xrandr.h
configure:14628: result: no