common/autoconf/libraries.m4

Tue, 27 Aug 2013 16:05:30 -0300

author
jlaskey
date
Tue, 27 Aug 2013 16:05:30 -0300
changeset 899
96f207364e46
parent 740
c0fa87863427
child 782
21198f51bc7e
permissions
-rw-r--r--

Merge

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

mercurial