--- old/common/autoconf/libraries.m4 2013-03-07 21:02:01.418752684 -0500 +++ new/common/autoconf/libraries.m4 2013-03-07 21:02:01.225750884 -0500 @@ -499,11 +499,40 @@ # Check for the gif library # -USE_EXTERNAL_LIBJPEG=true -AC_CHECK_LIB(gif, main, [], - [ USE_EXTERNAL_LIBGIF=false - AC_MSG_NOTICE([Will use gif decoder bundled with the OpenJDK source]) - ]) +AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib], + [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) + +AC_CHECK_LIB(gif, DGifGetCode, + [ GIFLIB_FOUND=yes ], + [ GIFLIB_FOUND=no ]) + +AC_MSG_CHECKING([for which giflib to use]) + +# default is bundled +DEFAULT_GIFLIB=bundled + +# +# if user didn't specify, use DEFAULT_GIFLIB +# +if test "x${with_giflib}" = "x"; then + with_giflib=${DEFAULT_GIFLIB} +fi + + +if test "x${with_giflib}" = "xbundled"; then + USE_EXTERNAL_LIBGIF=false + AC_MSG_RESULT([bundled]) +elif test "x${with_giflib}" = "xsystem"; then + if test "x${GIFLIB_FOUND}" = "xyes"; then + USE_EXTERNAL_LIBGIF=true + AC_MSG_RESULT([system]) + else + AC_MSG_RESULT([system not found]) + AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!]) + fi +else + AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled']) +fi AC_SUBST(USE_EXTERNAL_LIBGIF) ############################################################################### --- old/jdk/makefiles/CompileNativeLibraries.gmk 2013-03-07 21:02:04.479781243 -0500 +++ new/jdk/makefiles/CompileNativeLibraries.gmk 2013-03-07 21:02:04.040777147 -0500 @@ -2385,18 +2385,22 @@ ifndef BUILD_HEADLESS_ONLY LIBSPLASHSCREEN_DIRS:=\ - $(JDK_TOPDIR)/src/share/native/sun/awt/giflib \ $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \ $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \ $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen +ifeq ($(USE_EXTERNAL_LIBGIF),true) + LIBGIF := -lgif +else + LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/giflib +endif + ifneq ($(OPENJDK_TARGET_OS), macosx) LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen else LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen endif - LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \ $(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir)) @@ -2452,7 +2456,7 @@ MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \ LDFLAGS:=$(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN),\ - LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ),\ + LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(LIBGIF),\ LDFLAGS_SUFFIX_solaris:=-lc,\ VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\ RC_FLAGS:=$(RC_FLAGS)\