|
| 1 | +# |
| 2 | +# Copyright (c) 2011, 2021, 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 | +# Major library component reside in separate files. |
| 27 | +m4_include([lib-alsa.m4]) |
| 28 | +m4_include([lib-bundled.m4]) |
| 29 | +m4_include([lib-cups.m4]) |
| 30 | +m4_include([lib-ffi.m4]) |
| 31 | +m4_include([lib-freetype.m4]) |
| 32 | +m4_include([lib-std.m4]) |
| 33 | +m4_include([lib-x11.m4]) |
| 34 | +m4_include([lib-fontconfig.m4]) |
| 35 | +m4_include([lib-tests.m4]) |
| 36 | + |
| 37 | +################################################################################ |
| 38 | +# Determine which libraries are needed for this configuration |
| 39 | +################################################################################ |
| 40 | +AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES], |
| 41 | +[ |
| 42 | + # Check if X11 is needed |
| 43 | + if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then |
| 44 | + # No X11 support on windows or macosx |
| 45 | + NEEDS_LIB_X11=false |
| 46 | + else |
| 47 | + # All other instances need X11, even if building headless only, libawt still |
| 48 | + # needs X11 headers. |
| 49 | + NEEDS_LIB_X11=true |
| 50 | + fi |
| 51 | + |
| 52 | + # Check if fontconfig is needed |
| 53 | + if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then |
| 54 | + # No fontconfig support on windows or macosx |
| 55 | + NEEDS_LIB_FONTCONFIG=false |
| 56 | + else |
| 57 | + # All other instances need fontconfig, even if building headless only, |
| 58 | + # libawt still needs fontconfig headers. |
| 59 | + NEEDS_LIB_FONTCONFIG=true |
| 60 | + fi |
| 61 | + |
| 62 | + # Check if cups is needed |
| 63 | + if test "x$OPENJDK_TARGET_OS" = xwindows; then |
| 64 | + # Windows have a separate print system |
| 65 | + NEEDS_LIB_CUPS=false |
| 66 | + else |
| 67 | + NEEDS_LIB_CUPS=true |
| 68 | + fi |
| 69 | + |
| 70 | + # A custom hook may have set this already |
| 71 | + if test "x$NEEDS_LIB_FREETYPE" = "x"; then |
| 72 | + NEEDS_LIB_FREETYPE=true |
| 73 | + fi |
| 74 | + |
| 75 | + # Check if alsa is needed |
| 76 | + if test "x$OPENJDK_TARGET_OS" = xlinux; then |
| 77 | + NEEDS_LIB_ALSA=true |
| 78 | + else |
| 79 | + NEEDS_LIB_ALSA=false |
| 80 | + fi |
| 81 | + |
| 82 | + # Check if ffi is needed |
| 83 | + if HOTSPOT_CHECK_JVM_VARIANT(zero); then |
| 84 | + NEEDS_LIB_FFI=true |
| 85 | + else |
| 86 | + NEEDS_LIB_FFI=false |
| 87 | + fi |
| 88 | +]) |
| 89 | + |
| 90 | +################################################################################ |
| 91 | +# Parse library options, and setup needed libraries |
| 92 | +################################################################################ |
| 93 | +AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES], |
| 94 | +[ |
| 95 | + LIB_SETUP_STD_LIBS |
| 96 | + LIB_SETUP_X11 |
| 97 | + LIB_SETUP_CUPS |
| 98 | + LIB_SETUP_FONTCONFIG |
| 99 | + LIB_SETUP_FREETYPE |
| 100 | + LIB_SETUP_ALSA |
| 101 | + LIB_SETUP_LIBFFI |
| 102 | + LIB_SETUP_BUNDLED_LIBS |
| 103 | + LIB_SETUP_MISC_LIBS |
| 104 | + LIB_TESTS_SETUP_GTEST |
| 105 | + |
| 106 | + BASIC_JDKLIB_LIBS="" |
| 107 | + if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then |
| 108 | + BASIC_JDKLIB_LIBS="-ljava -ljvm" |
| 109 | + fi |
| 110 | + |
| 111 | + # Math library |
| 112 | + BASIC_JVM_LIBS="$LIBM" |
| 113 | + |
| 114 | + # Dynamic loading library |
| 115 | + if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then |
| 116 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL" |
| 117 | + fi |
| 118 | + |
| 119 | + # Threading library |
| 120 | + if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then |
| 121 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread" |
| 122 | + elif test "x$OPENJDK_TARGET_OS" = xsolaris; then |
| 123 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lthread" |
| 124 | + fi |
| 125 | + |
| 126 | + # librt for legacy clock_gettime |
| 127 | + if test "x$OPENJDK_TARGET_OS" = xlinux; then |
| 128 | + # Hotspot needs to link librt to get the clock_* functions. |
| 129 | + # But once our supported minimum build and runtime platform |
| 130 | + # has glibc 2.17, this can be removed as the functions are |
| 131 | + # in libc. |
| 132 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lrt" |
| 133 | + fi |
| 134 | + |
| 135 | + # Atomic library |
| 136 | + # 32-bit platforms needs fallback library for 8-byte atomic ops on Zero |
| 137 | + if HOTSPOT_CHECK_JVM_VARIANT(zero); then |
| 138 | + if test "x$OPENJDK_TARGET_OS" = xlinux && |
| 139 | + (test "x$OPENJDK_TARGET_CPU" = xarm || |
| 140 | + test "x$OPENJDK_TARGET_CPU" = xm68k || |
| 141 | + test "x$OPENJDK_TARGET_CPU" = xmips || |
| 142 | + test "x$OPENJDK_TARGET_CPU" = xmipsel || |
| 143 | + test "x$OPENJDK_TARGET_CPU" = xppc || |
| 144 | + test "x$OPENJDK_TARGET_CPU" = xsh); then |
| 145 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic" |
| 146 | + fi |
| 147 | + fi |
| 148 | + |
| 149 | + # perfstat lib |
| 150 | + if test "x$OPENJDK_TARGET_OS" = xaix; then |
| 151 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat" |
| 152 | + fi |
| 153 | + |
| 154 | + if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
| 155 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -lnsl \ |
| 156 | + -lrt -lkstat" |
| 157 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM" |
| 158 | + fi |
| 159 | + |
| 160 | + if test "x$OPENJDK_TARGET_OS" = xwindows; then |
| 161 | + BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \ |
| 162 | + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \ |
| 163 | + wsock32.lib winmm.lib version.lib psapi.lib" |
| 164 | + fi |
| 165 | + |
| 166 | + JDKLIB_LIBS="$BASIC_JDKLIB_LIBS" |
| 167 | + JDKEXE_LIBS="" |
| 168 | + JVM_LIBS="$BASIC_JVM_LIBS" |
| 169 | + OPENJDK_BUILD_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS" |
| 170 | + OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS" |
| 171 | + |
| 172 | + AC_SUBST(JDKLIB_LIBS) |
| 173 | + AC_SUBST(JDKEXE_LIBS) |
| 174 | + AC_SUBST(JVM_LIBS) |
| 175 | + AC_SUBST(OPENJDK_BUILD_JDKLIB_LIBS) |
| 176 | + AC_SUBST(OPENJDK_BUILD_JVM_LIBS) |
| 177 | + AC_SUBST(GLOBAL_LIBS) |
| 178 | +]) |
| 179 | + |
| 180 | +################################################################################ |
| 181 | +# Setup various libraries, typically small system libraries |
| 182 | +################################################################################ |
| 183 | +AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], |
| 184 | +[ |
| 185 | + # Setup libm (the maths library) |
| 186 | + if test "x$OPENJDK_TARGET_OS" != "xwindows"; then |
| 187 | + AC_CHECK_LIB(m, cos, [], [ |
| 188 | + AC_MSG_NOTICE([Maths library was not found]) |
| 189 | + ]) |
| 190 | + LIBM="-lm" |
| 191 | + else |
| 192 | + LIBM="" |
| 193 | + fi |
| 194 | + AC_SUBST(LIBM) |
| 195 | + |
| 196 | + # Setup libdl (for dynamic library loading) |
| 197 | + save_LIBS="$LIBS" |
| 198 | + LIBS="" |
| 199 | + AC_CHECK_LIB(dl, dlopen) |
| 200 | + LIBDL="$LIBS" |
| 201 | + AC_SUBST(LIBDL) |
| 202 | + LIBS="$save_LIBS" |
| 203 | + |
| 204 | + # Control if libzip can use mmap. Available for purposes of overriding. |
| 205 | + LIBZIP_CAN_USE_MMAP=true |
| 206 | + AC_SUBST(LIBZIP_CAN_USE_MMAP) |
| 207 | +]) |
0 commit comments