common/autoconf/libraries.m4

Wed, 29 May 2013 14:01:04 +0200

author
erikj
date
Wed, 29 May 2013 14:01:04 +0200
changeset 725
03e60e87d92a
parent 671
653ff6bcf0b1
child 740
c0fa87863427
permissions
-rw-r--r--

8013489: New build system does not run codesign on SA-related launchers on OS X
Reviewed-by: sla, tbell

erikj@459 1 #
erikj@459 2 # Copyright (c) 2011, 2012, 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 [
erikj@459 28
erikj@459 29 ###############################################################################
erikj@459 30 #
erikj@459 31 # OS specific settings that we never will need to probe.
erikj@459 32 #
erikj@459 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])
erikj@459 37 fi
erikj@459 38
erikj@459 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])
erikj@459 44 fi
erikj@459 45
erikj@459 46 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@459 47 AC_MSG_CHECKING([what is not needed on Windows?])
erikj@459 48 CUPS_NOT_NEEDED=yes
erikj@459 49 ALSA_NOT_NEEDED=yes
erikj@459 50 PULSE_NOT_NEEDED=yes
erikj@459 51 X11_NOT_NEEDED=yes
erikj@459 52 AC_MSG_RESULT([alsa cups pulse x11])
erikj@459 53 fi
erikj@459 54
erikj@459 55 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@459 56 AC_MSG_CHECKING([what is not needed on MacOSX?])
erikj@459 57 ALSA_NOT_NEEDED=yes
erikj@459 58 PULSE_NOT_NEEDED=yes
erikj@459 59 X11_NOT_NEEDED=yes
erikj@459 60 FREETYPE2_NOT_NEEDED=yes
erikj@459 61 # If the java runtime framework is disabled, then we need X11.
erikj@459 62 # This will be adjusted below.
erikj@459 63 AC_MSG_RESULT([alsa pulse x11])
erikj@459 64 fi
erikj@459 65
erikj@459 66 if test "x$OPENJDK_TARGET_OS" = xbsd; then
erikj@459 67 AC_MSG_CHECKING([what is not needed on bsd?])
erikj@459 68 ALSA_NOT_NEEDED=yes
erikj@459 69 AC_MSG_RESULT([alsa])
erikj@459 70 fi
erikj@459 71
erikj@459 72 if test "x$OPENJDK" = "xfalse"; then
erikj@459 73 FREETYPE2_NOT_NEEDED=yes
erikj@459 74 fi
erikj@459 75
ohair@478 76 if test "x$SUPPORT_HEADFUL" = xno; then
ohair@478 77 X11_NOT_NEEDED=yes
ohair@478 78 fi
ohair@478 79
erikj@459 80 ###############################################################################
erikj@459 81 #
erikj@459 82 # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
erikj@459 83 # that uses this API.
erikj@459 84 #
erikj@459 85 AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support],
erikj@459 86 [disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])],
erikj@459 87 [MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"])
erikj@459 88
erikj@459 89 USE_MACOSX_RUNTIME_SUPPORT=no
erikj@459 90 AC_MSG_CHECKING([for explicit Java runtime support in the OS])
erikj@459 91 if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
erikj@459 92 if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
erikj@459 93 MACOSX_RUNTIME_SUPPORT=yes
erikj@459 94 USE_MACOSX_RUNTIME_SUPPORT=yes
erikj@459 95 AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11])
erikj@459 96 else
erikj@459 97 AC_MSG_RESULT([yes, but explicitly disabled.])
erikj@459 98 fi
erikj@459 99 else
erikj@459 100 AC_MSG_RESULT([no])
erikj@459 101 fi
erikj@459 102
erikj@459 103 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
erikj@459 104 AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?])
erikj@459 105 X11_NOT_NEEDED=
erikj@459 106 FREETYPE2_NOT_NEEDED=
erikj@459 107 AC_MSG_RESULT([alsa pulse])
erikj@459 108 fi
erikj@459 109 ])
erikj@459 110
erikj@459 111 AC_DEFUN_ONCE([LIB_SETUP_X11],
erikj@459 112 [
erikj@459 113
erikj@459 114 ###############################################################################
erikj@459 115 #
erikj@459 116 # Check for X Windows
erikj@459 117 #
erikj@459 118
erikj@459 119 # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
erikj@459 120 # Make a simple check for the libraries at the sysroot, and setup --x-includes and
erikj@459 121 # --x-libraries for the sysroot, if that seems to be correct.
erikj@459 122 if test "x$SYS_ROOT" != "x/"; then
erikj@459 123 if test "x$x_includes" = xNONE; then
erikj@459 124 if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
erikj@459 125 x_includes="$SYS_ROOT/usr/X11R6/include"
erikj@459 126 fi
erikj@459 127 fi
erikj@459 128 if test "x$x_libraries" = xNONE; then
erikj@459 129 if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
erikj@459 130 x_libraries="$SYS_ROOT/usr/X11R6/lib"
erikj@459 131 fi
erikj@459 132 fi
erikj@459 133 fi
erikj@459 134
erikj@459 135 # Now let autoconf do it's magic
erikj@459 136 AC_PATH_X
erikj@459 137 AC_PATH_XTRA
erikj@459 138
erikj@600 139 # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
erikj@600 140 # this doesn't make sense so we remove it.
erikj@600 141 if test "x$COMPILE_TYPE" = xcross; then
erikj@600 142 X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
erikj@600 143 fi
erikj@600 144
erikj@459 145 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
erikj@459 146 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@459 147 AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
erikj@459 148 fi
erikj@459 149
erikj@459 150 # Some of the old makefiles require a setting of OPENWIN_HOME
erikj@459 151 # Since the X11R6 directory has disappeared on later Linuxes,
erikj@459 152 # we need to probe for it.
erikj@459 153 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@459 154 if test -d "$SYS_ROOT/usr/X11R6"; then
erikj@459 155 OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
erikj@459 156 fi
erikj@459 157 if test -d "$SYS_ROOT/usr/include/X11"; then
erikj@459 158 OPENWIN_HOME="$SYS_ROOT/usr"
erikj@459 159 fi
erikj@459 160 fi
erikj@459 161 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
erikj@459 162 OPENWIN_HOME="/usr/openwin"
erikj@459 163 fi
erikj@459 164 AC_SUBST(OPENWIN_HOME)
erikj@459 165
erikj@459 166
erikj@459 167 #
erikj@459 168 # Weird Sol10 something check...TODO change to try compile
erikj@459 169 #
erikj@459 170 if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
erikj@459 171 if test "`uname -r`" = "5.10"; then
erikj@459 172 if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
erikj@459 173 X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
erikj@459 174 fi
erikj@459 175 fi
erikj@459 176 fi
erikj@459 177
erikj@459 178 AC_LANG_PUSH(C)
erikj@459 179 OLD_CFLAGS="$CFLAGS"
erikj@459 180 CFLAGS="$CFLAGS $X_CFLAGS"
ohair@494 181
ohair@494 182 # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
erikj@459 183 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
ohair@494 184 [X11_A_OK=yes],
omajid@657 185 [X11_A_OK=no; break],
ohair@494 186 [ # include <X11/Xlib.h>
ohair@494 187 # include <X11/Xutil.h>
ohair@494 188 ])
ohair@494 189
erikj@459 190 CFLAGS="$OLD_CFLAGS"
erikj@459 191 AC_LANG_POP(C)
erikj@459 192
erikj@459 193 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
erikj@459 194 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@459 195 AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
erikj@459 196 fi
erikj@459 197
erikj@459 198 AC_SUBST(X_CFLAGS)
erikj@459 199 AC_SUBST(X_LIBS)
erikj@459 200 ])
erikj@459 201
erikj@459 202 AC_DEFUN_ONCE([LIB_SETUP_CUPS],
erikj@459 203 [
erikj@459 204
erikj@459 205 ###############################################################################
erikj@459 206 #
erikj@459 207 # The common unix printing system cups is used to print from java.
erikj@459 208 #
erikj@459 209 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
erikj@459 210 [specify prefix directory for the cups package
ohair@494 211 (expecting the headers under PATH/include)])])
erikj@459 212 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
erikj@459 213 [specify directory for the cups include files])])
erikj@459 214
erikj@459 215 if test "x$CUPS_NOT_NEEDED" = xyes; then
ohair@494 216 if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
erikj@459 217 AC_MSG_WARN([cups not used, so --with-cups is ignored])
erikj@459 218 fi
erikj@459 219 CUPS_CFLAGS=
erikj@459 220 else
erikj@459 221 CUPS_FOUND=no
erikj@459 222
ohair@494 223 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
erikj@459 224 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
erikj@459 225 fi
erikj@459 226
erikj@459 227 if test "x${with_cups}" != x; then
erikj@459 228 CUPS_CFLAGS="-I${with_cups}/include"
erikj@459 229 CUPS_FOUND=yes
erikj@459 230 fi
erikj@459 231 if test "x${with_cups_include}" != x; then
erikj@459 232 CUPS_CFLAGS="-I${with_cups_include}"
erikj@459 233 CUPS_FOUND=yes
erikj@459 234 fi
erikj@459 235 if test "x$CUPS_FOUND" = xno; then
erikj@459 236 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
erikj@459 237 fi
erikj@459 238 if test "x$CUPS_FOUND" = xno; then
erikj@459 239 # Are the cups headers installed in the default /usr/include location?
erikj@459 240 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
erikj@459 241 [CUPS_FOUND=yes
erikj@459 242 CUPS_CFLAGS=
erikj@459 243 DEFAULT_CUPS=yes])
erikj@459 244 fi
erikj@459 245 if test "x$CUPS_FOUND" = xno; then
erikj@459 246 # Getting nervous now? Lets poke around for standard Solaris third-party
erikj@459 247 # package installation locations.
ohair@494 248 AC_MSG_CHECKING([for cups headers])
erikj@459 249 if test -s /opt/sfw/cups/include/cups/cups.h; then
erikj@459 250 # An SFW package seems to be installed!
erikj@459 251 CUPS_FOUND=yes
erikj@459 252 CUPS_CFLAGS="-I/opt/sfw/cups/include"
erikj@459 253 elif test -s /opt/csw/include/cups/cups.h; then
erikj@459 254 # A CSW package seems to be installed!
erikj@459 255 CUPS_FOUND=yes
erikj@459 256 CUPS_CFLAGS="-I/opt/csw/include"
erikj@459 257 fi
erikj@459 258 AC_MSG_RESULT([$CUPS_FOUND])
erikj@459 259 fi
erikj@459 260 if test "x$CUPS_FOUND" = xno; then
erikj@459 261 HELP_MSG_MISSING_DEPENDENCY([cups])
erikj@459 262 AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
erikj@459 263 fi
erikj@459 264 fi
erikj@459 265
erikj@459 266 AC_SUBST(CUPS_CFLAGS)
erikj@459 267
erikj@459 268 ])
erikj@459 269
erikj@459 270 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
erikj@459 271 [
erikj@459 272
erikj@459 273 ###############################################################################
erikj@459 274 #
erikj@459 275 # The ubiquitous freetype2 library is used to render fonts.
erikj@459 276 #
erikj@459 277 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
erikj@459 278 [specify prefix directory for the freetype2 package
erikj@459 279 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@459 280
erikj@459 281 # If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
erikj@459 282 USING_SYSTEM_FT_LIB=false
erikj@459 283
erikj@459 284 if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
erikj@459 285 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
erikj@459 286 AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
erikj@459 287 fi
erikj@459 288 FREETYPE2_CFLAGS=
erikj@459 289 FREETYPE2_LIBS=
erikj@459 290 FREETYPE2_LIB_PATH=
erikj@459 291 else
erikj@459 292 FREETYPE2_FOUND=no
erikj@459 293
erikj@459 294 if test "x$with_freetype" != x; then
ohair@494 295 BASIC_FIXUP_PATH(with_freetype)
erikj@459 296 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
ohair@494 297 FREETYPE2_LIB_PATH="$with_freetype/lib"
ohair@494 298 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
ohair@494 299 FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
ohair@494 300 FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
ohair@494 301 fi
erikj@459 302 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@459 303 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
erikj@459 304 fi
erikj@459 305 FREETYPE2_CFLAGS="-I$with_freetype/include"
erikj@459 306 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
erikj@459 307 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
erikj@459 308 fi
ohair@494 309 FREETYPE2_FOUND=yes
erikj@459 310 if test "x$FREETYPE2_FOUND" = xyes; then
erikj@459 311 # Verify that the directories exist
erikj@459 312 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
erikj@459 313 AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
erikj@459 314 fi
erikj@459 315 # List the contents of the lib.
erikj@459 316 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
erikj@459 317 if test "x$FREETYPELIB" = x; then
ohair@494 318 AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
erikj@459 319 fi
erikj@459 320 # Check one h-file
erikj@459 321 if ! test -s "$with_freetype/include/ft2build.h"; then
erikj@459 322 AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
erikj@459 323 fi
erikj@459 324 fi
erikj@459 325 fi
erikj@459 326 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 327 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
erikj@459 328 USING_SYSTEM_FT_LIB=true
erikj@459 329 fi
ohair@494 330 if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
ohair@494 331 FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
ohair@494 332 BASIC_FIXUP_PATH(FREETYPELOCATION)
ohair@494 333 AC_MSG_CHECKING([for freetype in some standard windows locations])
ohair@494 334 if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
ohair@494 335 FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
ohair@494 336 FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
ohair@494 337 FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
ohair@494 338 if ! test -s "$FREETYPE2_LIBS"; then
ohair@494 339 AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
ohair@494 340 fi
ohair@494 341 if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
ohair@494 342 AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
ohair@494 343 fi
ohair@494 344 USING_SYSTEM_FT_LIB=true
ohair@494 345 FREETYPE2_FOUND=yes
ohair@494 346 fi
ohair@494 347 AC_MSG_RESULT([$FREETYPE2_FOUND])
ohair@494 348 fi
erikj@459 349 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 350 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
ohair@494 351 # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
ohair@494 352 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
erikj@459 353 USING_SYSTEM_FT_LIB=true
ohair@494 354 # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
ohair@494 355 if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
ohair@494 356 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
ohair@494 357 fi
erikj@459 358 fi
erikj@459 359 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 360 AC_MSG_CHECKING([for freetype in some standard locations])
erikj@459 361
erikj@459 362 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
erikj@459 363 DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
erikj@459 364 DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
erikj@459 365 fi
erikj@459 366 if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
erikj@459 367 DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
erikj@459 368 DEFAULT_FREETYPE_LIBS="-lfreetype"
erikj@459 369 fi
erikj@459 370
erikj@459 371 PREV_CXXCFLAGS="$CXXFLAGS"
erikj@459 372 PREV_LDFLAGS="$LDFLAGS"
erikj@459 373 CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
erikj@459 374 LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
erikj@459 375 AC_LINK_IFELSE([AC_LANG_SOURCE([[#include<ft2build.h>
erikj@459 376 #include FT_FREETYPE_H
erikj@459 377 int main() { return 0; }
erikj@459 378 ]])],
erikj@459 379 [
erikj@459 380 # Yes, the default cflags and libs did the trick.
erikj@459 381 FREETYPE2_FOUND=yes
erikj@459 382 FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
erikj@459 383 FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
erikj@459 384 ],
erikj@459 385 [
erikj@459 386 FREETYPE2_FOUND=no
erikj@459 387 ])
erikj@459 388 CXXCFLAGS="$PREV_CXXFLAGS"
erikj@459 389 LDFLAGS="$PREV_LDFLAGS"
erikj@459 390 AC_MSG_RESULT([$FREETYPE2_FOUND])
erikj@459 391 USING_SYSTEM_FT_LIB=true
erikj@459 392 fi
erikj@459 393 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 394 HELP_MSG_MISSING_DEPENDENCY([freetype2])
erikj@459 395 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
ohair@494 396 fi
ohair@494 397
ohair@494 398 if test "x$OPENJDK_TARGET_OS" != xwindows; then
ohair@494 399 # AC_CHECK_LIB does not support use of cl.exe
ohair@494 400 PREV_LDFLAGS="$LDFLAGS"
ohair@494 401 LDFLAGS="$FREETYPE2_LIBS"
erikj@502 402 AC_CHECK_LIB(freetype, FT_Init_FreeType,
erikj@502 403 FREETYPE2_FOUND=true,
erikj@502 404 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
ohair@494 405 LDFLAGS="$PREV_LDFLAGS"
ohair@494 406 fi
erikj@459 407 fi
erikj@459 408
erikj@459 409 AC_SUBST(USING_SYSTEM_FT_LIB)
erikj@459 410 AC_SUBST(FREETYPE2_LIB_PATH)
erikj@459 411 AC_SUBST(FREETYPE2_CFLAGS)
erikj@459 412 AC_SUBST(FREETYPE2_LIBS)
erikj@459 413
erikj@459 414 ])
erikj@459 415
erikj@459 416 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
erikj@459 417 [
erikj@459 418
erikj@459 419 ###############################################################################
erikj@459 420 #
erikj@459 421 # Check for alsa headers and libraries. Used on Linux/GNU systems.
erikj@459 422 #
erikj@459 423 AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
erikj@459 424 [specify prefix directory for the alsa package
erikj@459 425 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@459 426 AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
erikj@459 427 [specify directory for the alsa include files])])
erikj@459 428 AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
erikj@459 429 [specify directory for the alsa library])])
erikj@459 430
erikj@459 431 if test "x$ALSA_NOT_NEEDED" = xyes; then
erikj@459 432 if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
erikj@459 433 AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
erikj@459 434 fi
erikj@459 435 ALSA_CFLAGS=
erikj@459 436 ALSA_LIBS=
erikj@459 437 else
erikj@459 438 ALSA_FOUND=no
erikj@459 439
erikj@459 440 if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
erikj@459 441 AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
erikj@459 442 fi
erikj@459 443
erikj@459 444 if test "x${with_alsa}" != x; then
erikj@459 445 ALSA_LIBS="-L${with_alsa}/lib -lalsa"
erikj@459 446 ALSA_CFLAGS="-I${with_alsa}/include"
erikj@459 447 ALSA_FOUND=yes
erikj@459 448 fi
erikj@459 449 if test "x${with_alsa_include}" != x; then
erikj@459 450 ALSA_CFLAGS="-I${with_alsa_include}"
erikj@459 451 ALSA_FOUND=yes
erikj@459 452 fi
erikj@459 453 if test "x${with_alsa_lib}" != x; then
erikj@459 454 ALSA_LIBS="-L${with_alsa_lib} -lalsa"
erikj@459 455 ALSA_FOUND=yes
erikj@459 456 fi
erikj@459 457 if test "x$ALSA_FOUND" = xno; then
erikj@459 458 BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@459 459 fi
erikj@459 460 if test "x$ALSA_FOUND" = xno; then
erikj@459 461 PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@459 462 fi
erikj@459 463 if test "x$ALSA_FOUND" = xno; then
erikj@459 464 AC_CHECK_HEADERS([alsa/asoundlib.h],
erikj@459 465 [ALSA_FOUND=yes
erikj@459 466 ALSA_CFLAGS=-Iignoreme
erikj@459 467 ALSA_LIBS=-lasound
erikj@459 468 DEFAULT_ALSA=yes],
erikj@459 469 [ALSA_FOUND=no])
erikj@459 470 fi
erikj@459 471 if test "x$ALSA_FOUND" = xno; then
erikj@459 472 HELP_MSG_MISSING_DEPENDENCY([alsa])
erikj@459 473 AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
erikj@459 474 fi
erikj@459 475 fi
erikj@459 476
erikj@459 477 AC_SUBST(ALSA_CFLAGS)
erikj@459 478 AC_SUBST(ALSA_LIBS)
erikj@459 479
erikj@459 480 ])
erikj@459 481
erikj@459 482 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
erikj@459 483 [
erikj@459 484
erikj@459 485 ###############################################################################
erikj@459 486 #
erikj@459 487 # Check for the jpeg library
erikj@459 488 #
erikj@459 489
erikj@459 490 USE_EXTERNAL_LIBJPEG=true
erikj@459 491 AC_CHECK_LIB(jpeg, main, [],
erikj@459 492 [ USE_EXTERNAL_LIBJPEG=false
erikj@459 493 AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
erikj@459 494 ])
erikj@459 495 AC_SUBST(USE_EXTERNAL_LIBJPEG)
erikj@459 496
erikj@459 497 ###############################################################################
erikj@459 498 #
erikj@459 499 # Check for the gif library
erikj@459 500 #
erikj@459 501
omajid@665 502 AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
omajid@665 503 [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@665 504
omajid@665 505
omajid@665 506 AC_MSG_CHECKING([for which giflib to use])
omajid@665 507
omajid@665 508 # default is bundled
omajid@665 509 DEFAULT_GIFLIB=bundled
omajid@665 510
omajid@665 511 #
omajid@665 512 # if user didn't specify, use DEFAULT_GIFLIB
omajid@665 513 #
omajid@665 514 if test "x${with_giflib}" = "x"; then
omajid@665 515 with_giflib=${DEFAULT_GIFLIB}
omajid@665 516 fi
omajid@665 517
omajid@665 518 AC_MSG_RESULT(${with_giflib})
omajid@665 519
omajid@665 520 if test "x${with_giflib}" = "xbundled"; then
omajid@665 521 USE_EXTERNAL_LIBGIF=false
omajid@665 522 elif test "x${with_giflib}" = "xsystem"; then
omajid@665 523 AC_CHECK_HEADER(gif_lib.h, [],
omajid@665 524 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
omajid@665 525 AC_CHECK_LIB(gif, DGifGetCode, [],
omajid@665 526 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
omajid@665 527
omajid@665 528 USE_EXTERNAL_LIBGIF=true
omajid@665 529 else
omajid@665 530 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
omajid@665 531 fi
erikj@459 532 AC_SUBST(USE_EXTERNAL_LIBGIF)
erikj@459 533
erikj@459 534 ###############################################################################
erikj@459 535 #
erikj@459 536 # Check for the zlib library
erikj@459 537 #
erikj@459 538
erikj@459 539 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
erikj@459 540 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
erikj@459 541
erikj@459 542 AC_CHECK_LIB(z, compress,
erikj@459 543 [ ZLIB_FOUND=yes ],
erikj@459 544 [ ZLIB_FOUND=no ])
erikj@459 545
erikj@459 546 AC_MSG_CHECKING([for which zlib to use])
erikj@459 547
erikj@459 548 DEFAULT_ZLIB=bundled
erikj@459 549 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@459 550 #
erikj@459 551 # On macosx default is system...on others default is
erikj@459 552 #
erikj@459 553 DEFAULT_ZLIB=system
erikj@459 554 fi
erikj@459 555
erikj@459 556 if test "x${ZLIB_FOUND}" != "xyes"; then
erikj@459 557 #
erikj@459 558 # If we don't find any system...set default to bundled
erikj@459 559 #
erikj@459 560 DEFAULT_ZLIB=bundled
erikj@459 561 fi
erikj@459 562
erikj@459 563 #
erikj@459 564 # If user didn't specify, use DEFAULT_ZLIB
erikj@459 565 #
erikj@459 566 if test "x${with_zlib}" = "x"; then
erikj@459 567 with_zlib=${DEFAULT_ZLIB}
erikj@459 568 fi
erikj@459 569
erikj@459 570 if test "x${with_zlib}" = "xbundled"; then
erikj@459 571 USE_EXTERNAL_LIBZ=false
erikj@459 572 AC_MSG_RESULT([bundled])
erikj@459 573 elif test "x${with_zlib}" = "xsystem"; then
erikj@459 574 if test "x${ZLIB_FOUND}" = "xyes"; then
erikj@459 575 USE_EXTERNAL_LIBZ=true
erikj@459 576 AC_MSG_RESULT([system])
erikj@459 577 else
erikj@459 578 AC_MSG_RESULT([system not found])
erikj@459 579 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
erikj@459 580 fi
erikj@459 581 else
erikj@459 582 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
erikj@459 583 fi
erikj@459 584
erikj@459 585 AC_SUBST(USE_EXTERNAL_LIBZ)
erikj@459 586
erikj@459 587 ###############################################################################
erikj@459 588 LIBZIP_CAN_USE_MMAP=true
ohair@478 589
erikj@459 590 AC_SUBST(LIBZIP_CAN_USE_MMAP)
erikj@459 591
erikj@459 592 ###############################################################################
erikj@459 593 #
erikj@459 594 # Check if altzone exists in time.h
erikj@459 595 #
erikj@459 596
erikj@459 597 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
erikj@459 598 [has_altzone=yes],
erikj@459 599 [has_altzone=no])
erikj@459 600 if test "x$has_altzone" = xyes; then
erikj@459 601 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
erikj@459 602 fi
erikj@459 603
erikj@459 604 ###############################################################################
erikj@459 605 #
erikj@459 606 # Check the maths library
erikj@459 607 #
erikj@459 608
erikj@459 609 AC_CHECK_LIB(m, cos, [],
erikj@459 610 [
erikj@459 611 AC_MSG_NOTICE([Maths library was not found])
erikj@459 612 ])
erikj@459 613 AC_SUBST(LIBM)
erikj@459 614
erikj@459 615 ###############################################################################
erikj@459 616 #
erikj@459 617 # Check for libdl.so
erikj@459 618
erikj@459 619 save_LIBS="$LIBS"
erikj@459 620 LIBS=""
erikj@459 621 AC_CHECK_LIB(dl,dlopen)
erikj@459 622 LIBDL="$LIBS"
erikj@459 623 AC_SUBST(LIBDL)
erikj@459 624 LIBS="$save_LIBS"
erikj@459 625
erikj@459 626 ])
erikj@459 627
erikj@459 628 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
erikj@459 629 [
erikj@459 630 ###############################################################################
erikj@459 631 #
erikj@459 632 # statically link libstdc++ before C++ ABI is stablized on Linux unless
erikj@459 633 # dynamic build is configured on command line.
erikj@459 634 #
tbell@511 635 AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
tbell@511 636 [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
tbell@511 637 [
tbell@511 638 if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
tbell@511 639 && test "x$with_stdc__lib" != xdefault; then
tbell@511 640 AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
tbell@511 641 fi
tbell@511 642 ],
tbell@511 643 [with_stdc__lib=default]
tbell@511 644 )
erikj@459 645
erikj@459 646 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@459 647 # Test if -lstdc++ works.
erikj@459 648 AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
erikj@459 649 AC_LANG_PUSH(C++)
erikj@459 650 OLD_CXXFLAGS="$CXXFLAGS"
erikj@459 651 CXXFLAGS="$CXXFLAGS -lstdc++"
erikj@459 652 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@459 653 [has_dynamic_libstdcxx=yes],
erikj@459 654 [has_dynamic_libstdcxx=no])
erikj@459 655 CXXFLAGS="$OLD_CXXFLAGS"
erikj@459 656 AC_LANG_POP(C++)
erikj@459 657 AC_MSG_RESULT([$has_dynamic_libstdcxx])
erikj@459 658
erikj@459 659 # Test if stdc++ can be linked statically.
erikj@459 660 AC_MSG_CHECKING([if static link of stdc++ is possible])
erikj@459 661 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
erikj@459 662 AC_LANG_PUSH(C++)
erikj@459 663 OLD_LIBS="$LIBS"
erikj@459 664 OLD_CXX="$CXX"
erikj@459 665 LIBS="$STATIC_STDCXX_FLAGS"
erikj@459 666 CXX="$CC"
erikj@459 667 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@459 668 [has_static_libstdcxx=yes],
erikj@459 669 [has_static_libstdcxx=no])
erikj@459 670 LIBS="$OLD_LIBS"
erikj@459 671 CXX="$OLD_CXX"
erikj@459 672 AC_LANG_POP(C++)
erikj@459 673 AC_MSG_RESULT([$has_static_libstdcxx])
erikj@459 674
tbell@511 675 if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
tbell@511 676 AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
erikj@459 677 fi
erikj@459 678
tbell@511 679 if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
tbell@511 680 AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
erikj@459 681 fi
erikj@459 682
tbell@511 683 if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
tbell@511 684 AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
erikj@459 685 fi
erikj@459 686
erikj@459 687 AC_MSG_CHECKING([how to link with libstdc++])
tbell@511 688 # If dynamic was requested, it's available since it would fail above otherwise.
tbell@511 689 # If dynamic wasn't requested, go with static unless it isn't available.
omajid@671 690 if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
tbell@511 691 LIBCXX="$LIBCXX -lstdc++"
tbell@511 692 LDCXX="$CXX"
tbell@511 693 STATIC_CXX_SETTING="STATIC_CXX=false"
tbell@511 694 AC_MSG_RESULT([dynamic])
tbell@511 695 else
erikj@459 696 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
erikj@459 697 LDCXX="$CC"
ohair@494 698 STATIC_CXX_SETTING="STATIC_CXX=true"
erikj@459 699 AC_MSG_RESULT([static])
erikj@459 700 fi
erikj@459 701 fi
ohair@494 702 AC_SUBST(STATIC_CXX_SETTING)
erikj@459 703
omajid@671 704 if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
omajid@671 705 # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
omajid@671 706 PKG_CHECK_MODULES([LIBFFI], [libffi])
omajid@671 707
omajid@671 708 fi
omajid@671 709
omajid@671 710 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
omajid@671 711 AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config])
omajid@671 712
omajid@671 713 if test "x$LLVM_CONFIG" != xllvm-config; then
omajid@671 714 AC_MSG_ERROR([llvm-config not found in $PATH.])
omajid@671 715 fi
omajid@671 716
omajid@671 717 llvm_components="jit mcjit engine nativecodegen native"
omajid@671 718 unset LLVM_CFLAGS
omajid@671 719 for flag in $("$LLVM_CONFIG" --cxxflags); do
omajid@671 720 if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then
omajid@671 721 if test "${flag}" != "-D_DEBUG" ; then
omajid@671 722 if test "${LLVM_CFLAGS}" != "" ; then
omajid@671 723 LLVM_CFLAGS="${LLVM_CFLAGS} "
omajid@671 724 fi
omajid@671 725 LLVM_CFLAGS="${LLVM_CFLAGS}${flag}"
omajid@671 726 fi
omajid@671 727 fi
omajid@671 728 done
omajid@671 729 llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
omajid@671 730 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
omajid@671 731
omajid@671 732 unset LLVM_LDFLAGS
omajid@671 733 for flag in $("${LLVM_CONFIG}" --ldflags); do
omajid@671 734 if echo "${flag}" | grep -q '^-L'; then
omajid@671 735 if test "${LLVM_LDFLAGS}" != ""; then
omajid@671 736 LLVM_LDFLAGS="${LLVM_LDFLAGS} "
omajid@671 737 fi
omajid@671 738 LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}"
omajid@671 739 fi
omajid@671 740 done
omajid@671 741
omajid@671 742 unset LLVM_LIBS
omajid@671 743 for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do
omajid@671 744 if echo "${flag}" | grep -q '^-l'; then
omajid@671 745 if test "${LLVM_LIBS}" != ""; then
omajid@671 746 LLVM_LIBS="${LLVM_LIBS} "
omajid@671 747 fi
omajid@671 748 LLVM_LIBS="${LLVM_LIBS}${flag}"
omajid@671 749 fi
omajid@671 750 done
omajid@671 751
omajid@671 752 AC_SUBST(LLVM_CFLAGS)
omajid@671 753 AC_SUBST(LLVM_LDFLAGS)
omajid@671 754 AC_SUBST(LLVM_LIBS)
omajid@671 755 fi
omajid@671 756
erikj@459 757 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
erikj@459 758 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
ohair@478 759 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
erikj@459 760 fi
erikj@459 761
erikj@459 762 # TODO better (platform agnostic) test
erikj@459 763 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
erikj@459 764 LIBCXX="-lstdc++"
erikj@459 765 fi
erikj@459 766
erikj@459 767 AC_SUBST(LIBCXX)
erikj@459 768
erikj@459 769 ])

mercurial