common/autoconf/libraries.m4

Sat, 19 Oct 2013 08:51:39 -0700

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

mercurial