erikj@459: # erikj@459: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. erikj@459: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. erikj@459: # erikj@459: # This code is free software; you can redistribute it and/or modify it erikj@459: # under the terms of the GNU General Public License version 2 only, as erikj@459: # published by the Free Software Foundation. Oracle designates this erikj@459: # particular file as subject to the "Classpath" exception as provided erikj@459: # by Oracle in the LICENSE file that accompanied this code. erikj@459: # erikj@459: # This code is distributed in the hope that it will be useful, but WITHOUT erikj@459: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or erikj@459: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License erikj@459: # version 2 for more details (a copy is included in the LICENSE file that erikj@459: # accompanied this code). erikj@459: # erikj@459: # You should have received a copy of the GNU General Public License version erikj@459: # 2 along with this work; if not, write to the Free Software Foundation, erikj@459: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. erikj@459: # erikj@459: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA erikj@459: # or visit www.oracle.com if you need additional information or have any erikj@459: # questions. erikj@459: # erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_INIT], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # OS specific settings that we never will need to probe. erikj@459: # erikj@459: if test "x$OPENJDK_TARGET_OS" = xlinux; then erikj@459: AC_MSG_CHECKING([what is not needed on Linux?]) erikj@459: PULSE_NOT_NEEDED=yes erikj@459: AC_MSG_RESULT([pulse]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xsolaris; then erikj@459: AC_MSG_CHECKING([what is not needed on Solaris?]) erikj@459: ALSA_NOT_NEEDED=yes erikj@459: PULSE_NOT_NEEDED=yes erikj@459: AC_MSG_RESULT([alsa pulse]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xwindows; then erikj@459: AC_MSG_CHECKING([what is not needed on Windows?]) erikj@459: CUPS_NOT_NEEDED=yes erikj@459: ALSA_NOT_NEEDED=yes erikj@459: PULSE_NOT_NEEDED=yes erikj@459: X11_NOT_NEEDED=yes erikj@459: AC_MSG_RESULT([alsa cups pulse x11]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xmacosx; then erikj@459: AC_MSG_CHECKING([what is not needed on MacOSX?]) erikj@459: ALSA_NOT_NEEDED=yes erikj@459: PULSE_NOT_NEEDED=yes erikj@459: X11_NOT_NEEDED=yes erikj@459: FREETYPE2_NOT_NEEDED=yes erikj@459: # If the java runtime framework is disabled, then we need X11. erikj@459: # This will be adjusted below. erikj@459: AC_MSG_RESULT([alsa pulse x11]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xbsd; then erikj@459: AC_MSG_CHECKING([what is not needed on bsd?]) erikj@459: ALSA_NOT_NEEDED=yes erikj@459: AC_MSG_RESULT([alsa]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK" = "xfalse"; then erikj@459: FREETYPE2_NOT_NEEDED=yes erikj@459: fi erikj@459: ohair@478: if test "x$SUPPORT_HEADFUL" = xno; then ohair@478: X11_NOT_NEEDED=yes ohair@478: fi ohair@478: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM erikj@459: # that uses this API. erikj@459: # erikj@459: AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support], erikj@459: [disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])], erikj@459: [MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"]) erikj@459: erikj@459: USE_MACOSX_RUNTIME_SUPPORT=no erikj@459: AC_MSG_CHECKING([for explicit Java runtime support in the OS]) erikj@459: if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then erikj@459: if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then erikj@459: MACOSX_RUNTIME_SUPPORT=yes erikj@459: USE_MACOSX_RUNTIME_SUPPORT=yes erikj@459: AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11]) erikj@459: else erikj@459: AC_MSG_RESULT([yes, but explicitly disabled.]) erikj@459: fi erikj@459: else erikj@459: AC_MSG_RESULT([no]) erikj@459: fi erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then erikj@459: AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?]) erikj@459: X11_NOT_NEEDED= erikj@459: FREETYPE2_NOT_NEEDED= erikj@459: AC_MSG_RESULT([alsa pulse]) erikj@459: fi erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_X11], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for X Windows erikj@459: # erikj@459: erikj@459: # Check if the user has specified sysroot, but not --x-includes or --x-libraries. erikj@459: # Make a simple check for the libraries at the sysroot, and setup --x-includes and erikj@459: # --x-libraries for the sysroot, if that seems to be correct. erikj@459: if test "x$SYS_ROOT" != "x/"; then erikj@459: if test "x$x_includes" = xNONE; then erikj@459: if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then erikj@459: x_includes="$SYS_ROOT/usr/X11R6/include" erikj@740: elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then erikj@740: x_includes="$SYS_ROOT/usr/include" erikj@459: fi erikj@459: fi erikj@459: if test "x$x_libraries" = xNONE; then erikj@459: if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then erikj@459: x_libraries="$SYS_ROOT/usr/X11R6/lib" erikj@740: elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then erikj@740: x_libraries="$SYS_ROOT/usr/lib64" erikj@740: elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then erikj@740: x_libraries="$SYS_ROOT/usr/lib" erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: erikj@459: # Now let autoconf do it's magic erikj@459: AC_PATH_X erikj@459: AC_PATH_XTRA erikj@459: erikj@600: # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling erikj@600: # this doesn't make sense so we remove it. erikj@600: if test "x$COMPILE_TYPE" = xcross; then erikj@600: X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'` erikj@600: fi erikj@600: erikj@459: if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([x11]) erikj@459: AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG]) erikj@459: fi erikj@459: erikj@459: # Some of the old makefiles require a setting of OPENWIN_HOME erikj@459: # Since the X11R6 directory has disappeared on later Linuxes, erikj@459: # we need to probe for it. erikj@459: if test "x$OPENJDK_TARGET_OS" = xlinux; then erikj@459: if test -d "$SYS_ROOT/usr/X11R6"; then erikj@459: OPENWIN_HOME="$SYS_ROOT/usr/X11R6" erikj@740: elif test -d "$SYS_ROOT/usr/include/X11"; then erikj@459: OPENWIN_HOME="$SYS_ROOT/usr" erikj@459: fi erikj@459: fi erikj@459: if test "x$OPENJDK_TARGET_OS" = xsolaris; then erikj@459: OPENWIN_HOME="/usr/openwin" erikj@459: fi erikj@459: AC_SUBST(OPENWIN_HOME) erikj@459: erikj@459: erikj@459: # erikj@459: # Weird Sol10 something check...TODO change to try compile erikj@459: # erikj@459: if test "x${OPENJDK_TARGET_OS}" = xsolaris; then erikj@459: if test "`uname -r`" = "5.10"; then erikj@459: if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then erikj@459: X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS" erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: erikj@459: AC_LANG_PUSH(C) erikj@459: OLD_CFLAGS="$CFLAGS" erikj@459: CFLAGS="$CFLAGS $X_CFLAGS" ohair@494: ohair@494: # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10 erikj@782: AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h], ohair@494: [X11_A_OK=yes], omajid@657: [X11_A_OK=no; break], ohair@494: [ # include ohair@494: # include ohair@494: ]) ohair@494: erikj@459: CFLAGS="$OLD_CFLAGS" erikj@459: AC_LANG_POP(C) erikj@459: erikj@459: if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([x11]) erikj@782: AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG]) erikj@459: fi erikj@459: erikj@459: AC_SUBST(X_CFLAGS) erikj@459: AC_SUBST(X_LIBS) erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_CUPS], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # The common unix printing system cups is used to print from java. erikj@459: # erikj@459: AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups], erikj@459: [specify prefix directory for the cups package ohair@494: (expecting the headers under PATH/include)])]) erikj@459: AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include], erikj@459: [specify directory for the cups include files])]) erikj@459: erikj@459: if test "x$CUPS_NOT_NEEDED" = xyes; then ohair@494: if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then erikj@459: AC_MSG_WARN([cups not used, so --with-cups is ignored]) erikj@459: fi erikj@459: CUPS_CFLAGS= erikj@459: else erikj@459: CUPS_FOUND=no erikj@459: ohair@494: if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then erikj@459: AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.]) erikj@459: fi erikj@459: erikj@459: if test "x${with_cups}" != x; then erikj@459: CUPS_CFLAGS="-I${with_cups}/include" erikj@459: CUPS_FOUND=yes erikj@459: fi erikj@459: if test "x${with_cups_include}" != x; then erikj@459: CUPS_CFLAGS="-I${with_cups_include}" erikj@459: CUPS_FOUND=yes erikj@459: fi erikj@459: if test "x$CUPS_FOUND" = xno; then erikj@459: BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes]) erikj@459: fi erikj@459: if test "x$CUPS_FOUND" = xno; then erikj@459: # Are the cups headers installed in the default /usr/include location? erikj@459: AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], erikj@459: [CUPS_FOUND=yes erikj@459: CUPS_CFLAGS= erikj@459: DEFAULT_CUPS=yes]) erikj@459: fi erikj@459: if test "x$CUPS_FOUND" = xno; then erikj@459: # Getting nervous now? Lets poke around for standard Solaris third-party erikj@459: # package installation locations. ohair@494: AC_MSG_CHECKING([for cups headers]) erikj@459: if test -s /opt/sfw/cups/include/cups/cups.h; then erikj@459: # An SFW package seems to be installed! erikj@459: CUPS_FOUND=yes erikj@459: CUPS_CFLAGS="-I/opt/sfw/cups/include" erikj@459: elif test -s /opt/csw/include/cups/cups.h; then erikj@459: # A CSW package seems to be installed! erikj@459: CUPS_FOUND=yes erikj@459: CUPS_CFLAGS="-I/opt/csw/include" erikj@459: fi erikj@459: AC_MSG_RESULT([$CUPS_FOUND]) erikj@459: fi erikj@459: if test "x$CUPS_FOUND" = xno; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([cups]) erikj@459: AC_MSG_ERROR([Could not find cups! $HELP_MSG ]) erikj@459: fi erikj@459: fi erikj@459: erikj@459: AC_SUBST(CUPS_CFLAGS) erikj@459: erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_FREETYPE], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # The ubiquitous freetype2 library is used to render fonts. erikj@459: # erikj@459: AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype], erikj@459: [specify prefix directory for the freetype2 package erikj@459: (expecting the libraries under PATH/lib and the headers under PATH/include)])]) erikj@459: erikj@459: # 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: USING_SYSTEM_FT_LIB=false erikj@459: erikj@459: if test "x$FREETYPE2_NOT_NEEDED" = xyes; then erikj@459: if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then erikj@459: AC_MSG_WARN([freetype not used, so --with-freetype is ignored]) erikj@459: fi erikj@459: FREETYPE2_CFLAGS= erikj@459: FREETYPE2_LIBS= erikj@459: FREETYPE2_LIB_PATH= erikj@459: else erikj@459: FREETYPE2_FOUND=no erikj@459: erikj@459: if test "x$with_freetype" != x; then ohair@494: BASIC_FIXUP_PATH(with_freetype) erikj@459: FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype" ohair@494: FREETYPE2_LIB_PATH="$with_freetype/lib" ohair@494: if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then ohair@494: FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype" ohair@494: FREETYPE2_LIB_PATH="$with_freetype/lib/amd64" ohair@494: fi erikj@459: if test "x$OPENJDK_TARGET_OS" = xwindows; then erikj@459: FREETYPE2_LIBS="$with_freetype/lib/freetype.lib" erikj@459: fi erikj@459: FREETYPE2_CFLAGS="-I$with_freetype/include" erikj@459: if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then erikj@459: FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include" erikj@459: fi ohair@494: FREETYPE2_FOUND=yes erikj@459: if test "x$FREETYPE2_FOUND" = xyes; then erikj@459: # Verify that the directories exist erikj@459: if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then erikj@459: AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include]) erikj@459: fi erikj@459: # List the contents of the lib. erikj@459: FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null` erikj@459: if test "x$FREETYPELIB" = x; then ohair@494: AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib]) erikj@459: fi erikj@459: # Check one h-file erikj@459: if ! test -s "$with_freetype/include/ft2build.h"; then erikj@459: AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h]) erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: if test "x$FREETYPE2_FOUND" = xno; then erikj@459: BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) erikj@459: USING_SYSTEM_FT_LIB=true erikj@459: fi ohair@494: if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then ohair@494: FREETYPELOCATION="$PROGRAMFILES/GnuWin32" ohair@494: BASIC_FIXUP_PATH(FREETYPELOCATION) ohair@494: AC_MSG_CHECKING([for freetype in some standard windows locations]) ohair@494: if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then ohair@494: FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include" ohair@494: FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib" ohair@494: FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib" ohair@494: if ! test -s "$FREETYPE2_LIBS"; then ohair@494: AC_MSG_ERROR([Could not find $FREETYPE2_LIBS]) ohair@494: fi ohair@494: if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then ohair@494: AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll]) ohair@494: fi ohair@494: USING_SYSTEM_FT_LIB=true ohair@494: FREETYPE2_FOUND=yes ohair@494: fi ohair@494: AC_MSG_RESULT([$FREETYPE2_FOUND]) ohair@494: fi erikj@459: if test "x$FREETYPE2_FOUND" = xno; then erikj@459: PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) ohair@494: # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. ohair@494: FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'` erikj@459: USING_SYSTEM_FT_LIB=true ohair@494: # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 ohair@494: if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then ohair@494: FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'` ohair@494: fi erikj@459: fi erikj@459: if test "x$FREETYPE2_FOUND" = xno; then erikj@459: AC_MSG_CHECKING([for freetype in some standard locations]) erikj@459: erikj@740: if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then erikj@740: DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include" erikj@740: DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype" erikj@459: fi erikj@740: if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then erikj@740: DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2" erikj@459: DEFAULT_FREETYPE_LIBS="-lfreetype" erikj@459: fi erikj@459: erikj@459: PREV_CXXCFLAGS="$CXXFLAGS" erikj@459: PREV_LDFLAGS="$LDFLAGS" erikj@459: CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS" erikj@459: LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS" erikj@459: AC_LINK_IFELSE([AC_LANG_SOURCE([[#include erikj@459: #include FT_FREETYPE_H erikj@459: int main() { return 0; } erikj@459: ]])], erikj@459: [ erikj@459: # Yes, the default cflags and libs did the trick. erikj@459: FREETYPE2_FOUND=yes erikj@459: FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS" erikj@459: FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS" erikj@459: ], erikj@459: [ erikj@459: FREETYPE2_FOUND=no erikj@459: ]) erikj@459: CXXCFLAGS="$PREV_CXXFLAGS" erikj@459: LDFLAGS="$PREV_LDFLAGS" erikj@459: AC_MSG_RESULT([$FREETYPE2_FOUND]) erikj@459: USING_SYSTEM_FT_LIB=true erikj@459: fi erikj@459: if test "x$FREETYPE2_FOUND" = xno; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([freetype2]) erikj@459: AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]) ohair@494: fi ohair@494: ohair@494: if test "x$OPENJDK_TARGET_OS" != xwindows; then ohair@494: # AC_CHECK_LIB does not support use of cl.exe ohair@494: PREV_LDFLAGS="$LDFLAGS" ohair@494: LDFLAGS="$FREETYPE2_LIBS" erikj@502: AC_CHECK_LIB(freetype, FT_Init_FreeType, erikj@502: FREETYPE2_FOUND=true, erikj@502: AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])) ohair@494: LDFLAGS="$PREV_LDFLAGS" ohair@494: fi erikj@459: fi erikj@459: erikj@459: AC_SUBST(USING_SYSTEM_FT_LIB) erikj@459: AC_SUBST(FREETYPE2_LIB_PATH) erikj@459: AC_SUBST(FREETYPE2_CFLAGS) erikj@459: AC_SUBST(FREETYPE2_LIBS) erikj@459: erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_ALSA], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for alsa headers and libraries. Used on Linux/GNU systems. erikj@459: # erikj@459: AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa], erikj@459: [specify prefix directory for the alsa package erikj@459: (expecting the libraries under PATH/lib and the headers under PATH/include)])]) erikj@459: AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include], erikj@459: [specify directory for the alsa include files])]) erikj@459: AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib], erikj@459: [specify directory for the alsa library])]) erikj@459: erikj@459: if test "x$ALSA_NOT_NEEDED" = xyes; then erikj@459: if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then erikj@459: AC_MSG_WARN([alsa not used, so --with-alsa is ignored]) erikj@459: fi erikj@459: ALSA_CFLAGS= erikj@459: ALSA_LIBS= erikj@459: else erikj@459: ALSA_FOUND=no erikj@459: erikj@459: if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then erikj@459: AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.]) erikj@459: fi erikj@459: erikj@459: if test "x${with_alsa}" != x; then erikj@459: ALSA_LIBS="-L${with_alsa}/lib -lalsa" erikj@459: ALSA_CFLAGS="-I${with_alsa}/include" erikj@459: ALSA_FOUND=yes erikj@459: fi erikj@459: if test "x${with_alsa_include}" != x; then erikj@459: ALSA_CFLAGS="-I${with_alsa_include}" erikj@459: ALSA_FOUND=yes erikj@459: fi erikj@459: if test "x${with_alsa_lib}" != x; then erikj@459: ALSA_LIBS="-L${with_alsa_lib} -lalsa" erikj@459: ALSA_FOUND=yes erikj@459: fi erikj@459: if test "x$ALSA_FOUND" = xno; then erikj@459: BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no]) erikj@459: fi erikj@459: if test "x$ALSA_FOUND" = xno; then erikj@459: PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no]) erikj@459: fi erikj@459: if test "x$ALSA_FOUND" = xno; then erikj@459: AC_CHECK_HEADERS([alsa/asoundlib.h], erikj@459: [ALSA_FOUND=yes erikj@459: ALSA_CFLAGS=-Iignoreme erikj@459: ALSA_LIBS=-lasound erikj@459: DEFAULT_ALSA=yes], erikj@459: [ALSA_FOUND=no]) erikj@459: fi erikj@459: if test "x$ALSA_FOUND" = xno; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([alsa]) erikj@459: AC_MSG_ERROR([Could not find alsa! $HELP_MSG ]) erikj@459: fi erikj@459: fi erikj@459: erikj@459: AC_SUBST(ALSA_CFLAGS) erikj@459: AC_SUBST(ALSA_LIBS) erikj@459: erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], erikj@459: [ erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for the jpeg library erikj@459: # erikj@459: erikj@459: USE_EXTERNAL_LIBJPEG=true erikj@459: AC_CHECK_LIB(jpeg, main, [], erikj@459: [ USE_EXTERNAL_LIBJPEG=false erikj@459: AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source]) erikj@459: ]) erikj@459: AC_SUBST(USE_EXTERNAL_LIBJPEG) erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for the gif library erikj@459: # erikj@459: omajid@665: AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib], omajid@665: [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) omajid@665: omajid@665: omajid@665: AC_MSG_CHECKING([for which giflib to use]) omajid@665: omajid@665: # default is bundled omajid@665: DEFAULT_GIFLIB=bundled omajid@665: omajid@665: # omajid@665: # if user didn't specify, use DEFAULT_GIFLIB omajid@665: # omajid@665: if test "x${with_giflib}" = "x"; then omajid@665: with_giflib=${DEFAULT_GIFLIB} omajid@665: fi omajid@665: omajid@665: AC_MSG_RESULT(${with_giflib}) omajid@665: omajid@665: if test "x${with_giflib}" = "xbundled"; then omajid@665: USE_EXTERNAL_LIBGIF=false omajid@665: elif test "x${with_giflib}" = "xsystem"; then omajid@665: AC_CHECK_HEADER(gif_lib.h, [], omajid@665: [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])]) omajid@665: AC_CHECK_LIB(gif, DGifGetCode, [], omajid@665: [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])]) omajid@665: omajid@665: USE_EXTERNAL_LIBGIF=true omajid@665: else omajid@665: AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled']) omajid@665: fi erikj@459: AC_SUBST(USE_EXTERNAL_LIBGIF) erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for the zlib library erikj@459: # erikj@459: erikj@459: AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib], erikj@459: [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) erikj@459: erikj@459: AC_CHECK_LIB(z, compress, erikj@459: [ ZLIB_FOUND=yes ], erikj@459: [ ZLIB_FOUND=no ]) erikj@459: erikj@459: AC_MSG_CHECKING([for which zlib to use]) erikj@459: erikj@459: DEFAULT_ZLIB=bundled erikj@459: if test "x$OPENJDK_TARGET_OS" = xmacosx; then erikj@459: # erikj@459: # On macosx default is system...on others default is erikj@459: # erikj@459: DEFAULT_ZLIB=system erikj@459: fi erikj@459: erikj@459: if test "x${ZLIB_FOUND}" != "xyes"; then erikj@459: # erikj@459: # If we don't find any system...set default to bundled erikj@459: # erikj@459: DEFAULT_ZLIB=bundled erikj@459: fi erikj@459: erikj@459: # erikj@459: # If user didn't specify, use DEFAULT_ZLIB erikj@459: # erikj@459: if test "x${with_zlib}" = "x"; then erikj@459: with_zlib=${DEFAULT_ZLIB} erikj@459: fi erikj@459: erikj@459: if test "x${with_zlib}" = "xbundled"; then erikj@459: USE_EXTERNAL_LIBZ=false erikj@459: AC_MSG_RESULT([bundled]) erikj@459: elif test "x${with_zlib}" = "xsystem"; then erikj@459: if test "x${ZLIB_FOUND}" = "xyes"; then erikj@459: USE_EXTERNAL_LIBZ=true erikj@459: AC_MSG_RESULT([system]) erikj@459: else erikj@459: AC_MSG_RESULT([system not found]) erikj@459: AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!]) erikj@459: fi erikj@459: else erikj@459: AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled']) erikj@459: fi erikj@459: erikj@459: AC_SUBST(USE_EXTERNAL_LIBZ) erikj@459: erikj@459: ############################################################################### erikj@459: LIBZIP_CAN_USE_MMAP=true ohair@478: erikj@459: AC_SUBST(LIBZIP_CAN_USE_MMAP) erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check if altzone exists in time.h erikj@459: # erikj@459: erikj@459: AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [return (int)altzone;])], erikj@459: [has_altzone=yes], erikj@459: [has_altzone=no]) erikj@459: if test "x$has_altzone" = xyes; then erikj@459: AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h]) erikj@459: fi erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check the maths library erikj@459: # erikj@459: erikj@459: AC_CHECK_LIB(m, cos, [], erikj@459: [ erikj@459: AC_MSG_NOTICE([Maths library was not found]) erikj@459: ]) erikj@459: AC_SUBST(LIBM) erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # Check for libdl.so erikj@459: erikj@459: save_LIBS="$LIBS" erikj@459: LIBS="" erikj@459: AC_CHECK_LIB(dl,dlopen) erikj@459: LIBDL="$LIBS" erikj@459: AC_SUBST(LIBDL) erikj@459: LIBS="$save_LIBS" erikj@459: erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP], erikj@459: [ erikj@459: ############################################################################### erikj@459: # erikj@459: # statically link libstdc++ before C++ ABI is stablized on Linux unless erikj@459: # dynamic build is configured on command line. erikj@459: # tbell@511: AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=,,], tbell@511: [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])], tbell@511: [ tbell@511: if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \ tbell@511: && test "x$with_stdc__lib" != xdefault; then tbell@511: AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!]) tbell@511: fi tbell@511: ], tbell@511: [with_stdc__lib=default] tbell@511: ) erikj@459: erikj@459: if test "x$OPENJDK_TARGET_OS" = xlinux; then erikj@459: # Test if -lstdc++ works. erikj@459: AC_MSG_CHECKING([if dynamic link of stdc++ is possible]) erikj@459: AC_LANG_PUSH(C++) erikj@459: OLD_CXXFLAGS="$CXXFLAGS" erikj@459: CXXFLAGS="$CXXFLAGS -lstdc++" erikj@459: AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])], erikj@459: [has_dynamic_libstdcxx=yes], erikj@459: [has_dynamic_libstdcxx=no]) erikj@459: CXXFLAGS="$OLD_CXXFLAGS" erikj@459: AC_LANG_POP(C++) erikj@459: AC_MSG_RESULT([$has_dynamic_libstdcxx]) erikj@459: erikj@459: # Test if stdc++ can be linked statically. erikj@459: AC_MSG_CHECKING([if static link of stdc++ is possible]) erikj@459: STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic" erikj@459: AC_LANG_PUSH(C++) erikj@459: OLD_LIBS="$LIBS" erikj@459: OLD_CXX="$CXX" erikj@459: LIBS="$STATIC_STDCXX_FLAGS" erikj@459: CXX="$CC" erikj@459: AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])], erikj@459: [has_static_libstdcxx=yes], erikj@459: [has_static_libstdcxx=no]) erikj@459: LIBS="$OLD_LIBS" erikj@459: CXX="$OLD_CXX" erikj@459: AC_LANG_POP(C++) erikj@459: AC_MSG_RESULT([$has_static_libstdcxx]) erikj@459: tbell@511: if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then tbell@511: AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!]) erikj@459: fi erikj@459: tbell@511: if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then tbell@511: AC_MSG_ERROR([Static linking of libstdc++ was not possible!]) erikj@459: fi erikj@459: tbell@511: if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then tbell@511: AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!]) erikj@459: fi erikj@459: erikj@459: AC_MSG_CHECKING([how to link with libstdc++]) tbell@511: # If dynamic was requested, it's available since it would fail above otherwise. tbell@511: # If dynamic wasn't requested, go with static unless it isn't available. omajid@671: if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then tbell@511: LIBCXX="$LIBCXX -lstdc++" tbell@511: LDCXX="$CXX" tbell@511: STATIC_CXX_SETTING="STATIC_CXX=false" tbell@511: AC_MSG_RESULT([dynamic]) tbell@511: else erikj@459: LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS" erikj@459: LDCXX="$CC" ohair@494: STATIC_CXX_SETTING="STATIC_CXX=true" erikj@459: AC_MSG_RESULT([static]) erikj@459: fi erikj@459: fi ohair@494: AC_SUBST(STATIC_CXX_SETTING) erikj@459: omajid@671: if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then omajid@671: # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS omajid@671: PKG_CHECK_MODULES([LIBFFI], [libffi]) omajid@671: omajid@671: fi omajid@671: omajid@671: if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then omajid@671: AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config]) omajid@671: omajid@671: if test "x$LLVM_CONFIG" != xllvm-config; then omajid@671: AC_MSG_ERROR([llvm-config not found in $PATH.]) omajid@671: fi omajid@671: omajid@671: llvm_components="jit mcjit engine nativecodegen native" omajid@671: unset LLVM_CFLAGS omajid@671: for flag in $("$LLVM_CONFIG" --cxxflags); do omajid@671: if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then omajid@671: if test "${flag}" != "-D_DEBUG" ; then omajid@671: if test "${LLVM_CFLAGS}" != "" ; then omajid@671: LLVM_CFLAGS="${LLVM_CFLAGS} " omajid@671: fi omajid@671: LLVM_CFLAGS="${LLVM_CFLAGS}${flag}" omajid@671: fi omajid@671: fi omajid@671: done omajid@671: llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//') omajid@671: LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" omajid@671: omajid@671: unset LLVM_LDFLAGS omajid@671: for flag in $("${LLVM_CONFIG}" --ldflags); do omajid@671: if echo "${flag}" | grep -q '^-L'; then omajid@671: if test "${LLVM_LDFLAGS}" != ""; then omajid@671: LLVM_LDFLAGS="${LLVM_LDFLAGS} " omajid@671: fi omajid@671: LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}" omajid@671: fi omajid@671: done omajid@671: omajid@671: unset LLVM_LIBS omajid@671: for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do omajid@671: if echo "${flag}" | grep -q '^-l'; then omajid@671: if test "${LLVM_LIBS}" != ""; then omajid@671: LLVM_LIBS="${LLVM_LIBS} " omajid@671: fi omajid@671: LLVM_LIBS="${LLVM_LIBS}${flag}" omajid@671: fi omajid@671: done omajid@671: omajid@671: AC_SUBST(LLVM_CFLAGS) omajid@671: AC_SUBST(LLVM_LDFLAGS) omajid@671: AC_SUBST(LLVM_LIBS) omajid@671: fi omajid@671: erikj@459: # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) erikj@459: if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then ohair@478: LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" erikj@459: fi erikj@459: erikj@459: # TODO better (platform agnostic) test erikj@459: if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then erikj@459: LIBCXX="-lstdc++" erikj@459: fi erikj@459: erikj@459: AC_SUBST(LIBCXX) erikj@459: erikj@459: ])