common/autoconf/libraries.m4

Mon, 28 Jan 2013 16:29:34 -0400

author
jlaskey
date
Mon, 28 Jan 2013 16:29:34 -0400
changeset 877
3dc55f0c1b6f
parent 511
c81c4a5d8b50
child 600
0d4b0a13adb2
permissions
-rw-r--r--

8006676: Integrate Nashorn into new build system
Reviewed-by: jlaskey
Contributed-by: james.laskey@oracle.com

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@459 139 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
erikj@459 140 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@459 141 AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
erikj@459 142 fi
erikj@459 143
erikj@459 144 # Some of the old makefiles require a setting of OPENWIN_HOME
erikj@459 145 # Since the X11R6 directory has disappeared on later Linuxes,
erikj@459 146 # we need to probe for it.
erikj@459 147 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@459 148 if test -d "$SYS_ROOT/usr/X11R6"; then
erikj@459 149 OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
erikj@459 150 fi
erikj@459 151 if test -d "$SYS_ROOT/usr/include/X11"; then
erikj@459 152 OPENWIN_HOME="$SYS_ROOT/usr"
erikj@459 153 fi
erikj@459 154 fi
erikj@459 155 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
erikj@459 156 OPENWIN_HOME="/usr/openwin"
erikj@459 157 fi
erikj@459 158 AC_SUBST(OPENWIN_HOME)
erikj@459 159
erikj@459 160
erikj@459 161 #
erikj@459 162 # Weird Sol10 something check...TODO change to try compile
erikj@459 163 #
erikj@459 164 if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
erikj@459 165 if test "`uname -r`" = "5.10"; then
erikj@459 166 if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
erikj@459 167 X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
erikj@459 168 fi
erikj@459 169 fi
erikj@459 170 fi
erikj@459 171
erikj@459 172 AC_LANG_PUSH(C)
erikj@459 173 OLD_CFLAGS="$CFLAGS"
erikj@459 174 CFLAGS="$CFLAGS $X_CFLAGS"
ohair@494 175
ohair@494 176 # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
erikj@459 177 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
ohair@494 178 [X11_A_OK=yes],
ohair@494 179 [X11_A_OK=no],
ohair@494 180 [ # include <X11/Xlib.h>
ohair@494 181 # include <X11/Xutil.h>
ohair@494 182 ])
ohair@494 183
erikj@459 184 CFLAGS="$OLD_CFLAGS"
erikj@459 185 AC_LANG_POP(C)
erikj@459 186
erikj@459 187 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
erikj@459 188 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@459 189 AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
erikj@459 190 fi
erikj@459 191
erikj@459 192 AC_SUBST(X_CFLAGS)
erikj@459 193 AC_SUBST(X_LIBS)
erikj@459 194 ])
erikj@459 195
erikj@459 196 AC_DEFUN_ONCE([LIB_SETUP_CUPS],
erikj@459 197 [
erikj@459 198
erikj@459 199 ###############################################################################
erikj@459 200 #
erikj@459 201 # The common unix printing system cups is used to print from java.
erikj@459 202 #
erikj@459 203 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
erikj@459 204 [specify prefix directory for the cups package
ohair@494 205 (expecting the headers under PATH/include)])])
erikj@459 206 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
erikj@459 207 [specify directory for the cups include files])])
erikj@459 208
erikj@459 209 if test "x$CUPS_NOT_NEEDED" = xyes; then
ohair@494 210 if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
erikj@459 211 AC_MSG_WARN([cups not used, so --with-cups is ignored])
erikj@459 212 fi
erikj@459 213 CUPS_CFLAGS=
erikj@459 214 else
erikj@459 215 CUPS_FOUND=no
erikj@459 216
ohair@494 217 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
erikj@459 218 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
erikj@459 219 fi
erikj@459 220
erikj@459 221 if test "x${with_cups}" != x; then
erikj@459 222 CUPS_CFLAGS="-I${with_cups}/include"
erikj@459 223 CUPS_FOUND=yes
erikj@459 224 fi
erikj@459 225 if test "x${with_cups_include}" != x; then
erikj@459 226 CUPS_CFLAGS="-I${with_cups_include}"
erikj@459 227 CUPS_FOUND=yes
erikj@459 228 fi
erikj@459 229 if test "x$CUPS_FOUND" = xno; then
erikj@459 230 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
erikj@459 231 fi
erikj@459 232 if test "x$CUPS_FOUND" = xno; then
erikj@459 233 # Are the cups headers installed in the default /usr/include location?
erikj@459 234 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
erikj@459 235 [CUPS_FOUND=yes
erikj@459 236 CUPS_CFLAGS=
erikj@459 237 DEFAULT_CUPS=yes])
erikj@459 238 fi
erikj@459 239 if test "x$CUPS_FOUND" = xno; then
erikj@459 240 # Getting nervous now? Lets poke around for standard Solaris third-party
erikj@459 241 # package installation locations.
ohair@494 242 AC_MSG_CHECKING([for cups headers])
erikj@459 243 if test -s /opt/sfw/cups/include/cups/cups.h; then
erikj@459 244 # An SFW package seems to be installed!
erikj@459 245 CUPS_FOUND=yes
erikj@459 246 CUPS_CFLAGS="-I/opt/sfw/cups/include"
erikj@459 247 elif test -s /opt/csw/include/cups/cups.h; then
erikj@459 248 # A CSW package seems to be installed!
erikj@459 249 CUPS_FOUND=yes
erikj@459 250 CUPS_CFLAGS="-I/opt/csw/include"
erikj@459 251 fi
erikj@459 252 AC_MSG_RESULT([$CUPS_FOUND])
erikj@459 253 fi
erikj@459 254 if test "x$CUPS_FOUND" = xno; then
erikj@459 255 HELP_MSG_MISSING_DEPENDENCY([cups])
erikj@459 256 AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
erikj@459 257 fi
erikj@459 258 fi
erikj@459 259
erikj@459 260 AC_SUBST(CUPS_CFLAGS)
erikj@459 261
erikj@459 262 ])
erikj@459 263
erikj@459 264 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
erikj@459 265 [
erikj@459 266
erikj@459 267 ###############################################################################
erikj@459 268 #
erikj@459 269 # The ubiquitous freetype2 library is used to render fonts.
erikj@459 270 #
erikj@459 271 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
erikj@459 272 [specify prefix directory for the freetype2 package
erikj@459 273 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@459 274
erikj@459 275 # 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 276 USING_SYSTEM_FT_LIB=false
erikj@459 277
erikj@459 278 if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
erikj@459 279 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
erikj@459 280 AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
erikj@459 281 fi
erikj@459 282 FREETYPE2_CFLAGS=
erikj@459 283 FREETYPE2_LIBS=
erikj@459 284 FREETYPE2_LIB_PATH=
erikj@459 285 else
erikj@459 286 FREETYPE2_FOUND=no
erikj@459 287
erikj@459 288 if test "x$with_freetype" != x; then
ohair@494 289 BASIC_FIXUP_PATH(with_freetype)
erikj@459 290 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
ohair@494 291 FREETYPE2_LIB_PATH="$with_freetype/lib"
ohair@494 292 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
ohair@494 293 FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
ohair@494 294 FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
ohair@494 295 fi
erikj@459 296 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@459 297 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
erikj@459 298 fi
erikj@459 299 FREETYPE2_CFLAGS="-I$with_freetype/include"
erikj@459 300 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
erikj@459 301 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
erikj@459 302 fi
ohair@494 303 FREETYPE2_FOUND=yes
erikj@459 304 if test "x$FREETYPE2_FOUND" = xyes; then
erikj@459 305 # Verify that the directories exist
erikj@459 306 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
erikj@459 307 AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
erikj@459 308 fi
erikj@459 309 # List the contents of the lib.
erikj@459 310 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
erikj@459 311 if test "x$FREETYPELIB" = x; then
ohair@494 312 AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
erikj@459 313 fi
erikj@459 314 # Check one h-file
erikj@459 315 if ! test -s "$with_freetype/include/ft2build.h"; then
erikj@459 316 AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
erikj@459 317 fi
erikj@459 318 fi
erikj@459 319 fi
erikj@459 320 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 321 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
erikj@459 322 USING_SYSTEM_FT_LIB=true
erikj@459 323 fi
ohair@494 324 if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
ohair@494 325 FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
ohair@494 326 BASIC_FIXUP_PATH(FREETYPELOCATION)
ohair@494 327 AC_MSG_CHECKING([for freetype in some standard windows locations])
ohair@494 328 if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
ohair@494 329 FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
ohair@494 330 FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
ohair@494 331 FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
ohair@494 332 if ! test -s "$FREETYPE2_LIBS"; then
ohair@494 333 AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
ohair@494 334 fi
ohair@494 335 if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
ohair@494 336 AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
ohair@494 337 fi
ohair@494 338 USING_SYSTEM_FT_LIB=true
ohair@494 339 FREETYPE2_FOUND=yes
ohair@494 340 fi
ohair@494 341 AC_MSG_RESULT([$FREETYPE2_FOUND])
ohair@494 342 fi
erikj@459 343 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 344 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
ohair@494 345 # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
ohair@494 346 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
erikj@459 347 USING_SYSTEM_FT_LIB=true
ohair@494 348 # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
ohair@494 349 if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
ohair@494 350 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
ohair@494 351 fi
erikj@459 352 fi
erikj@459 353 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 354 AC_MSG_CHECKING([for freetype in some standard locations])
erikj@459 355
erikj@459 356 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
erikj@459 357 DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
erikj@459 358 DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
erikj@459 359 fi
erikj@459 360 if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
erikj@459 361 DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
erikj@459 362 DEFAULT_FREETYPE_LIBS="-lfreetype"
erikj@459 363 fi
erikj@459 364
erikj@459 365 PREV_CXXCFLAGS="$CXXFLAGS"
erikj@459 366 PREV_LDFLAGS="$LDFLAGS"
erikj@459 367 CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
erikj@459 368 LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
erikj@459 369 AC_LINK_IFELSE([AC_LANG_SOURCE([[#include<ft2build.h>
erikj@459 370 #include FT_FREETYPE_H
erikj@459 371 int main() { return 0; }
erikj@459 372 ]])],
erikj@459 373 [
erikj@459 374 # Yes, the default cflags and libs did the trick.
erikj@459 375 FREETYPE2_FOUND=yes
erikj@459 376 FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
erikj@459 377 FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
erikj@459 378 ],
erikj@459 379 [
erikj@459 380 FREETYPE2_FOUND=no
erikj@459 381 ])
erikj@459 382 CXXCFLAGS="$PREV_CXXFLAGS"
erikj@459 383 LDFLAGS="$PREV_LDFLAGS"
erikj@459 384 AC_MSG_RESULT([$FREETYPE2_FOUND])
erikj@459 385 USING_SYSTEM_FT_LIB=true
erikj@459 386 fi
erikj@459 387 if test "x$FREETYPE2_FOUND" = xno; then
erikj@459 388 HELP_MSG_MISSING_DEPENDENCY([freetype2])
erikj@459 389 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
ohair@494 390 fi
ohair@494 391
ohair@494 392 if test "x$OPENJDK_TARGET_OS" != xwindows; then
ohair@494 393 # AC_CHECK_LIB does not support use of cl.exe
ohair@494 394 PREV_LDFLAGS="$LDFLAGS"
ohair@494 395 LDFLAGS="$FREETYPE2_LIBS"
erikj@502 396 AC_CHECK_LIB(freetype, FT_Init_FreeType,
erikj@502 397 FREETYPE2_FOUND=true,
erikj@502 398 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
ohair@494 399 LDFLAGS="$PREV_LDFLAGS"
ohair@494 400 fi
erikj@459 401 fi
erikj@459 402
erikj@459 403 AC_SUBST(USING_SYSTEM_FT_LIB)
erikj@459 404 AC_SUBST(FREETYPE2_LIB_PATH)
erikj@459 405 AC_SUBST(FREETYPE2_CFLAGS)
erikj@459 406 AC_SUBST(FREETYPE2_LIBS)
erikj@459 407
erikj@459 408 ])
erikj@459 409
erikj@459 410 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
erikj@459 411 [
erikj@459 412
erikj@459 413 ###############################################################################
erikj@459 414 #
erikj@459 415 # Check for alsa headers and libraries. Used on Linux/GNU systems.
erikj@459 416 #
erikj@459 417 AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
erikj@459 418 [specify prefix directory for the alsa package
erikj@459 419 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@459 420 AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
erikj@459 421 [specify directory for the alsa include files])])
erikj@459 422 AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
erikj@459 423 [specify directory for the alsa library])])
erikj@459 424
erikj@459 425 if test "x$ALSA_NOT_NEEDED" = xyes; then
erikj@459 426 if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
erikj@459 427 AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
erikj@459 428 fi
erikj@459 429 ALSA_CFLAGS=
erikj@459 430 ALSA_LIBS=
erikj@459 431 else
erikj@459 432 ALSA_FOUND=no
erikj@459 433
erikj@459 434 if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
erikj@459 435 AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
erikj@459 436 fi
erikj@459 437
erikj@459 438 if test "x${with_alsa}" != x; then
erikj@459 439 ALSA_LIBS="-L${with_alsa}/lib -lalsa"
erikj@459 440 ALSA_CFLAGS="-I${with_alsa}/include"
erikj@459 441 ALSA_FOUND=yes
erikj@459 442 fi
erikj@459 443 if test "x${with_alsa_include}" != x; then
erikj@459 444 ALSA_CFLAGS="-I${with_alsa_include}"
erikj@459 445 ALSA_FOUND=yes
erikj@459 446 fi
erikj@459 447 if test "x${with_alsa_lib}" != x; then
erikj@459 448 ALSA_LIBS="-L${with_alsa_lib} -lalsa"
erikj@459 449 ALSA_FOUND=yes
erikj@459 450 fi
erikj@459 451 if test "x$ALSA_FOUND" = xno; then
erikj@459 452 BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@459 453 fi
erikj@459 454 if test "x$ALSA_FOUND" = xno; then
erikj@459 455 PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@459 456 fi
erikj@459 457 if test "x$ALSA_FOUND" = xno; then
erikj@459 458 AC_CHECK_HEADERS([alsa/asoundlib.h],
erikj@459 459 [ALSA_FOUND=yes
erikj@459 460 ALSA_CFLAGS=-Iignoreme
erikj@459 461 ALSA_LIBS=-lasound
erikj@459 462 DEFAULT_ALSA=yes],
erikj@459 463 [ALSA_FOUND=no])
erikj@459 464 fi
erikj@459 465 if test "x$ALSA_FOUND" = xno; then
erikj@459 466 HELP_MSG_MISSING_DEPENDENCY([alsa])
erikj@459 467 AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
erikj@459 468 fi
erikj@459 469 fi
erikj@459 470
erikj@459 471 AC_SUBST(ALSA_CFLAGS)
erikj@459 472 AC_SUBST(ALSA_LIBS)
erikj@459 473
erikj@459 474 ])
erikj@459 475
erikj@459 476 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
erikj@459 477 [
erikj@459 478
erikj@459 479 ###############################################################################
erikj@459 480 #
erikj@459 481 # Check for the jpeg library
erikj@459 482 #
erikj@459 483
erikj@459 484 USE_EXTERNAL_LIBJPEG=true
erikj@459 485 AC_CHECK_LIB(jpeg, main, [],
erikj@459 486 [ USE_EXTERNAL_LIBJPEG=false
erikj@459 487 AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
erikj@459 488 ])
erikj@459 489 AC_SUBST(USE_EXTERNAL_LIBJPEG)
erikj@459 490
erikj@459 491 ###############################################################################
erikj@459 492 #
erikj@459 493 # Check for the gif library
erikj@459 494 #
erikj@459 495
erikj@459 496 USE_EXTERNAL_LIBJPEG=true
erikj@459 497 AC_CHECK_LIB(gif, main, [],
erikj@459 498 [ USE_EXTERNAL_LIBGIF=false
erikj@459 499 AC_MSG_NOTICE([Will use gif decoder bundled with the OpenJDK source])
erikj@459 500 ])
erikj@459 501 AC_SUBST(USE_EXTERNAL_LIBGIF)
erikj@459 502
erikj@459 503 ###############################################################################
erikj@459 504 #
erikj@459 505 # Check for the zlib library
erikj@459 506 #
erikj@459 507
erikj@459 508 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
erikj@459 509 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
erikj@459 510
erikj@459 511 AC_CHECK_LIB(z, compress,
erikj@459 512 [ ZLIB_FOUND=yes ],
erikj@459 513 [ ZLIB_FOUND=no ])
erikj@459 514
erikj@459 515 AC_MSG_CHECKING([for which zlib to use])
erikj@459 516
erikj@459 517 DEFAULT_ZLIB=bundled
erikj@459 518 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@459 519 #
erikj@459 520 # On macosx default is system...on others default is
erikj@459 521 #
erikj@459 522 DEFAULT_ZLIB=system
erikj@459 523 fi
erikj@459 524
erikj@459 525 if test "x${ZLIB_FOUND}" != "xyes"; then
erikj@459 526 #
erikj@459 527 # If we don't find any system...set default to bundled
erikj@459 528 #
erikj@459 529 DEFAULT_ZLIB=bundled
erikj@459 530 fi
erikj@459 531
erikj@459 532 #
erikj@459 533 # If user didn't specify, use DEFAULT_ZLIB
erikj@459 534 #
erikj@459 535 if test "x${with_zlib}" = "x"; then
erikj@459 536 with_zlib=${DEFAULT_ZLIB}
erikj@459 537 fi
erikj@459 538
erikj@459 539 if test "x${with_zlib}" = "xbundled"; then
erikj@459 540 USE_EXTERNAL_LIBZ=false
erikj@459 541 AC_MSG_RESULT([bundled])
erikj@459 542 elif test "x${with_zlib}" = "xsystem"; then
erikj@459 543 if test "x${ZLIB_FOUND}" = "xyes"; then
erikj@459 544 USE_EXTERNAL_LIBZ=true
erikj@459 545 AC_MSG_RESULT([system])
erikj@459 546 else
erikj@459 547 AC_MSG_RESULT([system not found])
erikj@459 548 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
erikj@459 549 fi
erikj@459 550 else
erikj@459 551 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
erikj@459 552 fi
erikj@459 553
erikj@459 554 AC_SUBST(USE_EXTERNAL_LIBZ)
erikj@459 555
erikj@459 556 ###############################################################################
erikj@459 557 LIBZIP_CAN_USE_MMAP=true
ohair@478 558
erikj@459 559 AC_SUBST(LIBZIP_CAN_USE_MMAP)
erikj@459 560
erikj@459 561 ###############################################################################
erikj@459 562 #
erikj@459 563 # Check if altzone exists in time.h
erikj@459 564 #
erikj@459 565
erikj@459 566 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
erikj@459 567 [has_altzone=yes],
erikj@459 568 [has_altzone=no])
erikj@459 569 if test "x$has_altzone" = xyes; then
erikj@459 570 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
erikj@459 571 fi
erikj@459 572
erikj@459 573 ###############################################################################
erikj@459 574 #
erikj@459 575 # Check the maths library
erikj@459 576 #
erikj@459 577
erikj@459 578 AC_CHECK_LIB(m, cos, [],
erikj@459 579 [
erikj@459 580 AC_MSG_NOTICE([Maths library was not found])
erikj@459 581 ])
erikj@459 582 AC_SUBST(LIBM)
erikj@459 583
erikj@459 584 ###############################################################################
erikj@459 585 #
erikj@459 586 # Check for libdl.so
erikj@459 587
erikj@459 588 save_LIBS="$LIBS"
erikj@459 589 LIBS=""
erikj@459 590 AC_CHECK_LIB(dl,dlopen)
erikj@459 591 LIBDL="$LIBS"
erikj@459 592 AC_SUBST(LIBDL)
erikj@459 593 LIBS="$save_LIBS"
erikj@459 594
erikj@459 595 ])
erikj@459 596
erikj@459 597 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
erikj@459 598 [
erikj@459 599 ###############################################################################
erikj@459 600 #
erikj@459 601 # statically link libstdc++ before C++ ABI is stablized on Linux unless
erikj@459 602 # dynamic build is configured on command line.
erikj@459 603 #
tbell@511 604 AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
tbell@511 605 [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
tbell@511 606 [
tbell@511 607 if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
tbell@511 608 && test "x$with_stdc__lib" != xdefault; then
tbell@511 609 AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
tbell@511 610 fi
tbell@511 611 ],
tbell@511 612 [with_stdc__lib=default]
tbell@511 613 )
erikj@459 614
erikj@459 615 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@459 616 # Test if -lstdc++ works.
erikj@459 617 AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
erikj@459 618 AC_LANG_PUSH(C++)
erikj@459 619 OLD_CXXFLAGS="$CXXFLAGS"
erikj@459 620 CXXFLAGS="$CXXFLAGS -lstdc++"
erikj@459 621 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@459 622 [has_dynamic_libstdcxx=yes],
erikj@459 623 [has_dynamic_libstdcxx=no])
erikj@459 624 CXXFLAGS="$OLD_CXXFLAGS"
erikj@459 625 AC_LANG_POP(C++)
erikj@459 626 AC_MSG_RESULT([$has_dynamic_libstdcxx])
erikj@459 627
erikj@459 628 # Test if stdc++ can be linked statically.
erikj@459 629 AC_MSG_CHECKING([if static link of stdc++ is possible])
erikj@459 630 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
erikj@459 631 AC_LANG_PUSH(C++)
erikj@459 632 OLD_LIBS="$LIBS"
erikj@459 633 OLD_CXX="$CXX"
erikj@459 634 LIBS="$STATIC_STDCXX_FLAGS"
erikj@459 635 CXX="$CC"
erikj@459 636 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@459 637 [has_static_libstdcxx=yes],
erikj@459 638 [has_static_libstdcxx=no])
erikj@459 639 LIBS="$OLD_LIBS"
erikj@459 640 CXX="$OLD_CXX"
erikj@459 641 AC_LANG_POP(C++)
erikj@459 642 AC_MSG_RESULT([$has_static_libstdcxx])
erikj@459 643
tbell@511 644 if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
tbell@511 645 AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
erikj@459 646 fi
erikj@459 647
tbell@511 648 if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
tbell@511 649 AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
erikj@459 650 fi
erikj@459 651
tbell@511 652 if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
tbell@511 653 AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
erikj@459 654 fi
erikj@459 655
erikj@459 656 AC_MSG_CHECKING([how to link with libstdc++])
tbell@511 657 # If dynamic was requested, it's available since it would fail above otherwise.
tbell@511 658 # If dynamic wasn't requested, go with static unless it isn't available.
tbell@511 659 if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno; then
tbell@511 660 LIBCXX="$LIBCXX -lstdc++"
tbell@511 661 LDCXX="$CXX"
tbell@511 662 STATIC_CXX_SETTING="STATIC_CXX=false"
tbell@511 663 AC_MSG_RESULT([dynamic])
tbell@511 664 else
erikj@459 665 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
erikj@459 666 LDCXX="$CC"
ohair@494 667 STATIC_CXX_SETTING="STATIC_CXX=true"
erikj@459 668 AC_MSG_RESULT([static])
erikj@459 669 fi
erikj@459 670 fi
ohair@494 671 AC_SUBST(STATIC_CXX_SETTING)
erikj@459 672
erikj@459 673 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
erikj@459 674 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
ohair@478 675 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
erikj@459 676 fi
erikj@459 677
erikj@459 678 # TODO better (platform agnostic) test
erikj@459 679 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
erikj@459 680 LIBCXX="-lstdc++"
erikj@459 681 fi
erikj@459 682
erikj@459 683 AC_SUBST(LIBCXX)
erikj@459 684
erikj@459 685 ])

mercurial