annotate common/autoconf/lib-bundled.m4 @ 32921:8e0250dfa145

8138761: Improved handling of libffi, and cleanup of libraries.m4 Reviewed-by: erikj
author ihse
date Wed, 07 Oct 2015 15:26:48 +0200
parents common/autoconf/libraries.m4@8c2512d63fac
children fb6c19577a6a
rev   line source
erikj@13133 1 #
ihse@32921 2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
ihse@32921 26 ################################################################################
ihse@32921 27 # Setup bundled libraries.
ihse@32921 28 #
ihse@32921 29 # For libjpeg, giflib, libpng, lcms2 and zlib, the source is present in the
ihse@32921 30 # OpenJDK repository. Default is to use these libraries as bundled, but they
ihse@32921 31 # might be replaced by en external version by the user.
ihse@32921 32 ################################################################################
ihse@32921 33 AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
erikj@13133 34 [
ihse@32921 35 LIB_SETUP_LIBJPEG
ihse@32921 36 LIB_SETUP_GIFLIB
ihse@32921 37 LIB_SETUP_LIBPNG
ihse@32921 38 LIB_SETUP_ZLIB
ihse@32921 39 LIB_SETUP_LCMS
erikj@13133 40 ])
erikj@13133 41
ihse@32921 42 ################################################################################
ihse@32921 43 # Setup libjpeg
ihse@32921 44 ################################################################################
ihse@32921 45 AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
erikj@13133 46 [
omajid@25035 47 AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
omajid@25035 48 [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@25035 49
omajid@25035 50 AC_MSG_CHECKING([for which libjpeg to use])
omajid@25035 51 # default is bundled
omajid@25035 52 DEFAULT_LIBJPEG=bundled
omajid@25035 53 # if user didn't specify, use DEFAULT_LIBJPEG
omajid@25035 54 if test "x${with_libjpeg}" = "x"; then
omajid@25035 55 with_libjpeg=${DEFAULT_LIBJPEG}
omajid@25035 56 fi
omajid@25035 57 AC_MSG_RESULT(${with_libjpeg})
omajid@25035 58
omajid@25035 59 if test "x${with_libjpeg}" = "xbundled"; then
omajid@25035 60 USE_EXTERNAL_LIBJPEG=false
omajid@25035 61 elif test "x${with_libjpeg}" = "xsystem"; then
omajid@25035 62 AC_CHECK_HEADER(jpeglib.h, [],
omajid@25035 63 [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
omajid@25035 64 AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
omajid@25035 65 [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
omajid@25035 66
omajid@25035 67 USE_EXTERNAL_LIBJPEG=true
omajid@25035 68 else
omajid@25035 69 AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
omajid@25035 70 fi
omajid@25035 71
ihse@20363 72 AC_SUBST(USE_EXTERNAL_LIBJPEG)
ihse@32921 73 ])
erikj@13133 74
ihse@32921 75 ################################################################################
ihse@32921 76 # Setup giflib
ihse@32921 77 ################################################################################
ihse@32921 78 AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
ihse@32921 79 [
ihse@20363 80 AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
ihse@20363 81 [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@16424 82
ihse@20363 83 AC_MSG_CHECKING([for which giflib to use])
ihse@20363 84 # default is bundled
ihse@20363 85 DEFAULT_GIFLIB=bundled
ihse@20363 86 # if user didn't specify, use DEFAULT_GIFLIB
ihse@20363 87 if test "x${with_giflib}" = "x"; then
omajid@16424 88 with_giflib=${DEFAULT_GIFLIB}
ihse@20363 89 fi
ihse@20363 90 AC_MSG_RESULT(${with_giflib})
omajid@16424 91
ihse@20363 92 if test "x${with_giflib}" = "xbundled"; then
omajid@16424 93 USE_EXTERNAL_LIBGIF=false
ihse@20363 94 elif test "x${with_giflib}" = "xsystem"; then
omajid@16424 95 AC_CHECK_HEADER(gif_lib.h, [],
ihse@20363 96 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
omajid@16424 97 AC_CHECK_LIB(gif, DGifGetCode, [],
ihse@20363 98 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
omajid@16424 99
omajid@16424 100 USE_EXTERNAL_LIBGIF=true
ihse@20363 101 else
omajid@16424 102 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
ihse@20363 103 fi
ihse@32921 104
ihse@20363 105 AC_SUBST(USE_EXTERNAL_LIBGIF)
ihse@32921 106 ])
erikj@13133 107
ihse@32921 108 ################################################################################
ihse@32921 109 # Setup libpng
ihse@32921 110 ################################################################################
ihse@32921 111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
ihse@32921 112 [
omajid@23163 113 AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
omajid@23163 114 [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@23163 115
omajid@23163 116 AC_MSG_CHECKING([for which libpng to use])
omajid@23163 117
omajid@23163 118 # default is bundled
omajid@23163 119 DEFAULT_LIBPNG=bundled
omajid@23163 120 # if user didn't specify, use DEFAULT_LIBPNG
omajid@23163 121 if test "x${with_libpng}" = "x"; then
omajid@23163 122 with_libpng=${DEFAULT_LIBPNG}
omajid@23163 123 fi
omajid@23163 124
omajid@23163 125 if test "x${with_libpng}" = "xbundled"; then
omajid@23163 126 USE_EXTERNAL_LIBPNG=false
omajid@23163 127 AC_MSG_RESULT([bundled])
omajid@23163 128 elif test "x${with_libpng}" = "xsystem"; then
omajid@23163 129 PKG_CHECK_MODULES(PNG, libpng,
omajid@23163 130 [ LIBPNG_FOUND=yes ],
omajid@23163 131 [ LIBPNG_FOUND=no ])
omajid@23163 132 if test "x${LIBPNG_FOUND}" = "xyes"; then
omajid@23163 133 USE_EXTERNAL_LIBPNG=true
omajid@23163 134 AC_MSG_RESULT([system])
omajid@23163 135 else
omajid@23163 136 AC_MSG_RESULT([system not found])
omajid@23163 137 AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
omajid@23163 138 fi
omajid@23163 139 else
omajid@23163 140 AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
omajid@23163 141 fi
ihse@32921 142
omajid@23163 143 AC_SUBST(USE_EXTERNAL_LIBPNG)
ihse@32921 144 ])
omajid@23163 145
ihse@32921 146 ################################################################################
ihse@32921 147 # Setup zlib
ihse@32921 148 ################################################################################
ihse@32921 149 AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
ihse@32921 150 [
ihse@20363 151 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
ihse@20363 152 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
erikj@13133 153
ihse@20363 154 AC_CHECK_LIB(z, compress,
ihse@20363 155 [ ZLIB_FOUND=yes ],
ihse@20363 156 [ ZLIB_FOUND=no ])
erikj@13133 157
ihse@20363 158 AC_MSG_CHECKING([for which zlib to use])
erikj@13133 159
ihse@20363 160 DEFAULT_ZLIB=bundled
ihse@20363 161 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@32921 162 # On macosx default is system...on others default is bundled
erikj@13133 163 DEFAULT_ZLIB=system
ihse@20363 164 fi
erikj@13133 165
ihse@20363 166 if test "x${ZLIB_FOUND}" != "xyes"; then
ihse@20363 167 # If we don't find any system...set default to bundled
erikj@13133 168 DEFAULT_ZLIB=bundled
ihse@20363 169 fi
erikj@13133 170
ihse@20363 171 # If user didn't specify, use DEFAULT_ZLIB
ihse@20363 172 if test "x${with_zlib}" = "x"; then
erikj@13133 173 with_zlib=${DEFAULT_ZLIB}
ihse@20363 174 fi
erikj@13133 175
ihse@20363 176 if test "x${with_zlib}" = "xbundled"; then
erikj@13133 177 USE_EXTERNAL_LIBZ=false
erikj@13133 178 AC_MSG_RESULT([bundled])
ihse@20363 179 elif test "x${with_zlib}" = "xsystem"; then
erikj@13133 180 if test "x${ZLIB_FOUND}" = "xyes"; then
ihse@20363 181 USE_EXTERNAL_LIBZ=true
ihse@20363 182 AC_MSG_RESULT([system])
erikj@13133 183 else
ihse@20363 184 AC_MSG_RESULT([system not found])
ihse@20363 185 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
erikj@13133 186 fi
ihse@20363 187 else
ihse@20363 188 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
ihse@20363 189 fi
erikj@13133 190
ihse@20363 191 AC_SUBST(USE_EXTERNAL_LIBZ)
ihse@32921 192 ])
erikj@13133 193
ihse@32921 194 ################################################################################
ihse@32921 195 # Setup lcms (Little CMS)
ihse@32921 196 ################################################################################
ihse@32921 197 AC_DEFUN_ONCE([LIB_SETUP_LCMS],
ihse@32921 198 [
ihse@32921 199 AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
ihse@32921 200 [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
ohair@13697 201
ihse@32921 202 AC_MSG_CHECKING([for which lcms to use])
erikj@13133 203
ihse@32921 204 DEFAULT_LCMS=bundled
ihse@32921 205 # If user didn't specify, use DEFAULT_LCMS
ihse@32921 206 if test "x${with_lcms}" = "x"; then
ihse@32921 207 with_lcms=${DEFAULT_LCMS}
ihse@20363 208 fi
erikj@13133 209
ihse@32921 210 if test "x${with_lcms}" = "xbundled"; then
ihse@32921 211 USE_EXTERNAL_LCMS=false
ihse@32921 212 AC_MSG_RESULT([bundled])
ihse@32921 213 elif test "x${with_lcms}" = "xsystem"; then
ihse@32921 214 AC_MSG_RESULT([system])
ihse@32921 215 PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
ihse@32921 216 if test "x${LCMS_FOUND}" = "xyes"; then
ihse@32921 217 USE_EXTERNAL_LCMS=true
ihse@32921 218 else
ihse@32921 219 AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
erikj@13133 220 fi
ihse@32921 221 else
ihse@32921 222 AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
ihse@20363 223 fi
omajid@16581 224
ihse@32921 225 AC_SUBST(USE_EXTERNAL_LCMS)
erikj@13133 226 ])