common/autoconf/libraries.m4

Fri, 07 Sep 2018 10:22:27 +0800

author
aoqi
date
Fri, 07 Sep 2018 10:22:27 +0800
changeset 2188
d75ef5fa5b02
parent 1482
8fb429038513
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

#7535 BUILDER_NAME supports Fedora 23-29

aoqi@0 1 #
ddehaven@1304 2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation. Oracle designates this
aoqi@0 8 # particular file as subject to the "Classpath" exception as provided
aoqi@0 9 # by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 #
aoqi@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 # accompanied this code).
aoqi@0 16 #
aoqi@0 17 # You should have received a copy of the GNU General Public License version
aoqi@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 #
aoqi@0 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 # or visit www.oracle.com if you need additional information or have any
aoqi@0 23 # questions.
aoqi@0 24 #
aoqi@0 25
aoqi@0 26 AC_DEFUN_ONCE([LIB_SETUP_INIT],
aoqi@0 27 [
aoqi@0 28
aoqi@0 29 ###############################################################################
aoqi@0 30 #
aoqi@0 31 # OS specific settings that we never will need to probe.
aoqi@0 32 #
aoqi@0 33 if test "x$OPENJDK_TARGET_OS" = xlinux; then
aoqi@0 34 AC_MSG_CHECKING([what is not needed on Linux?])
aoqi@0 35 PULSE_NOT_NEEDED=yes
aoqi@0 36 AC_MSG_RESULT([pulse])
aoqi@0 37 fi
aoqi@0 38
aoqi@0 39 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
aoqi@0 40 AC_MSG_CHECKING([what is not needed on Solaris?])
aoqi@0 41 ALSA_NOT_NEEDED=yes
aoqi@0 42 PULSE_NOT_NEEDED=yes
aoqi@0 43 AC_MSG_RESULT([alsa pulse])
aoqi@0 44 fi
aoqi@0 45
aoqi@0 46 if test "x$OPENJDK_TARGET_OS" = xaix; then
aoqi@0 47 AC_MSG_CHECKING([what is not needed on AIX?])
aoqi@0 48 ALSA_NOT_NEEDED=yes
aoqi@0 49 PULSE_NOT_NEEDED=yes
aoqi@0 50 AC_MSG_RESULT([alsa pulse])
aoqi@0 51 fi
aoqi@0 52
aoqi@0 53
aoqi@0 54 if test "x$OPENJDK_TARGET_OS" = xwindows; then
aoqi@0 55 AC_MSG_CHECKING([what is not needed on Windows?])
aoqi@0 56 CUPS_NOT_NEEDED=yes
aoqi@0 57 ALSA_NOT_NEEDED=yes
aoqi@0 58 PULSE_NOT_NEEDED=yes
aoqi@0 59 X11_NOT_NEEDED=yes
aoqi@0 60 AC_MSG_RESULT([alsa cups pulse x11])
aoqi@0 61 fi
aoqi@0 62
aoqi@0 63 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
aoqi@0 64 AC_MSG_CHECKING([what is not needed on MacOSX?])
aoqi@0 65 ALSA_NOT_NEEDED=yes
aoqi@0 66 PULSE_NOT_NEEDED=yes
aoqi@0 67 X11_NOT_NEEDED=yes
aoqi@0 68 AC_MSG_RESULT([alsa pulse x11])
aoqi@0 69 fi
aoqi@0 70
aoqi@0 71 if test "x$OPENJDK_TARGET_OS" = xbsd; then
aoqi@0 72 AC_MSG_CHECKING([what is not needed on bsd?])
aoqi@0 73 ALSA_NOT_NEEDED=yes
aoqi@0 74 AC_MSG_RESULT([alsa])
aoqi@0 75 fi
aoqi@0 76
aoqi@0 77 if test "x$OPENJDK" = "xfalse"; then
aoqi@0 78 FREETYPE_NOT_NEEDED=yes
aoqi@0 79 fi
aoqi@0 80
aoqi@0 81 if test "x$SUPPORT_HEADFUL" = xno; then
aoqi@0 82 X11_NOT_NEEDED=yes
aoqi@0 83 fi
aoqi@0 84
ddehaven@1304 85 # Deprecated and now ignored
aoqi@0 86 BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
aoqi@0 87 ])
aoqi@0 88
aoqi@0 89 AC_DEFUN_ONCE([LIB_SETUP_X11],
aoqi@0 90 [
aoqi@0 91
aoqi@0 92 ###############################################################################
aoqi@0 93 #
aoqi@0 94 # Check for X Windows
aoqi@0 95 #
aoqi@0 96
aoqi@0 97 # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
aoqi@0 98 # Make a simple check for the libraries at the sysroot, and setup --x-includes and
aoqi@0 99 # --x-libraries for the sysroot, if that seems to be correct.
aoqi@0 100 if test "x$SYS_ROOT" != "x/"; then
aoqi@0 101 if test "x$x_includes" = xNONE; then
aoqi@0 102 if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
aoqi@0 103 x_includes="$SYS_ROOT/usr/X11R6/include"
aoqi@0 104 elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then
aoqi@0 105 x_includes="$SYS_ROOT/usr/include"
aoqi@0 106 fi
aoqi@0 107 fi
aoqi@0 108 if test "x$x_libraries" = xNONE; then
aoqi@0 109 if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
aoqi@0 110 x_libraries="$SYS_ROOT/usr/X11R6/lib"
aoqi@0 111 elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
aoqi@0 112 x_libraries="$SYS_ROOT/usr/lib64"
aoqi@0 113 elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then
aoqi@0 114 x_libraries="$SYS_ROOT/usr/lib"
aoqi@0 115 fi
aoqi@0 116 fi
aoqi@0 117 fi
aoqi@0 118
aoqi@0 119 # Now let autoconf do it's magic
aoqi@0 120 AC_PATH_X
aoqi@0 121 AC_PATH_XTRA
aoqi@0 122
aoqi@0 123 # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
aoqi@0 124 # this doesn't make sense so we remove it.
aoqi@0 125 if test "x$COMPILE_TYPE" = xcross; then
aoqi@0 126 X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
aoqi@0 127 fi
aoqi@0 128
aoqi@0 129 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
aoqi@0 130 HELP_MSG_MISSING_DEPENDENCY([x11])
aoqi@0 131 AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
aoqi@0 132 fi
aoqi@0 133
aoqi@0 134 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
aoqi@0 135 OPENWIN_HOME="/usr/openwin"
aoqi@0 136 fi
aoqi@0 137 AC_SUBST(OPENWIN_HOME)
aoqi@0 138
aoqi@0 139
aoqi@0 140 #
aoqi@0 141 # Weird Sol10 something check...TODO change to try compile
aoqi@0 142 #
aoqi@0 143 if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
aoqi@0 144 if test "`uname -r`" = "5.10"; then
aoqi@0 145 if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
aoqi@0 146 X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
aoqi@0 147 fi
aoqi@0 148 fi
aoqi@0 149 fi
aoqi@0 150
aoqi@0 151 AC_LANG_PUSH(C)
aoqi@0 152 OLD_CFLAGS="$CFLAGS"
aoqi@0 153 CFLAGS="$CFLAGS $X_CFLAGS"
aoqi@0 154
aoqi@0 155 # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
aoqi@0 156 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
aoqi@0 157 [X11_A_OK=yes],
aoqi@0 158 [X11_A_OK=no; break],
aoqi@0 159 [
aoqi@0 160 # include <X11/Xlib.h>
aoqi@0 161 # include <X11/Xutil.h>
aoqi@0 162 ]
aoqi@0 163 )
aoqi@0 164
aoqi@0 165 CFLAGS="$OLD_CFLAGS"
aoqi@0 166 AC_LANG_POP(C)
aoqi@0 167
aoqi@0 168 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
aoqi@0 169 HELP_MSG_MISSING_DEPENDENCY([x11])
aoqi@0 170 AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
aoqi@0 171 fi
aoqi@0 172
aoqi@0 173 AC_SUBST(X_CFLAGS)
aoqi@0 174 AC_SUBST(X_LIBS)
aoqi@0 175 ])
aoqi@0 176
aoqi@0 177 AC_DEFUN_ONCE([LIB_SETUP_CUPS],
aoqi@0 178 [
aoqi@0 179
aoqi@0 180 ###############################################################################
aoqi@0 181 #
aoqi@0 182 # The common unix printing system cups is used to print from java.
aoqi@0 183 #
aoqi@0 184 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
aoqi@0 185 [specify prefix directory for the cups package
aoqi@0 186 (expecting the headers under PATH/include)])])
aoqi@0 187 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
aoqi@0 188 [specify directory for the cups include files])])
aoqi@0 189
aoqi@0 190 if test "x$CUPS_NOT_NEEDED" = xyes; then
aoqi@0 191 if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
aoqi@0 192 AC_MSG_WARN([cups not used, so --with-cups is ignored])
aoqi@0 193 fi
aoqi@0 194 CUPS_CFLAGS=
aoqi@0 195 else
aoqi@0 196 CUPS_FOUND=no
aoqi@0 197
aoqi@0 198 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
aoqi@0 199 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
aoqi@0 200 fi
aoqi@0 201
aoqi@0 202 if test "x${with_cups}" != x; then
aoqi@0 203 CUPS_CFLAGS="-I${with_cups}/include"
aoqi@0 204 CUPS_FOUND=yes
aoqi@0 205 fi
aoqi@0 206 if test "x${with_cups_include}" != x; then
aoqi@0 207 CUPS_CFLAGS="-I${with_cups_include}"
aoqi@0 208 CUPS_FOUND=yes
aoqi@0 209 fi
aoqi@0 210 if test "x$CUPS_FOUND" = xno; then
aoqi@0 211 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
aoqi@0 212 fi
aoqi@0 213 if test "x$CUPS_FOUND" = xno; then
aoqi@0 214 # Are the cups headers installed in the default /usr/include location?
aoqi@0 215 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
aoqi@0 216 [
aoqi@0 217 CUPS_FOUND=yes
aoqi@0 218 CUPS_CFLAGS=
aoqi@0 219 DEFAULT_CUPS=yes
aoqi@0 220 ]
aoqi@0 221 )
aoqi@0 222 fi
aoqi@0 223 if test "x$CUPS_FOUND" = xno; then
aoqi@0 224 # Getting nervous now? Lets poke around for standard Solaris third-party
aoqi@0 225 # package installation locations.
aoqi@0 226 AC_MSG_CHECKING([for cups headers])
aoqi@0 227 if test -s /opt/sfw/cups/include/cups/cups.h; then
aoqi@0 228 # An SFW package seems to be installed!
aoqi@0 229 CUPS_FOUND=yes
aoqi@0 230 CUPS_CFLAGS="-I/opt/sfw/cups/include"
aoqi@0 231 elif test -s /opt/csw/include/cups/cups.h; then
aoqi@0 232 # A CSW package seems to be installed!
aoqi@0 233 CUPS_FOUND=yes
aoqi@0 234 CUPS_CFLAGS="-I/opt/csw/include"
aoqi@0 235 fi
aoqi@0 236 AC_MSG_RESULT([$CUPS_FOUND])
aoqi@0 237 fi
aoqi@0 238 if test "x$CUPS_FOUND" = xno; then
aoqi@0 239 HELP_MSG_MISSING_DEPENDENCY([cups])
aoqi@0 240 AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
aoqi@0 241 fi
aoqi@0 242 fi
aoqi@0 243
aoqi@0 244 AC_SUBST(CUPS_CFLAGS)
aoqi@0 245
aoqi@0 246 ])
aoqi@0 247
aoqi@0 248 AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
aoqi@0 249 [
aoqi@0 250 POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
aoqi@0 251 POTENTIAL_FREETYPE_LIB_PATH="$2"
aoqi@0 252 METHOD="$3"
aoqi@0 253
aoqi@0 254 # First check if the files exists.
aoqi@0 255 if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
aoqi@0 256 # We found an arbitrary include file. That's a good sign.
aoqi@0 257 AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
aoqi@0 258 FOUND_FREETYPE=yes
aoqi@0 259
aoqi@0 260 FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
aoqi@0 261 if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
aoqi@0 262 AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
aoqi@0 263 FOUND_FREETYPE=no
aoqi@0 264 else
aoqi@0 265 if test "x$OPENJDK_TARGET_OS" = xwindows; then
aoqi@0 266 # On Windows, we will need both .lib and .dll file.
aoqi@0 267 if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
aoqi@0 268 AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
aoqi@0 269 FOUND_FREETYPE=no
aoqi@0 270 fi
aoqi@0 271 elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
aoqi@0 272 # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
aoqi@0 273 POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
aoqi@0 274 fi
aoqi@0 275 fi
aoqi@0 276 fi
aoqi@0 277
aoqi@0 278 if test "x$FOUND_FREETYPE" = xyes; then
aoqi@0 279 BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
aoqi@0 280 BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
aoqi@0 281
aoqi@0 282 FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
aoqi@0 283 AC_MSG_CHECKING([for freetype includes])
aoqi@0 284 AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
aoqi@0 285 FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
aoqi@0 286 AC_MSG_CHECKING([for freetype libraries])
aoqi@0 287 AC_MSG_RESULT([$FREETYPE_LIB_PATH])
aoqi@0 288 fi
aoqi@0 289 ])
aoqi@0 290
aoqi@0 291 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
aoqi@0 292 [
aoqi@0 293
aoqi@0 294 ###############################################################################
aoqi@0 295 #
aoqi@0 296 # The ubiquitous freetype library is used to render fonts.
aoqi@0 297 #
aoqi@0 298 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
aoqi@0 299 [specify prefix directory for the freetype package
aoqi@0 300 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
aoqi@0 301 AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
aoqi@0 302 [specify directory for the freetype include files])])
aoqi@0 303 AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
aoqi@0 304 [specify directory for the freetype library])])
aoqi@0 305 AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
aoqi@0 306 [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
aoqi@0 307
aoqi@0 308 FREETYPE_CFLAGS=
aoqi@0 309 FREETYPE_LIBS=
aoqi@0 310 FREETYPE_BUNDLE_LIB_PATH=
aoqi@0 311
aoqi@0 312 if test "x$FREETYPE_NOT_NEEDED" = xyes; then
aoqi@0 313 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
aoqi@0 314 AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
aoqi@0 315 fi
aoqi@0 316 if test "x$enable_freetype_bundling" != x; then
aoqi@0 317 AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
aoqi@0 318 fi
aoqi@0 319 else
aoqi@0 320 # freetype is needed to build; go get it!
aoqi@0 321
aoqi@0 322 BUNDLE_FREETYPE="$enable_freetype_bundling"
aoqi@0 323
aoqi@0 324 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
aoqi@0 325 # User has specified settings
aoqi@0 326
aoqi@0 327 if test "x$BUNDLE_FREETYPE" = x; then
aoqi@0 328 # If not specified, default is to bundle freetype
aoqi@0 329 BUNDLE_FREETYPE=yes
aoqi@0 330 fi
aoqi@0 331
aoqi@0 332 if test "x$with_freetype" != x; then
aoqi@0 333 POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
aoqi@0 334 POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
aoqi@0 335 fi
aoqi@0 336
aoqi@0 337 # Allow --with-freetype-lib and --with-freetype-include to override
aoqi@0 338 if test "x$with_freetype_include" != x; then
aoqi@0 339 POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
aoqi@0 340 fi
aoqi@0 341 if test "x$with_freetype_lib" != x; then
aoqi@0 342 POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
aoqi@0 343 fi
aoqi@0 344
aoqi@0 345 if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
aoqi@0 346 # Okay, we got it. Check that it works.
aoqi@0 347 LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
aoqi@0 348 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 349 AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
aoqi@0 350 fi
aoqi@0 351 else
aoqi@0 352 # User specified only one of lib or include. This is an error.
aoqi@0 353 if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
aoqi@0 354 AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
aoqi@0 355 AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
aoqi@0 356 else
aoqi@0 357 AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
aoqi@0 358 AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
aoqi@0 359 fi
aoqi@0 360 fi
aoqi@0 361 else
aoqi@0 362 # User did not specify settings, but we need freetype. Try to locate it.
aoqi@0 363
aoqi@0 364 if test "x$BUNDLE_FREETYPE" = x; then
aoqi@0 365 # If not specified, default is to bundle freetype only on windows
aoqi@0 366 if test "x$OPENJDK_TARGET_OS" = xwindows; then
aoqi@0 367 BUNDLE_FREETYPE=yes
aoqi@0 368 else
aoqi@0 369 BUNDLE_FREETYPE=no
aoqi@0 370 fi
aoqi@0 371 fi
aoqi@0 372
aoqi@0 373 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 374 # Check builddeps
aoqi@0 375 BDEPS_CHECK_MODULE(FREETYPE, freetype2, xxx, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
aoqi@0 376 # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
aoqi@0 377 if test "x$FOUND_FREETYPE" = xyes; then
aoqi@0 378 if test "x$BUNDLE_FREETYPE" = xyes; then
aoqi@0 379 AC_MSG_NOTICE([Found freetype using builddeps, but ignoring since we can not bundle that])
aoqi@0 380 FOUND_FREETYPE=no
aoqi@0 381 else
aoqi@0 382 AC_MSG_CHECKING([for freetype])
aoqi@0 383 AC_MSG_RESULT([yes (using builddeps)])
aoqi@0 384 fi
aoqi@0 385 fi
aoqi@0 386 fi
aoqi@0 387
aoqi@0 388 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 389 # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
aoqi@0 390 if test "x$PKG_CONFIG" != x; then
aoqi@0 391 PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
aoqi@0 392 if test "x$FOUND_FREETYPE" = xyes; then
aoqi@0 393 # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
aoqi@0 394 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
aoqi@0 395 # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
aoqi@0 396 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
aoqi@0 397 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
aoqi@0 398 fi
aoqi@0 399 # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
aoqi@0 400 if test "x$BUNDLE_FREETYPE" = xyes; then
aoqi@0 401 AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
aoqi@0 402 FOUND_FREETYPE=no
aoqi@0 403 else
aoqi@0 404 AC_MSG_CHECKING([for freetype])
aoqi@0 405 AC_MSG_RESULT([yes (using pkg-config)])
aoqi@0 406 fi
aoqi@0 407 fi
aoqi@0 408 fi
aoqi@0 409 fi
aoqi@0 410
aoqi@0 411 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 412 # Check in well-known locations
aoqi@0 413 if test "x$OPENJDK_TARGET_OS" = xwindows; then
aoqi@0 414 FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
aoqi@0 415 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
aoqi@0 416 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
aoqi@0 417 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 418 FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
aoqi@0 419 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
aoqi@0 420 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
aoqi@0 421 fi
aoqi@0 422 else
aoqi@0 423 if test "x$SYS_ROOT" = "x/"; then
aoqi@0 424 FREETYPE_ROOT=
aoqi@0 425 else
aoqi@0 426 FREETYPE_ROOT="$SYS_ROOT"
aoqi@0 427 fi
aoqi@0 428 FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
aoqi@0 429 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
aoqi@0 430
aoqi@0 431 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 432 FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
aoqi@0 433 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
aoqi@0 434 fi
aoqi@0 435
aoqi@0 436 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 437 FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
aoqi@0 438 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
aoqi@0 439 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
aoqi@0 440 else
aoqi@0 441 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
aoqi@0 442 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 443 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
aoqi@0 444 fi
aoqi@0 445 fi
aoqi@0 446 fi
aoqi@0 447 fi
aoqi@0 448 fi # end check in well-known locations
aoqi@0 449
aoqi@0 450 if test "x$FOUND_FREETYPE" != xyes; then
aoqi@0 451 HELP_MSG_MISSING_DEPENDENCY([freetype])
aoqi@0 452 AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
aoqi@0 453 fi
aoqi@0 454 fi # end user specified settings
aoqi@0 455
aoqi@0 456 # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
aoqi@0 457 if test "x$FREETYPE_CFLAGS" = x; then
aoqi@0 458 BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
aoqi@0 459 if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
aoqi@0 460 FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
aoqi@0 461 else
aoqi@0 462 FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
aoqi@0 463 fi
aoqi@0 464 fi
aoqi@0 465
aoqi@0 466 if test "x$FREETYPE_LIBS" = x; then
aoqi@0 467 BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
aoqi@0 468 if test "x$OPENJDK_TARGET_OS" = xwindows; then
aoqi@0 469 FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
aoqi@0 470 else
aoqi@0 471 FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
aoqi@0 472 fi
aoqi@0 473 fi
aoqi@0 474
aoqi@0 475 # Try to compile it
aoqi@0 476 AC_MSG_CHECKING([if we can compile and link with freetype])
aoqi@0 477 AC_LANG_PUSH(C++)
aoqi@0 478 PREV_CXXCFLAGS="$CXXFLAGS"
aoqi@0 479 PREV_LIBS="$LIBS"
aoqi@0 480 PREV_CXX="$CXX"
aoqi@0 481 CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
aoqi@0 482 LIBS="$LIBS $FREETYPE_LIBS"
aoqi@0 483 CXX="$FIXPATH $CXX"
aoqi@0 484 AC_LINK_IFELSE([AC_LANG_SOURCE([[
aoqi@0 485 #include<ft2build.h>
aoqi@0 486 #include FT_FREETYPE_H
aoqi@0 487 int main () {
aoqi@0 488 FT_Init_FreeType(NULL);
aoqi@0 489 return 0;
aoqi@0 490 }
aoqi@0 491 ]])],
aoqi@0 492 [
aoqi@0 493 AC_MSG_RESULT([yes])
aoqi@0 494 ],
aoqi@0 495 [
aoqi@0 496 AC_MSG_RESULT([no])
aoqi@0 497 AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
aoqi@0 498 AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
aoqi@0 499
aoqi@0 500 HELP_MSG_MISSING_DEPENDENCY([freetype])
aoqi@0 501
aoqi@0 502 AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
aoqi@0 503 ]
aoqi@0 504 )
aoqi@0 505 CXXCFLAGS="$PREV_CXXFLAGS"
aoqi@0 506 LIBS="$PREV_LIBS"
aoqi@0 507 CXX="$PREV_CXX"
aoqi@0 508 AC_LANG_POP(C++)
aoqi@0 509
aoqi@0 510 AC_MSG_CHECKING([if we should bundle freetype])
aoqi@0 511 if test "x$BUNDLE_FREETYPE" = xyes; then
aoqi@0 512 FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
aoqi@0 513 fi
aoqi@0 514 AC_MSG_RESULT([$BUNDLE_FREETYPE])
aoqi@0 515
aoqi@0 516 fi # end freetype needed
aoqi@0 517
aoqi@0 518 AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
aoqi@0 519 AC_SUBST(FREETYPE_CFLAGS)
aoqi@0 520 AC_SUBST(FREETYPE_LIBS)
aoqi@0 521 ])
aoqi@0 522
aoqi@0 523 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
aoqi@0 524 [
aoqi@0 525
aoqi@0 526 ###############################################################################
aoqi@0 527 #
aoqi@0 528 # Check for alsa headers and libraries. Used on Linux/GNU systems.
aoqi@0 529 #
aoqi@0 530 AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
aoqi@0 531 [specify prefix directory for the alsa package
aoqi@0 532 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
aoqi@0 533 AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
aoqi@0 534 [specify directory for the alsa include files])])
aoqi@0 535 AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
aoqi@0 536 [specify directory for the alsa library])])
aoqi@0 537
aoqi@0 538 if test "x$ALSA_NOT_NEEDED" = xyes; then
aoqi@0 539 if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
aoqi@0 540 AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
aoqi@0 541 fi
aoqi@0 542 ALSA_CFLAGS=
aoqi@0 543 ALSA_LIBS=
aoqi@0 544 else
aoqi@0 545 ALSA_FOUND=no
aoqi@0 546
aoqi@0 547 if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
aoqi@0 548 AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
aoqi@0 549 fi
aoqi@0 550
aoqi@0 551 if test "x${with_alsa}" != x; then
aoqi@0 552 ALSA_LIBS="-L${with_alsa}/lib -lasound"
aoqi@0 553 ALSA_CFLAGS="-I${with_alsa}/include"
aoqi@0 554 ALSA_FOUND=yes
aoqi@0 555 fi
aoqi@0 556 if test "x${with_alsa_include}" != x; then
aoqi@0 557 ALSA_CFLAGS="-I${with_alsa_include}"
aoqi@0 558 ALSA_FOUND=yes
aoqi@0 559 fi
aoqi@0 560 if test "x${with_alsa_lib}" != x; then
aoqi@0 561 ALSA_LIBS="-L${with_alsa_lib} -lasound"
aoqi@0 562 ALSA_FOUND=yes
aoqi@0 563 fi
aoqi@0 564 if test "x$ALSA_FOUND" = xno; then
aoqi@0 565 BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
aoqi@0 566 fi
aoqi@0 567 if test "x$ALSA_FOUND" = xno; then
aoqi@0 568 PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
aoqi@0 569 fi
aoqi@0 570 if test "x$ALSA_FOUND" = xno; then
aoqi@0 571 AC_CHECK_HEADERS([alsa/asoundlib.h],
aoqi@0 572 [
aoqi@0 573 ALSA_FOUND=yes
aoqi@0 574 ALSA_CFLAGS=-Iignoreme
aoqi@0 575 ALSA_LIBS=-lasound
aoqi@0 576 DEFAULT_ALSA=yes
aoqi@0 577 ],
aoqi@0 578 [ALSA_FOUND=no])
aoqi@0 579 fi
aoqi@0 580 if test "x$ALSA_FOUND" = xno; then
aoqi@0 581 HELP_MSG_MISSING_DEPENDENCY([alsa])
aoqi@0 582 AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
aoqi@0 583 fi
aoqi@0 584 fi
aoqi@0 585
aoqi@0 586 AC_SUBST(ALSA_CFLAGS)
aoqi@0 587 AC_SUBST(ALSA_LIBS)
aoqi@0 588 ])
aoqi@0 589
aoqi@0 590 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
aoqi@0 591 [
aoqi@0 592
aoqi@0 593 ###############################################################################
aoqi@0 594 #
aoqi@0 595 # Check for the jpeg library
aoqi@0 596 #
aoqi@0 597
aoqi@0 598 USE_EXTERNAL_LIBJPEG=true
aoqi@0 599 AC_CHECK_LIB(jpeg, main, [],
aoqi@0 600 [ USE_EXTERNAL_LIBJPEG=false
aoqi@0 601 AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
aoqi@0 602 ])
aoqi@0 603 AC_SUBST(USE_EXTERNAL_LIBJPEG)
aoqi@0 604
aoqi@0 605 ###############################################################################
aoqi@0 606 #
aoqi@0 607 # Check for the gif library
aoqi@0 608 #
aoqi@0 609
aoqi@0 610 AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
aoqi@0 611 [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
aoqi@0 612
aoqi@0 613
aoqi@0 614 AC_MSG_CHECKING([for which giflib to use])
aoqi@0 615
aoqi@0 616 # default is bundled
aoqi@0 617 DEFAULT_GIFLIB=bundled
aoqi@0 618
aoqi@0 619 #
aoqi@0 620 # if user didn't specify, use DEFAULT_GIFLIB
aoqi@0 621 #
aoqi@0 622 if test "x${with_giflib}" = "x"; then
aoqi@0 623 with_giflib=${DEFAULT_GIFLIB}
aoqi@0 624 fi
aoqi@0 625
aoqi@0 626 AC_MSG_RESULT(${with_giflib})
aoqi@0 627
aoqi@0 628 if test "x${with_giflib}" = "xbundled"; then
aoqi@0 629 USE_EXTERNAL_LIBGIF=false
aoqi@0 630 elif test "x${with_giflib}" = "xsystem"; then
aoqi@0 631 AC_CHECK_HEADER(gif_lib.h, [],
aoqi@0 632 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
aoqi@0 633 AC_CHECK_LIB(gif, DGifGetCode, [],
aoqi@0 634 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
aoqi@0 635
aoqi@0 636 USE_EXTERNAL_LIBGIF=true
aoqi@0 637 else
aoqi@0 638 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
aoqi@0 639 fi
aoqi@0 640 AC_SUBST(USE_EXTERNAL_LIBGIF)
aoqi@0 641
aoqi@0 642 ###############################################################################
aoqi@0 643 #
aoqi@0 644 # Check for the zlib library
aoqi@0 645 #
aoqi@0 646
aoqi@0 647 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
aoqi@0 648 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
aoqi@0 649
aoqi@0 650 AC_CHECK_LIB(z, compress,
aoqi@0 651 [ ZLIB_FOUND=yes ],
aoqi@0 652 [ ZLIB_FOUND=no ])
aoqi@0 653
aoqi@0 654 AC_MSG_CHECKING([for which zlib to use])
aoqi@0 655
aoqi@0 656 DEFAULT_ZLIB=bundled
aoqi@0 657 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
aoqi@0 658 #
aoqi@0 659 # On macosx default is system...on others default is
aoqi@0 660 #
aoqi@0 661 DEFAULT_ZLIB=system
aoqi@0 662 fi
aoqi@0 663
aoqi@0 664 if test "x${ZLIB_FOUND}" != "xyes"; then
aoqi@0 665 #
aoqi@0 666 # If we don't find any system...set default to bundled
aoqi@0 667 #
aoqi@0 668 DEFAULT_ZLIB=bundled
aoqi@0 669 fi
aoqi@0 670
aoqi@0 671 #
aoqi@0 672 # If user didn't specify, use DEFAULT_ZLIB
aoqi@0 673 #
aoqi@0 674 if test "x${with_zlib}" = "x"; then
aoqi@0 675 with_zlib=${DEFAULT_ZLIB}
aoqi@0 676 fi
aoqi@0 677
aoqi@0 678 if test "x${with_zlib}" = "xbundled"; then
aoqi@0 679 USE_EXTERNAL_LIBZ=false
aoqi@0 680 AC_MSG_RESULT([bundled])
aoqi@0 681 elif test "x${with_zlib}" = "xsystem"; then
aoqi@0 682 if test "x${ZLIB_FOUND}" = "xyes"; then
aoqi@0 683 USE_EXTERNAL_LIBZ=true
aoqi@0 684 AC_MSG_RESULT([system])
aoqi@0 685 else
aoqi@0 686 AC_MSG_RESULT([system not found])
aoqi@0 687 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
aoqi@0 688 fi
aoqi@0 689 else
aoqi@0 690 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
aoqi@0 691 fi
aoqi@0 692
aoqi@0 693 AC_SUBST(USE_EXTERNAL_LIBZ)
aoqi@0 694
aoqi@0 695 ###############################################################################
aoqi@0 696 LIBZIP_CAN_USE_MMAP=true
aoqi@0 697
aoqi@0 698 AC_SUBST(LIBZIP_CAN_USE_MMAP)
aoqi@0 699
aoqi@0 700 ###############################################################################
aoqi@0 701 #
aoqi@0 702 # Check if altzone exists in time.h
aoqi@0 703 #
aoqi@0 704
aoqi@0 705 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
aoqi@0 706 [has_altzone=yes],
aoqi@0 707 [has_altzone=no])
aoqi@0 708 if test "x$has_altzone" = xyes; then
aoqi@0 709 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
aoqi@0 710 fi
aoqi@0 711
aoqi@0 712 ###############################################################################
aoqi@0 713 #
aoqi@0 714 # Check the maths library
aoqi@0 715 #
aoqi@0 716
aoqi@0 717 AC_CHECK_LIB(m, cos, [],
aoqi@0 718 [
aoqi@0 719 AC_MSG_NOTICE([Maths library was not found])
aoqi@0 720 ]
aoqi@0 721 )
aoqi@0 722 AC_SUBST(LIBM)
aoqi@0 723
aoqi@0 724 ###############################################################################
aoqi@0 725 #
aoqi@0 726 # Check for libdl.so
aoqi@0 727
aoqi@0 728 save_LIBS="$LIBS"
aoqi@0 729 LIBS=""
aoqi@0 730 AC_CHECK_LIB(dl,dlopen)
aoqi@0 731 LIBDL="$LIBS"
aoqi@0 732 AC_SUBST(LIBDL)
aoqi@0 733 LIBS="$save_LIBS"
aoqi@0 734 ])
aoqi@0 735
aoqi@0 736 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
aoqi@0 737 [
aoqi@0 738 ###############################################################################
aoqi@0 739 #
aoqi@0 740 # statically link libstdc++ before C++ ABI is stablized on Linux unless
aoqi@0 741 # dynamic build is configured on command line.
aoqi@0 742 #
aoqi@0 743 AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
aoqi@0 744 [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
aoqi@0 745 [
aoqi@0 746 if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
aoqi@0 747 && test "x$with_stdc__lib" != xdefault; then
aoqi@0 748 AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
aoqi@0 749 fi
aoqi@0 750 ],
aoqi@0 751 [with_stdc__lib=default]
aoqi@0 752 )
aoqi@0 753
aoqi@0 754 if test "x$OPENJDK_TARGET_OS" = xlinux; then
aoqi@0 755 # Test if -lstdc++ works.
aoqi@0 756 AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
aoqi@0 757 AC_LANG_PUSH(C++)
aoqi@0 758 OLD_CXXFLAGS="$CXXFLAGS"
aoqi@0 759 CXXFLAGS="$CXXFLAGS -lstdc++"
aoqi@0 760 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
aoqi@0 761 [has_dynamic_libstdcxx=yes],
aoqi@0 762 [has_dynamic_libstdcxx=no])
aoqi@0 763 CXXFLAGS="$OLD_CXXFLAGS"
aoqi@0 764 AC_LANG_POP(C++)
aoqi@0 765 AC_MSG_RESULT([$has_dynamic_libstdcxx])
aoqi@0 766
aoqi@0 767 # Test if stdc++ can be linked statically.
aoqi@0 768 AC_MSG_CHECKING([if static link of stdc++ is possible])
aoqi@0 769 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
aoqi@0 770 AC_LANG_PUSH(C++)
aoqi@0 771 OLD_LIBS="$LIBS"
aoqi@0 772 OLD_CXX="$CXX"
aoqi@0 773 LIBS="$STATIC_STDCXX_FLAGS"
aoqi@0 774 CXX="$CC"
aoqi@0 775 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
aoqi@0 776 [has_static_libstdcxx=yes],
aoqi@0 777 [has_static_libstdcxx=no])
aoqi@0 778 LIBS="$OLD_LIBS"
aoqi@0 779 CXX="$OLD_CXX"
aoqi@0 780 AC_LANG_POP(C++)
aoqi@0 781 AC_MSG_RESULT([$has_static_libstdcxx])
aoqi@0 782
aoqi@0 783 if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
aoqi@0 784 AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
aoqi@0 785 fi
aoqi@0 786
aoqi@0 787 if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
aoqi@0 788 AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
aoqi@0 789 fi
aoqi@0 790
aoqi@0 791 if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
aoqi@0 792 AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
aoqi@0 793 fi
aoqi@0 794
aoqi@0 795 AC_MSG_CHECKING([how to link with libstdc++])
aoqi@0 796 # If dynamic was requested, it's available since it would fail above otherwise.
aoqi@0 797 # If dynamic wasn't requested, go with static unless it isn't available.
aoqi@0 798 if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
aoqi@0 799 LIBCXX="$LIBCXX -lstdc++"
aoqi@0 800 LDCXX="$CXX"
aoqi@0 801 STATIC_CXX_SETTING="STATIC_CXX=false"
aoqi@0 802 AC_MSG_RESULT([dynamic])
aoqi@0 803 else
aoqi@0 804 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
aoqi@0 805 LDCXX="$CC"
aoqi@0 806 STATIC_CXX_SETTING="STATIC_CXX=true"
aoqi@0 807 AC_MSG_RESULT([static])
aoqi@0 808 fi
aoqi@0 809 fi
aoqi@0 810 AC_SUBST(STATIC_CXX_SETTING)
aoqi@0 811
aoqi@0 812 if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
aoqi@0 813 # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
aoqi@0 814 PKG_CHECK_MODULES([LIBFFI], [libffi])
aoqi@0 815
aoqi@0 816 fi
aoqi@0 817
aoqi@0 818 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
aoqi@0 819 AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config])
aoqi@0 820
aoqi@0 821 if test "x$LLVM_CONFIG" != xllvm-config; then
aoqi@0 822 AC_MSG_ERROR([llvm-config not found in $PATH.])
aoqi@0 823 fi
aoqi@0 824
aoqi@0 825 llvm_components="jit mcjit engine nativecodegen native"
aoqi@0 826 unset LLVM_CFLAGS
aoqi@0 827 for flag in $("$LLVM_CONFIG" --cxxflags); do
aoqi@0 828 if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then
aoqi@0 829 if test "${flag}" != "-D_DEBUG" ; then
aoqi@0 830 if test "${LLVM_CFLAGS}" != "" ; then
aoqi@0 831 LLVM_CFLAGS="${LLVM_CFLAGS} "
aoqi@0 832 fi
aoqi@0 833 LLVM_CFLAGS="${LLVM_CFLAGS}${flag}"
aoqi@0 834 fi
aoqi@0 835 fi
aoqi@0 836 done
aoqi@0 837 llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
aoqi@0 838 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
aoqi@0 839
aoqi@0 840 unset LLVM_LDFLAGS
aoqi@0 841 for flag in $("${LLVM_CONFIG}" --ldflags); do
aoqi@0 842 if echo "${flag}" | grep -q '^-L'; then
aoqi@0 843 if test "${LLVM_LDFLAGS}" != ""; then
aoqi@0 844 LLVM_LDFLAGS="${LLVM_LDFLAGS} "
aoqi@0 845 fi
aoqi@0 846 LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}"
aoqi@0 847 fi
aoqi@0 848 done
aoqi@0 849
aoqi@0 850 unset LLVM_LIBS
aoqi@0 851 for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do
aoqi@0 852 if echo "${flag}" | grep -q '^-l'; then
aoqi@0 853 if test "${LLVM_LIBS}" != ""; then
aoqi@0 854 LLVM_LIBS="${LLVM_LIBS} "
aoqi@0 855 fi
aoqi@0 856 LLVM_LIBS="${LLVM_LIBS}${flag}"
aoqi@0 857 fi
aoqi@0 858 done
aoqi@0 859
aoqi@0 860 AC_SUBST(LLVM_CFLAGS)
aoqi@0 861 AC_SUBST(LLVM_LDFLAGS)
aoqi@0 862 AC_SUBST(LLVM_LIBS)
aoqi@0 863 fi
aoqi@0 864
aoqi@0 865 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
aoqi@0 866 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
aoqi@0 867 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
aoqi@0 868 fi
aoqi@0 869
aoqi@0 870 # TODO better (platform agnostic) test
aoqi@0 871 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
aoqi@0 872 LIBCXX="-lstdc++"
aoqi@0 873 fi
aoqi@0 874
aoqi@0 875 AC_SUBST(LIBCXX)
aoqi@0 876 ])

mercurial