libraries.m4 revision 1081:fd8ea978b212
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 AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg], 608 [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) 609 610 AC_MSG_CHECKING([for which libjpeg to use]) 611 612 # default is bundled 613 DEFAULT_LIBJPEG=bundled 614 615 # 616 # if user didn't specify, use DEFAULT_LIBJPEG 617 # 618 if test "x${with_libjpeg}" = "x"; then 619 with_libjpeg=${DEFAULT_LIBJPEG} 620 fi 621 622 AC_MSG_RESULT(${with_libjpeg}) 623 624 if test "x${with_libjpeg}" = "xbundled"; then 625 USE_EXTERNAL_LIBJPEG=false 626 elif test "x${with_libjpeg}" = "xsystem"; then 627 AC_CHECK_HEADER(jpeglib.h, [], 628 [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])]) 629 AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [], 630 [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])]) 631 632 USE_EXTERNAL_LIBJPEG=true 633 else 634 AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled']) 635 fi 636 637 AC_SUBST(USE_EXTERNAL_LIBJPEG) 638 639 ############################################################################### 640 # 641 # Check for the gif library 642 # 643 644 AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib], 645 [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) 646 647 648 AC_MSG_CHECKING([for which giflib to use]) 649 650 # default is bundled 651 DEFAULT_GIFLIB=bundled 652 653 # 654 # if user didn't specify, use DEFAULT_GIFLIB 655 # 656 if test "x${with_giflib}" = "x"; then 657 with_giflib=${DEFAULT_GIFLIB} 658 fi 659 660 AC_MSG_RESULT(${with_giflib}) 661 662 if test "x${with_giflib}" = "xbundled"; then 663 USE_EXTERNAL_LIBGIF=false 664 elif test "x${with_giflib}" = "xsystem"; then 665 AC_CHECK_HEADER(gif_lib.h, [], 666 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])]) 667 AC_CHECK_LIB(gif, DGifGetCode, [], 668 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])]) 669 670 USE_EXTERNAL_LIBGIF=true 671 else 672 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled']) 673 fi 674 AC_SUBST(USE_EXTERNAL_LIBGIF) 675 676 ############################################################################### 677 # 678 # Check for the lcms2 library 679 # 680 681 AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms], 682 [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) 683 684 AC_MSG_CHECKING([for which lcms to use]) 685 686 DEFAULT_LCMS=bundled 687 688 # 689 # If user didn't specify, use DEFAULT_LCMS 690 # 691 if test "x${with_lcms}" = "x"; then 692 with_lcms=${DEFAULT_LCMS} 693 fi 694 695 if test "x${with_lcms}" = "xbundled"; then 696 USE_EXTERNAL_LCMS=false 697 AC_MSG_RESULT([bundled]) 698 elif test "x${with_lcms}" = "xsystem"; then 699 AC_MSG_RESULT([system]) 700 PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no]) 701 if test "x${LCMS_FOUND}" = "xyes"; then 702 USE_EXTERNAL_LCMS=true 703 else 704 AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!]) 705 fi 706 else 707 AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled']) 708 fi 709 710 AC_SUBST(USE_EXTERNAL_LCMS) 711 712 ############################################################################### 713 # 714 # Check for the png library 715 # 716 717 AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng], 718 [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) 719 720 721 AC_MSG_CHECKING([for which libpng to use]) 722 723 # default is bundled 724 DEFAULT_LIBPNG=bundled 725 726 # 727 # if user didn't specify, use DEFAULT_LIBPNG 728 # 729 if test "x${with_libpng}" = "x"; then 730 with_libpng=${DEFAULT_LIBPNG} 731 fi 732 733 if test "x${with_libpng}" = "xbundled"; then 734 USE_EXTERNAL_LIBPNG=false 735 AC_MSG_RESULT([bundled]) 736 elif test "x${with_libpng}" = "xsystem"; then 737 PKG_CHECK_MODULES(PNG, libpng, 738 [ LIBPNG_FOUND=yes ], 739 [ LIBPNG_FOUND=no ]) 740 if test "x${LIBPNG_FOUND}" = "xyes"; then 741 USE_EXTERNAL_LIBPNG=true 742 AC_MSG_RESULT([system]) 743 else 744 AC_MSG_RESULT([system not found]) 745 AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!]) 746 fi 747 else 748 AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled']) 749 fi 750 AC_SUBST(USE_EXTERNAL_LIBPNG) 751 752 ############################################################################### 753 # 754 # Check for the zlib library 755 # 756 757 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib], 758 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) 759 760 AC_CHECK_LIB(z, compress, 761 [ ZLIB_FOUND=yes ], 762 [ ZLIB_FOUND=no ]) 763 764 AC_MSG_CHECKING([for which zlib to use]) 765 766 DEFAULT_ZLIB=bundled 767 if test "x$OPENJDK_TARGET_OS" = xmacosx; then 768 # 769 # On macosx default is system...on others default is 770 # 771 DEFAULT_ZLIB=system 772 fi 773 774 if test "x${ZLIB_FOUND}" != "xyes"; then 775 # 776 # If we don't find any system...set default to bundled 777 # 778 DEFAULT_ZLIB=bundled 779 fi 780 781 # 782 # If user didn't specify, use DEFAULT_ZLIB 783 # 784 if test "x${with_zlib}" = "x"; then 785 with_zlib=${DEFAULT_ZLIB} 786 fi 787 788 if test "x${with_zlib}" = "xbundled"; then 789 USE_EXTERNAL_LIBZ=false 790 AC_MSG_RESULT([bundled]) 791 elif test "x${with_zlib}" = "xsystem"; then 792 if test "x${ZLIB_FOUND}" = "xyes"; then 793 USE_EXTERNAL_LIBZ=true 794 AC_MSG_RESULT([system]) 795 else 796 AC_MSG_RESULT([system not found]) 797 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!]) 798 fi 799 else 800 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled']) 801 fi 802 803 AC_SUBST(USE_EXTERNAL_LIBZ) 804 805 ############################################################################### 806 LIBZIP_CAN_USE_MMAP=true 807 808 AC_SUBST(LIBZIP_CAN_USE_MMAP) 809 810 ############################################################################### 811 # 812 # Check if altzone exists in time.h 813 # 814 815 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])], 816 [has_altzone=yes], 817 [has_altzone=no]) 818 if test "x$has_altzone" = xyes; then 819 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h]) 820 fi 821 822 ############################################################################### 823 # 824 # Check the maths library 825 # 826 827 AC_CHECK_LIB(m, cos, [], 828 [ 829 AC_MSG_NOTICE([Maths library was not found]) 830 ] 831 ) 832 AC_SUBST(LIBM) 833 834 ############################################################################### 835 # 836 # Check for libdl.so 837 838 save_LIBS="$LIBS" 839 LIBS="" 840 AC_CHECK_LIB(dl,dlopen) 841 LIBDL="$LIBS" 842 AC_SUBST(LIBDL) 843 LIBS="$save_LIBS" 844]) 845 846AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP], 847[ 848 ############################################################################### 849 # 850 # statically link libstdc++ before C++ ABI is stablized on Linux unless 851 # dynamic build is configured on command line. 852 # 853 AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>], 854 [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])], 855 [ 856 if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \ 857 && test "x$with_stdc__lib" != xdefault; then 858 AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!]) 859 fi 860 ], 861 [with_stdc__lib=default] 862 ) 863 864 if test "x$OPENJDK_TARGET_OS" = xlinux; then 865 # Test if -lstdc++ works. 866 AC_MSG_CHECKING([if dynamic link of stdc++ is possible]) 867 AC_LANG_PUSH(C++) 868 OLD_CXXFLAGS="$CXXFLAGS" 869 CXXFLAGS="$CXXFLAGS -lstdc++" 870 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])], 871 [has_dynamic_libstdcxx=yes], 872 [has_dynamic_libstdcxx=no]) 873 CXXFLAGS="$OLD_CXXFLAGS" 874 AC_LANG_POP(C++) 875 AC_MSG_RESULT([$has_dynamic_libstdcxx]) 876 877 # Test if stdc++ can be linked statically. 878 AC_MSG_CHECKING([if static link of stdc++ is possible]) 879 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic" 880 AC_LANG_PUSH(C++) 881 OLD_LIBS="$LIBS" 882 OLD_CXX="$CXX" 883 LIBS="$STATIC_STDCXX_FLAGS" 884 CXX="$CC" 885 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])], 886 [has_static_libstdcxx=yes], 887 [has_static_libstdcxx=no]) 888 LIBS="$OLD_LIBS" 889 CXX="$OLD_CXX" 890 AC_LANG_POP(C++) 891 AC_MSG_RESULT([$has_static_libstdcxx]) 892 893 if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then 894 AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!]) 895 fi 896 897 if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then 898 AC_MSG_ERROR([Static linking of libstdc++ was not possible!]) 899 fi 900 901 if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then 902 AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!]) 903 fi 904 905 AC_MSG_CHECKING([how to link with libstdc++]) 906 # If dynamic was requested, it's available since it would fail above otherwise. 907 # If dynamic wasn't requested, go with static unless it isn't available. 908 if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 909 LIBCXX="$LIBCXX -lstdc++" 910 LDCXX="$CXX" 911 STATIC_CXX_SETTING="STATIC_CXX=false" 912 AC_MSG_RESULT([dynamic]) 913 else 914 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS" 915 LDCXX="$CC" 916 STATIC_CXX_SETTING="STATIC_CXX=true" 917 AC_MSG_RESULT([static]) 918 fi 919 fi 920 AC_SUBST(STATIC_CXX_SETTING) 921 922 if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 923 # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS 924 PKG_CHECK_MODULES([LIBFFI], [libffi]) 925 926 fi 927 928 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 929 AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config]) 930 931 if test "x$LLVM_CONFIG" != xllvm-config; then 932 AC_MSG_ERROR([llvm-config not found in $PATH.]) 933 fi 934 935 llvm_components="jit mcjit engine nativecodegen native" 936 unset LLVM_CFLAGS 937 for flag in $("$LLVM_CONFIG" --cxxflags); do 938 if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then 939 if test "${flag}" != "-D_DEBUG" ; then 940 if test "${LLVM_CFLAGS}" != "" ; then 941 LLVM_CFLAGS="${LLVM_CFLAGS} " 942 fi 943 LLVM_CFLAGS="${LLVM_CFLAGS}${flag}" 944 fi 945 fi 946 done 947 llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//') 948 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" 949 950 unset LLVM_LDFLAGS 951 for flag in $("${LLVM_CONFIG}" --ldflags); do 952 if echo "${flag}" | grep -q '^-L'; then 953 if test "${LLVM_LDFLAGS}" != ""; then 954 LLVM_LDFLAGS="${LLVM_LDFLAGS} " 955 fi 956 LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}" 957 fi 958 done 959 960 unset LLVM_LIBS 961 for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do 962 if echo "${flag}" | grep -q '^-l'; then 963 if test "${LLVM_LIBS}" != ""; then 964 LLVM_LIBS="${LLVM_LIBS} " 965 fi 966 LLVM_LIBS="${LLVM_LIBS}${flag}" 967 fi 968 done 969 970 AC_SUBST(LLVM_CFLAGS) 971 AC_SUBST(LLVM_LDFLAGS) 972 AC_SUBST(LLVM_LIBS) 973 fi 974 975 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) 976 if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then 977 LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" 978 fi 979 980 # TODO better (platform agnostic) test 981 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$TOOLCHAIN_TYPE" = xgcc; then 982 LIBCXX="-lstdc++" 983 fi 984 985 AC_SUBST(LIBCXX) 986]) 987 988AC_DEFUN_ONCE([LIB_SETUP_ON_WINDOWS], 989[ 990 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 991 TOOLCHAIN_SETUP_MSVCR_DLL 992 BASIC_DEPRECATED_ARG_WITH([dxsdk]) 993 BASIC_DEPRECATED_ARG_WITH([dxsdk-lib]) 994 BASIC_DEPRECATED_ARG_WITH([dxsdk-include]) 995 fi 996 AC_SUBST(MSVCR_DLL) 997]) 998