|
1 # |
|
2 # Copyright (c) 2011, 2017, 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 |
|
35 ################################################################################ |
|
36 # Determine which libraries are needed for this configuration |
|
37 ################################################################################ |
|
38 AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES], |
|
39 [ |
|
40 # Check if X11 is needed |
|
41 if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
42 # No X11 support on windows or macosx |
|
43 NEEDS_LIB_X11=false |
|
44 else |
|
45 # All other instances need X11, even if building headless only, libawt still |
|
46 # needs X11 headers. |
|
47 NEEDS_LIB_X11=true |
|
48 fi |
|
49 |
|
50 # Check if cups is needed |
|
51 if test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
52 # Windows have a separate print system |
|
53 NEEDS_LIB_CUPS=false |
|
54 else |
|
55 NEEDS_LIB_CUPS=true |
|
56 fi |
|
57 |
|
58 # A custom hook may have set this already |
|
59 if test "x$NEEDS_LIB_FREETYPE" = "x"; then |
|
60 NEEDS_LIB_FREETYPE=true |
|
61 fi |
|
62 |
|
63 # Check if alsa is needed |
|
64 if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
65 NEEDS_LIB_ALSA=true |
|
66 else |
|
67 NEEDS_LIB_ALSA=false |
|
68 fi |
|
69 |
|
70 # Check if ffi is needed |
|
71 if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then |
|
72 NEEDS_LIB_FFI=true |
|
73 else |
|
74 NEEDS_LIB_FFI=false |
|
75 fi |
|
76 ]) |
|
77 |
|
78 ################################################################################ |
|
79 # Parse library options, and setup needed libraries |
|
80 ################################################################################ |
|
81 AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES], |
|
82 [ |
|
83 LIB_SETUP_STD_LIBS |
|
84 LIB_SETUP_X11 |
|
85 LIB_SETUP_CUPS |
|
86 LIB_SETUP_FREETYPE |
|
87 LIB_SETUP_ALSA |
|
88 LIB_SETUP_LIBFFI |
|
89 LIB_SETUP_LLVM |
|
90 LIB_SETUP_BUNDLED_LIBS |
|
91 LIB_SETUP_MISC_LIBS |
|
92 LIB_SETUP_SOLARIS_STLPORT |
|
93 ]) |
|
94 |
|
95 ################################################################################ |
|
96 # Setup llvm (Low-Level VM) |
|
97 ################################################################################ |
|
98 AC_DEFUN_ONCE([LIB_SETUP_LLVM], |
|
99 [ |
|
100 if HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then |
|
101 AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config]) |
|
102 |
|
103 if test "x$LLVM_CONFIG" != xllvm-config; then |
|
104 AC_MSG_ERROR([llvm-config not found in $PATH.]) |
|
105 fi |
|
106 |
|
107 llvm_components="jit mcjit engine nativecodegen native" |
|
108 unset LLVM_CFLAGS |
|
109 for flag in $("$LLVM_CONFIG" --cxxflags); do |
|
110 if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then |
|
111 if test "${flag}" != "-D_DEBUG" ; then |
|
112 if test "${LLVM_CFLAGS}" != "" ; then |
|
113 LLVM_CFLAGS="${LLVM_CFLAGS} " |
|
114 fi |
|
115 LLVM_CFLAGS="${LLVM_CFLAGS}${flag}" |
|
116 fi |
|
117 fi |
|
118 done |
|
119 llvm_version=$("${LLVM_CONFIG}" --version | $SED 's/\.//; s/svn.*//') |
|
120 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" |
|
121 |
|
122 unset LLVM_LDFLAGS |
|
123 for flag in $("${LLVM_CONFIG}" --ldflags); do |
|
124 if echo "${flag}" | grep -q '^-L'; then |
|
125 if test "${LLVM_LDFLAGS}" != ""; then |
|
126 LLVM_LDFLAGS="${LLVM_LDFLAGS} " |
|
127 fi |
|
128 LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}" |
|
129 fi |
|
130 done |
|
131 |
|
132 unset LLVM_LIBS |
|
133 for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do |
|
134 if echo "${flag}" | grep -q '^-l'; then |
|
135 if test "${LLVM_LIBS}" != ""; then |
|
136 LLVM_LIBS="${LLVM_LIBS} " |
|
137 fi |
|
138 LLVM_LIBS="${LLVM_LIBS}${flag}" |
|
139 fi |
|
140 done |
|
141 |
|
142 # Due to https://llvm.org/bugs/show_bug.cgi?id=16902, llvm does not |
|
143 # always properly detect -ltinfo |
|
144 LLVM_LIBS="${LLVM_LIBS} -ltinfo" |
|
145 |
|
146 AC_SUBST(LLVM_CFLAGS) |
|
147 AC_SUBST(LLVM_LDFLAGS) |
|
148 AC_SUBST(LLVM_LIBS) |
|
149 fi |
|
150 ]) |
|
151 |
|
152 ################################################################################ |
|
153 # Setup various libraries, typically small system libraries |
|
154 ################################################################################ |
|
155 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], |
|
156 [ |
|
157 # Setup libm (the maths library) |
|
158 if test "x$OPENJDK_TARGET_OS" != "xwindows"; then |
|
159 AC_CHECK_LIB(m, cos, [], [ |
|
160 AC_MSG_NOTICE([Maths library was not found]) |
|
161 ]) |
|
162 LIBM="-lm" |
|
163 else |
|
164 LIBM="" |
|
165 fi |
|
166 AC_SUBST(LIBM) |
|
167 |
|
168 # Setup libdl (for dynamic library loading) |
|
169 save_LIBS="$LIBS" |
|
170 LIBS="" |
|
171 AC_CHECK_LIB(dl, dlopen) |
|
172 LIBDL="$LIBS" |
|
173 AC_SUBST(LIBDL) |
|
174 LIBS="$save_LIBS" |
|
175 |
|
176 # Deprecated libraries, keep the flags for backwards compatibility |
|
177 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
|
178 BASIC_DEPRECATED_ARG_WITH([dxsdk]) |
|
179 BASIC_DEPRECATED_ARG_WITH([dxsdk-lib]) |
|
180 BASIC_DEPRECATED_ARG_WITH([dxsdk-include]) |
|
181 fi |
|
182 |
|
183 # Control if libzip can use mmap. Available for purposes of overriding. |
|
184 LIBZIP_CAN_USE_MMAP=true |
|
185 AC_SUBST(LIBZIP_CAN_USE_MMAP) |
|
186 ]) |
|
187 |
|
188 ################################################################################ |
|
189 # libstlport.so.1 is needed for running gtest on Solaris. Find it to |
|
190 # redistribute it in the test image. |
|
191 ################################################################################ |
|
192 AC_DEFUN_ONCE([LIB_SETUP_SOLARIS_STLPORT], |
|
193 [ |
|
194 if test "$OPENJDK_TARGET_OS" = "solaris" && test "x$BUILD_GTEST" = "xtrue"; then |
|
195 # Find the root of the Solaris Studio installation from the compiler path |
|
196 SOLARIS_STUDIO_DIR="$(dirname $CC)/.." |
|
197 STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4$OPENJDK_TARGET_CPU_ISADIR/libstlport.so.1" |
|
198 AC_MSG_CHECKING([for libstlport.so.1]) |
|
199 if ! test -f "$STLPORT_LIB" && test "x$OPENJDK_TARGET_CPU_ISADIR" = "x/sparcv9"; then |
|
200 # SS12u3 has libstlport under 'stlport4/v9' instead of 'stlport4/sparcv9' |
|
201 STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4/v9/libstlport.so.1" |
|
202 fi |
|
203 if test -f "$STLPORT_LIB"; then |
|
204 AC_MSG_RESULT([yes, $STLPORT_LIB]) |
|
205 BASIC_FIXUP_PATH([STLPORT_LIB]) |
|
206 else |
|
207 AC_MSG_RESULT([no, not found at $STLPORT_LIB]) |
|
208 AC_MSG_ERROR([Failed to find libstlport.so.1, cannot build Hotspot gtests]) |
|
209 fi |
|
210 AC_SUBST(STLPORT_LIB) |
|
211 fi |
|
212 ]) |
|
213 |