annotate common/autoconf/libraries.m4 @ 23163:1e2f42892ffe

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