common/autoconf/libraries.m4

changeset 494
e64f2cb57d05
parent 478
2ba6f4da4bf3
child 502
ed9e5635fc80
equal deleted inserted replaced
488:8a3fe0ae06a8 494:e64f2cb57d05
170 fi 170 fi
171 171
172 AC_LANG_PUSH(C) 172 AC_LANG_PUSH(C)
173 OLD_CFLAGS="$CFLAGS" 173 OLD_CFLAGS="$CFLAGS"
174 CFLAGS="$CFLAGS $X_CFLAGS" 174 CFLAGS="$CFLAGS $X_CFLAGS"
175
176 # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
175 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h], 177 AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h],
176 [X11_A_OK=yes], 178 [X11_A_OK=yes],
177 [X11_A_OK=no]) 179 [X11_A_OK=no],
180 [ # include <X11/Xlib.h>
181 # include <X11/Xutil.h>
182 ])
183
178 CFLAGS="$OLD_CFLAGS" 184 CFLAGS="$OLD_CFLAGS"
179 AC_LANG_POP(C) 185 AC_LANG_POP(C)
180 186
181 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then 187 if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
182 HELP_MSG_MISSING_DEPENDENCY([x11]) 188 HELP_MSG_MISSING_DEPENDENCY([x11])
194 # 200 #
195 # The common unix printing system cups is used to print from java. 201 # The common unix printing system cups is used to print from java.
196 # 202 #
197 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups], 203 AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
198 [specify prefix directory for the cups package 204 [specify prefix directory for the cups package
199 (expecting the libraries under PATH/lib and the headers under PATH/include)])]) 205 (expecting the headers under PATH/include)])])
200 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include], 206 AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
201 [specify directory for the cups include files])]) 207 [specify directory for the cups include files])])
202 AC_ARG_WITH(cups-lib, [AS_HELP_STRING([--with-cups-lib],
203 [specify directory for the cups library])])
204 208
205 if test "x$CUPS_NOT_NEEDED" = xyes; then 209 if test "x$CUPS_NOT_NEEDED" = xyes; then
206 if test "x${with_cups}" != x || test "x${with_cups_include}" != x || test "x${with_cups_lib}" != x; then 210 if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
207 AC_MSG_WARN([cups not used, so --with-cups is ignored]) 211 AC_MSG_WARN([cups not used, so --with-cups is ignored])
208 fi 212 fi
209 CUPS_CFLAGS= 213 CUPS_CFLAGS=
210 CUPS_LIBS=
211 else 214 else
212 CUPS_FOUND=no 215 CUPS_FOUND=no
213 216
214 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno || test "x${with_cups_lib}" = xno; then 217 if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
215 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.]) 218 AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
216 fi 219 fi
217 220
218 if test "x${with_cups}" != x; then 221 if test "x${with_cups}" != x; then
219 CUPS_LIBS="-L${with_cups}/lib -lcups"
220 CUPS_CFLAGS="-I${with_cups}/include" 222 CUPS_CFLAGS="-I${with_cups}/include"
221 CUPS_FOUND=yes 223 CUPS_FOUND=yes
222 fi 224 fi
223 if test "x${with_cups_include}" != x; then 225 if test "x${with_cups_include}" != x; then
224 CUPS_CFLAGS="-I${with_cups_include}" 226 CUPS_CFLAGS="-I${with_cups_include}"
225 CUPS_FOUND=yes
226 fi
227 if test "x${with_cups_lib}" != x; then
228 CUPS_LIBS="-L${with_cups_lib} -lcups"
229 CUPS_FOUND=yes 227 CUPS_FOUND=yes
230 fi 228 fi
231 if test "x$CUPS_FOUND" = xno; then 229 if test "x$CUPS_FOUND" = xno; then
232 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes]) 230 BDEPS_CHECK_MODULE(CUPS, cups, xxx, [CUPS_FOUND=yes])
233 fi 231 fi
234 if test "x$CUPS_FOUND" = xno; then 232 if test "x$CUPS_FOUND" = xno; then
235 # Are the cups headers installed in the default /usr/include location? 233 # Are the cups headers installed in the default /usr/include location?
236 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], 234 AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
237 [CUPS_FOUND=yes 235 [CUPS_FOUND=yes
238 CUPS_CFLAGS= 236 CUPS_CFLAGS=
239 CUPS_LIBS="-lcups"
240 DEFAULT_CUPS=yes]) 237 DEFAULT_CUPS=yes])
241 fi 238 fi
242 if test "x$CUPS_FOUND" = xno; then 239 if test "x$CUPS_FOUND" = xno; then
243 # Getting nervous now? Lets poke around for standard Solaris third-party 240 # Getting nervous now? Lets poke around for standard Solaris third-party
244 # package installation locations. 241 # package installation locations.
245 AC_MSG_CHECKING([for cups headers and libs]) 242 AC_MSG_CHECKING([for cups headers])
246 if test -s /opt/sfw/cups/include/cups/cups.h; then 243 if test -s /opt/sfw/cups/include/cups/cups.h; then
247 # An SFW package seems to be installed! 244 # An SFW package seems to be installed!
248 CUPS_FOUND=yes 245 CUPS_FOUND=yes
249 CUPS_CFLAGS="-I/opt/sfw/cups/include" 246 CUPS_CFLAGS="-I/opt/sfw/cups/include"
250 CUPS_LIBS="-L/opt/sfw/cups/lib -lcups"
251 elif test -s /opt/csw/include/cups/cups.h; then 247 elif test -s /opt/csw/include/cups/cups.h; then
252 # A CSW package seems to be installed! 248 # A CSW package seems to be installed!
253 CUPS_FOUND=yes 249 CUPS_FOUND=yes
254 CUPS_CFLAGS="-I/opt/csw/include" 250 CUPS_CFLAGS="-I/opt/csw/include"
255 CUPS_LIBS="-L/opt/csw/lib -lcups"
256 fi 251 fi
257 AC_MSG_RESULT([$CUPS_FOUND]) 252 AC_MSG_RESULT([$CUPS_FOUND])
258 fi 253 fi
259 if test "x$CUPS_FOUND" = xno; then 254 if test "x$CUPS_FOUND" = xno; then
260 HELP_MSG_MISSING_DEPENDENCY([cups]) 255 HELP_MSG_MISSING_DEPENDENCY([cups])
261 AC_MSG_ERROR([Could not find cups! $HELP_MSG ]) 256 AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
262 fi 257 fi
263 fi 258 fi
264 259
265 AC_SUBST(CUPS_CFLAGS) 260 AC_SUBST(CUPS_CFLAGS)
266 AC_SUBST(CUPS_LIBS)
267 261
268 ]) 262 ])
269 263
270 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE], 264 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
271 [ 265 [
290 FREETYPE2_LIB_PATH= 284 FREETYPE2_LIB_PATH=
291 else 285 else
292 FREETYPE2_FOUND=no 286 FREETYPE2_FOUND=no
293 287
294 if test "x$with_freetype" != x; then 288 if test "x$with_freetype" != x; then
295 SPACESAFE(with_freetype,[the path to freetype]) 289 BASIC_FIXUP_PATH(with_freetype)
296 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype" 290 FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
291 FREETYPE2_LIB_PATH="$with_freetype/lib"
292 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
293 FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
294 FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
295 fi
297 if test "x$OPENJDK_TARGET_OS" = xwindows; then 296 if test "x$OPENJDK_TARGET_OS" = xwindows; then
298 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib" 297 FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
299 fi 298 fi
300 FREETYPE2_LIB_PATH="$with_freetype/lib"
301 FREETYPE2_CFLAGS="-I$with_freetype/include" 299 FREETYPE2_CFLAGS="-I$with_freetype/include"
302 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then 300 if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
303 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include" 301 FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
304 fi 302 fi
305 FREETYPE2_FOUND=yes 303 FREETYPE2_FOUND=yes
306 if test "x$FREETYPE2_FOUND" = xyes; then 304 if test "x$FREETYPE2_FOUND" = xyes; then
307 # Verify that the directories exist 305 # Verify that the directories exist
308 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then 306 if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
309 AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include]) 307 AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
310 fi 308 fi
311 # List the contents of the lib. 309 # List the contents of the lib.
312 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null` 310 FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
313 if test "x$FREETYPELIB" = x; then 311 if test "x$FREETYPELIB" = x; then
314 AC_MSG_ERROR([Could not find libfreetype.se nor freetype.dll in $with_freetype/lib]) 312 AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
315 fi 313 fi
316 # Check one h-file 314 # Check one h-file
317 if ! test -s "$with_freetype/include/ft2build.h"; then 315 if ! test -s "$with_freetype/include/ft2build.h"; then
318 AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h]) 316 AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
319 fi 317 fi
321 fi 319 fi
322 if test "x$FREETYPE2_FOUND" = xno; then 320 if test "x$FREETYPE2_FOUND" = xno; then
323 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) 321 BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
324 USING_SYSTEM_FT_LIB=true 322 USING_SYSTEM_FT_LIB=true
325 fi 323 fi
324 if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
325 FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
326 BASIC_FIXUP_PATH(FREETYPELOCATION)
327 AC_MSG_CHECKING([for freetype in some standard windows locations])
328 if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
329 FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
330 FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
331 FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
332 if ! test -s "$FREETYPE2_LIBS"; then
333 AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
334 fi
335 if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
336 AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
337 fi
338 USING_SYSTEM_FT_LIB=true
339 FREETYPE2_FOUND=yes
340 fi
341 AC_MSG_RESULT([$FREETYPE2_FOUND])
342 fi
326 if test "x$FREETYPE2_FOUND" = xno; then 343 if test "x$FREETYPE2_FOUND" = xno; then
327 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no]) 344 PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
345 # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
346 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
328 USING_SYSTEM_FT_LIB=true 347 USING_SYSTEM_FT_LIB=true
348 # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
349 if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
350 FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
351 fi
329 fi 352 fi
330 if test "x$FREETYPE2_FOUND" = xno; then 353 if test "x$FREETYPE2_FOUND" = xno; then
331 AC_MSG_CHECKING([for freetype in some standard locations]) 354 AC_MSG_CHECKING([for freetype in some standard locations])
332 355
333 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then 356 if test -s /usr/X11/include/ft2build.h && test -d /usr/X11/include/freetype2/freetype; then
362 USING_SYSTEM_FT_LIB=true 385 USING_SYSTEM_FT_LIB=true
363 fi 386 fi
364 if test "x$FREETYPE2_FOUND" = xno; then 387 if test "x$FREETYPE2_FOUND" = xno; then
365 HELP_MSG_MISSING_DEPENDENCY([freetype2]) 388 HELP_MSG_MISSING_DEPENDENCY([freetype2])
366 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]) 389 AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
367 fi 390 fi
391
392 if test "x$OPENJDK_TARGET_OS" != xwindows; then
393 # AC_CHECK_LIB does not support use of cl.exe
394 PREV_LDFLAGS="$LDFLAGS"
395 LDFLAGS="$FREETYPE2_LIBS"
396 AC_CHECK_LIB(freetype, FT_Init_FreeType, [], AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
397 LDFLAGS="$PREV_LDFLAGS"
398 fi
368 fi 399 fi
369 400
370 AC_SUBST(USING_SYSTEM_FT_LIB) 401 AC_SUBST(USING_SYSTEM_FT_LIB)
371 AC_SUBST(FREETYPE2_LIB_PATH) 402 AC_SUBST(FREETYPE2_LIB_PATH)
372 AC_SUBST(FREETYPE2_CFLAGS) 403 AC_SUBST(FREETYPE2_CFLAGS)
619 650
620 AC_MSG_CHECKING([how to link with libstdc++]) 651 AC_MSG_CHECKING([how to link with libstdc++])
621 if test "x$enable_static_link_stdc__" = xyes; then 652 if test "x$enable_static_link_stdc__" = xyes; then
622 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS" 653 LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
623 LDCXX="$CC" 654 LDCXX="$CC"
655 STATIC_CXX_SETTING="STATIC_CXX=true"
624 AC_MSG_RESULT([static]) 656 AC_MSG_RESULT([static])
625 else 657 else
626 LIBCXX="$LIBCXX -lstdc++" 658 LIBCXX="$LIBCXX -lstdc++"
627 LDCXX="$CXX" 659 LDCXX="$CXX"
660 STATIC_CXX_SETTING="STATIC_CXX=false"
628 AC_MSG_RESULT([dynamic]) 661 AC_MSG_RESULT([dynamic])
629 fi 662 fi
630 fi 663 fi
664 AC_SUBST(STATIC_CXX_SETTING)
631 665
632 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) 666 # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
633 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then 667 if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
634 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" 668 LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
635 fi 669 fi

mercurial