author | ihse |
Mon, 04 Nov 2019 11:15:45 +0100 | |
changeset 58909 | 66f7d2494d4e |
parent 49120 | c04d813140dc |
permissions | -rw-r--r-- |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
1 |
# |
49120 | 2 |
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
4 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
10 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
16 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
20 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
23 |
# questions. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
24 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
25 |
|
32921
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
26 |
################################################################################ |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
27 |
# Setup the standard C/C++ runtime libraries. |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
28 |
# |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
29 |
# Most importantly, determine if stdc++ should be linked statically or |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
30 |
# dynamically. |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
31 |
################################################################################ |
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
32 |
AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS], |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
33 |
[ |
20363 | 34 |
# statically link libstdc++ before C++ ABI is stablized 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 |
) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
46 |
|
20363 | 47 |
if test "x$OPENJDK_TARGET_OS" = xlinux; then |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
48 |
# Test if stdc++ can be linked statically. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
49 |
AC_MSG_CHECKING([if static link of stdc++ is possible]) |
41170
30db66a57e7d
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
37402
diff
changeset
|
50 |
STATIC_STDCXX_FLAGS="-static-libstdc++ -static-libgcc" |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
51 |
AC_LANG_PUSH(C++) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
52 |
OLD_LIBS="$LIBS" |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
53 |
LIBS="$STATIC_STDCXX_FLAGS" |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
54 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])], |
20363 | 55 |
[has_static_libstdcxx=yes], |
56 |
[has_static_libstdcxx=no]) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
57 |
LIBS="$OLD_LIBS" |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
58 |
AC_LANG_POP(C++) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
59 |
AC_MSG_RESULT([$has_static_libstdcxx]) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
60 |
|
14459
6213b3f9e08d
8001875: build-infra: We must be able to force static linking of stdc++
tbell
parents:
14280
diff
changeset
|
61 |
if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then |
20363 | 62 |
AC_MSG_ERROR([Static linking of libstdc++ was not possible!]) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
63 |
fi |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
64 |
|
14459
6213b3f9e08d
8001875: build-infra: We must be able to force static linking of stdc++
tbell
parents:
14280
diff
changeset
|
65 |
# If dynamic was requested, it's available since it would fail above otherwise. |
6213b3f9e08d
8001875: build-infra: We must be able to force static linking of stdc++
tbell
parents:
14280
diff
changeset
|
66 |
# If dynamic wasn't requested, go with static unless it isn't available. |
32921
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
67 |
AC_MSG_CHECKING([how to link with libstdc++]) |
47687 | 68 |
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno ; then |
20363 | 69 |
AC_MSG_RESULT([dynamic]) |
14459
6213b3f9e08d
8001875: build-infra: We must be able to force static linking of stdc++
tbell
parents:
14280
diff
changeset
|
70 |
else |
20363 | 71 |
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS" |
41170
30db66a57e7d
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
37402
diff
changeset
|
72 |
JVM_LDFLAGS="$JVM_LDFLAGS $STATIC_STDCXX_FLAGS" |
37402 | 73 |
# Ideally, we should test stdc++ for the BUILD toolchain separately. For now |
74 |
# just use the same setting as for the TARGET toolchain. |
|
41170
30db66a57e7d
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
37402
diff
changeset
|
75 |
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $STATIC_STDCXX_FLAGS" |
20363 | 76 |
AC_MSG_RESULT([static]) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
77 |
fi |
20363 | 78 |
fi |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
79 |
|
20363 | 80 |
# libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) |
22721
63761da45392
8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents:
22710
diff
changeset
|
81 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then |
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
23165
diff
changeset
|
82 |
LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" |
20363 | 83 |
fi |
49120 | 84 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
85 |
LIBCXX_JVM="-lCrun" |
|
86 |
fi |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
87 |
|
32921
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
88 |
AC_SUBST(LIBCXX) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
89 |
|
32921
8e0250dfa145
8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents:
31327
diff
changeset
|
90 |
# Setup Windows runtime dlls |
22721
63761da45392
8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents:
22710
diff
changeset
|
91 |
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
28901
5acc0ec03d06
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27595
diff
changeset
|
92 |
TOOLCHAIN_SETUP_VS_RUNTIME_DLLS |
22721
63761da45392
8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents:
22710
diff
changeset
|
93 |
fi |
63761da45392
8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents:
22710
diff
changeset
|
94 |
]) |