common/autoconf/lib-x11.m4
author sundar
Wed, 04 Jan 2017 18:47:35 +0530
changeset 43017 88c78d6617f4
parent 42300 218374d35efd
permissions -rw-r--r--
8164391: Provide a javadoc description for jdk.scripting.nashorn Reviewed-by: attila, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
     2
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    26
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    27
# Setup X11 Windows system
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    28
################################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    29
AC_DEFUN_ONCE([LIB_SETUP_X11],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    30
[
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    31
  if test "x$NEEDS_LIB_X11" = xfalse; then
33393
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32974
diff changeset
    32
    if (test "x${with_x}" != x && test "x${with_x}" != xno); then
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    33
      AC_MSG_WARN([X11 is not used, so --with-x is ignored])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    34
    fi
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    35
    X_CFLAGS=
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    36
    X_LIBS=
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    37
  else
32974
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    38
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    39
    if test "x${with_x}" = xno; then
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    40
      AC_MSG_ERROR([It is not possible to disable the use of X11. Remove the --without-x option.])
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    41
    fi
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    42
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    43
    if test "x${with_x}" != x &&  test "x${with_x}" != xyes; then
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    44
      # The user has specified a X11 base directory. Use it for includes and
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 41040
diff changeset
    45
      # libraries, unless explicitly overridden.
32974
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    46
      if test "x$x_includes" = xNONE; then
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    47
        x_includes="${with_x}/include"
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    48
      fi
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    49
      if test "x$x_libraries" = xNONE; then
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    50
        x_libraries="${with_x}/lib"
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    51
      fi
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    52
    else
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    53
      # Check if the user has specified sysroot, but not --with-x, --x-includes or --x-libraries.
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    54
      # Make a simple check for the libraries at the sysroot, and setup --x-includes and
aa5083b6aca4 8139413: Use --with-x to set X11 root directory
ihse
parents: 32921
diff changeset
    55
      # --x-libraries for the sysroot, if that seems to be correct.
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    56
      if test "x$SYSROOT" != "x"; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    57
        if test "x$x_includes" = xNONE; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    58
          if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    59
            x_includes="$SYSROOT/usr/X11R6/include"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    60
          elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    61
            x_includes="$SYSROOT/usr/include"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    62
          fi
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
    63
        fi
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    64
        if test "x$x_libraries" = xNONE; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    65
          if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    66
            x_libraries="$SYSROOT/usr/X11R6/lib"
31327
8c2512d63fac 8130303: Fix bogus check for libX11.so in libraries.m4
simonis
parents: 28901
diff changeset
    67
          elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    68
            x_libraries="$SYSROOT/usr/lib64"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    69
          elif test -f "$SYSROOT/usr/lib/libX11.so"; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    70
            x_libraries="$SYSROOT/usr/lib"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    71
          fi
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
    72
        fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    73
      fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    74
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    75
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    76
    # Now let autoconf do it's magic
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    77
    AC_PATH_X
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    78
    AC_PATH_XTRA
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    79
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    80
    # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    81
    # this doesn't make sense so we remove it.
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    82
    if test "x$COMPILE_TYPE" = xcross; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    83
      X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    84
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    85
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    86
    if test "x$no_x" = xyes; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    87
      HELP_MSG_MISSING_DEPENDENCY([x11])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    88
      AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    89
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    90
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    91
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    92
      OPENWIN_HOME="/usr/openwin"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    93
      X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
41040
7b919a4497ff 8165161: Solaris: /usr/ccs /opt/sfw and /opt/csw are dead, references should be expunged
alanbur
parents: 33393
diff changeset
    94
      X_LIBS="-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    95
          -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    96
    fi
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    97
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    98
    AC_LANG_PUSH(C)
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    99
    OLD_CFLAGS="$CFLAGS"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   100
    CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   101
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   102
    # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   103
    AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   104
        [X11_HEADERS_OK=yes],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   105
        [X11_HEADERS_OK=no; break],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   106
        [
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   107
          # include <X11/Xlib.h>
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   108
          # include <X11/Xutil.h>
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   109
        ]
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   110
    )
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   111
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   112
    if test "x$X11_HEADERS_OK" = xno; then
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   113
      HELP_MSG_MISSING_DEPENDENCY([x11])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   114
      AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   115
    fi
27239
12771c65e334 8062159: Fix Xrender check to work with sysroot
erikj
parents: 26400
diff changeset
   116
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   117
    # If XLinearGradient isn't available in Xrender.h, signal that it needs to be
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   118
    # defined in libawt_xawt.
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   119
    AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   120
    AC_COMPILE_IFELSE(
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   121
        [AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   122
            [[XLinearGradient x;]])],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   123
        [AC_MSG_RESULT([yes])],
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   124
        [AC_MSG_RESULT([no])
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   125
         X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   126
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   127
    CFLAGS="$OLD_CFLAGS"
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
   128
    AC_LANG_POP(C)
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   129
  fi # NEEDS_LIB_X11
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   130
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   131
  AC_SUBST(X_CFLAGS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   132
  AC_SUBST(X_LIBS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   133
])