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