common/autoconf/libraries.m4

Mon, 29 Jun 2020 21:30:12 +0100

author
andrew
date
Mon, 29 Jun 2020 21:30:12 +0100
changeset 2537
a8da94d779b3
parent 2400
9da665f87c4b
child 2408
2e38e8d106de
permissions
-rw-r--r--

Merge

     1 #
     2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     8 # particular file as subject to the "Classpath" exception as provided
     9 # by Oracle in the LICENSE file that accompanied this code.
    10 #
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14 # version 2 for more details (a copy is included in the LICENSE file that
    15 # accompanied this code).
    16 #
    17 # You should have received a copy of the GNU General Public License version
    18 # 2 along with this work; if not, write to the Free Software Foundation,
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20 #
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22 # or visit www.oracle.com if you need additional information or have any
    23 # questions.
    24 #
    26 AC_DEFUN_ONCE([LIB_SETUP_INIT],
    27 [
    29   ###############################################################################
    30   #
    31   # OS specific settings that we never will need to probe.
    32   #
    33   if test "x$OPENJDK_TARGET_OS" = xlinux; then
    34     AC_MSG_CHECKING([what is not needed on Linux?])
    35     PULSE_NOT_NEEDED=yes
    36     AC_MSG_RESULT([pulse])
    37   fi
    39   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
    40     AC_MSG_CHECKING([what is not needed on Solaris?])
    41     ALSA_NOT_NEEDED=yes
    42     PULSE_NOT_NEEDED=yes
    43     AC_MSG_RESULT([alsa pulse])
    44   fi
    46   if test "x$OPENJDK_TARGET_OS" = xaix; then
    47     AC_MSG_CHECKING([what is not needed on AIX?])
    48     ALSA_NOT_NEEDED=yes
    49     PULSE_NOT_NEEDED=yes
    50     AC_MSG_RESULT([alsa pulse])
    51   fi
    54   if test "x$OPENJDK_TARGET_OS" = xwindows; then
    55     AC_MSG_CHECKING([what is not needed on Windows?])
    56     CUPS_NOT_NEEDED=yes
    57     ALSA_NOT_NEEDED=yes
    58     PULSE_NOT_NEEDED=yes
    59     X11_NOT_NEEDED=yes
    60     FONTCONFIG_NOT_NEEDED=yes
    61     AC_MSG_RESULT([alsa cups pulse x11])
    62   fi
    64   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
    65     AC_MSG_CHECKING([what is not needed on MacOSX?])
    66     ALSA_NOT_NEEDED=yes
    67     PULSE_NOT_NEEDED=yes
    68     X11_NOT_NEEDED=yes
    69     FONTCONFIG_NOT_NEEDED=yes
    70     AC_MSG_RESULT([alsa pulse x11])
    71   fi
    73   if test "x$OPENJDK_TARGET_OS" = xbsd; then
    74     AC_MSG_CHECKING([what is not needed on bsd?])
    75     ALSA_NOT_NEEDED=yes
    76     AC_MSG_RESULT([alsa])
    77   fi
    79   if test "x$OPENJDK" = "xfalse"; then
    80     FREETYPE_NOT_NEEDED=yes
    81   fi
    83   if test "x$SUPPORT_HEADFUL" = xno; then
    84     X11_NOT_NEEDED=yes
    85   fi
    87   # Deprecated and now ignored
    88   BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
    89 ])
    91 AC_DEFUN_ONCE([LIB_SETUP_X11],
    92 [
    94   ###############################################################################
    95   #
    96   # Check for X Windows
    97   #
    99   # Check if the user has specified sysroot, but not --x-includes or --x-libraries.
   100   # Make a simple check for the libraries at the sysroot, and setup --x-includes and
   101   # --x-libraries for the sysroot, if that seems to be correct.
   102   if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
   103     if test "x$SYSROOT" != "x"; then
   104       if test "x$x_includes" = xNONE; then
   105         if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
   106           x_includes="$SYSROOT/usr/X11R6/include"
   107         elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
   108           x_includes="$SYSROOT/usr/include"
   109         fi
   110       fi
   111       if test "x$x_libraries" = xNONE; then
   112         if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
   113           x_libraries="$SYSROOT/usr/X11R6/lib"
   114         elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   115           x_libraries="$SYSROOT/usr/lib64"
   116         elif test -f "$SYSROOT/usr/lib/libX11.so"; then
   117           x_libraries="$SYSROOT/usr/lib"
   118         fi
   119       fi
   120     fi
   121   fi
   123   # Now let autoconf do it's magic
   124   AC_PATH_X
   125   AC_PATH_XTRA
   127   # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
   128   # this doesn't make sense so we remove it.
   129   if test "x$COMPILE_TYPE" = xcross; then
   130     X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
   131   fi
   133   if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
   134     HELP_MSG_MISSING_DEPENDENCY([x11])
   135     AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
   136   fi
   139   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   140     OPENWIN_HOME="/usr/openwin"
   141     X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
   142     X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
   143         -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
   144         -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
   145         -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
   146   fi
   148   #
   149   # Weird Sol10 something check...TODO change to try compile
   150   #
   151   if test "x${OPENJDK_TARGET_OS}" = xsolaris; then
   152     if test "`uname -r`" = "5.10"; then
   153       if test "`${EGREP} -c XLinearGradient ${OPENWIN_HOME}/share/include/X11/extensions/Xrender.h`" = "0"; then
   154         X_CFLAGS="${X_CFLAGS} -DSOLARIS10_NO_XRENDER_STRUCTS"
   155       fi
   156     fi
   157   fi
   159   AC_LANG_PUSH(C)
   160   OLD_CFLAGS="$CFLAGS"
   161   CFLAGS="$CFLAGS $X_CFLAGS"
   163   # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
   164   AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
   165       [X11_A_OK=yes],
   166       [X11_A_OK=no; break],
   167       [
   168         # include <X11/Xlib.h>
   169         # include <X11/Xutil.h>
   170       ]
   171   )
   173   CFLAGS="$OLD_CFLAGS"
   174   AC_LANG_POP(C)
   176   if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
   177     HELP_MSG_MISSING_DEPENDENCY([x11])
   178     AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
   179   fi
   181   AC_SUBST(X_CFLAGS)
   182   AC_SUBST(X_LIBS)
   183 ])
   185 AC_DEFUN_ONCE([LIB_SETUP_CUPS],
   186 [
   188   ###############################################################################
   189   #
   190   # The common unix printing system cups is used to print from java.
   191   #
   192   AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
   193       [specify prefix directory for the cups package
   194       (expecting the headers under PATH/include)])])
   195   AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
   196       [specify directory for the cups include files])])
   198   if test "x$CUPS_NOT_NEEDED" = xyes; then
   199     if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
   200       AC_MSG_WARN([cups not used, so --with-cups is ignored])
   201     fi
   202     CUPS_CFLAGS=
   203   else
   204     CUPS_FOUND=no
   206     if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
   207       AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
   208     fi
   210     if test "x${with_cups}" != x; then
   211       CUPS_CFLAGS="-I${with_cups}/include"
   212       CUPS_FOUND=yes
   213     fi
   214     if test "x${with_cups_include}" != x; then
   215       CUPS_CFLAGS="-I${with_cups_include}"
   216       CUPS_FOUND=yes
   217     fi
   218     if test "x$CUPS_FOUND" = xno; then
   219       BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
   220     fi
   221     if test "x$CUPS_FOUND" = xno; then
   222       # Are the cups headers installed in the default /usr/include location?
   223       AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
   224           [
   225             CUPS_FOUND=yes
   226             CUPS_CFLAGS=
   227             DEFAULT_CUPS=yes
   228           ]
   229       )
   230     fi
   231     if test "x$CUPS_FOUND" = xno; then
   232       # Getting nervous now? Lets poke around for standard Solaris third-party
   233       # package installation locations.
   234       AC_MSG_CHECKING([for cups headers])
   235       if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
   236         # An SFW package seems to be installed!
   237         CUPS_FOUND=yes
   238         CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
   239       elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
   240         # A CSW package seems to be installed!
   241         CUPS_FOUND=yes
   242         CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
   243       fi
   244       AC_MSG_RESULT([$CUPS_FOUND])
   245     fi
   246     if test "x$CUPS_FOUND" = xno; then
   247       HELP_MSG_MISSING_DEPENDENCY([cups])
   248       AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
   249     fi
   250   fi
   252   AC_SUBST(CUPS_CFLAGS)
   254 ])
   256 AC_DEFUN([LIB_BUILD_FREETYPE],
   257 [
   258   FREETYPE_SRC_PATH="$1"
   259   BUILD_FREETYPE=yes
   261   # Check if the freetype sources are acessible..
   262   if ! test -d $FREETYPE_SRC_PATH; then
   263     AC_MSG_WARN([--with-freetype-src specified, but can't find path "$FREETYPE_SRC_PATH" - ignoring --with-freetype-src])
   264     BUILD_FREETYPE=no
   265   fi
   266   # ..and contain a vc2010 project file
   267   vcxproj_path="$FREETYPE_SRC_PATH/builds/windows/vc2010/freetype.vcxproj"
   268   if test "x$BUILD_FREETYPE" = xyes && ! test -s $vcxproj_path; then
   269     AC_MSG_WARN([Can't find project file $vcxproj_path (you may try a newer freetype version) - ignoring --with-freetype-src])
   270     BUILD_FREETYPE=no
   271   fi
   272   # Now check if configure found a version of 'msbuild.exe'
   273   if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
   274     AC_MSG_WARN([Can't find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
   275     BUILD_FREETYPE=no
   276   fi
   278   # Ready to go..
   279   if test "x$BUILD_FREETYPE" = xyes; then
   281     # msbuild requires trailing slashes for output directories
   282     freetype_lib_path="$FREETYPE_SRC_PATH/lib$OPENJDK_TARGET_CPU_BITS/"
   283     freetype_lib_path_unix="$freetype_lib_path"
   284     freetype_obj_path="$FREETYPE_SRC_PATH/obj$OPENJDK_TARGET_CPU_BITS/"
   285     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(vcxproj_path)
   286     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_lib_path)
   287     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_obj_path)
   288     if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   289       freetype_platform=x64
   290     else
   291       freetype_platform=win32
   292     fi
   294     # The original freetype project file is for VS 2010 (i.e. 'v100'),
   295     # so we have to adapt the toolset if building with any other toolsed (i.e. SDK).
   296     # Currently 'PLATFORM_TOOLSET' is set in 'TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT'/
   297     # 'TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT' in toolchain_windows.m4
   298     AC_MSG_NOTICE([Trying to compile freetype sources with PlatformToolset=$PLATFORM_TOOLSET to $freetype_lib_path_unix ...])
   300     # First we try to build the freetype.dll
   301     $ECHO -e "@echo off\n"\
   302 	     "$MSBUILD $vcxproj_path "\
   303 		       "/p:PlatformToolset=$PLATFORM_TOOLSET "\
   304 		       "/p:Configuration=\"Release Multithreaded\" "\
   305 		       "/p:Platform=$freetype_platform "\
   306 		       "/p:ConfigurationType=DynamicLibrary "\
   307 		       "/p:TargetName=freetype "\
   308 		       "/p:OutDir=\"$freetype_lib_path\" "\
   309 		       "/p:IntDir=\"$freetype_obj_path\" > freetype.log" > freetype.bat
   310     cmd /c freetype.bat
   312     if test -s "$freetype_lib_path_unix/freetype.dll"; then
   313       # If that succeeds we also build freetype.lib
   314       $ECHO -e "@echo off\n"\
   315 	       "$MSBUILD $vcxproj_path "\
   316 			 "/p:PlatformToolset=$PLATFORM_TOOLSET "\
   317 			 "/p:Configuration=\"Release Multithreaded\" "\
   318 			 "/p:Platform=$freetype_platform "\
   319 			 "/p:ConfigurationType=StaticLibrary "\
   320 			 "/p:TargetName=freetype "\
   321 			 "/p:OutDir=\"$freetype_lib_path\" "\
   322 			 "/p:IntDir=\"$freetype_obj_path\" >> freetype.log" > freetype.bat
   323       cmd /c freetype.bat
   325       if test -s "$freetype_lib_path_unix/freetype.lib"; then
   326 	# Once we build both, lib and dll, set freetype lib and include path appropriately
   327 	POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_SRC_PATH/include"
   328 	POTENTIAL_FREETYPE_LIB_PATH="$freetype_lib_path_unix"
   329 	AC_MSG_NOTICE([Compiling freetype sources succeeded! (see freetype.log for build results)])
   330       else
   331 	BUILD_FREETYPE=no
   332       fi
   333     else
   334       BUILD_FREETYPE=no
   335     fi
   336   fi
   337 ])
   339 AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
   340 [
   341   POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
   342   POTENTIAL_FREETYPE_LIB_PATH="$2"
   343   METHOD="$3"
   345   # First check if the files exists.
   346   if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
   347     # We found an arbitrary include file. That's a good sign.
   348     AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
   349     FOUND_FREETYPE=yes
   351     FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
   352     if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
   353       AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
   354       FOUND_FREETYPE=no
   355     else
   356       if test "x$OPENJDK_TARGET_OS" = xwindows; then
   357         # On Windows, we will need both .lib and .dll file.
   358         if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
   359           AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
   360           FOUND_FREETYPE=no
   361         fi
   362       elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
   363         # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
   364         POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
   365       fi
   366     fi
   367   fi
   369   if test "x$FOUND_FREETYPE" = xyes; then
   370     BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
   371     BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
   373     FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
   374     AC_MSG_CHECKING([for freetype includes])
   375     AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
   376     FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
   377     AC_MSG_CHECKING([for freetype libraries])
   378     AC_MSG_RESULT([$FREETYPE_LIB_PATH])
   379   fi
   380 ])
   382 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
   383 [
   385   ###############################################################################
   386   #
   387   # The ubiquitous freetype library is used to render fonts.
   388   #
   389   AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
   390       [specify prefix directory for the freetype package
   391       (expecting the libraries under PATH/lib and the headers under PATH/include)])])
   392   AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
   393       [specify directory for the freetype include files])])
   394   AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
   395       [specify directory for the freetype library])])
   396   AC_ARG_WITH(freetype-src, [AS_HELP_STRING([--with-freetype-src],
   397       [specify directory with freetype sources to automatically build the library (experimental, Windows-only)])])
   398   AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
   399       [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
   401   FREETYPE_CFLAGS=
   402   FREETYPE_LIBS=
   403   FREETYPE_BUNDLE_LIB_PATH=
   405   if test "x$FREETYPE_NOT_NEEDED" = xyes; then
   406     if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x || test "x$with_freetype_src" != x; then
   407       AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
   408     fi
   409     if test "x$enable_freetype_bundling" != x; then
   410       AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
   411     fi
   412   else
   413     # freetype is needed to build; go get it!
   415     BUNDLE_FREETYPE="$enable_freetype_bundling"
   417     if  test "x$with_freetype_src" != x; then
   418       if test "x$OPENJDK_TARGET_OS" = xwindows; then
   419         # Try to build freetype if --with-freetype-src was given on Windows
   420         LIB_BUILD_FREETYPE([$with_freetype_src])
   421         if test "x$BUILD_FREETYPE" = xyes; then
   422           # Okay, we built it. Check that it works.
   423           LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype-src])
   424           if test "x$FOUND_FREETYPE" != xyes; then
   425             AC_MSG_ERROR([Can not use the built freetype at location given by --with-freetype-src])
   426           fi
   427         else
   428           AC_MSG_NOTICE([User specified --with-freetype-src but building freetype failed. (see freetype.log for build results)])
   429           AC_MSG_ERROR([Consider building freetype manually and using --with-freetype instead.])
   430         fi
   431       else
   432         AC_MSG_WARN([--with-freetype-src is currently only supported on Windows - ignoring])
   433       fi
   434     fi
   436     if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
   437       # User has specified settings
   439       if test "x$BUNDLE_FREETYPE" = x; then
   440         # If not specified, default is to bundle freetype
   441         BUNDLE_FREETYPE=yes
   442       fi
   444       if test "x$with_freetype" != x; then
   445         POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
   446         POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
   447       fi
   449       # Allow --with-freetype-lib and --with-freetype-include to override
   450       if test "x$with_freetype_include" != x; then
   451         POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
   452       fi
   453       if test "x$with_freetype_lib" != x; then
   454         POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
   455       fi
   457       if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
   458         # Okay, we got it. Check that it works.
   459         LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
   460         if test "x$FOUND_FREETYPE" != xyes; then
   461           AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
   462         fi
   463       else
   464         # User specified only one of lib or include. This is an error.
   465         if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
   466           AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
   467           AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
   468         else
   469           AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
   470           AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
   471         fi
   472       fi
   473     else
   474       # User did not specify settings, but we need freetype. Try to locate it.
   476       if test "x$BUNDLE_FREETYPE" = x; then
   477         # If not specified, default is to bundle freetype only on windows
   478         if test "x$OPENJDK_TARGET_OS" = xwindows; then
   479           BUNDLE_FREETYPE=yes
   480         else
   481           BUNDLE_FREETYPE=no
   482         fi
   483       fi
   485       if test "x$FOUND_FREETYPE" != xyes; then
   486         # Check builddeps
   487         BDEPS_CHECK_MODULE(FREETYPE, freetype2, xxx, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
   488         # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
   489         if test "x$FOUND_FREETYPE" = xyes; then
   490           if test "x$BUNDLE_FREETYPE" = xyes; then
   491             AC_MSG_NOTICE([Found freetype using builddeps, but ignoring since we can not bundle that])
   492             FOUND_FREETYPE=no
   493           else
   494             AC_MSG_CHECKING([for freetype])
   495             AC_MSG_RESULT([yes (using builddeps)])
   496           fi
   497         fi
   498       fi
   500       # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
   501       if test "x$SYSROOT" = x; then
   502         if test "x$FOUND_FREETYPE" != xyes; then
   503           # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
   504           if test "x$PKG_CONFIG" != x; then
   505             PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
   506             if test "x$FOUND_FREETYPE" = xyes; then
   507               # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
   508               FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
   509               # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
   510               if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   511                 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
   512               fi
   513               # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
   514               if test "x$BUNDLE_FREETYPE" = xyes; then
   515                 AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
   516                 FOUND_FREETYPE=no
   517               else
   518                 AC_MSG_CHECKING([for freetype])
   519                 AC_MSG_RESULT([yes (using pkg-config)])
   520               fi
   521             fi
   522           fi
   523         fi
   524       fi
   526       if test "x$FOUND_FREETYPE" != xyes; then
   527         # Check in well-known locations
   528         if test "x$OPENJDK_TARGET_OS" = xwindows; then
   529           FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
   530           BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
   531           LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   532           if test "x$FOUND_FREETYPE" != xyes; then
   533             FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
   534             BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
   535             LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   536           fi
   537         else
   538           FREETYPE_BASE_DIR="$SYSROOT/usr"
   539           LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   541           if test "x$FOUND_FREETYPE" != xyes; then
   542             FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
   543             LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   544           fi
   546           if test "x$FOUND_FREETYPE" != xyes; then
   547             FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
   548             LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
   549           fi
   551           if test "x$FOUND_FREETYPE" != xyes; then
   552             FREETYPE_BASE_DIR="$SYSROOT/usr"
   553             if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   554               LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
   555             else
   556               LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
   557               if test "x$FOUND_FREETYPE" != xyes; then
   558                 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
   559               fi
   560             fi
   561           fi
   562         fi
   563       fi # end check in well-known locations
   565       if test "x$FOUND_FREETYPE" != xyes; then
   566         HELP_MSG_MISSING_DEPENDENCY([freetype])
   567         AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
   568       fi
   569     fi # end user specified settings
   571     # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
   572     if test "x$FREETYPE_CFLAGS" = x; then
   573       BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
   574       if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
   575         FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
   576       else
   577         FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
   578       fi
   579     fi
   581     if test "x$FREETYPE_LIBS" = x; then
   582       BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
   583       if test "x$OPENJDK_TARGET_OS" = xwindows; then
   584         FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
   585       else
   586         FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
   587       fi
   588     fi
   590     # Try to compile it
   591     AC_MSG_CHECKING([if we can compile and link with freetype])
   592     AC_LANG_PUSH(C++)
   593     PREV_CXXCFLAGS="$CXXFLAGS"
   594     PREV_LIBS="$LIBS"
   595     PREV_CXX="$CXX"
   596     CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
   597     LIBS="$LIBS $FREETYPE_LIBS"
   598     CXX="$FIXPATH $CXX"
   599     AC_LINK_IFELSE([AC_LANG_SOURCE([[
   600           #include<ft2build.h>
   601           #include FT_FREETYPE_H
   602           int main () {
   603             FT_Init_FreeType(NULL);
   604             return 0;
   605           }
   606         ]])],
   607         [
   608           AC_MSG_RESULT([yes])
   609         ],
   610         [
   611           AC_MSG_RESULT([no])
   612           AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
   613           AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
   615           HELP_MSG_MISSING_DEPENDENCY([freetype])
   617           AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
   618         ]
   619     )
   620     CXXCFLAGS="$PREV_CXXFLAGS"
   621     LIBS="$PREV_LIBS"
   622     CXX="$PREV_CXX"
   623     AC_LANG_POP(C++)
   625     AC_MSG_CHECKING([if we should bundle freetype])
   626     if test "x$BUNDLE_FREETYPE" = xyes; then
   627       FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
   628     fi
   629     AC_MSG_RESULT([$BUNDLE_FREETYPE])
   631   fi # end freetype needed
   633   AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
   634   AC_SUBST(FREETYPE_CFLAGS)
   635   AC_SUBST(FREETYPE_LIBS)
   636 ])
   638 AC_DEFUN_ONCE([LIB_SETUP_ALSA],
   639 [
   641   ###############################################################################
   642   #
   643   # Check for alsa headers and libraries. Used on Linux/GNU systems.
   644   #
   645   AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
   646       [specify prefix directory for the alsa package
   647       (expecting the libraries under PATH/lib and the headers under PATH/include)])])
   648   AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
   649       [specify directory for the alsa include files])])
   650   AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
   651       [specify directory for the alsa library])])
   653   if test "x$ALSA_NOT_NEEDED" = xyes; then
   654     if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
   655       AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
   656     fi
   657     ALSA_CFLAGS=
   658     ALSA_LIBS=
   659   else
   660     ALSA_FOUND=no
   662     if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
   663       AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
   664     fi
   666     if test "x${with_alsa}" != x; then
   667       ALSA_LIBS="-L${with_alsa}/lib -lasound"
   668       ALSA_CFLAGS="-I${with_alsa}/include"
   669       ALSA_FOUND=yes
   670     fi
   671     if test "x${with_alsa_include}" != x; then
   672       ALSA_CFLAGS="-I${with_alsa_include}"
   673       ALSA_FOUND=yes
   674     fi
   675     if test "x${with_alsa_lib}" != x; then
   676       ALSA_LIBS="-L${with_alsa_lib} -lasound"
   677       ALSA_FOUND=yes
   678     fi
   679     if test "x$ALSA_FOUND" = xno; then
   680       BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no])
   681     fi
   682     # Do not try pkg-config if we have a sysroot set.
   683     if test "x$SYSROOT" = x; then
   684       if test "x$ALSA_FOUND" = xno; then
   685         PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
   686       fi
   687     fi
   688     if test "x$ALSA_FOUND" = xno; then
   689       AC_CHECK_HEADERS([alsa/asoundlib.h],
   690           [
   691             ALSA_FOUND=yes
   692             ALSA_CFLAGS=-Iignoreme
   693             ALSA_LIBS=-lasound
   694             DEFAULT_ALSA=yes
   695           ],
   696           [ALSA_FOUND=no])
   697     fi
   698     if test "x$ALSA_FOUND" = xno; then
   699       HELP_MSG_MISSING_DEPENDENCY([alsa])
   700       AC_MSG_ERROR([Could not find alsa! $HELP_MSG ])
   701     fi
   702   fi
   704   AC_SUBST(ALSA_CFLAGS)
   705   AC_SUBST(ALSA_LIBS)
   706 ])
   708 ################################################################################
   709 # Setup fontconfig
   710 ################################################################################
   711 AC_DEFUN_ONCE([LIB_SETUP_FONTCONFIG],
   712 [
   713   AC_ARG_WITH(fontconfig, [AS_HELP_STRING([--with-fontconfig],
   714       [specify prefix directory for the fontconfig package
   715       (expecting the headers under PATH/include)])])
   716   AC_ARG_WITH(fontconfig-include, [AS_HELP_STRING([--with-fontconfig-include],
   717       [specify directory for the fontconfig include files])])
   719   if test "x$FONTCONFIG_NOT_NEEDED" = xyes; then
   720     if (test "x${with_fontconfig}" != x && test "x${with_fontconfig}" != xno) || \
   721         (test "x${with_fontconfig_include}" != x && test "x${with_fontconfig_include}" != xno); then
   722       AC_MSG_WARN([[fontconfig not used, so --with-fontconfig[-*] is ignored]])
   723     fi
   724     FONTCONFIG_CFLAGS=
   725   else
   726     FONTCONFIG_FOUND=no
   728     if test "x${with_fontconfig}" = xno || test "x${with_fontconfig_include}" = xno; then
   729       AC_MSG_ERROR([It is not possible to disable the use of fontconfig. Remove the --without-fontconfig option.])
   730     fi
   732     if test "x${with_fontconfig}" != x; then
   733       AC_MSG_CHECKING([for fontconfig headers])
   734       if test -s "${with_fontconfig}/include/fontconfig/fontconfig.h"; then
   735         FONTCONFIG_CFLAGS="-I${with_fontconfig}/include"
   736         FONTCONFIG_FOUND=yes
   737         AC_MSG_RESULT([$FONTCONFIG_FOUND])
   738       else
   739         AC_MSG_ERROR([Can't find 'include/fontconfig/fontconfig.h' under ${with_fontconfig} given with the --with-fontconfig option.])
   740       fi
   741     fi
   742     if test "x${with_fontconfig_include}" != x; then
   743       AC_MSG_CHECKING([for fontconfig headers])
   744       if test -s "${with_fontconfig_include}/fontconfig/fontconfig.h"; then
   745         FONTCONFIG_CFLAGS="-I${with_fontconfig_include}"
   746         FONTCONFIG_FOUND=yes
   747         AC_MSG_RESULT([$FONTCONFIG_FOUND])
   748       else
   749         AC_MSG_ERROR([Can't find 'fontconfig/fontconfig.h' under ${with_fontconfig_include} given with the --with-fontconfig-include option.])
   750       fi
   751     fi
   752     if test "x$FONTCONFIG_FOUND" = xno; then
   753       # Are the fontconfig headers installed in the default /usr/include location?
   754       AC_CHECK_HEADERS([fontconfig/fontconfig.h], [
   755           FONTCONFIG_FOUND=yes
   756           FONTCONFIG_CFLAGS=
   757           DEFAULT_FONTCONFIG=yes
   758       ])
   759     fi
   760     if test "x$FONTCONFIG_FOUND" = xno; then
   761       HELP_MSG_MISSING_DEPENDENCY([fontconfig])
   762       AC_MSG_ERROR([Could not find fontconfig! $HELP_MSG ])
   763     fi
   764   fi
   766   AC_SUBST(FONTCONFIG_CFLAGS)
   767 ])
   769 AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
   770 [
   772   ###############################################################################
   773   #
   774   # Check for the jpeg library
   775   #
   777   USE_EXTERNAL_LIBJPEG=true
   778   AC_CHECK_LIB(jpeg, main, [],
   779       [ USE_EXTERNAL_LIBJPEG=false
   780       AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
   781   ])
   782   AC_SUBST(USE_EXTERNAL_LIBJPEG)
   784   ###############################################################################
   785   #
   786   # Check for the gif library
   787   #
   789   AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
   790       [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
   793   AC_MSG_CHECKING([for which giflib to use])
   795   # default is bundled
   796   DEFAULT_GIFLIB=bundled
   798   #
   799   # if user didn't specify, use DEFAULT_GIFLIB
   800   #
   801   if test "x${with_giflib}" = "x"; then
   802     with_giflib=${DEFAULT_GIFLIB}
   803   fi
   805   AC_MSG_RESULT(${with_giflib})
   807   if test "x${with_giflib}" = "xbundled"; then
   808     USE_EXTERNAL_LIBGIF=false
   809   elif test "x${with_giflib}" = "xsystem"; then
   810     AC_CHECK_HEADER(gif_lib.h, [],
   811         [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
   812     AC_CHECK_LIB(gif, DGifGetCode, [],
   813         [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
   815     USE_EXTERNAL_LIBGIF=true
   816   else
   817     AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
   818   fi
   819   AC_SUBST(USE_EXTERNAL_LIBGIF)
   821   ###############################################################################
   822   #
   823   # Check for the zlib library
   824   #
   826   AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
   827       [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
   829   AC_CHECK_LIB(z, compress,
   830       [ ZLIB_FOUND=yes ],
   831       [ ZLIB_FOUND=no ])
   833   AC_MSG_CHECKING([for which zlib to use])
   835   DEFAULT_ZLIB=bundled
   836   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   837     #
   838     # On macosx default is system...on others default is
   839     #
   840     DEFAULT_ZLIB=system
   841   fi
   843   if test "x${ZLIB_FOUND}" != "xyes"; then
   844     #
   845     # If we don't find any system...set default to bundled
   846     #
   847     DEFAULT_ZLIB=bundled
   848   fi
   850   #
   851   # If user didn't specify, use DEFAULT_ZLIB
   852   #
   853   if test "x${with_zlib}" = "x"; then
   854     with_zlib=${DEFAULT_ZLIB}
   855   fi
   857   if test "x${with_zlib}" = "xbundled"; then
   858     USE_EXTERNAL_LIBZ=false
   859     AC_MSG_RESULT([bundled])
   860   elif test "x${with_zlib}" = "xsystem"; then
   861     if test "x${ZLIB_FOUND}" = "xyes"; then
   862       USE_EXTERNAL_LIBZ=true
   863       AC_MSG_RESULT([system])
   864     else
   865       AC_MSG_RESULT([system not found])
   866       AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
   867     fi
   868   else
   869     AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
   870   fi
   872   AC_SUBST(USE_EXTERNAL_LIBZ)
   874   ###############################################################################
   875   LIBZIP_CAN_USE_MMAP=true
   877   AC_SUBST(LIBZIP_CAN_USE_MMAP)
   879   ###############################################################################
   880   #
   881   # Check if altzone exists in time.h
   882   #
   884   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [return (int)altzone;])],
   885       [has_altzone=yes],
   886       [has_altzone=no])
   887   if test "x$has_altzone" = xyes; then
   888     AC_DEFINE([HAVE_ALTZONE], 1, [Define if you have the external 'altzone' variable in time.h])
   889   fi
   891   ###############################################################################
   892   #
   893   # Check the maths library
   894   #
   896   AC_CHECK_LIB(m, cos, [],
   897       [
   898         AC_MSG_NOTICE([Maths library was not found])
   899       ]
   900   )
   901   AC_SUBST(LIBM)
   903   ###############################################################################
   904   #
   905   # Check for libdl.so
   907   save_LIBS="$LIBS"
   908   LIBS=""
   909   AC_CHECK_LIB(dl,dlopen)
   910   LIBDL="$LIBS"
   911   AC_SUBST(LIBDL)
   912   LIBS="$save_LIBS"
   913 ])
   915 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
   916 [
   917   ###############################################################################
   918   #
   919   # statically link libstdc++ before C++ ABI is stablized on Linux unless
   920   # dynamic build is configured on command line.
   921   #
   922   AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
   923       [force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
   924       [
   925         if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
   926                 && test "x$with_stdc__lib" != xdefault; then
   927           AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
   928         fi
   929       ],
   930       [with_stdc__lib=default]
   931   )
   933   if test "x$OPENJDK_TARGET_OS" = xlinux; then
   934     # Test if -lstdc++ works.
   935     AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
   936     AC_LANG_PUSH(C++)
   937     OLD_CXXFLAGS="$CXXFLAGS"
   938     CXXFLAGS="$CXXFLAGS -lstdc++"
   939     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
   940         [has_dynamic_libstdcxx=yes],
   941         [has_dynamic_libstdcxx=no])
   942     CXXFLAGS="$OLD_CXXFLAGS"
   943     AC_LANG_POP(C++)
   944     AC_MSG_RESULT([$has_dynamic_libstdcxx])
   946     # Test if stdc++ can be linked statically.
   947     AC_MSG_CHECKING([if static link of stdc++ is possible])
   948     STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
   949     AC_LANG_PUSH(C++)
   950     OLD_LIBS="$LIBS"
   951     OLD_CXX="$CXX"
   952     LIBS="$STATIC_STDCXX_FLAGS"
   953     CXX="$CC"
   954     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
   955         [has_static_libstdcxx=yes],
   956         [has_static_libstdcxx=no])
   957     LIBS="$OLD_LIBS"
   958     CXX="$OLD_CXX"
   959     AC_LANG_POP(C++)
   960     AC_MSG_RESULT([$has_static_libstdcxx])
   962     if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
   963       AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
   964     fi
   966     if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
   967       AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
   968     fi
   970     if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
   971       AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
   972     fi
   974     AC_MSG_CHECKING([how to link with libstdc++])
   975     # If dynamic was requested, it's available since it would fail above otherwise.
   976     # If dynamic wasn't requested, go with static unless it isn't available.
   977     if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
   978       LIBCXX="$LIBCXX -lstdc++"
   979       LDCXX="$CXX"
   980       STATIC_CXX_SETTING="STATIC_CXX=false"
   981       AC_MSG_RESULT([dynamic])
   982     else
   983       LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
   984       LDCXX="$CC"
   985       STATIC_CXX_SETTING="STATIC_CXX=true"
   986       AC_MSG_RESULT([static])
   987     fi
   988   fi
   989   AC_SUBST(STATIC_CXX_SETTING)
   991   if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
   992     # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
   993     PKG_CHECK_MODULES([LIBFFI], [libffi])
   995   fi
   997   if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
   998     AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config])
  1000     if test "x$LLVM_CONFIG" != xllvm-config; then
  1001       AC_MSG_ERROR([llvm-config not found in $PATH.])
  1002     fi
  1004     llvm_components="jit mcjit engine nativecodegen native"
  1005     unset LLVM_CFLAGS
  1006     for flag in $("$LLVM_CONFIG" --cxxflags); do
  1007       if echo "${flag}" | grep -q '^-@<:@ID@:>@'; then
  1008         if test "${flag}" != "-D_DEBUG" ; then
  1009           if test "${LLVM_CFLAGS}" != "" ; then
  1010             LLVM_CFLAGS="${LLVM_CFLAGS} "
  1011           fi
  1012           LLVM_CFLAGS="${LLVM_CFLAGS}${flag}"
  1013         fi
  1014       fi
  1015     done
  1016     llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
  1017     LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
  1019     unset LLVM_LDFLAGS
  1020     for flag in $("${LLVM_CONFIG}" --ldflags); do
  1021       if echo "${flag}" | grep -q '^-L'; then
  1022         if test "${LLVM_LDFLAGS}" != ""; then
  1023           LLVM_LDFLAGS="${LLVM_LDFLAGS} "
  1024         fi
  1025         LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}"
  1026       fi
  1027     done
  1029     unset LLVM_LIBS
  1030     for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do
  1031       if echo "${flag}" | grep -q '^-l'; then
  1032         if test "${LLVM_LIBS}" != ""; then
  1033           LLVM_LIBS="${LLVM_LIBS} "
  1034         fi
  1035         LLVM_LIBS="${LLVM_LIBS}${flag}"
  1036       fi
  1037     done
  1039     AC_SUBST(LLVM_CFLAGS)
  1040     AC_SUBST(LLVM_LDFLAGS)
  1041     AC_SUBST(LLVM_LIBS)
  1042   fi
  1044   # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
  1045   if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
  1046     LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
  1047   fi
  1049   # TODO better (platform agnostic) test
  1050   if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$TOOLCHAIN_TYPE" = xgcc; then
  1051     LIBCXX="-lstdc++"
  1052   fi
  1054   AC_SUBST(LIBCXX)
  1055 ])
  1057 AC_DEFUN_ONCE([LIB_SETUP_ON_WINDOWS],
  1059   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
  1060     TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
  1061     BASIC_DEPRECATED_ARG_WITH([dxsdk])
  1062     BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
  1063     BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
  1064   fi
  1065 ])

mercurial