annotate common/autoconf/libraries.m4 @ 13697:5262b00bc10c

7197849: Update new build-infra makefiles Reviewed-by: ihse, erikj, ohrstrom, tbell
author ohair
date Tue, 18 Sep 2012 11:29:16 -0700
parents 701e61c32ece
children 2a82ecb35fc7
rev   line source
erikj@13133 1 #
erikj@13133 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
erikj@13133 26 AC_DEFUN_ONCE([LIB_SETUP_INIT],
erikj@13133 27 [
erikj@13133 28
erikj@13133 29 ###############################################################################
erikj@13133 30 #
erikj@13133 31 # OS specific settings that we never will need to probe.
erikj@13133 32 #
erikj@13133 33 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@13133 34 AC_MSG_CHECKING([what is not needed on Linux?])
erikj@13133 35 PULSE_NOT_NEEDED=yes
erikj@13133 36 AC_MSG_RESULT([pulse])
erikj@13133 37 fi
erikj@13133 38
erikj@13133 39 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
erikj@13133 40 AC_MSG_CHECKING([what is not needed on Solaris?])
erikj@13133 41 ALSA_NOT_NEEDED=yes
erikj@13133 42 PULSE_NOT_NEEDED=yes
erikj@13133 43 AC_MSG_RESULT([alsa pulse])
erikj@13133 44 fi
erikj@13133 45
erikj@13133 46 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@13133 47 AC_MSG_CHECKING([what is not needed on Windows?])
erikj@13133 48 CUPS_NOT_NEEDED=yes
erikj@13133 49 ALSA_NOT_NEEDED=yes
erikj@13133 50 PULSE_NOT_NEEDED=yes
erikj@13133 51 X11_NOT_NEEDED=yes
erikj@13133 52 AC_MSG_RESULT([alsa cups pulse x11])
erikj@13133 53 fi
erikj@13133 54
erikj@13133 55 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@13133 56 AC_MSG_CHECKING([what is not needed on MacOSX?])
erikj@13133 57 ALSA_NOT_NEEDED=yes
erikj@13133 58 PULSE_NOT_NEEDED=yes
erikj@13133 59 X11_NOT_NEEDED=yes
erikj@13133 60 FREETYPE2_NOT_NEEDED=yes
erikj@13133 61 # If the java runtime framework is disabled, then we need X11.
erikj@13133 62 # This will be adjusted below.
erikj@13133 63 AC_MSG_RESULT([alsa pulse x11])
erikj@13133 64 fi
erikj@13133 65
erikj@13133 66 if test "x$OPENJDK_TARGET_OS" = xbsd; then
erikj@13133 67 AC_MSG_CHECKING([what is not needed on bsd?])
erikj@13133 68 ALSA_NOT_NEEDED=yes
erikj@13133 69 AC_MSG_RESULT([alsa])
erikj@13133 70 fi
erikj@13133 71
erikj@13133 72 if test "x$OPENJDK" = "xfalse"; then
erikj@13133 73 FREETYPE2_NOT_NEEDED=yes
erikj@13133 74 fi
erikj@13133 75
ohair@13697 76 if test "x$SUPPORT_HEADFUL" = xno; then
ohair@13697 77 X11_NOT_NEEDED=yes
ohair@13697 78 fi
ohair@13697 79
erikj@13133 80 ###############################################################################
erikj@13133 81 #
erikj@13133 82 # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
erikj@13133 83 # that uses this API.
erikj@13133 84 #
erikj@13133 85 AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support],
erikj@13133 86 [disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])],
erikj@13133 87 [MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"])
erikj@13133 88
erikj@13133 89 USE_MACOSX_RUNTIME_SUPPORT=no
erikj@13133 90 AC_MSG_CHECKING([for explicit Java runtime support in the OS])
erikj@13133 91 if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
erikj@13133 92 if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
erikj@13133 93 MACOSX_RUNTIME_SUPPORT=yes
erikj@13133 94 USE_MACOSX_RUNTIME_SUPPORT=yes
erikj@13133 95 AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11])
erikj@13133 96 else
erikj@13133 97 AC_MSG_RESULT([yes, but explicitly disabled.])
erikj@13133 98 fi
erikj@13133 99 else
erikj@13133 100 AC_MSG_RESULT([no])
erikj@13133 101 fi
erikj@13133 102
erikj@13133 103 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
erikj@13133 104 AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?])
erikj@13133 105 X11_NOT_NEEDED=
erikj@13133 106 FREETYPE2_NOT_NEEDED=
erikj@13133 107 AC_MSG_RESULT([alsa pulse])
erikj@13133 108 fi
erikj@13133 109 ])
erikj@13133 110
erikj@13133 111 AC_DEFUN_ONCE([LIB_SETUP_X11],
erikj@13133 112 [
erikj@13133 113
erikj@13133 114 ###############################################################################
erikj@13133 115 #
erikj@13133 116 # Check for X Windows
erikj@13133 117 #
erikj@13133 118
erikj@13133 119 # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
erikj@13133 120 # Make a simple check for the libraries at the sysroot, and setup --x-includes and
erikj@13133 121 # --x-libraries for the sysroot, if that seems to be correct.
erikj@13133 122 if test "x$SYS_ROOT" != "x/"; then
erikj@13133 123 if test "x$x_includes" = xNONE; then
erikj@13133 124 if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then
erikj@13133 125 x_includes="$SYS_ROOT/usr/X11R6/include"
erikj@13133 126 fi
erikj@13133 127 fi
erikj@13133 128 if test "x$x_libraries" = xNONE; then
erikj@13133 129 if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then
erikj@13133 130 x_libraries="$SYS_ROOT/usr/X11R6/lib"
erikj@13133 131 fi
erikj@13133 132 fi
erikj@13133 133 fi
erikj@13133 134
erikj@13133 135 # Now let autoconf do it's magic
erikj@13133 136 AC_PATH_X
erikj@13133 137 AC_PATH_XTRA
erikj@13133 138
erikj@13133 139 if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
erikj@13133 140 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@13133 141 AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
erikj@13133 142 fi
erikj@13133 143
erikj@13133 144 # Some of the old makefiles require a setting of OPENWIN_HOME
erikj@13133 145 # Since the X11R6 directory has disappeared on later Linuxes,
erikj@13133 146 # we need to probe for it.
erikj@13133 147 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@13133 148 if test -d "$SYS_ROOT/usr/X11R6"; then
erikj@13133 149 OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
erikj@13133 150 fi
erikj@13133 151 if test -d "$SYS_ROOT/usr/include/X11"; then
erikj@13133 152 OPENWIN_HOME="$SYS_ROOT/usr"
erikj@13133 153 fi
erikj@13133 154 fi
erikj@13133 155 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
erikj@13133 156 OPENWIN_HOME="/usr/openwin"
erikj@13133 157 fi
erikj@13133 158 AC_SUBST(OPENWIN_HOME)
erikj@13133 159
erikj@13133 160
erikj@13133 161 #
erikj@13133 162 # Weird Sol10 something check...TODO change to try compile
erikj@13133 163 #
erikj@13133 164 if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
erikj@13133 165 if test "`uname -r`" = "5.10"; then
erikj@13133 166 if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
erikj@13133 167 X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
erikj@13133 168 fi
erikj@13133 169 fi
erikj@13133 170 fi
erikj@13133 171
erikj@13133 172 AC_LANG_PUSH(C)
erikj@13133 173 OLD_CFLAGS="$CFLAGS"
erikj@13133 174 CFLAGS="$CFLAGS $X_CFLAGS"
erikj@13133 175 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
erikj@13133 176 [X11_A_OK=yes],
erikj@13133 177 [X11_A_OK=no])
erikj@13133 178 CFLAGS="$OLD_CFLAGS"
erikj@13133 179 AC_LANG_POP(C)
erikj@13133 180
erikj@13133 181 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
erikj@13133 182 HELP_MSG_MISSING_DEPENDENCY([x11])
erikj@13133 183 AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h). $HELP_MSG])
erikj@13133 184 fi
erikj@13133 185
erikj@13133 186 AC_SUBST(X_CFLAGS)
erikj@13133 187 AC_SUBST(X_LIBS)
erikj@13133 188 ])
erikj@13133 189
erikj@13133 190 AC_DEFUN_ONCE([LIB_SETUP_CUPS],
erikj@13133 191 [
erikj@13133 192
erikj@13133 193 ###############################################################################
erikj@13133 194 #
erikj@13133 195 # The common unix printing system cups is used to print from java.
erikj@13133 196 #
erikj@13133 197 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
erikj@13133 198 [specify prefix directory for the cups package
erikj@13133 199 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@13133 200 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
erikj@13133 201 [specify directory for the cups include files])])
erikj@13133 202 AC_ARG_WITH(cups-lib, [AS_HELP_STRING([--with-cups-lib],
erikj@13133 203 [specify directory for the cups library])])
erikj@13133 204
erikj@13133 205 if test "x$CUPS_NOT_NEEDED" = xyes; then
erikj@13133 206 if test "x${with_cups}" != x || test "x${with_cups_include}" != x || test "x${with_cups_lib}" != x; then
erikj@13133 207 AC_MSG_WARN([cups not used, so --with-cups is ignored])
erikj@13133 208 fi
erikj@13133 209 CUPS_CFLAGS=
erikj@13133 210 CUPS_LIBS=
erikj@13133 211 else
erikj@13133 212 CUPS_FOUND=no
erikj@13133 213
erikj@13133 214 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno || test "x${with_cups_lib}" = xno; then
erikj@13133 215 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
erikj@13133 216 fi
erikj@13133 217
erikj@13133 218 if test "x${with_cups}" != x; then
erikj@13133 219 CUPS_LIBS="-L${with_cups}/lib -lcups"
erikj@13133 220 CUPS_CFLAGS="-I${with_cups}/include"
erikj@13133 221 CUPS_FOUND=yes
erikj@13133 222 fi
erikj@13133 223 if test "x${with_cups_include}" != x; then
erikj@13133 224 CUPS_CFLAGS="-I${with_cups_include}"
erikj@13133 225 CUPS_FOUND=yes
erikj@13133 226 fi
erikj@13133 227 if test "x${with_cups_lib}" != x; then
erikj@13133 228 CUPS_LIBS="-L${with_cups_lib} -lcups"
erikj@13133 229 CUPS_FOUND=yes
erikj@13133 230 fi
erikj@13133 231 if test "x$CUPS_FOUND" = xno; then
erikj@13133 232 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
erikj@13133 233 fi
erikj@13133 234 if test "x$CUPS_FOUND" = xno; then
erikj@13133 235 # Are the cups headers installed in the default /usr/include location?
erikj@13133 236 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
erikj@13133 237 [CUPS_FOUND=yes
erikj@13133 238 CUPS_CFLAGS=
erikj@13133 239 CUPS_LIBS="-lcups"
erikj@13133 240 DEFAULT_CUPS=yes])
erikj@13133 241 fi
erikj@13133 242 if test "x$CUPS_FOUND" = xno; then
erikj@13133 243 # Getting nervous now? Lets poke around for standard Solaris third-party
erikj@13133 244 # package installation locations.
erikj@13133 245 AC_MSG_CHECKING([for cups headers and libs])
erikj@13133 246 if test -s /opt/sfw/cups/include/cups/cups.h; then
erikj@13133 247 # An SFW package seems to be installed!
erikj@13133 248 CUPS_FOUND=yes
erikj@13133 249 CUPS_CFLAGS="-I/opt/sfw/cups/include"
erikj@13133 250 CUPS_LIBS="-L/opt/sfw/cups/lib -lcups"
erikj@13133 251 elif test -s /opt/csw/include/cups/cups.h; then
erikj@13133 252 # A CSW package seems to be installed!
erikj@13133 253 CUPS_FOUND=yes
erikj@13133 254 CUPS_CFLAGS="-I/opt/csw/include"
erikj@13133 255 CUPS_LIBS="-L/opt/csw/lib -lcups"
erikj@13133 256 fi
erikj@13133 257 AC_MSG_RESULT([$CUPS_FOUND])
erikj@13133 258 fi
erikj@13133 259 if test "x$CUPS_FOUND" = xno; then
erikj@13133 260 HELP_MSG_MISSING_DEPENDENCY([cups])
erikj@13133 261 AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
erikj@13133 262 fi
erikj@13133 263 fi
erikj@13133 264
erikj@13133 265 AC_SUBST(CUPS_CFLAGS)
erikj@13133 266 AC_SUBST(CUPS_LIBS)
erikj@13133 267
erikj@13133 268 ])
erikj@13133 269
erikj@13133 270 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
erikj@13133 271 [
erikj@13133 272
erikj@13133 273 ###############################################################################
erikj@13133 274 #
erikj@13133 275 # The ubiquitous freetype2 library is used to render fonts.
erikj@13133 276 #
erikj@13133 277 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
erikj@13133 278 [specify prefix directory for the freetype2 package
erikj@13133 279 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@13133 280
erikj@13133 281 # If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
erikj@13133 282 USING_SYSTEM_FT_LIB=false
erikj@13133 283
erikj@13133 284 if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
erikj@13133 285 if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
erikj@13133 286 AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
erikj@13133 287 fi
erikj@13133 288 FREETYPE2_CFLAGS=
erikj@13133 289 FREETYPE2_LIBS=
erikj@13133 290 FREETYPE2_LIB_PATH=
erikj@13133 291 else
erikj@13133 292 FREETYPE2_FOUND=no
erikj@13133 293
erikj@13133 294 if test "x$with_freetype" != x; then
erikj@13133 295 SPACESAFE(with_freetype,[the path to freetype])
erikj@13133 296 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
erikj@13133 297 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@13133 298 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
erikj@13133 299 fi
erikj@13133 300 FREETYPE2_LIB_PATH="$with_freetype/lib"
erikj@13133 301 FREETYPE2_CFLAGS="-I$with_freetype/include"
erikj@13133 302 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
erikj@13133 303 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
erikj@13133 304 fi
erikj@13133 305 FREETYPE2_FOUND=yes
erikj@13133 306 if test "x$FREETYPE2_FOUND" = xyes; then
erikj@13133 307 # Verify that the directories exist
erikj@13133 308 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
erikj@13133 309 AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
erikj@13133 310 fi
erikj@13133 311 # List the contents of the lib.
erikj@13133 312 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
erikj@13133 313 if test "x$FREETYPELIB" = x; then
erikj@13133 314 AC_MSG_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib])
erikj@13133 315 fi
erikj@13133 316 # Check one h-file
erikj@13133 317 if ! test -s "$with_freetype/include/ft2build.h"; then
erikj@13133 318 AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
erikj@13133 319 fi
erikj@13133 320 fi
erikj@13133 321 fi
erikj@13133 322 if test "x$FREETYPE2_FOUND" = xno; then
erikj@13133 323 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
erikj@13133 324 USING_SYSTEM_FT_LIB=true
erikj@13133 325 fi
erikj@13133 326 if test "x$FREETYPE2_FOUND" = xno; then
erikj@13133 327 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
erikj@13133 328 USING_SYSTEM_FT_LIB=true
erikj@13133 329 fi
erikj@13133 330 if test "x$FREETYPE2_FOUND" = xno; then
erikj@13133 331 AC_MSG_CHECKING([for freetype in some standard locations])
erikj@13133 332
erikj@13133 333 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
erikj@13133 334 DEFAULT_FREETYPE_CFLAGS="-I/usr/X11/include/freetype2 -I/usr/X11/include"
erikj@13133 335 DEFAULT_FREETYPE_LIBS="-L/usr/X11/lib -lfreetype"
erikj@13133 336 fi
erikj@13133 337 if test -s /usr/include/ft2build.h && test -d /usr/include/freetype2/freetype; then
erikj@13133 338 DEFAULT_FREETYPE_CFLAGS="-I/usr/include/freetype2"
erikj@13133 339 DEFAULT_FREETYPE_LIBS="-lfreetype"
erikj@13133 340 fi
erikj@13133 341
erikj@13133 342 PREV_CXXCFLAGS="$CXXFLAGS"
erikj@13133 343 PREV_LDFLAGS="$LDFLAGS"
erikj@13133 344 CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
erikj@13133 345 LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
erikj@13133 346 AC_LINK_IFELSE([AC_LANG_SOURCE([[#include<ft2build.h>
erikj@13133 347 #include FT_FREETYPE_H
erikj@13133 348 int main() { return 0; }
erikj@13133 349 ]])],
erikj@13133 350 [
erikj@13133 351 # Yes, the default cflags and libs did the trick.
erikj@13133 352 FREETYPE2_FOUND=yes
erikj@13133 353 FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
erikj@13133 354 FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
erikj@13133 355 ],
erikj@13133 356 [
erikj@13133 357 FREETYPE2_FOUND=no
erikj@13133 358 ])
erikj@13133 359 CXXCFLAGS="$PREV_CXXFLAGS"
erikj@13133 360 LDFLAGS="$PREV_LDFLAGS"
erikj@13133 361 AC_MSG_RESULT([$FREETYPE2_FOUND])
erikj@13133 362 USING_SYSTEM_FT_LIB=true
erikj@13133 363 fi
erikj@13133 364 if test "x$FREETYPE2_FOUND" = xno; then
erikj@13133 365 HELP_MSG_MISSING_DEPENDENCY([freetype2])
erikj@13133 366 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
erikj@13133 367 fi
erikj@13133 368 fi
erikj@13133 369
erikj@13133 370 AC_SUBST(USING_SYSTEM_FT_LIB)
erikj@13133 371 AC_SUBST(FREETYPE2_LIB_PATH)
erikj@13133 372 AC_SUBST(FREETYPE2_CFLAGS)
erikj@13133 373 AC_SUBST(FREETYPE2_LIBS)
erikj@13133 374
erikj@13133 375 ])
erikj@13133 376
erikj@13133 377 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
erikj@13133 378 [
erikj@13133 379
erikj@13133 380 ###############################################################################
erikj@13133 381 #
erikj@13133 382 # Check for alsa headers and libraries. Used on Linux/GNU systems.
erikj@13133 383 #
erikj@13133 384 AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
erikj@13133 385 [specify prefix directory for the alsa package
erikj@13133 386 (expecting the libraries under PATH/lib and the headers under PATH/include)])])
erikj@13133 387 AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
erikj@13133 388 [specify directory for the alsa include files])])
erikj@13133 389 AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
erikj@13133 390 [specify directory for the alsa library])])
erikj@13133 391
erikj@13133 392 if test "x$ALSA_NOT_NEEDED" = xyes; then
erikj@13133 393 if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
erikj@13133 394 AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
erikj@13133 395 fi
erikj@13133 396 ALSA_CFLAGS=
erikj@13133 397 ALSA_LIBS=
erikj@13133 398 else
erikj@13133 399 ALSA_FOUND=no
erikj@13133 400
erikj@13133 401 if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
erikj@13133 402 AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
erikj@13133 403 fi
erikj@13133 404
erikj@13133 405 if test "x${with_alsa}" != x; then
erikj@13133 406 ALSA_LIBS="-L${with_alsa}/lib -lalsa"
erikj@13133 407 ALSA_CFLAGS="-I${with_alsa}/include"
erikj@13133 408 ALSA_FOUND=yes
erikj@13133 409 fi
erikj@13133 410 if test "x${with_alsa_include}" != x; then
erikj@13133 411 ALSA_CFLAGS="-I${with_alsa_include}"
erikj@13133 412 ALSA_FOUND=yes
erikj@13133 413 fi
erikj@13133 414 if test "x${with_alsa_lib}" != x; then
erikj@13133 415 ALSA_LIBS="-L${with_alsa_lib} -lalsa"
erikj@13133 416 ALSA_FOUND=yes
erikj@13133 417 fi
erikj@13133 418 if test "x$ALSA_FOUND" = xno; then
erikj@13133 419 BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@13133 420 fi
erikj@13133 421 if test "x$ALSA_FOUND" = xno; then
erikj@13133 422 PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
erikj@13133 423 fi
erikj@13133 424 if test "x$ALSA_FOUND" = xno; then
erikj@13133 425 AC_CHECK_HEADERS([alsa/asoundlib.h],
erikj@13133 426 [ALSA_FOUND=yes
erikj@13133 427 ALSA_CFLAGS=-Iignoreme
erikj@13133 428 ALSA_LIBS=-lasound
erikj@13133 429 DEFAULT_ALSA=yes],
erikj@13133 430 [ALSA_FOUND=no])
erikj@13133 431 fi
erikj@13133 432 if test "x$ALSA_FOUND" = xno; then
erikj@13133 433 HELP_MSG_MISSING_DEPENDENCY([alsa])
erikj@13133 434 AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
erikj@13133 435 fi
erikj@13133 436 fi
erikj@13133 437
erikj@13133 438 AC_SUBST(ALSA_CFLAGS)
erikj@13133 439 AC_SUBST(ALSA_LIBS)
erikj@13133 440
erikj@13133 441 ])
erikj@13133 442
erikj@13133 443 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
erikj@13133 444 [
erikj@13133 445
erikj@13133 446 ###############################################################################
erikj@13133 447 #
erikj@13133 448 # Check for the jpeg library
erikj@13133 449 #
erikj@13133 450
erikj@13133 451 USE_EXTERNAL_LIBJPEG=true
erikj@13133 452 AC_CHECK_LIB(jpeg, main, [],
erikj@13133 453 [ USE_EXTERNAL_LIBJPEG=false
erikj@13133 454 AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
erikj@13133 455 ])
erikj@13133 456 AC_SUBST(USE_EXTERNAL_LIBJPEG)
erikj@13133 457
erikj@13133 458 ###############################################################################
erikj@13133 459 #
erikj@13133 460 # Check for the gif library
erikj@13133 461 #
erikj@13133 462
erikj@13133 463 USE_EXTERNAL_LIBJPEG=true
erikj@13133 464 AC_CHECK_LIB(gif, main, [],
erikj@13133 465 [ USE_EXTERNAL_LIBGIF=false
erikj@13133 466 AC_MSG_NOTICE([Will use gif decoder bundled with the OpenJDK source])
erikj@13133 467 ])
erikj@13133 468 AC_SUBST(USE_EXTERNAL_LIBGIF)
erikj@13133 469
erikj@13133 470 ###############################################################################
erikj@13133 471 #
erikj@13133 472 # Check for the zlib library
erikj@13133 473 #
erikj@13133 474
erikj@13133 475 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
erikj@13133 476 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
erikj@13133 477
erikj@13133 478 AC_CHECK_LIB(z, compress,
erikj@13133 479 [ ZLIB_FOUND=yes ],
erikj@13133 480 [ ZLIB_FOUND=no ])
erikj@13133 481
erikj@13133 482 AC_MSG_CHECKING([for which zlib to use])
erikj@13133 483
erikj@13133 484 DEFAULT_ZLIB=bundled
erikj@13133 485 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
erikj@13133 486 #
erikj@13133 487 # On macosx default is system...on others default is
erikj@13133 488 #
erikj@13133 489 DEFAULT_ZLIB=system
erikj@13133 490 fi
erikj@13133 491
erikj@13133 492 if test "x${ZLIB_FOUND}" != "xyes"; then
erikj@13133 493 #
erikj@13133 494 # If we don't find any system...set default to bundled
erikj@13133 495 #
erikj@13133 496 DEFAULT_ZLIB=bundled
erikj@13133 497 fi
erikj@13133 498
erikj@13133 499 #
erikj@13133 500 # If user didn't specify, use DEFAULT_ZLIB
erikj@13133 501 #
erikj@13133 502 if test "x${with_zlib}" = "x"; then
erikj@13133 503 with_zlib=${DEFAULT_ZLIB}
erikj@13133 504 fi
erikj@13133 505
erikj@13133 506 if test "x${with_zlib}" = "xbundled"; then
erikj@13133 507 USE_EXTERNAL_LIBZ=false
erikj@13133 508 AC_MSG_RESULT([bundled])
erikj@13133 509 elif test "x${with_zlib}" = "xsystem"; then
erikj@13133 510 if test "x${ZLIB_FOUND}" = "xyes"; then
erikj@13133 511 USE_EXTERNAL_LIBZ=true
erikj@13133 512 AC_MSG_RESULT([system])
erikj@13133 513 else
erikj@13133 514 AC_MSG_RESULT([system not found])
erikj@13133 515 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
erikj@13133 516 fi
erikj@13133 517 else
erikj@13133 518 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
erikj@13133 519 fi
erikj@13133 520
erikj@13133 521 AC_SUBST(USE_EXTERNAL_LIBZ)
erikj@13133 522
erikj@13133 523 ###############################################################################
erikj@13133 524 LIBZIP_CAN_USE_MMAP=true
ohair@13697 525
erikj@13133 526 AC_SUBST(LIBZIP_CAN_USE_MMAP)
erikj@13133 527
erikj@13133 528 ###############################################################################
erikj@13133 529 #
erikj@13133 530 # Check if altzone exists in time.h
erikj@13133 531 #
erikj@13133 532
erikj@13133 533 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
erikj@13133 534 [has_altzone=yes],
erikj@13133 535 [has_altzone=no])
erikj@13133 536 if test "x$has_altzone" = xyes; then
erikj@13133 537 AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
erikj@13133 538 fi
erikj@13133 539
erikj@13133 540 ###############################################################################
erikj@13133 541 #
erikj@13133 542 # Check the maths library
erikj@13133 543 #
erikj@13133 544
erikj@13133 545 AC_CHECK_LIB(m, cos, [],
erikj@13133 546 [
erikj@13133 547 AC_MSG_NOTICE([Maths library was not found])
erikj@13133 548 ])
erikj@13133 549 AC_SUBST(LIBM)
erikj@13133 550
erikj@13133 551 ###############################################################################
erikj@13133 552 #
erikj@13133 553 # Check for libdl.so
erikj@13133 554
erikj@13133 555 save_LIBS="$LIBS"
erikj@13133 556 LIBS=""
erikj@13133 557 AC_CHECK_LIB(dl,dlopen)
erikj@13133 558 LIBDL="$LIBS"
erikj@13133 559 AC_SUBST(LIBDL)
erikj@13133 560 LIBS="$save_LIBS"
erikj@13133 561
erikj@13133 562 ])
erikj@13133 563
erikj@13133 564 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
erikj@13133 565 [
erikj@13133 566 ###############################################################################
erikj@13133 567 #
erikj@13133 568 # statically link libstdc++ before C++ ABI is stablized on Linux unless
erikj@13133 569 # dynamic build is configured on command line.
erikj@13133 570 #
erikj@13133 571 AC_ARG_ENABLE([static-link-stdc++], [AS_HELP_STRING([--disable-static-link-stdc++],
erikj@13133 572 [disable static linking of the C++ runtime on Linux @<:@enabled@:>@])],,
erikj@13133 573 [
erikj@13133 574 enable_static_link_stdc__=yes
erikj@13133 575 ])
erikj@13133 576
erikj@13133 577 if test "x$OPENJDK_TARGET_OS" = xlinux; then
erikj@13133 578 # Test if -lstdc++ works.
erikj@13133 579 AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
erikj@13133 580 AC_LANG_PUSH(C++)
erikj@13133 581 OLD_CXXFLAGS="$CXXFLAGS"
erikj@13133 582 CXXFLAGS="$CXXFLAGS -lstdc++"
erikj@13133 583 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@13133 584 [has_dynamic_libstdcxx=yes],
erikj@13133 585 [has_dynamic_libstdcxx=no])
erikj@13133 586 CXXFLAGS="$OLD_CXXFLAGS"
erikj@13133 587 AC_LANG_POP(C++)
erikj@13133 588 AC_MSG_RESULT([$has_dynamic_libstdcxx])
erikj@13133 589
erikj@13133 590 # Test if stdc++ can be linked statically.
erikj@13133 591 AC_MSG_CHECKING([if static link of stdc++ is possible])
erikj@13133 592 STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
erikj@13133 593 AC_LANG_PUSH(C++)
erikj@13133 594 OLD_LIBS="$LIBS"
erikj@13133 595 OLD_CXX="$CXX"
erikj@13133 596 LIBS="$STATIC_STDCXX_FLAGS"
erikj@13133 597 CXX="$CC"
erikj@13133 598 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
erikj@13133 599 [has_static_libstdcxx=yes],
erikj@13133 600 [has_static_libstdcxx=no])
erikj@13133 601 LIBS="$OLD_LIBS"
erikj@13133 602 CXX="$OLD_CXX"
erikj@13133 603 AC_LANG_POP(C++)
erikj@13133 604 AC_MSG_RESULT([$has_static_libstdcxx])
erikj@13133 605
erikj@13133 606 if test "x$has_static_libcxx" = xno && test "x$has_dynamic_libcxx" = xno; then
erikj@13133 607 AC_MSG_ERROR([I cannot link to stdc++! Neither dynamically nor statically.])
erikj@13133 608 fi
erikj@13133 609
erikj@13133 610 if test "x$enable_static_link_stdc__" = xyes && test "x$has_static_libstdcxx" = xno; then
erikj@13133 611 AC_MSG_NOTICE([Static linking of libstdc++ was not possible reverting to dynamic linking.])
erikj@13133 612 enable_static_link_stdc__=no
erikj@13133 613 fi
erikj@13133 614
erikj@13133 615 if test "x$enable_static_link_stdc__" = xno && test "x$has_dynamic_libstdcxx" = xno; then
erikj@13133 616 AC_MSG_NOTICE([Dynamic linking of libstdc++ was not possible reverting to static linking.])
erikj@13133 617 enable_static_link_stdc__=yes
erikj@13133 618 fi
erikj@13133 619
erikj@13133 620 AC_MSG_CHECKING([how to link with libstdc++])
erikj@13133 621 if test "x$enable_static_link_stdc__" = xyes; then
erikj@13133 622 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
erikj@13133 623 LDCXX="$CC"
erikj@13133 624 AC_MSG_RESULT([static])
erikj@13133 625 else
erikj@13133 626 LIBCXX="$LIBCXX -lstdc++"
erikj@13133 627 LDCXX="$CXX"
erikj@13133 628 AC_MSG_RESULT([dynamic])
erikj@13133 629 fi
erikj@13133 630 fi
erikj@13133 631
erikj@13133 632 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
erikj@13133 633 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
ohair@13697 634 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
erikj@13133 635 fi
erikj@13133 636
erikj@13133 637 # TODO better (platform agnostic) test
erikj@13133 638 if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
erikj@13133 639 LIBCXX="-lstdc++"
erikj@13133 640 fi
erikj@13133 641
erikj@13133 642 AC_SUBST(LIBCXX)
erikj@13133 643
erikj@13133 644 ])