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