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