8213944: Fix AIX build after the removal of Xrandr.h and add a configure check for it
authorsimonis
Thu, 22 Nov 2018 09:44:02 +0100
changeset 52658 2d18e5ed0f8d
parent 52657 533b02f7842c
child 52659 8b26bd8b1832
8213944: Fix AIX build after the removal of Xrandr.h and add a configure check for it Reviewed-by: shade, erikj, stuefe, ihse, goetz
make/autoconf/help.m4
make/autoconf/lib-x11.m4
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
--- a/make/autoconf/help.m4	Thu Nov 22 09:26:51 2018 +0100
+++ b/make/autoconf/help.m4	Thu Nov 22 09:44:02 2018 +0100
@@ -102,7 +102,7 @@
     ffi)
       PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
     x11)
-      PKGHANDLER_COMMAND="sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
+      PKGHANDLER_COMMAND="sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev" ;;
     ccache)
       PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
     dtrace)
@@ -125,7 +125,7 @@
     freetype)
       PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
     x11)
-      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
+      PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;;
     ccache)
       PKGHANDLER_COMMAND="sudo yum install ccache" ;;
   esac
--- a/make/autoconf/lib-x11.m4	Thu Nov 22 09:26:51 2018 +0100
+++ b/make/autoconf/lib-x11.m4	Thu Nov 22 09:44:02 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -99,8 +99,14 @@
     OLD_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
 
+    HEADERS_TO_CHECK="X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h"
+    # There is no Xrandr extension on AIX
+    if test "x$OPENJDK_TARGET_OS" != xaix; then
+      HEADERS_TO_CHECK="$HEADERS_TO_CHECK X11/extensions/Xrandr.h"
+    fi
+
     # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
-    AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
+    AC_CHECK_HEADERS([$HEADERS_TO_CHECK],
         [X11_HEADERS_OK=yes],
         [X11_HEADERS_OK=no; break],
         [
@@ -111,7 +117,7 @@
 
     if test "x$X11_HEADERS_OK" = xno; then
       HELP_MSG_MISSING_DEPENDENCY([x11])
-      AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
+      AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h Xrander.h XTest.h Intrinsic.h). $HELP_MSG])
     fi
 
     # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Thu Nov 22 09:26:51 2018 +0100
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Thu Nov 22 09:44:02 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,9 @@
 #ifndef HEADLESS
 #include <X11/extensions/Xdbe.h>
 #include <X11/XKBlib.h>
+#ifndef _AIX
 #include <X11/extensions/Xrandr.h>
+#endif
 #include "GLXGraphicsConfig.h"
 #endif /* !HEADLESS */
 
@@ -1625,6 +1627,8 @@
 
 #ifndef HEADLESS
 
+#ifndef _AIX
+
 #define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
 #define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
 
@@ -1830,6 +1834,8 @@
     }
 }
 
+#endif /* !_AIX */
+
 static void
 X11GD_SetFullscreenMode(Window win, jboolean enabled)
 {
@@ -1869,7 +1875,7 @@
 Java_sun_awt_X11GraphicsDevice_initXrandrExtension
     (JNIEnv *env, jclass x11gd)
 {
-#ifdef HEADLESS
+#if defined(HEADLESS) || defined(_AIX)
     return JNI_FALSE;
 #else
     int opcode = 0, firstEvent = 0, firstError = 0;
@@ -1896,7 +1902,7 @@
 Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
     (JNIEnv* env, jclass x11gd, jint screen)
 {
-#ifdef HEADLESS
+#if defined(HEADLESS) || defined(_AIX)
     return NULL;
 #else
     XRRScreenConfiguration *config;
@@ -1992,7 +1998,7 @@
     (JNIEnv* env, jclass x11gd,
      jint screen, jobject arrayList)
 {
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(_AIX)
 
     AWT_LOCK();
 
@@ -2080,7 +2086,7 @@
     (JNIEnv* env, jclass x11gd,
      jint screen, jint width, jint height, jint refreshRate)
 {
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(_AIX)
     jboolean success = JNI_FALSE;
     XRRScreenConfiguration *config;
     Drawable root;
@@ -2197,6 +2203,9 @@
  */
 
 static char *get_output_screen_name(JNIEnv *env, int screen) {
+#ifdef _AIX
+    return NULL;
+#else
     if (!awt_XRRGetScreenResources || !awt_XRRGetOutputInfo) {
         return NULL;
     }
@@ -2226,6 +2235,7 @@
     }
     AWT_UNLOCK();
     return name;
+#endif /* _AIX */
 }
 
 /*