annotate make/autoconf/libraries.m4 @ 52753:528d904ccf11

refactor and improve performance
author rpressler
date Sun, 25 Nov 2018 16:11:37 +0000
parents 7c51db95ccb6
children 75a42622414e
rev   line source
erikj@13133 1 #
ihse@49120 2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
ihse@32921 26 # Major library component reside in separate files.
ihse@32921 27 m4_include([lib-alsa.m4])
ihse@32921 28 m4_include([lib-bundled.m4])
ihse@32921 29 m4_include([lib-cups.m4])
ihse@32921 30 m4_include([lib-ffi.m4])
ihse@32921 31 m4_include([lib-freetype.m4])
ihse@32921 32 m4_include([lib-std.m4])
ihse@32921 33 m4_include([lib-x11.m4])
prr@47507 34 m4_include([lib-fontconfig.m4])
epavlova@50908 35 m4_include([lib-tests.m4])
ihse@32921 36
ihse@32921 37 ################################################################################
ihse@32921 38 # Determine which libraries are needed for this configuration
ihse@32921 39 ################################################################################
ihse@32921 40 AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
erikj@13133 41 [
ihse@32921 42 # Check if X11 is needed
ihse@32921 43 if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@32921 44 # No X11 support on windows or macosx
ihse@32921 45 NEEDS_LIB_X11=false
ihse@32921 46 else
erikj@41046 47 # All other instances need X11, even if building headless only, libawt still
erikj@41046 48 # needs X11 headers.
erikj@41046 49 NEEDS_LIB_X11=true
ihse@20363 50 fi
erikj@13133 51
prr@47507 52 # Check if fontconfig is needed
prr@47507 53 if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
prr@47507 54 # No fontconfig support on windows or macosx
prr@47507 55 NEEDS_LIB_FONTCONFIG=false
prr@47507 56 else
prr@47507 57 # All other instances need fontconfig, even if building headless only,
prr@47507 58 # libawt still needs fontconfig headers.
prr@47507 59 NEEDS_LIB_FONTCONFIG=true
prr@47507 60 fi
prr@47507 61
ihse@32921 62 # Check if cups is needed
ihse@32921 63 if test "x$OPENJDK_TARGET_OS" = xwindows; then
ihse@32921 64 # Windows have a separate print system
ihse@32921 65 NEEDS_LIB_CUPS=false
ihse@32921 66 else
ihse@32921 67 NEEDS_LIB_CUPS=true
ihse@20363 68 fi
erikj@13133 69
erikj@39384 70 # A custom hook may have set this already
erikj@39384 71 if test "x$NEEDS_LIB_FREETYPE" = "x"; then
ihse@32921 72 NEEDS_LIB_FREETYPE=true
kvn@22467 73 fi
simonis@22466 74
ihse@32921 75 # Check if alsa is needed
ihse@32921 76 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@32921 77 NEEDS_LIB_ALSA=true
ihse@32921 78 else
ihse@32921 79 NEEDS_LIB_ALSA=false
ihse@20363 80 fi
erikj@13133 81
ihse@32921 82 # Check if ffi is needed
rkennke@47687 83 if HOTSPOT_CHECK_JVM_VARIANT(zero); then
ihse@32921 84 NEEDS_LIB_FFI=true
ihse@32921 85 else
ihse@32921 86 NEEDS_LIB_FFI=false
ihse@20363 87 fi
erikj@13133 88 ])
erikj@13133 89
ihse@32921 90 ################################################################################
ihse@32921 91 # Parse library options, and setup needed libraries
ihse@32921 92 ################################################################################
ihse@32921 93 AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
erikj@13133 94 [
ihse@32921 95 LIB_SETUP_STD_LIBS
ihse@32921 96 LIB_SETUP_X11
ihse@32921 97 LIB_SETUP_CUPS
prr@47507 98 LIB_SETUP_FONTCONFIG
ihse@32921 99 LIB_SETUP_FREETYPE
ihse@32921 100 LIB_SETUP_ALSA
ihse@32921 101 LIB_SETUP_LIBFFI
ihse@32921 102 LIB_SETUP_BUNDLED_LIBS
ihse@32921 103 LIB_SETUP_MISC_LIBS
iignatyev@37967 104 LIB_SETUP_SOLARIS_STLPORT
epavlova@50908 105 LIB_TESTS_SETUP_GRAALUNIT
ihse@49120 106
ihse@49120 107 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49241 108 GLOBAL_LIBS="-lc"
ihse@49120 109 else
ihse@49241 110 GLOBAL_LIBS=""
ihse@49120 111 fi
ihse@49120 112
ihse@49120 113 BASIC_JDKLIB_LIBS=""
ihse@49120 114 if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
ihse@49120 115 BASIC_JDKLIB_LIBS="-ljava -ljvm"
ihse@49120 116 fi
ihse@49120 117
ihse@49120 118 # Math library
kvn@49640 119 BASIC_JVM_LIBS="$LIBM"
ihse@49120 120
ihse@49120 121 # Dynamic loading library
ihse@49120 122 if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
ihse@49120 123 BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL"
ihse@49120 124 fi
ihse@49120 125
ihse@49120 126 # Threading library
ihse@49120 127 if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
ihse@49120 128 BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
ihse@49120 129 elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@49120 130 BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lthread"
ihse@49120 131 fi
ihse@49120 132
ihse@49120 133 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@49120 134 BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -ldemangle -lnsl \
egahlin@50113 135 -lrt -lkstat"
ihse@49120 136 BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM"
ihse@49120 137 fi
ihse@49120 138
ihse@49120 139 if test "x$OPENJDK_TARGET_OS" = xwindows; then
ihse@49120 140 BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
ihse@49120 141 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
ihse@49120 142 wsock32.lib winmm.lib version.lib psapi.lib"
ihse@49120 143 fi
ihse@49120 144
ihse@49120 145 JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
ihse@49120 146 JDKEXE_LIBS=""
ihse@49120 147 JVM_LIBS="$BASIC_JVM_LIBS"
ihse@49120 148 OPENJDK_BUILD_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
ihse@49120 149 OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS"
ihse@49120 150
ihse@49120 151 AC_SUBST(JDKLIB_LIBS)
ihse@49120 152 AC_SUBST(JDKEXE_LIBS)
ihse@49120 153 AC_SUBST(JVM_LIBS)
ihse@49120 154 AC_SUBST(OPENJDK_BUILD_JDKLIB_LIBS)
ihse@49120 155 AC_SUBST(OPENJDK_BUILD_JVM_LIBS)
ihse@49241 156 AC_SUBST(GLOBAL_LIBS)
erikj@13133 157 ])
erikj@13133 158
ihse@32921 159 ################################################################################
ihse@32921 160 # Setup various libraries, typically small system libraries
ihse@32921 161 ################################################################################
ihse@32921 162 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
ihse@22721 163 [
ihse@32921 164 # Setup libm (the maths library)
ihse@36050 165 if test "x$OPENJDK_TARGET_OS" != "xwindows"; then
ihse@36050 166 AC_CHECK_LIB(m, cos, [], [
ihse@36050 167 AC_MSG_NOTICE([Maths library was not found])
ihse@36050 168 ])
ihse@36050 169 LIBM="-lm"
ihse@36050 170 else
ihse@36050 171 LIBM=""
ihse@36050 172 fi
ihse@32921 173 AC_SUBST(LIBM)
ihse@32921 174
ihse@32921 175 # Setup libdl (for dynamic library loading)
ihse@32921 176 save_LIBS="$LIBS"
ihse@32921 177 LIBS=""
ihse@32921 178 AC_CHECK_LIB(dl, dlopen)
ihse@32921 179 LIBDL="$LIBS"
ihse@32921 180 AC_SUBST(LIBDL)
ihse@32921 181 LIBS="$save_LIBS"
ihse@32921 182
ihse@32921 183 # Control if libzip can use mmap. Available for purposes of overriding.
ihse@32921 184 LIBZIP_CAN_USE_MMAP=true
ihse@32921 185 AC_SUBST(LIBZIP_CAN_USE_MMAP)
ihse@22721 186 ])
iignatyev@37967 187
iignatyev@37967 188 ################################################################################
iignatyev@37967 189 # libstlport.so.1 is needed for running gtest on Solaris. Find it to
iignatyev@37967 190 # redistribute it in the test image.
iignatyev@37967 191 ################################################################################
iignatyev@37967 192 AC_DEFUN_ONCE([LIB_SETUP_SOLARIS_STLPORT],
iignatyev@37967 193 [
simonis@39193 194 if test "$OPENJDK_TARGET_OS" = "solaris" && test "x$BUILD_GTEST" = "xtrue"; then
iignatyev@37967 195 # Find the root of the Solaris Studio installation from the compiler path
iignatyev@37967 196 SOLARIS_STUDIO_DIR="$(dirname $CC)/.."
iignatyev@37967 197 STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4$OPENJDK_TARGET_CPU_ISADIR/libstlport.so.1"
iignatyev@37967 198 AC_MSG_CHECKING([for libstlport.so.1])
simonis@39193 199 if ! test -f "$STLPORT_LIB" && test "x$OPENJDK_TARGET_CPU_ISADIR" = "x/sparcv9"; then
simonis@39193 200 # SS12u3 has libstlport under 'stlport4/v9' instead of 'stlport4/sparcv9'
simonis@39193 201 STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4/v9/libstlport.so.1"
simonis@39193 202 fi
iignatyev@37967 203 if test -f "$STLPORT_LIB"; then
iignatyev@37967 204 AC_MSG_RESULT([yes, $STLPORT_LIB])
iignatyev@37967 205 BASIC_FIXUP_PATH([STLPORT_LIB])
iignatyev@37967 206 else
iignatyev@37967 207 AC_MSG_RESULT([no, not found at $STLPORT_LIB])
iignatyev@37967 208 AC_MSG_ERROR([Failed to find libstlport.so.1, cannot build Hotspot gtests])
iignatyev@37967 209 fi
iignatyev@37967 210 AC_SUBST(STLPORT_LIB)
iignatyev@37967 211 fi
iignatyev@37967 212 ])