annotate make/autoconf/lib-std.m4 @ 49578:7c82bb507446

8190333: sun/security/ssl/X509KeyManager/PreferredKey.java failed with "Failed to get the preferable key aliases" Reviewed-by: mullan
author amjiang
date Tue, 10 Apr 2018 18:16:12 -0700
parents fb290fd1f9d4
children
rev   line source
erikj@13133 1 #
ihse@49121 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 ################################################################################
ihse@32921 27 # Setup the standard C/C++ runtime libraries.
ihse@32921 28 #
ihse@32921 29 # Most importantly, determine if stdc++ should be linked statically or
ihse@32921 30 # dynamically.
ihse@32921 31 ################################################################################
ihse@32921 32 AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
erikj@13133 33 [
ihse@20363 34 # statically link libstdc++ before C++ ABI is stablized on Linux unless
ihse@20363 35 # dynamic build is configured on command line.
ihse@20363 36 AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
ihse@20363 37 [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
ihse@20363 38 [
ihse@20363 39 if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
ihse@20363 40 && test "x$with_stdc__lib" != xdefault; then
ihse@20363 41 AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
ihse@20363 42 fi
ihse@20363 43 ],
ihse@20363 44 [with_stdc__lib=default]
ihse@20363 45 )
erikj@13133 46
ihse@20363 47 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@13133 48 # Test if stdc++ can be linked statically.
erikj@13133 49 AC_MSG_CHECKING([if static link of stdc++ is possible])
erikj@41170 50 STATIC_STDCXX_FLAGS="-static-libstdc++ -static-libgcc"
erikj@13133 51 AC_LANG_PUSH(C++)
erikj@13133 52 OLD_LIBS="$LIBS"
erikj@13133 53 LIBS="$STATIC_STDCXX_FLAGS"
erikj@13133 54 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
ihse@20363 55 [has_static_libstdcxx=yes],
ihse@20363 56 [has_static_libstdcxx=no])
erikj@13133 57 LIBS="$OLD_LIBS"
erikj@13133 58 AC_LANG_POP(C++)
erikj@13133 59 AC_MSG_RESULT([$has_static_libstdcxx])
erikj@13133 60
tbell@14459 61 if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
ihse@20363 62 AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
erikj@13133 63 fi
erikj@13133 64
tbell@14459 65 # If dynamic was requested, it's available since it would fail above otherwise.
tbell@14459 66 # If dynamic wasn't requested, go with static unless it isn't available.
ihse@32921 67 AC_MSG_CHECKING([how to link with libstdc++])
rkennke@47687 68 if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno ; then
ihse@20363 69 AC_MSG_RESULT([dynamic])
tbell@14459 70 else
ihse@20363 71 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
erikj@41170 72 JVM_LDFLAGS="$JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
erikj@37402 73 # Ideally, we should test stdc++ for the BUILD toolchain separately. For now
erikj@37402 74 # just use the same setting as for the TARGET toolchain.
erikj@41170 75 OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
ihse@20363 76 AC_MSG_RESULT([static])
erikj@13133 77 fi
ihse@20363 78 fi
erikj@13133 79
ihse@20363 80 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
ihse@22721 81 if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
erikj@23428 82 LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
ihse@20363 83 fi
ihse@49121 84 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49121 85 LIBCXX_JVM="-lCrun"
ihse@49121 86 fi
erikj@13133 87
ihse@32921 88 AC_SUBST(LIBCXX)
erikj@13133 89
ihse@32921 90 # Setup Windows runtime dlls
ihse@22721 91 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
erikj@28901 92 TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
ihse@22721 93 fi
ihse@22721 94 ])