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