lib-x11.m4 revision 1670:ee11e7837c17
1279377Simp# 2279377Simp# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 3279377Simp# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4279377Simp# 5279377Simp# This code is free software; you can redistribute it and/or modify it 6279377Simp# under the terms of the GNU General Public License version 2 only, as 7279377Simp# published by the Free Software Foundation. Oracle designates this 8279377Simp# particular file as subject to the "Classpath" exception as provided 9279377Simp# by Oracle in the LICENSE file that accompanied this code. 10279377Simp# 11279377Simp# This code is distributed in the hope that it will be useful, but WITHOUT 12279377Simp# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13279377Simp# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14279377Simp# version 2 for more details (a copy is included in the LICENSE file that 15279377Simp# accompanied this code). 16279377Simp# 17279377Simp# You should have received a copy of the GNU General Public License version 18279377Simp# 2 along with this work; if not, write to the Free Software Foundation, 19279377Simp# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20279377Simp# 21279377Simp# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22279377Simp# or visit www.oracle.com if you need additional information or have any 23279377Simp# questions. 24279377Simp# 25279377Simp 26279377Simp################################################################################ 27279377Simp# Setup X11 Windows system 28279377Simp################################################################################ 29AC_DEFUN_ONCE([LIB_SETUP_X11], 30[ 31 if test "x$NEEDS_LIB_X11" = xfalse; then 32 if test "x${with_x}" != x; then 33 AC_MSG_WARN([X11 is not used, so --with-x is ignored]) 34 fi 35 X_CFLAGS= 36 X_LIBS= 37 else 38 # Check if the user has specified sysroot, but not --x-includes or --x-libraries. 39 # Make a simple check for the libraries at the sysroot, and setup --x-includes and 40 # --x-libraries for the sysroot, if that seems to be correct. 41 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then 42 if test "x$SYSROOT" != "x"; then 43 if test "x$x_includes" = xNONE; then 44 if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then 45 x_includes="$SYSROOT/usr/X11R6/include" 46 elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then 47 x_includes="$SYSROOT/usr/include" 48 fi 49 fi 50 if test "x$x_libraries" = xNONE; then 51 if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then 52 x_libraries="$SYSROOT/usr/X11R6/lib" 53 elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 54 x_libraries="$SYSROOT/usr/lib64" 55 elif test -f "$SYSROOT/usr/lib/libX11.so"; then 56 x_libraries="$SYSROOT/usr/lib" 57 fi 58 fi 59 fi 60 fi 61 62 # Now let autoconf do it's magic 63 AC_PATH_X 64 AC_PATH_XTRA 65 66 # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling 67 # this doesn't make sense so we remove it. 68 if test "x$COMPILE_TYPE" = xcross; then 69 X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'` 70 fi 71 72 if test "x$no_x" = xyes; then 73 HELP_MSG_MISSING_DEPENDENCY([x11]) 74 AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG]) 75 fi 76 77 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 78 OPENWIN_HOME="/usr/openwin" 79 X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" 80 X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ 81 -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ 82 -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ 83 -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" 84 fi 85 86 AC_LANG_PUSH(C) 87 OLD_CFLAGS="$CFLAGS" 88 CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS" 89 90 # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10 91 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h], 92 [X11_HEADERS_OK=yes], 93 [X11_HEADERS_OK=no; break], 94 [ 95 # include <X11/Xlib.h> 96 # include <X11/Xutil.h> 97 ] 98 ) 99 100 if test "x$X11_HEADERS_OK" = xno; then 101 HELP_MSG_MISSING_DEPENDENCY([x11]) 102 AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG]) 103 fi 104 105 # If XLinearGradient isn't available in Xrender.h, signal that it needs to be 106 # defined in libawt_xawt. 107 AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h]) 108 AC_COMPILE_IFELSE( 109 [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]], 110 [[XLinearGradient x;]])], 111 [AC_MSG_RESULT([yes])], 112 [AC_MSG_RESULT([no]) 113 X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"]) 114 115 CFLAGS="$OLD_CFLAGS" 116 AC_LANG_POP(C) 117 fi # NEEDS_LIB_X11 118 119 AC_SUBST(X_CFLAGS) 120 AC_SUBST(X_LIBS) 121]) 122