96 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
97 AC_CHECK_LIB(gif, DGifGetCode, [],
98 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
99
100 USE_EXTERNAL_LIBGIF=true
101 else
102 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
103 fi
104
105 AC_SUBST(USE_EXTERNAL_LIBGIF)
106 ])
107
108 ################################################################################
109 # Setup libpng
110 ################################################################################
111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
112 [
113 AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
114 [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
115
116 AC_MSG_CHECKING([for which libpng to use])
117
118 # default is bundled
119 DEFAULT_LIBPNG=bundled
120 # if user didn't specify, use DEFAULT_LIBPNG
121 if test "x${with_libpng}" = "x"; then
122 with_libpng=${DEFAULT_LIBPNG}
123 fi
124
125 if test "x${with_libpng}" = "xbundled"; then
126 USE_EXTERNAL_LIBPNG=false
127 PNG_CFLAGS=""
128 PNG_LIBS=""
129 AC_MSG_RESULT([bundled])
130 elif test "x${with_libpng}" = "xsystem"; then
131 PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
132 if test "x${LIBPNG_FOUND}" = "xyes"; then
133 # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
134 USE_EXTERNAL_LIBPNG=true
135 AC_MSG_RESULT([system])
136 else
137 AC_MSG_RESULT([system not found])
138 AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
139 fi
140 else
141 AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
142 fi
143
144 AC_SUBST(USE_EXTERNAL_LIBPNG)
145 AC_SUBST(PNG_CFLAGS)
146 AC_SUBST(PNG_LIBS)
147 ])
148
149 ################################################################################
150 # Setup zlib
151 ################################################################################
166 DEFAULT_ZLIB=bundled
167 fi
168
169 if test "x${ZLIB_FOUND}" != "xyes"; then
170 # If we don't find any system...set default to bundled
171 DEFAULT_ZLIB=bundled
172 fi
173
174 # If user didn't specify, use DEFAULT_ZLIB
175 if test "x${with_zlib}" = "x"; then
176 with_zlib=${DEFAULT_ZLIB}
177 fi
178
179 if test "x${with_zlib}" = "xbundled"; then
180 USE_EXTERNAL_LIBZ=false
181 AC_MSG_RESULT([bundled])
182 elif test "x${with_zlib}" = "xsystem"; then
183 if test "x${ZLIB_FOUND}" = "xyes"; then
184 USE_EXTERNAL_LIBZ=true
185 AC_MSG_RESULT([system])
186 else
187 AC_MSG_RESULT([system not found])
188 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
189 fi
190 else
191 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
192 fi
193
194 AC_SUBST(USE_EXTERNAL_LIBZ)
195 ])
196
197 ################################################################################
198 # Setup lcms (Little CMS)
199 ################################################################################
200 AC_DEFUN_ONCE([LIB_SETUP_LCMS],
201 [
202 AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
203 [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
204
205 AC_MSG_CHECKING([for which lcms to use])
|
96 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
97 AC_CHECK_LIB(gif, DGifGetCode, [],
98 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
99
100 USE_EXTERNAL_LIBGIF=true
101 else
102 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
103 fi
104
105 AC_SUBST(USE_EXTERNAL_LIBGIF)
106 ])
107
108 ################################################################################
109 # Setup libpng
110 ################################################################################
111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
112 [
113 AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
114 [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
115
116 PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
117 AC_MSG_CHECKING([for which libpng to use])
118
119 # default is bundled
120 DEFAULT_LIBPNG=bundled
121 # if user didn't specify, use DEFAULT_LIBPNG
122 if test "x${with_libpng}" = "x"; then
123 with_libpng=${DEFAULT_LIBPNG}
124 fi
125
126 if test "x${with_libpng}" = "xbundled"; then
127 USE_EXTERNAL_LIBPNG=false
128 PNG_CFLAGS=""
129 PNG_LIBS=""
130 AC_MSG_RESULT([bundled])
131 elif test "x${with_libpng}" = "xsystem"; then
132 if test "x${LIBPNG_FOUND}" = "xyes"; then
133 # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
134 USE_EXTERNAL_LIBPNG=true
135 AC_MSG_RESULT([system])
136 else
137 AC_MSG_RESULT([system not found])
138 AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
139 fi
140 else
141 AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
142 fi
143
144 AC_SUBST(USE_EXTERNAL_LIBPNG)
145 AC_SUBST(PNG_CFLAGS)
146 AC_SUBST(PNG_LIBS)
147 ])
148
149 ################################################################################
150 # Setup zlib
151 ################################################################################
166 DEFAULT_ZLIB=bundled
167 fi
168
169 if test "x${ZLIB_FOUND}" != "xyes"; then
170 # If we don't find any system...set default to bundled
171 DEFAULT_ZLIB=bundled
172 fi
173
174 # If user didn't specify, use DEFAULT_ZLIB
175 if test "x${with_zlib}" = "x"; then
176 with_zlib=${DEFAULT_ZLIB}
177 fi
178
179 if test "x${with_zlib}" = "xbundled"; then
180 USE_EXTERNAL_LIBZ=false
181 AC_MSG_RESULT([bundled])
182 elif test "x${with_zlib}" = "xsystem"; then
183 if test "x${ZLIB_FOUND}" = "xyes"; then
184 USE_EXTERNAL_LIBZ=true
185 AC_MSG_RESULT([system])
186
187 if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
188 # If we use bundled libpng, we must verify that we have a proper zlib.
189 # For instance zlib-ng has had issues with inflateValidate().
190 AC_MSG_CHECKING([for system zlib functionality])
191 AC_COMPILE_IFELSE(
192 [AC_LANG_PROGRAM([#include "zlib.h"], [
193 #if ZLIB_VERNUM >= 0x1281
194 inflateValidate(NULL, 0);
195 #endif
196 ])],
197 [AC_MSG_RESULT([ok])],
198 [
199 AC_MSG_RESULT([not ok])
200 AC_MSG_ERROR([System zlib not working correctly])
201 ]
202 )
203 fi
204 else
205 AC_MSG_RESULT([system not found])
206 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
207 fi
208 else
209 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
210 fi
211
212 AC_SUBST(USE_EXTERNAL_LIBZ)
213 ])
214
215 ################################################################################
216 # Setup lcms (Little CMS)
217 ################################################################################
218 AC_DEFUN_ONCE([LIB_SETUP_LCMS],
219 [
220 AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
221 [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
222
223 AC_MSG_CHECKING([for which lcms to use])
|