common/autoconf/libraries.m4

Mon, 29 Jun 2020 21:30:12 +0100

author
andrew
date
Mon, 29 Jun 2020 21:30:12 +0100
changeset 2537
a8da94d779b3
parent 2400
9da665f87c4b
child 2408
2e38e8d106de
permissions
-rw-r--r--

Merge

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

mercurial