jdk

Форк
0
/
lib-x11.m4 
135 строк · 5.4 Кб
1
#
2
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
################################################################################
27
# Setup X11 Windows system
28
################################################################################
29
AC_DEFUN_ONCE([LIB_SETUP_X11],
30
[
31
  if test "x$NEEDS_LIB_X11" = xfalse; then
32
    if (test "x${with_x}" != x && test "x${with_x}" != xno); 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
    x_libraries_orig="$x_libraries"
39

40
    if test "x${with_x}" = xno; then
41
      AC_MSG_ERROR([It is not possible to disable the use of X11. Remove the --without-x option.])
42
    fi
43

44
    if test "x${with_x}" != x &&  test "x${with_x}" != xyes; then
45
      # The user has specified a X11 base directory. Use it for includes and
46
      # libraries, unless explicitly overridden.
47
      if test "x$x_includes" = xNONE; then
48
        x_includes="${with_x}/include"
49
      fi
50
      if test "x$x_libraries" = xNONE; then
51
        x_libraries="${with_x}/lib"
52
        x_libraries_orig="$x_libraries"
53
      fi
54
    else
55
      # Check if the user has specified sysroot, but not --with-x, --x-includes or --x-libraries.
56
      # Make a simple check for the libraries at the sysroot, and setup --x-includes and
57
      # --x-libraries for the sysroot, if that seems to be correct.
58
      if test "x$SYSROOT" != "x"; then
59
        if test "x$x_includes" = xNONE; then
60
          if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
61
            x_includes="$SYSROOT/usr/X11R6/include"
62
          elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
63
            x_includes="$SYSROOT/usr/include"
64
          fi
65
        fi
66
        if test "x$x_libraries" = xNONE; then
67
          if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
68
            x_libraries="$SYSROOT/usr/X11R6/lib"
69
          elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
70
            x_libraries="$SYSROOT/usr/lib64"
71
          elif test -f "$SYSROOT/usr/lib/libX11.so"; then
72
            x_libraries="$SYSROOT/usr/lib"
73
          elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libX11.so"; then
74
            x_libraries="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI"
75
          elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libX11.so"; then
76
            x_libraries="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI"
77
          fi
78
        fi
79
      fi
80
    fi
81

82
    # Now let autoconf do it's magic
83
    AC_PATH_X
84
    AC_PATH_XTRA
85

86
    # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
87
    # this doesn't make sense so we remove it; same for sysroot (devkit).
88
    if test "x$COMPILE_TYPE" = xcross || (test "x$SYSROOT" != "x" && test "x$x_libraries_orig" = xNONE); then
89
      X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
90
    fi
91

92
    if test "x$no_x" = xyes; then
93
      HELP_MSG_MISSING_DEPENDENCY([x11])
94
      AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
95
    fi
96

97
    AC_LANG_PUSH(C)
98
    OLD_CFLAGS="$CFLAGS"
99
    CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
100

101
    if test "x$OPENJDK_TARGET_OS" = xaix; then
102
      # There is no Xrandr extension on AIX. Code is duplicated to avoid autoconf
103
      # 2.71+ warning "AC_CHECK_HEADERS: you should use literals"
104
      X_CFLAGS="$X_CFLAGS -DNO_XRANDR"
105
      AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
106
          [X11_HEADERS_OK=yes],
107
          [X11_HEADERS_OK=no; break],
108
          [
109
            # include <X11/Xlib.h>
110
            # include <X11/Xutil.h>
111
          ]
112
      )
113
    else
114
      AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h X11/extensions/Xrandr.h],
115
          [X11_HEADERS_OK=yes],
116
          [X11_HEADERS_OK=no; break],
117
          [
118
            # include <X11/Xlib.h>
119
            # include <X11/Xutil.h>
120
          ]
121
      )
122
    fi
123

124
    if test "x$X11_HEADERS_OK" = xno; then
125
      HELP_MSG_MISSING_DEPENDENCY([x11])
126
      AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h Xrandr.h XTest.h Intrinsic.h). $HELP_MSG])
127
    fi
128

129
    CFLAGS="$OLD_CFLAGS"
130
    AC_LANG_POP(C)
131
  fi # NEEDS_LIB_X11
132

133
  AC_SUBST(X_CFLAGS)
134
  AC_SUBST(X_LIBS)
135
])
136

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.