8062159: Fix Xrender check to work with sysroot
authorerikj
Tue, 28 Oct 2014 09:47:32 +0100
changeset 27239 12771c65e334
parent 27236 b409bc51bc23
child 27240 a2a7d337e3b7
8062159: Fix Xrender check to work with sysroot Reviewed-by: tbell, prr
common/autoconf/generated-configure.sh
common/autoconf/libraries.m4
--- a/common/autoconf/generated-configure.sh	Wed Jul 05 20:05:30 2017 +0200
+++ b/common/autoconf/generated-configure.sh	Tue Oct 28 09:47:32 2014 +0100
@@ -4328,7 +4328,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1413533532
+DATE_WHEN_GENERATED=1414485998
 
 ###############################################################################
 #
@@ -44037,17 +44037,6 @@
         -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
   fi
 
-  #
-  # Weird Sol10 something check...TODO change to try compile
-  #
-  if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
-    if test "`uname -r`" = "5.10"; then
-      if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
-        X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
-      fi
-    fi
-  fi
-
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -44055,7 +44044,7 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
   OLD_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $X_CFLAGS"
+  CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
 
   # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
   for ac_header in X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h
@@ -44079,6 +44068,31 @@
 done
 
 
+  # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
+  # defined in libawt_xawt.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if XlinearGradient is defined in Xrender.h" >&5
+$as_echo_n "checking if XlinearGradient is defined in Xrender.h... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/extensions/Xrender.h>
+int
+main ()
+{
+XLinearGradient x;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
   CFLAGS="$OLD_CFLAGS"
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
--- a/common/autoconf/libraries.m4	Wed Jul 05 20:05:30 2017 +0200
+++ b/common/autoconf/libraries.m4	Tue Oct 28 09:47:32 2014 +0100
@@ -139,20 +139,9 @@
         -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
   fi
 
-  #
-  # Weird Sol10 something check...TODO change to try compile
-  #
-  if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
-    if test "`uname -r`" = "5.10"; then
-      if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
-        X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
-      fi
-    fi
-  fi
-
   AC_LANG_PUSH(C)
   OLD_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $X_CFLAGS"
+  CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
 
   # 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],
@@ -164,6 +153,16 @@
       ]
   )
 
+  # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
+  # defined in libawt_xawt.
+  AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h])
+  AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],
+          [[XLinearGradient x;]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])
+       X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"])
+
   CFLAGS="$OLD_CFLAGS"
   AC_LANG_POP(C)