lib-x11.m4 revision 2360:321bde455f54
155714Skris# 255714Skris# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 355714Skris# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 455714Skris# 555714Skris# This code is free software; you can redistribute it and/or modify it 655714Skris# under the terms of the GNU General Public License version 2 only, as 755714Skris# published by the Free Software Foundation. Oracle designates this 8280297Sjkim# particular file as subject to the "Classpath" exception as provided 955714Skris# by Oracle in the LICENSE file that accompanied this code. 1055714Skris# 1155714Skris# This code is distributed in the hope that it will be useful, but WITHOUT 1255714Skris# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1355714Skris# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1455714Skris# version 2 for more details (a copy is included in the LICENSE file that 15280297Sjkim# accompanied this code). 1655714Skris# 1755714Skris# You should have received a copy of the GNU General Public License version 1855714Skris# 2 along with this work; if not, write to the Free Software Foundation, 1955714Skris# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2055714Skris# 2155714Skris# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22280297Sjkim# or visit www.oracle.com if you need additional information or have any 2355714Skris# questions. 2455714Skris# 2555714Skris 2655714Skris################################################################################ 2755714Skris# Setup X11 Windows system 2855714Skris################################################################################ 2955714SkrisAC_DEFUN_ONCE([LIB_SETUP_X11], 3055714Skris[ 3155714Skris if test "x$NEEDS_LIB_X11" = xfalse; then 3255714Skris if (test "x${with_x}" != x && test "x${with_x}" != xno); then 3355714Skris AC_MSG_WARN([X11 is not used, so --with-x is ignored]) 3455714Skris fi 3555714Skris X_CFLAGS= 3655714Skris X_LIBS= 37280297Sjkim else 3855714Skris 3955714Skris if test "x${with_x}" = xno; then 40280297Sjkim AC_MSG_ERROR([It is not possible to disable the use of X11. Remove the --without-x option.]) 4155714Skris fi 4255714Skris 4355714Skris if test "x${with_x}" != x && test "x${with_x}" != xyes; then 4455714Skris # The user has specified a X11 base directory. Use it for includes and 4555714Skris # libraries, unless explicitly overridden. 4655714Skris if test "x$x_includes" = xNONE; then 4755714Skris x_includes="${with_x}/include" 4855714Skris fi 4955714Skris if test "x$x_libraries" = xNONE; then 5055714Skris x_libraries="${with_x}/lib" 5155714Skris fi 52280297Sjkim else 5355714Skris # Check if the user has specified sysroot, but not --with-x, --x-includes or --x-libraries. 5455714Skris # Make a simple check for the libraries at the sysroot, and setup --x-includes and 5555714Skris # --x-libraries for the sysroot, if that seems to be correct. 5655714Skris if test "x$SYSROOT" != "x"; then 5755714Skris if test "x$x_includes" = xNONE; then 58100928Snectar if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then 59238405Sjkim x_includes="$SYSROOT/usr/X11R6/include" 60100928Snectar elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then 61100928Snectar x_includes="$SYSROOT/usr/include" 62100928Snectar fi 63100928Snectar fi 64100928Snectar if test "x$x_libraries" = xNONE; then 65100928Snectar if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then 66280297Sjkim x_libraries="$SYSROOT/usr/X11R6/lib" 67100928Snectar elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 68100928Snectar x_libraries="$SYSROOT/usr/lib64" 69100928Snectar elif test -f "$SYSROOT/usr/lib/libX11.so"; then 70100928Snectar x_libraries="$SYSROOT/usr/lib" 71100928Snectar fi 72100928Snectar fi 73100928Snectar fi 74100928Snectar fi 75100928Snectar 76100928Snectar # Now let autoconf do it's magic 77100928Snectar AC_PATH_X 78100928Snectar AC_PATH_XTRA 79100928Snectar 80100928Snectar # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling 81100928Snectar # this doesn't make sense so we remove it. 82100928Snectar if test "x$COMPILE_TYPE" = xcross; then 83100928Snectar X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'` 84100928Snectar fi 85100928Snectar 86100928Snectar if test "x$no_x" = xyes; then 87100928Snectar HELP_MSG_MISSING_DEPENDENCY([x11]) 88100928Snectar AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG]) 89100928Snectar fi 90100928Snectar 91100928Snectar if test "x$OPENJDK_TARGET_OS" = xsolaris; then 92100928Snectar OPENWIN_HOME="/usr/openwin" 93100928Snectar X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" 94100928Snectar X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ 95100928Snectar -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" 96100928Snectar fi 97100928Snectar 98100928Snectar AC_LANG_PUSH(C) 99100928Snectar OLD_CFLAGS="$CFLAGS" 100100928Snectar CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS" 101100928Snectar 102100928Snectar # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10 103100928Snectar AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h], 104100928Snectar [X11_HEADERS_OK=yes], 105100928Snectar [X11_HEADERS_OK=no; break], 106100928Snectar [ 107100928Snectar # include <X11/Xlib.h> 108100928Snectar # include <X11/Xutil.h> 109100928Snectar ] 110100928Snectar ) 111238405Sjkim 112238405Sjkim if test "x$X11_HEADERS_OK" = xno; then 113238405Sjkim HELP_MSG_MISSING_DEPENDENCY([x11]) 114238405Sjkim AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG]) 115238405Sjkim fi 116238405Sjkim 117238405Sjkim # If XLinearGradient isn't available in Xrender.h, signal that it needs to be 118238405Sjkim # defined in libawt_xawt. 119238405Sjkim AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h]) 120238405Sjkim AC_COMPILE_IFELSE( 121238405Sjkim [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]], 122238405Sjkim [[XLinearGradient x;]])], 123238405Sjkim [AC_MSG_RESULT([yes])], 124238405Sjkim [AC_MSG_RESULT([no]) 125238405Sjkim X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"]) 126238405Sjkim 127238405Sjkim CFLAGS="$OLD_CFLAGS" 128238405Sjkim AC_LANG_POP(C) 129238405Sjkim fi # NEEDS_LIB_X11 130238405Sjkim 131238405Sjkim AC_SUBST(X_CFLAGS) 132238405Sjkim AC_SUBST(X_LIBS) 133238405Sjkim]) 134238405Sjkim