jdk

Форк
0
/
lib-std.m4 
87 строк · 3.6 Кб
1
#
2
# Copyright (c) 2011, 2020, 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 the standard C/C++ runtime libraries.
28
#
29
# Most importantly, determine if stdc++ should be linked statically or
30
# dynamically.
31
################################################################################
32
AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
33
[
34
  # statically link libstdc++ before C++ ABI is stabilized on Linux unless
35
  # dynamic build is configured on command line.
36
  AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
37
      [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
38
      [
39
        if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
40
                && test "x$with_stdc__lib" != xdefault; then
41
          AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
42
        fi
43
      ],
44
      [with_stdc__lib=default]
45
  )
46

47
  if test "x$OPENJDK_TARGET_OS" = xlinux; then
48
    # Test if stdc++ can be linked statically.
49
    AC_MSG_CHECKING([if static link of stdc++ is possible])
50
    STATIC_STDCXX_FLAGS="-static-libstdc++ -static-libgcc"
51
    AC_LANG_PUSH(C++)
52
    OLD_LIBS="$LIBS"
53
    LIBS="$STATIC_STDCXX_FLAGS"
54
    AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
55
        [has_static_libstdcxx=yes],
56
        [has_static_libstdcxx=no])
57
    LIBS="$OLD_LIBS"
58
    AC_LANG_POP(C++)
59
    AC_MSG_RESULT([$has_static_libstdcxx])
60

61
    if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
62
      AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
63
    fi
64

65
    # If dynamic was requested, it's available since it would fail above otherwise.
66
    # If dynamic wasn't requested, go with static unless it isn't available.
67
    AC_MSG_CHECKING([how to link with libstdc++])
68
    if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno ; then
69
      AC_MSG_RESULT([dynamic])
70
    else
71
      LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
72
      JVM_LDFLAGS="$JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
73
      ADLC_LDFLAGS="$ADLC_LDFLAGS $STATIC_STDCXX_FLAGS"
74
      # Ideally, we should test stdc++ for the BUILD toolchain separately. For now
75
      # just use the same setting as for the TARGET toolchain.
76
      OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
77
      AC_MSG_RESULT([static])
78
    fi
79
  fi
80

81
  AC_SUBST(LIBCXX)
82

83
  # Setup Windows runtime dlls
84
  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
85
    TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
86
  fi
87
])
88

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

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

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

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