common/autoconf/libraries.m4

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 980
d6db2aec371e
parent 0
75a576e87639
child 1482
8fb429038513
permissions
-rw-r--r--

merge

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

mercurial