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