common/autoconf/libraries.m4

Thu, 27 Dec 2018 11:47:57 +0800

author
aoqi
date
Thu, 27 Dec 2018 11:47:57 +0800
changeset 2316
64a3eeabf6e5
parent 2223
01cc48ed67f3
parent 1482
8fb429038513
child 2408
2e38e8d106de
permissions
-rw-r--r--

Merge

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

mercurial