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