annotate common/autoconf/libraries.m4 @ 25035:2c0a89ff0198

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