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